Initialize Schnappix Photo Booth application with custom UVC camera, silent Wi-Fi IPP printing, local gallery storage, and kiosk screen pinning support

This commit is contained in:
2026-05-25 16:44:15 +02:00
parent 5958319772
commit 872e1ffc86
51 changed files with 8931 additions and 1 deletions
+48
View File
@@ -0,0 +1,48 @@
import * as FileSystem from 'expo-file-system';
export interface AppSettings {
countdownDuration: number; // in seconds
printerIp: string;
adminPassword: string;
kioskModeEnabled: boolean;
}
const SETTINGS_FILE = `${FileSystem.documentDirectory}settings.json`;
const DEFAULT_SETTINGS: AppSettings = {
countdownDuration: 3,
printerIp: '192.168.1.100',
adminPassword: '1234',
kioskModeEnabled: false,
};
/**
* Load settings from persistent storage.
*/
export async function loadSettings(): Promise<AppSettings> {
try {
const fileInfo = await FileSystem.getInfoAsync(SETTINGS_FILE);
if (fileInfo.exists) {
const content = await FileSystem.readAsStringAsync(SETTINGS_FILE);
const parsed = JSON.parse(content);
return { ...DEFAULT_SETTINGS, ...parsed };
}
} catch (e) {
console.error('Failed to load settings, using defaults:', e);
}
return DEFAULT_SETTINGS;
}
/**
* Save settings to persistent storage.
*/
export async function saveSettings(settings: AppSettings): Promise<void> {
try {
const content = JSON.stringify(settings, null, 2);
await FileSystem.writeAsStringAsync(SETTINGS_FILE, content);
console.log('Settings saved successfully:', content);
} catch (e) {
console.error('Failed to save settings:', e);
throw e;
}
}