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