@@ -20,7 +20,7 @@ import {
2020
2121import { Route } from '../constants/routes' ;
2222import type { RootStackParamList } from '../types/navigation' ;
23- import NativeJwtTokenModule from '../utility/ NativeJwtTokenModule' ;
23+ import NativeJwtTokenModule from '../NativeJwtTokenModule' ;
2424
2525type Navigation = StackNavigationProp < RootStackParamList > ;
2626
@@ -141,7 +141,9 @@ export const IterableAppProvider: FunctionComponent<
141141
142142 const initialize = useCallback (
143143 ( navigation : Navigation ) => {
144- login ( ) ;
144+ if ( getUserId ( ) ) {
145+ login ( ) ;
146+ }
145147
146148 const config = new IterableConfig ( ) ;
147149
@@ -222,8 +224,6 @@ export const IterableAppProvider: FunctionComponent<
222224
223225 if ( ! isSuccessful ) {
224226 return Promise . reject ( '`Iterable.initialize` failed' ) ;
225- } else if ( getUserId ( ) ) {
226- login ( ) ;
227227 }
228228
229229 return isSuccessful ;
@@ -236,19 +236,9 @@ export const IterableAppProvider: FunctionComponent<
236236 setIsInitialized ( false ) ;
237237 setLoginInProgress ( false ) ;
238238 return Promise . reject ( err ) ;
239- } )
240- . finally ( ( ) => {
241- // For some reason, ios is throwing an error on initialize.
242- // To temporarily fix this, we're using the finally block to login.
243- // MOB-10419: Find out why initialize is throwing an error on ios
244- setIsInitialized ( true ) ;
245- if ( getUserId ( ) ) {
246- login ( ) ;
247- }
248- return Promise . resolve ( true ) ;
249239 } ) ;
250240 } ,
251- [ apiKey , getUserId , login , getJwtToken ]
241+ [ getUserId , apiKey , login , getJwtToken ]
252242 ) ;
253243
254244 const logout = useCallback ( ( ) => {
0 commit comments