chore: update app configurations and screens

This commit is contained in:
2026-05-31 13:48:02 +02:00
parent 9296a9bc8b
commit d3c0ef2420
5 changed files with 90 additions and 98 deletions
+2 -6
View File
@@ -59,12 +59,8 @@ export default function App() {
updatedUris.pop();
setPhotoUris(updatedUris);
// If we have other photos, let user retake from current collage length
if (updatedUris.length > 0) {
setCurrentScreen('camera');
} else {
setCurrentScreen('home');
}
// Always let user retake
setCurrentScreen('camera');
};
const handleAddAnother = () => {
-4
View File
@@ -12,10 +12,6 @@
},
"android": {
"package": "com.schnappix",
"adaptiveIcon": {
"backgroundColor": "#050510",
"foregroundImage": "./Icon.png"
},
"permissions": [
"android.permission.CAMERA",
"android.permission.RECORD_AUDIO",
+41 -81
View File
@@ -272,6 +272,15 @@ export default function CameraScreen({
}
};
const handleCancel = useCallback(() => {
if (burstTimerRef.current) {
clearTimeout(burstTimerRef.current);
}
setHasStarted(false);
setIsCapturing(false);
onCancel();
}, [onCancel]);
const handleSettingsTap = () => {
setEnteredPassword('');
setErrorText('');
@@ -327,24 +336,13 @@ export default function CameraScreen({
<FontAwesomeIcon icon={faUserGear} size={22} color={THEME.colors.accent} />
</TouchableOpacity>
<View style={styles.welcomeBox}>
<Text style={styles.logo}>SCHNAPPIX</Text>
<Text style={styles.welcomeTitle}>{welcomeText}</Text>
<View style={styles.divider} />
<LinearGradient
colors={THEME.gradient.primary}
start={{ x: 0, y: 0.5 }}
end={{ x: 1, y: 0.5 }}
style={styles.startButton}
>
<FontAwesomeIcon icon={faCameraRetro} size={20} color={THEME.colors.text} style={{ marginRight: 10 }} />
<Text style={styles.startButtonText}>ZUM STARTEN ÜBERALL TIPPEN</Text>
</LinearGradient>
<Text style={styles.welcomeFooter}>Fotos machen Collage erstellen Sofort drucken</Text>
</View>
{/* Header Event Text */}
<Text style={styles.headerTitle}>{welcomeText}</Text>
{/* Footer Instructions */}
<Text style={styles.footerInstructions}>
ZUM STARTEN TIPPEN Fotos machen Collage Drucken
</Text>
{/* Password Prompt Modal */}
<Modal
@@ -459,7 +457,7 @@ export default function CameraScreen({
{/* Cancel Button */}
{!isCapturing && !isBurstWaiting && (
<TouchableOpacity style={styles.backButton} onPress={onCancel}>
<TouchableOpacity style={styles.backButton} onPress={handleCancel}>
<FontAwesomeIcon icon={faXmark} size={16} color={THEME.colors.text} style={{ marginRight: 6 }} />
<Text style={styles.backButtonText}>ABBRECHEN</Text>
</TouchableOpacity>
@@ -530,10 +528,12 @@ const styles = StyleSheet.create({
zIndex: 9999,
},
idleOverlayContainer: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'rgba(5, 5, 16, 0.25)',
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundColor: 'transparent',
},
captureOverlayContainer: {
flex: 1,
@@ -554,73 +554,31 @@ const styles = StyleSheet.create({
alignItems: 'center',
zIndex: 999,
},
welcomeBox: {
alignItems: 'center',
padding: THEME.spacing.xl,
borderRadius: THEME.borderRadius.lg,
backgroundColor: 'rgba(5, 5, 16, 0.85)',
borderWidth: 1,
borderColor: THEME.colors.gradientBorder,
width: '60%',
shadowColor: THEME.colors.gradientGlow,
shadowOffset: { width: 0, height: 0 },
shadowOpacity: 0.4,
shadowRadius: 30,
elevation: 10,
},
logo: {
fontSize: 54,
headerTitle: {
position: 'absolute',
top: 40,
width: '100%',
textAlign: 'center',
fontSize: 48,
fontWeight: '900',
color: THEME.colors.accent,
letterSpacing: 8,
marginBottom: THEME.spacing.sm,
letterSpacing: 6,
textShadowColor: THEME.colors.cyanGlow,
textShadowOffset: { width: 0, height: 0 },
textShadowRadius: 25,
},
welcomeTitle: {
fontSize: 22,
color: THEME.colors.text,
footerInstructions: {
position: 'absolute',
bottom: 40,
width: '100%',
textAlign: 'center',
marginBottom: THEME.spacing.lg,
letterSpacing: 1,
},
divider: {
width: 60,
height: 3,
backgroundColor: THEME.colors.accent,
marginBottom: THEME.spacing.xl,
borderRadius: THEME.borderRadius.sm,
shadowColor: THEME.colors.accent,
shadowOffset: { width: 0, height: 0 },
shadowOpacity: 0.8,
shadowRadius: 8,
},
startButton: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
paddingVertical: THEME.spacing.md,
paddingHorizontal: THEME.spacing.xl,
borderRadius: THEME.borderRadius.round,
marginBottom: THEME.spacing.xl,
overflow: 'hidden',
shadowColor: THEME.colors.gradientGlow,
shadowOffset: { width: 0, height: 4 },
shadowOpacity: 0.6,
shadowRadius: 14,
elevation: 8,
},
startButtonText: {
color: THEME.colors.text,
fontSize: 18,
fontSize: 20,
fontWeight: 'bold',
color: THEME.colors.text,
letterSpacing: 2,
},
welcomeFooter: {
fontSize: 14,
color: THEME.colors.textMuted,
letterSpacing: 1,
textShadowColor: 'rgba(0,0,0,0.9)',
textShadowOffset: { width: 0, height: 2 },
textShadowRadius: 15,
},
hudContainer: {
position: 'absolute',
@@ -838,6 +796,8 @@ const styles = StyleSheet.create({
},
confirmGradient: {
flex: 1,
width: '100%',
height: '100%',
alignItems: 'center',
justifyContent: 'center',
},
+42 -4
View File
@@ -70,6 +70,9 @@ export default function PreviewScreen({
const [selectedStickerId, setSelectedStickerId] = useState<string | null>(null);
const [showStickerTray, setShowStickerTray] = useState<boolean>(false);
// Idle Timer state
const idleTimerRef = useRef<any>(null);
// Frame state
const [selectedFrameId, setSelectedFrameId] = useState<string | null>(
frameMode === 'always' ? initialFrameId : null
@@ -227,7 +230,7 @@ export default function PreviewScreen({
};
// Auto-save and exit
const handleExit = async () => {
const handleExit = useCallback(async () => {
if (stickers.length === 0 && layout === 'single' && !activeFrame && dateOverlay === 'off') {
onReset();
return;
@@ -248,6 +251,36 @@ export default function PreviewScreen({
setIsProcessing(false);
onReset();
}
}, [stickers, layout, activeFrame, dateOverlay, onReset]);
// Idle timer logic
const resetIdleTimer = useCallback(() => {
if (idleTimerRef.current) clearTimeout(idleTimerRef.current);
idleTimerRef.current = setTimeout(() => {
handleExit();
}, 60000);
}, [handleExit]);
useEffect(() => {
resetIdleTimer();
return () => {
if (idleTimerRef.current) clearTimeout(idleTimerRef.current);
};
}, [resetIdleTimer]);
const handleRetakeClick = async () => {
if (stickers.length > 0 || layout !== 'single' || activeFrame || dateOverlay !== 'off') {
setIsProcessing(true);
setStatusMessage('Wird vor dem Wiederholen gespeichert...');
try {
const capturedUri = await captureComposite();
await saveToGallery(capturedUri);
} catch (error) {
console.error('Auto-saving before retake failed:', error);
}
setIsProcessing(false);
}
onRetakeLast();
};
// ── Render the collage ──
@@ -303,7 +336,12 @@ export default function PreviewScreen({
};
return (
<Animated.View entering={FadeIn.duration(400)} exiting={FadeOut.duration(300)} style={styles.container}>
<Animated.View
entering={FadeIn.duration(400)}
exiting={FadeOut.duration(300)}
style={styles.container}
onTouchStart={resetIdleTimer}
>
{/* Left panel: Preview Canvas */}
<TouchableOpacity
style={styles.previewPanel}
@@ -482,7 +520,7 @@ export default function PreviewScreen({
)}
<View style={styles.rowActions}>
<TouchableOpacity style={[styles.smallBtn, styles.retakeBtn]} onPress={onRetakeLast}>
<TouchableOpacity style={[styles.smallBtn, styles.retakeBtn]} onPress={handleRetakeClick}>
<FontAwesomeIcon icon={faRotateLeft} size={14} color={THEME.colors.error} style={{ marginRight: 6 }} />
<Text style={[styles.smallBtnText, { color: THEME.colors.error }]}>Wiederholen</Text>
</TouchableOpacity>
@@ -686,7 +724,7 @@ const styles = StyleSheet.create({
width: 480,
height: 320,
backgroundColor: '#fff',
padding: 10,
padding: 0,
shadowColor: THEME.colors.gradientGlow,
shadowOffset: { width: 0, height: 0 },
shadowOpacity: 0.35,
+5 -3
View File
@@ -1,4 +1,6 @@
import { File, Paths } from 'expo-file-system';
import * as FileSystem from 'expo-file-system';
import { FRAMES } from '../data/frames';
export interface AppSettings {
countdownDuration: number; // in seconds
@@ -28,9 +30,9 @@ const DEFAULT_SETTINGS: AppSettings = {
printerIp: '192.168.1.100',
adminPassword: '1234',
kioskModeEnabled: false,
frameMode: 'off',
frameMode: 'available',
selectedFrameId: null,
availableFrameIds: [],
availableFrameIds: FRAMES.map(f => f.id),
dateOverlay: 'off',
dateOverlayPosition: 'bottom-right',
eventText: '',
@@ -61,7 +63,7 @@ export async function loadSettings(): Promise<AppSettings> {
export async function saveSettings(settings: AppSettings): Promise<void> {
try {
const content = JSON.stringify(settings, null, 2);
settingsFile.write(content);
await FileSystem.writeAsStringAsync(settingsFile.uri, content);
console.log('Settings saved successfully:', content);
} catch (e) {
console.error('Failed to save settings:', e);