@@ -21,14 +21,9 @@ import {
2121 betterAuthSendVerificationOTP ,
2222 betterAuthVerifyEmailOTP ,
2323} from '../../lib/betterAuth' ;
24- import {
25- webappUrl ,
26- broadcastChannel ,
27- isTesting ,
28- isBrave ,
29- } from '../../lib/constants' ;
24+ import { webappUrl , broadcastChannel , isTesting } from '../../lib/constants' ;
3025import { getUserDefaultTimezone } from '../../lib/timezones' ;
31- import { isIOSNative , isMobile } from '../../lib/func' ;
26+ import { shouldUseSocialAuthPopup } from '../../lib/func' ;
3227import { generateNameFromEmail } from '../../lib/strings' ;
3328import { generateUsername , claimClaimableItem } from '../../graphql/users' ;
3429import useRegistration from '../../hooks/useRegistration' ;
@@ -558,9 +553,9 @@ function AuthOptionsInner({
558553 await handleLoginMessage ( ) ;
559554 return ;
560555 }
561- const isIOSApp = isIOSNative ( ) ;
556+ const shouldUsePopup = shouldUseSocialAuthPopup ( ) ;
562557 onAuthStateUpdate ?.( { isLoading : true } ) ;
563- if ( ! isIOSApp ) {
558+ if ( shouldUsePopup ) {
564559 windowPopup . current = window . open ( ) ;
565560 }
566561 const callbackURL = `${ webappUrl } callback?login=true` ;
@@ -585,21 +580,8 @@ function AuthOptionsInner({
585580 onAuthStateUpdate ?.( { isLoading : false } ) ;
586581 return ;
587582 }
588- if ( isIOSApp || ( isBrave ( ) && isMobile ( ) ) ) {
589- window . location . href = socialUrl ;
590- return ;
591- }
592583 if ( ! windowPopup . current ) {
593- logEvent ( {
594- event_name : authErrorEventName ,
595- extra : JSON . stringify ( {
596- error : 'Failed to open social login window' ,
597- origin : 'betterauth social popup' ,
598- } ) ,
599- } ) ;
600- setIsSocialAuthLoading ( false ) ;
601- displayToast ( SOCIAL_AUTH_RETRY_MESSAGE ) ;
602- onAuthStateUpdate ?.( { isLoading : false } ) ;
584+ window . location . href = socialUrl ;
603585 return ;
604586 }
605587 windowPopup . current . location . href = socialUrl ;
0 commit comments