Skip to content

Commit

Permalink
Merge pull request #48402 from callstack-internal/fix-46119
Browse files Browse the repository at this point in the history
fix Pusher instance not found error
  • Loading branch information
srikarparsi authored Sep 4, 2024
2 parents 3e5da78 + 326aa51 commit dd2d479
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/libs/Navigation/AppNavigator/AuthScreens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ function getCentralPaneScreenInitialParams(screenName: CentralPaneName, initialR
return undefined;
}

function initializePusher() {
Pusher.init({
appKey: CONFIG.PUSHER.APP_KEY,
cluster: CONFIG.PUSHER.CLUSTER,
authEndpoint: `${CONFIG.EXPENSIFY.DEFAULT_API_ROOT}api/AuthenticatePusher?`,
}).then(() => {
User.subscribeToUserEvents();
});
}

let timezone: Timezone | null;
let currentAccountID = -1;
let isLoadingApp = false;
Expand All @@ -125,7 +135,7 @@ Onyx.connect({

if (Navigation.isActiveRoute(ROUTES.SIGN_IN_MODAL)) {
// This means sign in in RHP was successful, so we can subscribe to user events
User.subscribeToUserEvents();
initializePusher();
}
},
});
Expand Down Expand Up @@ -256,13 +266,7 @@ function AuthScreens({session, lastOpenedPublicRoomID, initialLastUpdateIDApplie
NetworkConnection.listenForReconnect();
NetworkConnection.onReconnect(handleNetworkReconnect);
PusherConnectionManager.init();
Pusher.init({
appKey: CONFIG.PUSHER.APP_KEY,
cluster: CONFIG.PUSHER.CLUSTER,
authEndpoint: `${CONFIG.EXPENSIFY.DEFAULT_API_ROOT}api/AuthenticatePusher?`,
}).then(() => {
User.subscribeToUserEvents();
});
initializePusher();

// If we are on this screen then we are "logged in", but the user might not have "just logged in". They could be reopening the app
// or returning from background. If so, we'll assume they have some app data already and we can call reconnectApp() instead of openApp().
Expand Down

0 comments on commit dd2d479

Please sign in to comment.