Wait for redirect result before showing auth screen on iOS
This commit is contained in:
1 parent
00a1b4bb98
commit
9be72b9f40
1 file changed
+16
-10
+16
-10
@@ -731,18 +731,24 @@ function getFriendDisplayName(uid) {
|
||||
let _initializingUser = false;
|
||||
|
||||
// AUTH
|
||||
if (isIOS) {
|
||||
getRedirectResult(auth).then(async (result) => {
|
||||
if (result?.user) {
|
||||
_initializingUser = true;
|
||||
await initUser(result.user);
|
||||
}
|
||||
}).catch(e => console.warn('Redirect result:', e.code));
|
||||
}
|
||||
|
||||
onAuthStateChanged(auth, async (user) => {
|
||||
if (_initializingUser) return;
|
||||
|
||||
if (isIOS) {
|
||||
try {
|
||||
const redirectResult = await getRedirectResult(auth);
|
||||
if (redirectResult?.user) {
|
||||
_initializingUser = true;
|
||||
await initUser(redirectResult.user);
|
||||
return;
|
||||
}
|
||||
} catch(e) { console.warn('Redirect result:', e.code); }
|
||||
if (isIOS && !user) {
|
||||
setTimeout(() => {
|
||||
if (_initializingUser) return;
|
||||
if (isSignInWithEmailLink(auth, window.location.href)) return;
|
||||
showScreen('auth');
|
||||
}, 1500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isSignInWithEmailLink(auth, window.location.href)) {
|
||||
|
||||
Reference in new issue
Block a user