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