Skip to content

Commit

Permalink
Větší robustnost
Browse files Browse the repository at this point in the history
  • Loading branch information
tpkowastaken committed Oct 15, 2023
1 parent 5a4520f commit e65c32a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 4 additions & 3 deletions lib/pages/jidelna.dart
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,9 @@ class MainAppScreenState extends State<MainAppScreen> {
future: getLunchesForDay(minimalDate.add(Duration(days: index))),
builder: (context, snapshot) {
if (snapshot.hasError) {
Future.delayed(Duration.zero, () => failedLoginDialog(context, 'Nelze Připojit k internetu', widget.setHomeWidget));
return const Center(child: CircularProgressIndicator());
//this causes errors for some reason
//Future.delayed(Duration.zero, () => failedLoginDialog(context, 'Nelze Připojit k internetu', widget.setHomeWidget));
return const Center(child: Text('nepodařilo se načíst obědy zkuste znovu načíst stránku'));
}
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
Expand Down Expand Up @@ -286,7 +287,7 @@ class ListJidel extends StatelessWidget {
try {
jidlaListener.value = (await refreshLunches(currentDate)).jidla;
} catch (e) {
Future.delayed(Duration.zero, () => failedLoginDialog(context, 'Nelze Připojit k internetu', setHomeWidget));
//Future.delayed(Duration.zero, () => failedLoginDialog(context, 'Nelze Připojit k internetu', setHomeWidget));
}
}

Expand Down
10 changes: 7 additions & 3 deletions lib/shared_widgets/switch_account_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,13 @@ class _SwitchAccountPanelState extends State<SwitchAccountPanel> {
LoginDataAutojidelna loginData = await getLoginDataFromSecureStorage();
loginData.currentlyLoggedInId = id;
saveLoginToSecureStorage(loginData);
canteenData = null;
canteenInstance = null;
changeDate(newDate: DateTime.now());
try {
canteenData = null;
canteenInstance = null;
changeDate(newDate: DateTime.now());
} catch (e) {
//not needed
}
widget.setHomeWidget(LoggingInWidget(setHomeWidget: widget.setHomeWidget));
} else {
SwitchAccountVisible().setVisible(false);
Expand Down

0 comments on commit e65c32a

Please sign in to comment.