(shouldVerify?: boolean)
| 418 | }; |
| 419 | |
| 420 | const onLoginCheck = async (shouldVerify?: boolean) => { |
| 421 | if (shouldVerify) { |
| 422 | setEmailVerificationReturn(AuthDisplay.Default); |
| 423 | onSetActiveDisplay(AuthDisplay.EmailVerification); |
| 424 | return; |
| 425 | } |
| 426 | |
| 427 | if (isRegistration) { |
| 428 | return; |
| 429 | } |
| 430 | |
| 431 | if (!user || handleLoginCheck === false) { |
| 432 | return; |
| 433 | } |
| 434 | |
| 435 | setHandleLoginCheck(handleLoginCheck === null); |
| 436 | |
| 437 | if (user.infoConfirmed) { |
| 438 | logEvent({ |
| 439 | event_name: AuthEventNames.LoginSuccessfully, |
| 440 | }); |
| 441 | |
| 442 | // Check for claimable items on login (e.g., Plus subscription) |
| 443 | claimClaimableItem().then((hasClaimed) => { |
| 444 | if (hasClaimed) { |
| 445 | refetchBoot(); |
| 446 | } |
| 447 | }); |
| 448 | |
| 449 | const isAlreadyOnboarded = await checkForOnboardedUser(user); |
| 450 | if (!isAlreadyOnboarded) { |
| 451 | onSuccessfulLogin?.(); |
| 452 | } |
| 453 | } else if (autoProfileTriggers.includes(trigger)) { |
| 454 | await autoCompleteProfile(user.email, user.name); |
| 455 | } else { |
| 456 | onSetActiveDisplay(AuthDisplay.SocialRegistration); |
| 457 | } |
| 458 | }; |
| 459 | |
| 460 | useEffect(() => { |
| 461 | onLoginCheck(); |
no test coverage detected