feat(auth): handle fresh install flow in splash screen
add separate effect for users without stored identity to play animation then transition to signup, preventing unnecessary retry loop meant only for returning users
This commit is contained in:
parent
086c2a9d2c
commit
34cc1883f5
|
|
@ -45,9 +45,9 @@ const SplashScreen: Component<SplashScreenProps> = (props) => {
|
||||||
|
|
||||||
animTimer = setTimeout(() => setAnimationComplete(true), 3450);
|
animTimer = setTimeout(() => setAnimationComplete(true), 3450);
|
||||||
|
|
||||||
// if no connection after 5s, play exit and loop
|
// if no connection after 5s, play exit and loop (only for returning users)
|
||||||
exitTimer = setTimeout(() => {
|
exitTimer = setTimeout(() => {
|
||||||
if (props.relayConnected) return;
|
if (props.relayConnected || !props.identity) return;
|
||||||
|
|
||||||
setRetrying(true);
|
setRetrying(true);
|
||||||
|
|
||||||
|
|
@ -77,7 +77,7 @@ const SplashScreen: Component<SplashScreenProps> = (props) => {
|
||||||
|
|
||||||
onMount(() => startCycle());
|
onMount(() => startCycle());
|
||||||
|
|
||||||
// handle successful relay connection
|
// handle successful relay connection for returning users
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
if (animationComplete() && props.relayConnected && props.identity) {
|
if (animationComplete() && props.relayConnected && props.identity) {
|
||||||
clearTimers();
|
clearTimers();
|
||||||
|
|
@ -88,6 +88,15 @@ const SplashScreen: Component<SplashScreenProps> = (props) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// fresh install - no identity on disk, play the animation then hand off to signup
|
||||||
|
createEffect(() => {
|
||||||
|
if (animationComplete() && !props.identity) {
|
||||||
|
clearTimers();
|
||||||
|
setFading(true);
|
||||||
|
setTimeout(() => props.onComplete(), 500);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
onCleanup(() => clearTimers());
|
onCleanup(() => clearTimers());
|
||||||
|
|
||||||
// derived status text to keep jsx clean
|
// derived status text to keep jsx clean
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue