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:
@@ -20,6 +20,7 @@ import { AuthService } from '../../services/authService';
|
||||
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',
|
||||
@@ -70,6 +71,9 @@ export default function LoginScreen() {
|
||||
try {
|
||||
const session = await AuthService.login(email, password);
|
||||
const billing = await hydrateSession(session);
|
||||
if (session?.userId) {
|
||||
await PreAuthOnboardingService.flushToProfile(session.userId).catch(() => {});
|
||||
}
|
||||
const isPro = billing?.entitlement?.plan === 'pro' && billing?.entitlement?.status === 'active';
|
||||
// Non-pro accounts land on the paywall with context instead of being
|
||||
// bounced through the root redirect (which looks like an app restart).
|
||||
@@ -118,6 +122,9 @@ export default function LoginScreen() {
|
||||
name: fullName || undefined,
|
||||
});
|
||||
const billing = await hydrateSession(session);
|
||||
if (session?.userId) {
|
||||
await PreAuthOnboardingService.flushToProfile(session.userId).catch(() => {});
|
||||
}
|
||||
if (session.isNewUser) {
|
||||
await AsyncStorage.setItem('greenlens_show_tour', 'true');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user