diff --git a/lib/okna/jidelnicek.dart b/lib/okna/jidelnicek.dart index fa6ba34..467955b 100644 --- a/lib/okna/jidelnicek.dart +++ b/lib/okna/jidelnicek.dart @@ -356,8 +356,18 @@ class _JidelnicekPageState extends State { f.deleteSync(); } } + // Uložíme nová data - var j = await widget.canteen.jidelnicekDen(); + Jidelnicek j = Jidelnicek(DateTime.now(), []); + try { + j = await widget.canteen.jidelnicekDen(); + } catch (e) { + if (!widget.canteen.prihlasen) { + if (!mounted) return; // ! Přidat chybu, pokud není mounted + Navigator.pushReplacement( + context, MaterialPageRoute(builder: (c) => const LoginPage())); + } + } var soubor = File( "${appDocDir.path}/jidelnicek_${den.year}-${den.month}-${den.day}.json"); soubor.createSync(); diff --git a/pubspec.lock b/pubspec.lock index dfc85a0..b425f36 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -110,14 +110,14 @@ packages: name: flutter_local_notifications url: "https://pub.dartlang.org" source: hosted - version: "9.9.1" + version: "9.5.3+1" flutter_local_notifications_linux: dependency: transitive description: name: flutter_local_notifications_linux url: "https://pub.dartlang.org" source: hosted - version: "0.5.1" + version: "0.4.2" flutter_local_notifications_platform_interface: dependency: transitive description: @@ -143,7 +143,7 @@ packages: name: flutter_secure_storage url: "https://pub.dartlang.org" source: hosted - version: "5.1.2" + version: "5.0.2" flutter_secure_storage_linux: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 44b96b2..2fc9892 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,12 +17,12 @@ dependencies: flutter_localizations: sdk: flutter canteenlib: ^1.0.0 - flutter_secure_storage: ^5.0.2 + flutter_secure_storage: 5.0.2 url_launcher: ^6.0.20 path_provider: ^2.0.9 shared_preferences: ^2.0.13 introduction_screen: ^3.0.1 - flutter_local_notifications: ^9.5.3+1 + flutter_local_notifications: 9.5.3+1 timezone: ^0.8.0 flutter_native_timezone: ^2.0.0 intl: ^0.17.0