Skip to content

Commit dbf0303

Browse files
committed
fix: check that notifications are actually set before scheduling them
1 parent 1e34f28 commit dbf0303

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/api/race_components.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ class RaceListHeaderItem extends StatelessWidget {
6464
scheduleLastSavedFormat = Hive.box('requests')
6565
.get('f1ScheduleLastSavedFormat', defaultValue: 'ergast');
6666
}
67-
bool useDarkMode =
68-
Hive.box('settings').get('darkMode', defaultValue: true) as bool;
6967
bool shouldUse12HourClock = Hive.box('settings')
7068
.get('shouldUse12HourClock', defaultValue: false) as bool;
7169
List months = [
@@ -439,8 +437,9 @@ class RacesList extends StatelessWidget {
439437

440438
@override
441439
Widget build(BuildContext context) {
442-
// TODO: check that it is actually activated
443-
if (items.isNotEmpty && isUpNext && !isCache) {
440+
bool notificationsEnabled = Hive.box('settings')
441+
.get('notificationsEnabled', defaultValue: false) as bool;
442+
if (items.isNotEmpty && isUpNext && !isCache && notificationsEnabled) {
444443
scheduledNotification(items[0].meetingId);
445444
}
446445
return isUpNext

0 commit comments

Comments
 (0)