polished and finalised onboarding flow
This commit is contained in:
@@ -139,14 +139,16 @@ export default function TimerScreen() {
|
||||
const cancelHoldIdRef = React.useRef(0);
|
||||
const cancelHoldStartedAtRef = React.useRef(0);
|
||||
|
||||
const { tId, sessionType: sessionTypeParam, durationMinutes, durationSeconds, returnTaskId, chooseDuration } = useLocalSearchParams<{
|
||||
const { tId, sessionType: sessionTypeParam, durationMinutes, durationSeconds, returnTaskId, chooseDuration, onboardingDemo } = useLocalSearchParams<{
|
||||
tId?: string;
|
||||
sessionType?: SessionType;
|
||||
durationMinutes?: string;
|
||||
durationSeconds?: string;
|
||||
returnTaskId?: string;
|
||||
chooseDuration?: string;
|
||||
onboardingDemo?: string;
|
||||
}>();
|
||||
const isOnboardingDemo = onboardingDemo === 'true';
|
||||
const timerOverlayHeight = Math.max(containerHeight, 1);
|
||||
const timerOverlayOffscreenY = timerOverlayHeight + 1000;
|
||||
const selectedSessionType: SessionType = sessionTypeParam ?? 'focus';
|
||||
@@ -484,13 +486,18 @@ export default function TimerScreen() {
|
||||
|
||||
setIsRunning(false);
|
||||
resetSessionValues();
|
||||
await finalizeSprintSession('completed', completedSession);
|
||||
|
||||
if (isOnboardingDemo && completedSessionType === 'focus') {
|
||||
router.replace('/');
|
||||
return;
|
||||
}
|
||||
|
||||
setPostSessionPrompt({
|
||||
completedSessionType,
|
||||
returnTaskId: completedReturnTaskId,
|
||||
nextBreakType,
|
||||
});
|
||||
|
||||
await finalizeSprintSession('completed', completedSession);
|
||||
})();
|
||||
});
|
||||
});
|
||||
@@ -502,6 +509,7 @@ export default function TimerScreen() {
|
||||
currentSessionType,
|
||||
finalizeSprintSession,
|
||||
focusModeAnimation,
|
||||
isOnboardingDemo,
|
||||
resetSessionValues,
|
||||
syncStudyCycleAfterCompletion,
|
||||
taskDetailsAnimation,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { defaultStyles } from '@/constants/defaultStyles';
|
||||
import { SaveSetupSprintDemoUsed } from '@/lib/asyncStorage';
|
||||
import { CheckAssignmentCompletion } from '@/lib/progress';
|
||||
import { supabase } from '@/lib/supabase';
|
||||
import type { Task } from '@/lib/types';
|
||||
@@ -125,9 +126,14 @@ export default function UpsertTask() {
|
||||
SetIsSaving(false);
|
||||
|
||||
if (!isEditMode && isSetupFlow && result.data?.tId) {
|
||||
await SaveSetupSprintDemoUsed(data.user.id);
|
||||
router.replace({
|
||||
pathname: '/task/timer',
|
||||
params: { tId: result.data.tId },
|
||||
params: {
|
||||
tId: result.data.tId,
|
||||
durationSeconds: '5',
|
||||
onboardingDemo: 'true',
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user