Testflight

This commit is contained in:
2026-07-06 15:33:53 +02:00
parent 673ead2e3a
commit 99cd885833
19 changed files with 5288 additions and 5288 deletions

View File

@@ -1,36 +1,36 @@
import AsyncStorage from '@react-native-async-storage/async-storage';
import { OnboardingProgressService } from './onboardingProgressService';
const STORAGE_KEY = 'greenlens_preauth_onboarding_v1';
export type PreAuthAnswers = {
acquisitionSource?: string;
primaryGoal?: string;
experienceLevel?: string;
};
export const PreAuthOnboardingService = {
async setAnswer<K extends keyof PreAuthAnswers>(key: K, value: PreAuthAnswers[K]): Promise<void> {
const answers = await this.getAnswers();
answers[key] = value;
await AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(answers));
},
async getAnswers(): Promise<PreAuthAnswers> {
try {
const raw = await AsyncStorage.getItem(STORAGE_KEY);
return raw ? (JSON.parse(raw) as PreAuthAnswers) : {};
} catch {
return {};
}
},
// Persist buffered answers into the per-user profile after sign-up/login.
async flushToProfile(userId: number): Promise<void> {
const answers = await this.getAnswers();
if (answers.acquisitionSource) OnboardingProgressService.setAcquisitionSource(userId, answers.acquisitionSource);
if (answers.primaryGoal) OnboardingProgressService.setPrimaryGoal(userId, answers.primaryGoal);
if (answers.experienceLevel) OnboardingProgressService.setExperienceLevel(userId, answers.experienceLevel);
await AsyncStorage.removeItem(STORAGE_KEY);
},
};
import AsyncStorage from '@react-native-async-storage/async-storage';
import { OnboardingProgressService } from './onboardingProgressService';
const STORAGE_KEY = 'greenlens_preauth_onboarding_v1';
export type PreAuthAnswers = {
acquisitionSource?: string;
primaryGoal?: string;
experienceLevel?: string;
};
export const PreAuthOnboardingService = {
async setAnswer<K extends keyof PreAuthAnswers>(key: K, value: PreAuthAnswers[K]): Promise<void> {
const answers = await this.getAnswers();
answers[key] = value;
await AsyncStorage.setItem(STORAGE_KEY, JSON.stringify(answers));
},
async getAnswers(): Promise<PreAuthAnswers> {
try {
const raw = await AsyncStorage.getItem(STORAGE_KEY);
return raw ? (JSON.parse(raw) as PreAuthAnswers) : {};
} catch {
return {};
}
},
// Persist buffered answers into the per-user profile after sign-up/login.
async flushToProfile(userId: number): Promise<void> {
const answers = await this.getAnswers();
if (answers.acquisitionSource) OnboardingProgressService.setAcquisitionSource(userId, answers.acquisitionSource);
if (answers.primaryGoal) OnboardingProgressService.setPrimaryGoal(userId, answers.primaryGoal);
if (answers.experienceLevel) OnboardingProgressService.setExperienceLevel(userId, answers.experienceLevel);
await AsyncStorage.removeItem(STORAGE_KEY);
},
};