Onboarding
This commit is contained in:
@@ -12,21 +12,28 @@ import {
|
||||
Image,
|
||||
} from 'react-native';
|
||||
import { Ionicons } from '@expo/vector-icons';
|
||||
import { router } from 'expo-router';
|
||||
import { useApp } from '../../context/AppContext';
|
||||
import { useColors } from '../../constants/Colors';
|
||||
import { ThemeBackdrop } from '../../components/ThemeBackdrop';
|
||||
import { router } from 'expo-router';
|
||||
import { useApp } from '../../context/AppContext';
|
||||
import { useColors } from '../../constants/Colors';
|
||||
import { AuthService } from '../../services/authService';
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import * as AppleAuthentication from 'expo-apple-authentication';
|
||||
import Constants from 'expo-constants';
|
||||
import { usePostHog } from 'posthog-react-native';
|
||||
|
||||
const ONBOARDING_AUTH_BACKGROUND = {
|
||||
light: '#fbfaf3',
|
||||
dark: '#0a110b',
|
||||
};
|
||||
|
||||
export default function SignupScreen() {
|
||||
const { isDarkMode, colorPalette, hydrateSession, getPendingPlant, t } = useApp();
|
||||
const colors = useColors(isDarkMode, colorPalette);
|
||||
const posthog = usePostHog();
|
||||
const pendingPlant = getPendingPlant();
|
||||
const screenBackground = isDarkMode
|
||||
? ONBOARDING_AUTH_BACKGROUND.dark
|
||||
: ONBOARDING_AUTH_BACKGROUND.light;
|
||||
|
||||
const [name, setName] = useState('');
|
||||
const [email, setEmail] = useState('');
|
||||
@@ -78,7 +85,7 @@ export default function SignupScreen() {
|
||||
await hydrateSession(session);
|
||||
// Flag setzen: Tour beim nächsten App-Öffnen anzeigen
|
||||
await AsyncStorage.setItem('greenlens_show_tour', 'true');
|
||||
router.replace('/profile/billing');
|
||||
router.replace('/onboarding/source');
|
||||
} catch (e: any) {
|
||||
if (e.message === 'EMAIL_TAKEN') {
|
||||
setError(t.errEmailTaken);
|
||||
@@ -127,7 +134,7 @@ export default function SignupScreen() {
|
||||
await hydrateSession(session);
|
||||
await AsyncStorage.setItem('greenlens_show_tour', 'true');
|
||||
posthog.capture('apple_login_succeeded', { surface: 'signup' });
|
||||
router.replace(session.isNewUser ? '/profile/billing' : '/(tabs)');
|
||||
router.replace(session.isNewUser ? '/onboarding/source' : '/(tabs)');
|
||||
} catch (e: any) {
|
||||
if (e?.code === 'ERR_REQUEST_CANCELED') {
|
||||
return;
|
||||
@@ -145,12 +152,11 @@ export default function SignupScreen() {
|
||||
};
|
||||
|
||||
return (
|
||||
<KeyboardAvoidingView
|
||||
style={[styles.flex, { backgroundColor: colors.background }]}
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
>
|
||||
<ThemeBackdrop colors={colors} />
|
||||
<ScrollView
|
||||
<KeyboardAvoidingView
|
||||
style={[styles.flex, { backgroundColor: screenBackground }]}
|
||||
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
||||
>
|
||||
<ScrollView
|
||||
contentContainerStyle={styles.scroll}
|
||||
keyboardShouldPersistTaps="handled"
|
||||
showsVerticalScrollIndicator={false}
|
||||
@@ -391,12 +397,12 @@ const styles = StyleSheet.create({
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
logoIcon: {
|
||||
width: 56,
|
||||
height: 56,
|
||||
borderRadius: 14,
|
||||
marginBottom: 16,
|
||||
},
|
||||
logoIcon: {
|
||||
width: 84,
|
||||
height: 84,
|
||||
borderRadius: 20,
|
||||
marginBottom: 16,
|
||||
},
|
||||
appName: {
|
||||
fontSize: 30,
|
||||
fontWeight: '700',
|
||||
|
||||
Reference in New Issue
Block a user