Skip to content

Commit 08a9359

Browse files
committed
chore: switch to a fresh anonymous Braze user on logout
1 parent 3d55d97 commit 08a9359

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/app/store/AuthModel.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { LoginManager, LoginTracking } from "react-native-fbsdk-next"
2828
import Keychain from "react-native-keychain"
2929
import Keys from "react-native-keys"
3030
import SiftReactNative from "sift-react-native"
31+
import { v4 as uuidv4 } from "uuid"
3132
import { AuthError } from "./AuthError"
3233
import { GlobalStore, getCurrentEmissionState } from "./GlobalStore"
3334
import type { GlobalStoreModel } from "./GlobalStoreModel"
@@ -1004,12 +1005,14 @@ export const getAuthModel = (): AuthModel => ({
10041005
GlobalStore.actions.artsyPrefs.pushPromptLogic.resetPushPromptLogic()
10051006
SiftReactNative.unsetUserId()
10061007
SegmentTrackingProvider.identify?.(undefined, { is_temporary_user: 1 })
1008+
// Switch to a fresh anonymous Braze user so this device no longer receives
1009+
// push notifications for the logged-out user. The BrazePlugin's identify()
1010+
// skips changeUser when userId is undefined, so we call it explicitly.
1011+
Braze.changeUser(uuidv4())
10071012

1008-
// Delete from the server and from Firebase before clearing local storage, so both
1009-
// auth token and push token are still available. Deleting the Firebase token forces
1010-
// a fresh registration token on the next login (triggering onTokenRefresh).
1013+
// Delete from the server before clearing local storage, so both
1014+
// auth token and push token are still available.
10111015
await deleteToken()
1012-
// await messaging().deleteToken()
10131016

10141017
await Promise.all([
10151018
Platform.OS === "ios"

0 commit comments

Comments
 (0)