File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
location/src/main/kotlin/io/customer/location Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,16 @@ class ModuleLocation @JvmOverloads constructor(
7575 val previousUserId = lastKnownUserId
7676 lastKnownUserId = it.userId
7777
78- if (! it.userId.isNullOrEmpty()) {
78+ if (it.userId.isNullOrEmpty()) {
79+ // User logged out — clear synced data so the next user is not
80+ // suppressed by the previous user's 24h/1km window. Handled here
81+ // (not only in the ResetEvent subscriber) because both subscribers
82+ // run in separate coroutines and the UserChangedEvent for the new
83+ // user could arrive before the ResetEvent subscriber clears state.
84+ if (! previousUserId.isNullOrEmpty()) {
85+ locationTracker.onUserReset()
86+ }
87+ } else {
7988 // Clear synced data when switching between identified users so the
8089 // new user is not suppressed by the previous user's 24h/1km window.
8190 if (! previousUserId.isNullOrEmpty() && previousUserId != it.userId) {
You can’t perform that action at this time.
0 commit comments