Skip to content

Commit ea77d1e

Browse files
authored
Merge pull request #382 from superwall/develop
Bump to 2.7.8, minor bug fixes
2 parents 78f1af9 + 26aeb64 commit ea77d1e

4 files changed

Lines changed: 19 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
The changelog for `Superwall`. Also see the [releases](https://github.com/superwall/Superwall-Android/releases) on GitHub.
44

5+
## 2.7.8
6+
7+
## Fixes
8+
- Fix serialization issue with R8 and dates
9+
- Fix scope cancellation for test mode
510

611
## 2.7.7
712

superwall/src/main/java/com/superwall/sdk/misc/Scopes.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import kotlinx.coroutines.CoroutineScope
66
import kotlinx.coroutines.Deferred
77
import kotlinx.coroutines.Dispatchers
88
import kotlinx.coroutines.Job
9+
import kotlinx.coroutines.SupervisorJob
910
import kotlinx.coroutines.async
1011
import kotlinx.coroutines.launch
1112
import kotlin.coroutines.CoroutineContext
@@ -24,14 +25,14 @@ class IOScope(
2425
overrideWithContext: CoroutineContext = Dispatchers.IO,
2526
) : CoroutineScope,
2627
SuperwallScope {
27-
override val coroutineContext: CoroutineContext = overrideWithContext + exceptionHandler
28+
override val coroutineContext: CoroutineContext = SupervisorJob() + overrideWithContext + exceptionHandler
2829
}
2930

3031
class MainScope(
3132
overrideWithContext: CoroutineContext = Dispatchers.Main,
3233
) : CoroutineScope,
3334
SuperwallScope {
34-
override val coroutineContext: CoroutineContext = overrideWithContext + exceptionHandler
35+
override val coroutineContext: CoroutineContext = SupervisorJob() + overrideWithContext + exceptionHandler
3536
}
3637

3738
internal fun SuperwallScope.launchWithTracking(block: suspend CoroutineScope.() -> Unit): Job =

superwall/src/main/java/com/superwall/sdk/storage/core_data/Converters.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Converters {
4848
fun sanitizeMap(map: Map<String, Any>): Map<String, Any> =
4949
map.filterValues { value ->
5050
when (value) {
51-
is String, is Number, is Boolean, is List<*>, is Map<*, *> -> true
51+
is String, is Number, is Boolean, is Date, is List<*>, is Map<*, *> -> true
5252
else -> false
5353
}
5454
}
@@ -97,7 +97,15 @@ fun Any?.convertToJsonElement(): JsonElement =
9797
},
9898
)
9999

100-
else -> throw IllegalArgumentException("Unsupported type: ${this!!::class}")
100+
else -> {
101+
// Fallback: handle Date by Java class check in case R8 optimizes away the
102+
// instanceof check above. Any other unknown types are converted to null.
103+
if (Date::class.java.isInstance(this)) {
104+
JsonPrimitive((this as Date).time)
105+
} else {
106+
JsonNull
107+
}
108+
}
101109
}
102110

103111
// Helper function to convert JsonElement back to basic types

version.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
SUPERWALL_VERSION=2.7.7
1+
SUPERWALL_VERSION=2.7.8

0 commit comments

Comments
 (0)