From 2e64661436b40bb8782bef190c91e6b6b187e770 Mon Sep 17 00:00:00 2001 From: space Date: Sun, 1 Mar 2026 17:06:36 +0100 Subject: [PATCH] fix: improve image quality setting and enhance error handling in image upload --- mobile/src/pages/datacards.tsx | 2 +- mobile/src/pages/settings.tsx | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mobile/src/pages/datacards.tsx b/mobile/src/pages/datacards.tsx index f14e10a..6e60b12 100644 --- a/mobile/src/pages/datacards.tsx +++ b/mobile/src/pages/datacards.tsx @@ -770,7 +770,7 @@ function ImageRotatorFields({ form, onChange, onUrlsChange }: ImageRotatorFields } const result = await ImagePicker.launchImageLibraryAsync({ mediaTypes: "images", - quality: 0.8, + quality: 1, base64: true, }); if (result.canceled) return; diff --git a/mobile/src/pages/settings.tsx b/mobile/src/pages/settings.tsx index 078fb9f..47033df 100644 --- a/mobile/src/pages/settings.tsx +++ b/mobile/src/pages/settings.tsx @@ -49,7 +49,7 @@ export function SettingsPage() { const result = await ImagePicker.launchImageLibraryAsync({ mediaTypes: "images", - quality: 0.85, + quality: 1, base64: true, }); @@ -63,16 +63,20 @@ export function SettingsPage() { return; } + if (!asset.base64) { + setStatus("Could not read image data. Please try again."); + return; + } const ext = (asset.mimeType?.split("/")[1] ?? asset.uri.split(".").pop() ?? "jpg").toLowerCase(); setPendingUri(asset.uri); - setPendingBase64(asset.base64 ?? null); + setPendingBase64(asset.base64); setPendingExt(ext); setStatus(null); }; // ── Upload pending image and save as background const handleSave = async () => { - if (!pendingBase64) return; + if (!pendingBase64) { setStatus("No image selected."); return; } setSaving(true); setStatus(null); try {