(shouldVerify?: boolean)
| 434 | }; |
| 435 | |
| 436 | const onLoginCheck = async (shouldVerify?: boolean) => { |
| 437 | if (shouldVerify) { |
| 438 | setEmailVerificationReturn(AuthDisplay.Default); |
| 439 | onSetActiveDisplay(AuthDisplay.EmailVerification); |
| 440 | return; |
| 441 | } |
| 442 | |
| 443 | if (isRegistration) { |
| 444 | return; |
| 445 | } |
| 446 | |
| 447 | if (!user || handleLoginCheck === false) { |
| 448 | return; |
| 449 | } |
| 450 | |
| 451 | setHandleLoginCheck(handleLoginCheck === null); |
| 452 | |
| 453 | if (user.infoConfirmed) { |
| 454 | logEvent({ |
| 455 | event_name: AuthEventNames.LoginSuccessfully, |
| 456 | }); |
| 457 | |
| 458 | // Check for claimable items on login (e.g., Plus subscription) |
| 459 | claimClaimableItem().then((hasClaimed) => { |
| 460 | if (hasClaimed) { |
| 461 | refetchBoot(); |
| 462 | } |
| 463 | }); |
| 464 | |
| 465 | const isAlreadyOnboarded = await checkForOnboardedUser(user); |
| 466 | if (!isAlreadyOnboarded) { |
| 467 | onSuccessfulLogin?.(); |
| 468 | } |
| 469 | } else if (autoProfileTriggers.includes(trigger)) { |
| 470 | await autoCompleteProfile(user.email, user.name); |
| 471 | } else { |
| 472 | onSetActiveDisplay(AuthDisplay.SocialRegistration); |
| 473 | } |
| 474 | }; |
| 475 | |
| 476 | useEffect(() => { |
| 477 | onLoginCheck(); |
no test coverage detected