Fix iOS crash, storage, and printing issues; setup apk build
This commit is contained in:
@@ -5,6 +5,19 @@ export interface AppSettings {
|
||||
printerIp: string;
|
||||
adminPassword: string;
|
||||
kioskModeEnabled: boolean;
|
||||
// Photo Frames
|
||||
frameMode: 'off' | 'always' | 'available';
|
||||
selectedFrameId: string | null;
|
||||
// Date/Time overlay
|
||||
dateOverlay: 'off' | 'date' | 'datetime';
|
||||
dateOverlayPosition: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | 'bottom-center';
|
||||
// Event text (shown in date sticker & welcome)
|
||||
eventText: string;
|
||||
// Continuous shooting / burst
|
||||
burstCount: number; // 1 = single shot, 2–5 = burst
|
||||
burstIntervalSec: number; // seconds between burst shots
|
||||
// Welcome screen text
|
||||
welcomeText: string;
|
||||
}
|
||||
|
||||
const settingsFile = new File(Paths.document, 'settings.json');
|
||||
@@ -14,6 +27,14 @@ const DEFAULT_SETTINGS: AppSettings = {
|
||||
printerIp: '192.168.1.100',
|
||||
adminPassword: '1234',
|
||||
kioskModeEnabled: false,
|
||||
frameMode: 'off',
|
||||
selectedFrameId: null,
|
||||
dateOverlay: 'off',
|
||||
dateOverlayPosition: 'bottom-right',
|
||||
eventText: '',
|
||||
burstCount: 1,
|
||||
burstIntervalSec: 5,
|
||||
welcomeText: 'Willkommen zu unserer Feier!',
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Asset, Album, getPermissionsAsync, requestPermissionsAsync } from 'expo-media-library';
|
||||
import { getPermissionsAsync, requestPermissionsAsync, createAssetAsync, getAlbumAsync, createAlbumAsync, addAssetsToAlbumAsync } from 'expo-media-library';
|
||||
|
||||
const ALBUM_NAME = 'Schnappix';
|
||||
|
||||
@@ -33,28 +33,27 @@ export async function saveToGallery(localUri: string): Promise<string> {
|
||||
}
|
||||
|
||||
// 1. Create a media asset from the local file
|
||||
const asset = await Asset.create(localUri);
|
||||
const asset = await createAssetAsync(localUri);
|
||||
|
||||
try {
|
||||
// 2. Check if the "Schnappix" album already exists
|
||||
const album = await Album.get(ALBUM_NAME);
|
||||
const album = await getAlbumAsync(ALBUM_NAME);
|
||||
|
||||
if (!album) {
|
||||
// 3. If it doesn't exist, create it with our asset
|
||||
await Album.create(ALBUM_NAME, [asset], false);
|
||||
await createAlbumAsync(ALBUM_NAME, asset, false);
|
||||
console.log(`Created new album "${ALBUM_NAME}" and saved photo.`);
|
||||
} else {
|
||||
// 4. If it exists, add our asset to it
|
||||
await album.add(asset);
|
||||
await addAssetsToAlbumAsync([asset], album, false);
|
||||
console.log(`Saved photo to existing album "${ALBUM_NAME}".`);
|
||||
}
|
||||
|
||||
const assetUri = await asset.getUri();
|
||||
return assetUri;
|
||||
return asset.uri;
|
||||
} catch (e: any) {
|
||||
console.error('Error saving asset to album, returning fallback asset URI:', e);
|
||||
try {
|
||||
return await asset.getUri();
|
||||
return asset.uri;
|
||||
} catch {
|
||||
return asset.id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user