Skip to content

Commit

Permalink
Bug fix: filter screen doesnt break on loading error
Browse files Browse the repository at this point in the history
  • Loading branch information
Lasslos committed Aug 7, 2023
1 parent 4addb68 commit f584cbd
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ android {
minSdkVersion 19
targetSdkVersion flutter.targetSdkVersion
//TODO: Change versionCode and versionName if there is a new version
versionCode 1307
versionName "v1.3.7"
versionCode 1308
versionName "v1.3.8"
}

signingConfigs {
Expand Down
35 changes: 25 additions & 10 deletions lib/ui/screens/filter_screen/filter_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,30 @@ class _FilterScreenState extends ConsumerState<FilterScreen> {
continue;
}
Sentry.captureException(
timeTableAsync.hasError,
stackTrace: timeTableAsync.hasError,
timeTableAsync.error,
stackTrace: timeTableAsync.stackTrace,
);
getLogger().e(
"Error while loading timetable",
error: timeTableAsync.error,
stackTrace: timeTableAsync.stackTrace,
);
return const Scaffold(
body: Center(
child: Text('Fehler beim Laden des Stundenplans'),
return Scaffold(
appBar: AppBar(
title: const Text('Fehler'),
),
body: const Center(
child: Padding(
padding: EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Fehler beim Laden des Stundenplans', style: TextStyle(fontSize: 20)),
Text('Die möglichen Filter werden aus Stunden aus den letzten zwei und dne nächsten zwei Wochen erstellt.'
'Mindestens eine dieser Wochen konnte nicht richtig geladen werden. Versuche, alle Wochen neu zu laden oder die App zu schließen und zu öffnen, um es erneut zu versuchen. Wenn das Problem weiter auftritt, kannst du dich gerne an mich wenden.')
],
),
),
),
);
}
Expand Down Expand Up @@ -275,11 +288,13 @@ class _FilterScreenState extends ConsumerState<FilterScreen> {
<TimeTablePeriod>[],
(previousValue, element) => previousValue
..addAll(
element.value?.values.fold(
<TimeTablePeriod>[],
(previousValue, element) => previousValue?.toList()?..addAll(element),
) ??
previousValue.toList(),
(element.hasError
? null
: element.value?.values.fold(
<TimeTablePeriod>[],
(previousValue, element) => previousValue?.toList()?..addAll(element),
)) ??
[],
),
);

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: your_schedule
description: Filter your Untis Schedule by classes you have chosen.

version: 1.3.7
version: 1.3.8

environment:
sdk: ">=3.0.5 <4.0.0"
Expand Down

0 comments on commit f584cbd

Please sign in to comment.