From 120815280b7d89cee369883d3b53359d1968bea9 Mon Sep 17 00:00:00 2001 From: orfelorfel23 Date: Mon, 17 Aug 2026 19:39:05 +0200 Subject: [PATCH] Fix file system imports and File constructor crash --- App.tsx | 2 +- app.json | 4 ++-- package.json | 2 +- src/screens/CameraScreen.tsx | 2 +- src/services/logger.ts | 2 +- src/services/printer.ts | 5 ++--- src/services/settings.ts | 2 +- src/services/storage.ts | 2 +- 8 files changed, 10 insertions(+), 11 deletions(-) diff --git a/App.tsx b/App.tsx index d49e61a1..848160a1 100644 --- a/App.tsx +++ b/App.tsx @@ -7,7 +7,7 @@ import AdminScreen from './src/screens/AdminScreen'; import { loadSettings, saveSettings, AppSettings } from './src/services/settings'; import { StickerData } from './src/components/DraggableSticker'; import { logger, setLogsEnabled } from './src/services/logger'; -import * as FileSystem from 'expo-file-system/legacy'; +import * as FileSystem from 'expo-file-system'; // Set up global error handler const defaultErrorHandler = (global as any).ErrorUtils.getGlobalHandler(); diff --git a/app.json b/app.json index c170bec9..a2e3b42a 100644 --- a/app.json +++ b/app.json @@ -3,7 +3,7 @@ "newArchEnabled": true, "name": "Schnappix", "slug": "Schnappix", - "version": "23.01.21", + "version": "23.01.22", "orientation": "landscape", "icon": "./Icon.png", "userInterfaceStyle": "dark", @@ -13,7 +13,7 @@ }, "android": { "package": "de.orfel.schnappix", - "versionCode": 21, + "versionCode": 22, "usesCleartextTraffic": true, "adaptiveIcon": { "backgroundColor": "#050510", diff --git a/package.json b/package.json index 295c1778..c712d3ee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "schnappix", - "version": "23.01.21", + "version": "23.01.22", "main": "index.ts", "dependencies": { "@fortawesome/fontawesome-svg-core": "^6.7.2", diff --git a/src/screens/CameraScreen.tsx b/src/screens/CameraScreen.tsx index 4c685b6b..6f75212f 100644 --- a/src/screens/CameraScreen.tsx +++ b/src/screens/CameraScreen.tsx @@ -12,7 +12,7 @@ import { useWindowDimensions, } from 'react-native'; import { CameraView, useCameraPermissions } from 'expo-camera'; -import * as FileSystem from 'expo-file-system/legacy'; +import * as FileSystem from 'expo-file-system'; import { File, Paths } from 'expo-file-system/next'; import * as ImageManipulator from 'expo-image-manipulator'; import { LinearGradient } from 'expo-linear-gradient'; diff --git a/src/services/logger.ts b/src/services/logger.ts index 01a35a68..f744fd1f 100644 --- a/src/services/logger.ts +++ b/src/services/logger.ts @@ -1,4 +1,4 @@ -import * as FileSystem from 'expo-file-system/legacy'; +import * as FileSystem from 'expo-file-system'; const logFileUri = FileSystem.documentDirectory + 'app_logs.txt'; diff --git a/src/services/printer.ts b/src/services/printer.ts index d474a918..5990456e 100644 --- a/src/services/printer.ts +++ b/src/services/printer.ts @@ -1,6 +1,6 @@ import ipp from 'ipp-encoder'; import { Buffer } from 'buffer'; -import { File } from 'expo-file-system'; +import * as FileSystem from 'expo-file-system'; export interface PrintOptions { ipAddress: string; @@ -24,8 +24,7 @@ export async function printImageLocal(imageUri: string, options: PrintOptions): } // 1. Read the image file from local storage as Base64 and convert to binary Buffer - const file = new File(imageUri); - const base64Data = await file.base64(); + const base64Data = await FileSystem.readAsStringAsync(imageUri, { encoding: FileSystem.EncodingType.Base64 }); const imageBuffer = Buffer.from(base64Data, 'base64'); // 2. Build the IPP Print-Job request structure diff --git a/src/services/settings.ts b/src/services/settings.ts index 0045ef24..686814d8 100644 --- a/src/services/settings.ts +++ b/src/services/settings.ts @@ -1,5 +1,5 @@ import { File, Paths } from 'expo-file-system'; -import * as FileSystem from 'expo-file-system/legacy'; +import * as FileSystem from 'expo-file-system'; import { FRAMES } from '../data/frames'; import * as Application from 'expo-application'; diff --git a/src/services/storage.ts b/src/services/storage.ts index 7091d41a..08281cc6 100644 --- a/src/services/storage.ts +++ b/src/services/storage.ts @@ -1,5 +1,5 @@ import { getPermissionsAsync, requestPermissionsAsync, createAssetAsync, getAlbumAsync, createAlbumAsync, addAssetsToAlbumAsync } from 'expo-media-library'; -import * as FileSystem from 'expo-file-system/legacy'; +import * as FileSystem from 'expo-file-system'; import { logger } from './logger'; /**