fix(mobile): gate watch directory on instance URL; skip auto-scan if unconfigured

Settings: watch directory field is hidden behind a warning if no instance
URL is saved yet, making the dependency explicit before the user sets a
path.

Import: runAutoScan silently skips (no errors) when instance URL is
missing; manualScan shows a single clear message instead of one failure
per file.
This commit is contained in:
Davide Scaini
2026-04-25 22:20:02 +02:00
parent 42d829737c
commit a5c2810568
2 changed files with 28 additions and 12 deletions
+7
View File
@@ -53,6 +53,8 @@ export default function ImportScreen() {
if (isImporting.current) return;
const path = await getSetting(db, 'auto_import_path');
if (!path) return;
const instanceUrl = await getSetting(db, 'instance_url');
if (!instanceUrl) return; // silently skip — engine can't be downloaded without an instance
const newFiles = await discoverNewFiles(db, path);
if (newFiles.length === 0) return;
@@ -69,6 +71,11 @@ export default function ImportScreen() {
if (isImporting.current) return;
const path = await getSetting(db, 'auto_import_path');
if (!path) return;
const instanceUrl = await getSetting(db, 'instance_url');
if (!instanceUrl) {
setState({ status: 'error', message: 'No Bincio instance configured. Go to Settings and enter an instance URL first — it\'s needed to download the extraction engine.' });
return;
}
setState({ status: 'loading', msg: 'Scanning…', current: 0, total: 0 });
const newFiles = await discoverNewFiles(db, path);
+10 -1
View File
@@ -165,6 +165,12 @@ export default function SettingsScreen() {
{Platform.OS === 'android' && (
<Section title="Auto-import (Android)">
{!storedUrl ? (
<Text style={[styles.hint, styles.hintWarn]}>
Configure and save a Bincio instance URL above first it's needed to download the extraction engine.
</Text>
) : (
<>
<Field
label="Watch directory"
placeholder="/sdcard/FitFiles"
@@ -174,9 +180,11 @@ export default function SettingsScreen() {
autoCapitalize="none"
/>
<Text style={styles.hint}>
New FIT files in this directory are imported automatically when you
New FIT files in this folder are imported automatically when you
open the app. Leave blank to disable. Requires storage permission.
</Text>
</>
)}
</Section>
)}
@@ -326,6 +334,7 @@ const styles = StyleSheet.create({
fieldLabel: { color: '#71717a', fontSize: 11, marginBottom: 4 },
input: { color: '#f4f4f5', fontSize: 15 },
hint: { color: '#52525b', fontSize: 12, lineHeight: 16, padding: 12 },
hintWarn: { color: '#a16207' },
row: {
flexDirection: 'row', justifyContent: 'space-between',
paddingHorizontal: 14, paddingVertical: 12,