App copy
This commit is contained in:
@@ -5,9 +5,10 @@ import { Ionicons } from '@expo/vector-icons';
|
||||
import { useRouter } from 'expo-router';
|
||||
import { useApp } from '../../context/AppContext';
|
||||
import { useColors } from '../../constants/Colors';
|
||||
import { ThemeBackdrop } from '../../components/ThemeBackdrop';
|
||||
import { Language } from '../../types';
|
||||
import { AuthService } from '../../services/authService';
|
||||
import { ThemeBackdrop } from '../../components/ThemeBackdrop';
|
||||
import { Language } from '../../types';
|
||||
import { AuthService } from '../../services/authService';
|
||||
import { resetToFreshInstall } from '../../services/devReset';
|
||||
|
||||
const getDataCopy = (language: Language) => {
|
||||
if (language === 'de') {
|
||||
@@ -115,23 +116,45 @@ export default function DataScreen() {
|
||||
]);
|
||||
};
|
||||
|
||||
// Nur im Dev-Build: setzt die App auf "frisch installiert" zurueck. Noetig,
|
||||
// weil ein Expo-Reload weder Keychain noch SQLite loescht - man landet sonst
|
||||
// immer wieder direkt im Dashboard statt im Onboarding.
|
||||
const handleDevReset = () => {
|
||||
Alert.alert(
|
||||
'Onboarding neu starten?',
|
||||
'Session, Onboarding-Status und A/B-Zuweisung werden zurückgesetzt. Du landest wieder auf dem Welcome-Screen.',
|
||||
[
|
||||
{ text: 'Abbrechen', style: 'cancel' },
|
||||
{
|
||||
text: 'Zurücksetzen',
|
||||
style: 'destructive',
|
||||
onPress: async () => {
|
||||
await resetToFreshInstall();
|
||||
await signOut();
|
||||
router.replace('/onboarding');
|
||||
},
|
||||
},
|
||||
],
|
||||
);
|
||||
};
|
||||
|
||||
const handleDeleteAccount = () => {
|
||||
Alert.alert(copy.deleteConfirmTitle, copy.deleteConfirmMessage, [
|
||||
{ text: 'Cancel', style: 'cancel' },
|
||||
{
|
||||
text: copy.deleteActionBtn,
|
||||
style: 'destructive',
|
||||
onPress: async () => {
|
||||
try {
|
||||
await AuthService.deleteAccount();
|
||||
await signOut();
|
||||
router.replace('/onboarding');
|
||||
} catch {
|
||||
Alert.alert(copy.genericErrorTitle, copy.genericErrorMessage);
|
||||
}
|
||||
},
|
||||
},
|
||||
]);
|
||||
text: copy.deleteActionBtn,
|
||||
style: 'destructive',
|
||||
onPress: async () => {
|
||||
try {
|
||||
await AuthService.deleteAccount();
|
||||
await signOut();
|
||||
router.replace('/onboarding');
|
||||
} catch {
|
||||
Alert.alert(copy.genericErrorTitle, copy.genericErrorMessage);
|
||||
}
|
||||
},
|
||||
},
|
||||
]);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -177,6 +200,23 @@ export default function DataScreen() {
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
|
||||
{__DEV__ ? (
|
||||
<TouchableOpacity
|
||||
style={[styles.actionRow, { backgroundColor: colors.cardBg, borderColor: colors.border }]}
|
||||
onPress={handleDevReset}
|
||||
>
|
||||
<View style={styles.actionIcon}>
|
||||
<Ionicons name="refresh-circle-outline" size={24} color={colors.primary} />
|
||||
</View>
|
||||
<View style={styles.actionTextContainer}>
|
||||
<Text style={[styles.actionTitle, { color: colors.text }]}>Onboarding neu starten (DEV)</Text>
|
||||
<Text style={[styles.actionHint, { color: `${colors.text}80` }]}>
|
||||
Setzt Session, Onboarding-Status und A/B-Variante zurück.
|
||||
</Text>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
) : null}
|
||||
|
||||
<View style={{ marginTop: 24 }}>
|
||||
<TouchableOpacity style={[styles.actionRow, { backgroundColor: '#FF3B3015', borderColor: '#FF3B3050', marginBottom: 0 }]} onPress={handleDeleteAccount}>
|
||||
<View style={[styles.actionIcon, { backgroundColor: '#FF3B3020' }]}>
|
||||
|
||||
Reference in New Issue
Block a user