feat(app): buffer onboarding answers before auth, flush to profile after sign-up/login

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Timo Knuth
2026-07-06 13:50:22 +02:00
parent 84624e50cf
commit c24544a1b7
3 changed files with 50 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ import AsyncStorage from '@react-native-async-storage/async-storage';
import * as AppleAuthentication from 'expo-apple-authentication';
import Constants from 'expo-constants';
import { useSafeAnalytics } from '../../services/analytics';
import { PreAuthOnboardingService } from '../../services/preAuthOnboardingService';
const ONBOARDING_AUTH_BACKGROUND = {
light: '#fbfaf3',
@@ -83,6 +84,9 @@ export default function SignupScreen() {
try {
const session = await AuthService.signUp(email, name, password);
await hydrateSession(session);
if (session?.userId) {
await PreAuthOnboardingService.flushToProfile(session.userId).catch(() => {});
}
// Flag setzen: Tour beim nächsten App-Öffnen anzeigen
await AsyncStorage.setItem('greenlens_show_tour', 'true');
router.replace('/onboarding/source');
@@ -132,6 +136,9 @@ export default function SignupScreen() {
name: fullName || undefined,
});
const billing = await hydrateSession(session);
if (session?.userId) {
await PreAuthOnboardingService.flushToProfile(session.userId).catch(() => {});
}
await AsyncStorage.setItem('greenlens_show_tour', 'true');
posthog.capture('apple_login_succeeded', { surface: 'signup' });
const isPro = billing?.entitlement?.plan === 'pro' && billing?.entitlement?.status === 'active';