diff --git a/lib/app_version.dart b/lib/app_version.dart index 4708b0a..799fbff 100644 --- a/lib/app_version.dart +++ b/lib/app_version.dart @@ -1,4 +1,4 @@ /// Manuell mit `pubspec.yaml` synchron halten (kein package_info_plus, um /// keine zusätzliche Native-Plugin-Fläche in dieser Debugging-Phase /// einzuführen). Bei jedem Release beide Stellen bumpen. -const String kAppVersion = '0.1.9+10'; +const String kAppVersion = '0.1.10+11'; diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index a51030c..44b29e5 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -42,6 +42,51 @@ class _HomeScreenState extends State { }); } + Future _showVersionInfo() async { + bool checking = false; + String? checkResult; + + await showDialog( + context: context, + builder: (ctx) => StatefulBuilder( + builder: (ctx, setDialogState) => AlertDialog( + title: const Text('Version'), + content: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Installiert: v$kAppVersion'), + const SizedBox(height: 12), + if (checking) + const Center(child: Padding(padding: EdgeInsets.all(8), child: CircularProgressIndicator())) + else if (checkResult != null) + Text(checkResult!, style: TextStyle(color: checkResult!.startsWith('Neue') ? Colors.blue : Colors.green[700])), + const SizedBox(height: 8), + TextButton.icon( + onPressed: checking + ? null + : () async { + setDialogState(() => checking = true); + final newer = await _updateService.checkForNewerVersion(); + setDialogState(() { + checking = false; + checkResult = newer != null ? 'Neue Version verfügbar: v$newer' : 'Aktuell – kein Update verfügbar.'; + }); + if (newer != null && mounted) setState(() => _newerVersion = newer); + }, + icon: const Icon(Icons.refresh), + label: const Text('Jetzt prüfen'), + ), + ], + ), + actions: [ + TextButton(onPressed: () => Navigator.pop(ctx), child: const Text('Schließen')), + ], + ), + ), + ); + } + Future _installUpdate() async { setState(() { _updating = true; @@ -199,6 +244,7 @@ class _HomeScreenState extends State { appBar: AppBar( title: const Text('Zeiterfassung · v$kAppVersion'), actions: [ + IconButton(icon: const Icon(Icons.info_outline), onPressed: _showVersionInfo, tooltip: 'Version'), IconButton(icon: const Icon(Icons.logout), onPressed: _logout), ], ), diff --git a/pubspec.yaml b/pubspec.yaml index 6890cc7..ccf6ad3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: timemaster_mobile description: TimeMaster Zeiterfassung – Employee App publish_to: 'none' -version: 0.1.9+10 +version: 0.1.10+11 environment: sdk: '>=3.3.0 <4.0.0'