From 4157b331e1a1fad14786f1550565715a2861846d Mon Sep 17 00:00:00 2001 From: Nan Date: Fri, 3 Nov 2023 01:19:04 -0700 Subject: [PATCH] default the prev session to be invalid in a new app install Background: Each session has an `isValid` property that is read at the start of a potential new session. If this value read is `false`, then a new session will start and its property is set to `true`. If this value read is `true`, that means we continue on this same previous session. At the end of the session, this property will be set to `false`. Problem: On a brand new app install, we were defaulting this value to `true`, which means the logic to trigger a new session will not happen, since the SDK will believe it should continue from a previous session. However, this is the first time the app is opened after a new install. Solution: By defaulting instead to `false`, we ensure that this first app open will start a new session. In addition, this will trigger a `TRACK_SESSION_START` operation and ask the server to `refresh_device_metadata`, updating country and IP for this user. --- .../java/com/onesignal/session/internal/session/SessionModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OneSignalSDK/onesignal/core/src/main/java/com/onesignal/session/internal/session/SessionModel.kt b/OneSignalSDK/onesignal/core/src/main/java/com/onesignal/session/internal/session/SessionModel.kt index 439d22fe91..4719a8467e 100644 --- a/OneSignalSDK/onesignal/core/src/main/java/com/onesignal/session/internal/session/SessionModel.kt +++ b/OneSignalSDK/onesignal/core/src/main/java/com/onesignal/session/internal/session/SessionModel.kt @@ -19,7 +19,7 @@ class SessionModel : Model() { * Whether the session is valid. */ var isValid: Boolean - get() = getBooleanProperty(::isValid.name) { true } + get() = getBooleanProperty(::isValid.name) { false } set(value) { setBooleanProperty(::isValid.name, value) }