Was-ist-neu-Bericht als In-App-Dialog nach dem Abgleich
This commit is contained in:
+19
-2
@@ -30,6 +30,7 @@ import 'services/sync_service.dart';
|
||||
import 'services/yt_download_service.dart';
|
||||
import 'services/yt_search_service.dart';
|
||||
import 'settings/app_settings.dart';
|
||||
import 'shared/sync_bericht_dialog.dart';
|
||||
import 'shared/theme.dart';
|
||||
|
||||
late final MeloAudioHandler _handler;
|
||||
@@ -177,7 +178,7 @@ class _HomeShellState extends State<HomeShell> with WidgetsBindingObserver {
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
// Beim Start einmal mit dem Server abgleichen — neue Titel von anderen
|
||||
// Geräten sind dann sofort da.
|
||||
context.read<SyncService>().automatisch();
|
||||
unawaited(_gleicheAbUndZeigeBericht());
|
||||
unawaited(context.read<LibraryService>().ensureStartupPermissions());
|
||||
unawaited(_pruefeGeteilteAdresse());
|
||||
}
|
||||
@@ -205,13 +206,29 @@ class _HomeShellState extends State<HomeShell> with WidgetsBindingObserver {
|
||||
// auf dem Gerät wie am Server.
|
||||
if (state == AppLifecycleState.resumed) {
|
||||
if (Platform.isAndroid) _autoScan.pruefe();
|
||||
context.read<SyncService>().automatisch();
|
||||
unawaited(_gleicheAbUndZeigeBericht());
|
||||
// Ein zweites Teilen startet die App nicht neu (singleTop), sondern
|
||||
// bringt sie nur nach vorn — deshalb auch hier nachsehen.
|
||||
unawaited(_pruefeGeteilteAdresse());
|
||||
}
|
||||
}
|
||||
|
||||
/// Gleicht ab und zeigt danach höchstens einmal den „Was ist neu"-Bericht.
|
||||
Future<void> _gleicheAbUndZeigeBericht() async {
|
||||
final sync = context.read<SyncService>();
|
||||
await sync.automatisch();
|
||||
if (!mounted) return;
|
||||
final bericht = sync.bericht;
|
||||
if (bericht == null) return;
|
||||
// Zuerst quittieren: ein zweites Zurückkehren in die App soll denselben
|
||||
// Bericht nicht erneut zeigen.
|
||||
sync.berichtGesehen();
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) => SyncBerichtDialog(bericht: bericht),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final tabs = <Widget>[
|
||||
|
||||
Reference in New Issue
Block a user