Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ dependencies {
mavenPublishing {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)

signAllPublications() // disabled for local publishing
signAllPublications()
Comment thread
pandeymangg marked this conversation as resolved.

coordinates(groupId, artifactId, version.toString())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ class FormbricksInstrumentedTest {
assertEquals(workspaceId, Formbricks.workspaceId)

// User manager default state. There is no user yet.
assertEquals(UserManager.displays?.count(), 0)
// displays getter returns null when SharedPreferences key absent (no
// emptySet default like segments/responses), and logout() in setUp
// cleared the key.
assertNull(UserManager.displays)
assertEquals(UserManager.responses?.count(), 0)
assertEquals(UserManager.segments?.count(), 0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,16 @@ object UserManager {
fun syncUserStateIfNeeded() {
val id = userId
val expiresAt = expiresAt
if (id != null && expiresAt != null && Date().before(expiresAt)) {
if (id != null && expiresAt != null && !Date().before(expiresAt)) {
syncUser(id)
} else {
backingSegments = emptyList()
backingDisplays = emptyList()
backingResponses = emptyList()
// Drop only the in-memory caches. Assigning emptyList() would mask the
// persisted SharedPreferences arrays because the lazy getters fall back
// to disk only when the backing is null; a non-null empty list
// short-circuits the elvis/null-check and the persisted values never load.
backingSegments = null
backingDisplays = null
backingResponses = null
}
}

Expand Down
Loading