From 5673c2b627db96c51ac54cfa2362d72985c48bbc Mon Sep 17 00:00:00 2001 From: stopflock Date: Fri, 21 Nov 2025 21:08:10 -0600 Subject: [PATCH] Link to view progress in settings after starting an offline area download --- README.md | 2 ++ assets/changelog.json | 6 ++++ lib/localizations/de.json | 6 ++++ lib/localizations/en.json | 6 ++++ lib/localizations/es.json | 6 ++++ lib/localizations/fr.json | 6 ++++ lib/localizations/it.json | 6 ++++ lib/localizations/pt.json | 6 ++++ lib/localizations/zh.json | 6 ++++ lib/widgets/download_area_dialog.dart | 26 +++++++++++---- lib/widgets/download_started_dialog.dart | 40 ++++++++++++++++++++++++ pubspec.yaml | 2 +- 12 files changed, 111 insertions(+), 7 deletions(-) create mode 100644 lib/widgets/download_started_dialog.dart diff --git a/README.md b/README.md index 7ead598..8babc4e 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,8 @@ cp lib/keys.dart.example lib/keys.dart ## Roadmap ### Needed Bugfixes +- Disallow new/edit nodes below zoom 10 (15?) (don't allow zooming out beyond that either) +- Disallow large downloads or otherwise fix performance issue calculating number of tiles - Update node cache to reflect cleared queue entries - Improve/retune tile fetching backoff/retry - Are offline areas preferred for fast loading even when online? Check working. diff --git a/assets/changelog.json b/assets/changelog.json index 023081b..e989d53 100644 --- a/assets/changelog.json +++ b/assets/changelog.json @@ -1,4 +1,10 @@ { + "1.4.5": { + "content": [ + "• IMPROVED: Offline area download confirmation now shows as popup with 'View Progress in Settings' button instead of simple notification", + "• UX: Download failures now display as dialog instead of snackbar for better visibility" + ] + }, "1.4.4": { "content": [ "• FOV range notation parsing - now supports OSM data like '90-270' (180° FOV centered at 180°)", diff --git a/lib/localizations/de.json b/lib/localizations/de.json index 4e188ba..18c0dac 100644 --- a/lib/localizations/de.json +++ b/lib/localizations/de.json @@ -136,6 +136,12 @@ "downloadStarted": "Download gestartet! Lade Kacheln und Knoten...", "downloadFailed": "Download konnte nicht gestartet werden: {}" }, + "downloadStarted": { + "title": "Download gestartet", + "message": "Download gestartet! Lade Kacheln und Knoten...", + "ok": "OK", + "viewProgress": "Fortschritt in Einstellungen anzeigen" + }, "uploadMode": { "title": "Upload-Ziel", "subtitle": "Wählen Sie, wohin Kameras hochgeladen werden", diff --git a/lib/localizations/en.json b/lib/localizations/en.json index b6cbfc8..9ec3210 100644 --- a/lib/localizations/en.json +++ b/lib/localizations/en.json @@ -154,6 +154,12 @@ "downloadStarted": "Download started! Fetching tiles and nodes...", "downloadFailed": "Failed to start download: {}" }, + "downloadStarted": { + "title": "Download Started", + "message": "Download started! Fetching tiles and nodes...", + "ok": "OK", + "viewProgress": "View Progress in Settings" + }, "uploadMode": { "title": "Upload Destination", "subtitle": "Choose where cameras are uploaded", diff --git a/lib/localizations/es.json b/lib/localizations/es.json index 2b0e16e..06748e9 100644 --- a/lib/localizations/es.json +++ b/lib/localizations/es.json @@ -154,6 +154,12 @@ "downloadStarted": "¡Descarga iniciada! Obteniendo mosaicos y nodos...", "downloadFailed": "Error al iniciar la descarga: {}" }, + "downloadStarted": { + "title": "Descarga Iniciada", + "message": "¡Descarga iniciada! Obteniendo mosaicos y nodos...", + "ok": "OK", + "viewProgress": "Ver Progreso en Configuración" + }, "uploadMode": { "title": "Destino de Subida", "subtitle": "Elige dónde se suben las cámaras", diff --git a/lib/localizations/fr.json b/lib/localizations/fr.json index 03f2e0f..b51d29a 100644 --- a/lib/localizations/fr.json +++ b/lib/localizations/fr.json @@ -154,6 +154,12 @@ "downloadStarted": "Téléchargement démarré! Récupération des tuiles et nœuds...", "downloadFailed": "Échec du démarrage du téléchargement: {}" }, + "downloadStarted": { + "title": "Téléchargement Démarré", + "message": "Téléchargement démarré! Récupération des tuiles et nœuds...", + "ok": "OK", + "viewProgress": "Voir le Progrès dans Paramètres" + }, "uploadMode": { "title": "Destination de Téléchargement", "subtitle": "Choisir où les caméras sont téléchargées", diff --git a/lib/localizations/it.json b/lib/localizations/it.json index 2ca4634..c462ee9 100644 --- a/lib/localizations/it.json +++ b/lib/localizations/it.json @@ -154,6 +154,12 @@ "downloadStarted": "Download avviato! Recupero tile e nodi...", "downloadFailed": "Impossibile avviare il download: {}" }, + "downloadStarted": { + "title": "Download Avviato", + "message": "Download avviato! Recupero tile e nodi...", + "ok": "OK", + "viewProgress": "Visualizza Progresso in Impostazioni" + }, "uploadMode": { "title": "Destinazione Upload", "subtitle": "Scegli dove vengono caricate le telecamere", diff --git a/lib/localizations/pt.json b/lib/localizations/pt.json index 58137b9..0e7d7d2 100644 --- a/lib/localizations/pt.json +++ b/lib/localizations/pt.json @@ -154,6 +154,12 @@ "downloadStarted": "Download iniciado! Buscando tiles e nós...", "downloadFailed": "Falha ao iniciar o download: {}" }, + "downloadStarted": { + "title": "Download Iniciado", + "message": "Download iniciado! Buscando tiles e nós...", + "ok": "OK", + "viewProgress": "Ver Progresso nas Configurações" + }, "uploadMode": { "title": "Destino do Upload", "subtitle": "Escolha onde as câmeras são enviadas", diff --git a/lib/localizations/zh.json b/lib/localizations/zh.json index 260a02b..9933b83 100644 --- a/lib/localizations/zh.json +++ b/lib/localizations/zh.json @@ -154,6 +154,12 @@ "downloadStarted": "下载已开始!正在获取瓦片和节点...", "downloadFailed": "启动下载失败:{}" }, + "downloadStarted": { + "title": "下载已开始", + "message": "下载已开始!正在获取瓦片和节点...", + "ok": "确定", + "viewProgress": "在设置中查看进度" + }, "uploadMode": { "title": "上传目标", "subtitle": "选择摄像头上传位置", diff --git a/lib/widgets/download_area_dialog.dart b/lib/widgets/download_area_dialog.dart index 1242483..48c5635 100644 --- a/lib/widgets/download_area_dialog.dart +++ b/lib/widgets/download_area_dialog.dart @@ -9,6 +9,7 @@ import '../dev_config.dart'; import '../services/localization_service.dart'; import '../services/offline_area_service.dart'; import '../services/offline_areas/offline_tile_utils.dart'; +import 'download_started_dialog.dart'; class DownloadAreaDialog extends StatefulWidget { final MapController controller; @@ -275,16 +276,29 @@ class _DownloadAreaDialogState extends State { tileTypeName: selectedTileType?.name, ); Navigator.pop(context); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text(locService.t('download.downloadStarted')), - ), + showDialog( + context: context, + builder: (context) => const DownloadStartedDialog(), ); } catch (e) { Navigator.pop(context); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( + showDialog( + context: context, + builder: (context) => AlertDialog( + title: Row( + children: [ + const Icon(Icons.error, color: Colors.red), + const SizedBox(width: 10), + Text(locService.t('download.title')), + ], + ), content: Text(locService.t('download.downloadFailed', params: [e.toString()])), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: Text(locService.t('actions.ok')), + ), + ], ), ); } diff --git a/lib/widgets/download_started_dialog.dart b/lib/widgets/download_started_dialog.dart new file mode 100644 index 0000000..0eeb3a4 --- /dev/null +++ b/lib/widgets/download_started_dialog.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; +import '../services/localization_service.dart'; + +class DownloadStartedDialog extends StatelessWidget { + const DownloadStartedDialog({super.key}); + + @override + Widget build(BuildContext context) { + return AnimatedBuilder( + animation: LocalizationService.instance, + builder: (context, child) { + final locService = LocalizationService.instance; + + return AlertDialog( + title: Row( + children: [ + const Icon(Icons.download_for_offline, color: Colors.green), + const SizedBox(width: 10), + Text(locService.t('downloadStarted.title')), + ], + ), + content: Text(locService.t('downloadStarted.message')), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: Text(locService.t('downloadStarted.ok')), + ), + ElevatedButton( + onPressed: () { + Navigator.pop(context); + Navigator.pushNamed(context, '/settings/offline'); + }, + child: Text(locService.t('downloadStarted.viewProgress')), + ), + ], + ); + }, + ); + } +} \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 999daf1..e9a1658 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: deflockapp description: Map public surveillance infrastructure with OpenStreetMap publish_to: "none" -version: 1.4.4+15 # The thing after the + is the version code, incremented with each release +version: 1.4.5+16 # The thing after the + is the version code, incremented with each release environment: sdk: ">=3.5.0 <4.0.0" # oauth2_client 4.x needs Dart 3.5+