Fix bugs from code review (state flow, idle timer, logger, kiosk, temp files)

This commit is contained in:
2026-05-31 20:10:23 +02:00
parent 58015340a2
commit a922ec29c4
5 changed files with 133 additions and 66 deletions
+18 -2
View File
@@ -217,6 +217,22 @@ export default function AdminScreen({ currentSettings, onSave, onClose }: AdminS
</View>
);
const handleClose = () => {
// If user exits without saving, revert Kiosk Mode to match saved settings
if (kioskActive !== currentSettings.kioskModeEnabled) {
try {
if (currentSettings.kioskModeEnabled) {
KioskMode.startKiosk();
} else {
KioskMode.stopKiosk();
}
} catch (e) {
console.warn('Failed to revert Kiosk mode:', e);
}
}
onClose();
};
return (
<Animated.View entering={FadeIn.duration(400)} exiting={FadeOut.duration(300)} style={styles.container}>
<View style={styles.headerRow}>
@@ -224,7 +240,7 @@ export default function AdminScreen({ currentSettings, onSave, onClose }: AdminS
<FontAwesomeIcon icon={faUserGear} size={22} color={THEME.colors.accent} />
<Text style={styles.title}>EINSTELLUNGEN</Text>
</View>
<TouchableOpacity style={styles.closeBtn} onPress={onClose}>
<TouchableOpacity style={styles.closeBtn} onPress={handleClose}>
<FontAwesomeIcon icon={faArrowLeft} size={14} color={THEME.colors.text} />
<Text style={styles.closeBtnText}>Zurück zur Fotobox</Text>
</TouchableOpacity>
@@ -523,7 +539,7 @@ export default function AdminScreen({ currentSettings, onSave, onClose }: AdminS
<Text style={{ color: '#fff', fontWeight: 'bold' }}>Schließen</Text>
</TouchableOpacity>
<TouchableOpacity
style={{ backgroundColor: THEME.colors.danger, padding: 15, borderRadius: 8, flex: 0.48, alignItems: 'center' }}
style={{ backgroundColor: THEME.colors.error, padding: 15, borderRadius: 8, flex: 0.48, alignItems: 'center' }}
onPress={async () => { await logger.clearLogs(); setLogs(await logger.readLogs()); }}
>
<Text style={{ color: '#fff', fontWeight: 'bold' }}>Leeren</Text>