Fix file system imports and File constructor crash
This commit is contained in:
1 parent
757ff4104b
commit
120815280b
8 files changed
+10
-11
No files matched your search
@@ -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();
|
||||
|
||||
@@ -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",
|
||||
|
||||
+1
-1
@@ -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",
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user