From 6b351c1a832c0482ba7ecbfded832637b17415ac Mon Sep 17 00:00:00 2001 From: Ian Rumac Date: Thu, 12 Mar 2026 13:38:56 +0100 Subject: [PATCH 1/2] Bump to 2.7.8, minor bug fixes --- CHANGELOG.md | 5 +++++ .../src/main/java/com/superwall/sdk/misc/Scopes.kt | 5 +++-- .../superwall/sdk/storage/core_data/Converters.kt | 13 +++++++++++-- version.env | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 436a53b7a..74728a8df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ The changelog for `Superwall`. Also see the [releases](https://github.com/superwall/Superwall-Android/releases) on GitHub. +## 2.7.8 + +## Fixes +- Fix serialization issue with R8 and dates +- Fix scope cancellation for test mode ## 2.7.7 diff --git a/superwall/src/main/java/com/superwall/sdk/misc/Scopes.kt b/superwall/src/main/java/com/superwall/sdk/misc/Scopes.kt index dea2d7b5a..4659a6da0 100644 --- a/superwall/src/main/java/com/superwall/sdk/misc/Scopes.kt +++ b/superwall/src/main/java/com/superwall/sdk/misc/Scopes.kt @@ -6,6 +6,7 @@ import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Deferred import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job +import kotlinx.coroutines.SupervisorJob import kotlinx.coroutines.async import kotlinx.coroutines.launch import kotlin.coroutines.CoroutineContext @@ -24,14 +25,14 @@ class IOScope( overrideWithContext: CoroutineContext = Dispatchers.IO, ) : CoroutineScope, SuperwallScope { - override val coroutineContext: CoroutineContext = overrideWithContext + exceptionHandler + override val coroutineContext: CoroutineContext = SupervisorJob() + overrideWithContext + exceptionHandler } class MainScope( overrideWithContext: CoroutineContext = Dispatchers.Main, ) : CoroutineScope, SuperwallScope { - override val coroutineContext: CoroutineContext = overrideWithContext + exceptionHandler + override val coroutineContext: CoroutineContext = SupervisorJob() + overrideWithContext + exceptionHandler } internal fun SuperwallScope.launchWithTracking(block: suspend CoroutineScope.() -> Unit): Job = diff --git a/superwall/src/main/java/com/superwall/sdk/storage/core_data/Converters.kt b/superwall/src/main/java/com/superwall/sdk/storage/core_data/Converters.kt index d7ab8eb60..24c01dd95 100644 --- a/superwall/src/main/java/com/superwall/sdk/storage/core_data/Converters.kt +++ b/superwall/src/main/java/com/superwall/sdk/storage/core_data/Converters.kt @@ -48,7 +48,7 @@ class Converters { fun sanitizeMap(map: Map): Map = map.filterValues { value -> when (value) { - is String, is Number, is Boolean, is List<*>, is Map<*, *> -> true + is String, is Number, is Boolean, is Date, is List<*>, is Map<*, *> -> true else -> false } } @@ -97,7 +97,16 @@ fun Any?.convertToJsonElement(): JsonElement = }, ) - else -> throw IllegalArgumentException("Unsupported type: ${this!!::class}") + else -> { + // Fallback: handle Date by Java class check in case R8 optimizes away the + // instanceof check above, and convert any other unknown types to their string + // representation instead of crashing. + if (this != null && Date::class.java.isInstance(this)) { + JsonPrimitive((this as Date).time) + } else { + JsonNull + } + } } // Helper function to convert JsonElement back to basic types diff --git a/version.env b/version.env index 7d5eb34b8..3e4c8c888 100644 --- a/version.env +++ b/version.env @@ -1 +1 @@ -SUPERWALL_VERSION=2.7.7 +SUPERWALL_VERSION=2.7.8 From 26aeb646463bc76a9783c1bf5e7ea837362213f1 Mon Sep 17 00:00:00 2001 From: Ian Rumac Date: Thu, 12 Mar 2026 15:16:39 +0100 Subject: [PATCH 2/2] Update superwall/src/main/java/com/superwall/sdk/storage/core_data/Converters.kt Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- .../java/com/superwall/sdk/storage/core_data/Converters.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/superwall/src/main/java/com/superwall/sdk/storage/core_data/Converters.kt b/superwall/src/main/java/com/superwall/sdk/storage/core_data/Converters.kt index 24c01dd95..bf3048852 100644 --- a/superwall/src/main/java/com/superwall/sdk/storage/core_data/Converters.kt +++ b/superwall/src/main/java/com/superwall/sdk/storage/core_data/Converters.kt @@ -99,9 +99,8 @@ fun Any?.convertToJsonElement(): JsonElement = else -> { // Fallback: handle Date by Java class check in case R8 optimizes away the - // instanceof check above, and convert any other unknown types to their string - // representation instead of crashing. - if (this != null && Date::class.java.isInstance(this)) { + // instanceof check above. Any other unknown types are converted to null. + if (Date::class.java.isInstance(this)) { JsonPrimitive((this as Date).time) } else { JsonNull