Skip to content

Commit

Permalink
Refactor to also call Segment.identify on app init
Browse files Browse the repository at this point in the history
  • Loading branch information
cnguyen812 committed Sep 10, 2022
1 parent a17d52b commit 673a201
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/store/app/app.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export const startAppInit = (): Effect => async (dispatch, getState) => {

// init analytics -> post onboarding or migration
if (onboardingCompleted) {
dispatch(askForTrackingPermissionAndEnableSdks(true));
await dispatch(askForTrackingPermissionAndEnableSdks(true));
}

if (!migrationComplete) {
Expand Down
10 changes: 4 additions & 6 deletions src/store/bitpay-id/bitpay-id.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export const startBitPayIdStoreInit =
const {basicInfo: user} = initialData;

if (user) {
const {eid, email, name} = user;

dispatch(Analytics.identify(eid, {email, name}));

dispatch(
BitPayIdActions.successInitializeStore(APP.network, initialData),
);
Expand Down Expand Up @@ -423,12 +427,6 @@ const startPairAndLoadUser =
dispatch(CardEffects.startCardStoreInit(data.user));
dispatch(AppEffects.initializeBrazeContent());
dispatch(ShopEffects.startFetchCatalog());

if (data.user.basicInfo) {
const {eid, email, name} = data.user.basicInfo;

dispatch(Analytics.identify(eid, {email, name}));
}
} catch (err) {
let errMsg;

Expand Down

0 comments on commit 673a201

Please sign in to comment.