Skip to content

Commit

Permalink
fix(rtn-web-browser): signInWithRedirect needs to be called twice on …
Browse files Browse the repository at this point in the history
…Android
  • Loading branch information
Ashwin Kumar committed Jul 13, 2024
1 parent e3a10ca commit ea57ff5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/rtn-web-browser/src/apis/openAuthSessionAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { nativeModule } from '../nativeModule';

let appStateListener: NativeEventSubscription | undefined;
let redirectListener: NativeEventSubscription | undefined;
let previousState = AppState.currentState;

export const openAuthSessionAsync = async (
url: string,
Expand Down Expand Up @@ -65,6 +66,7 @@ const openAuthSessionAndroid = async (url: string, redirectUrls: string[]) => {
redirectListener?.remove();
appStateListener = undefined;
redirectListener = undefined;
previousState = AppState.currentState;
}
};

Expand All @@ -76,11 +78,12 @@ const getAppStatePromise = (): Promise<null> =>
return;
}

if (nextAppState === 'active') {
if (previousState !== 'active' && nextAppState === 'active') {
appStateListener?.remove();
appStateListener = undefined;
resolve(null);
}
previousState = nextAppState;
});
});

Expand Down

0 comments on commit ea57ff5

Please sign in to comment.