diff --git a/assets/group3.json b/assets/group3.json index 623ffc8..55ce9e0 100644 --- a/assets/group3.json +++ b/assets/group3.json @@ -13,7 +13,7 @@ }, "sleep_query": { "days": ["Dienstag", "Samstag"], - "hours": 11, - "minutes": 30 + "hours": 15, + "minutes": 42 } } diff --git a/lib/pages/scanner_page.dart b/lib/pages/scanner_page.dart index 8ab4419..b21b523 100644 --- a/lib/pages/scanner_page.dart +++ b/lib/pages/scanner_page.dart @@ -68,7 +68,7 @@ class ScannerPageState extends State { textStyle: const TextStyle(fontSize: 20)), onPressed: () { loadSettingsFromLocalJSON(); - NotificationService().showNotification(); + NotificationService().setAllNotifications(); }, child: const Text('Read JSON'), ) diff --git a/lib/service/date_service.dart b/lib/service/date_service.dart index 257afc1..f703fa6 100644 --- a/lib/service/date_service.dart +++ b/lib/service/date_service.dart @@ -47,7 +47,10 @@ List createTZDateTimes( final Iterable selectedDaysInt = selectedDays.map((day) => weekDays[day]); for (int i = 0; i < trainingTime; i++) { - final DateTime date = DateTime.now().add(Duration(days: i)); + final DateTime now = DateTime.now(); + final DateTime date = DateTime(now.year, now.month, now.day, selectedHours, + selectedMinutes, 0, 0, 0) + .add(Duration(days: i)); if (selectedDaysInt.contains(date.weekday) && date.isAfter(DateTime.now())) { tzDateTimes.add(TZDateTime.local(date.year, date.month, date.day, diff --git a/lib/service/notification_service.dart b/lib/service/notification_service.dart index a63b3fd..c2e3bfd 100644 --- a/lib/service/notification_service.dart +++ b/lib/service/notification_service.dart @@ -64,13 +64,17 @@ class NotificationService { Future setAllNotifications() async { List moodDates = await getDatesforMood(); List sleepDates = await getDatesforSleep(); + int index = 0; for (var date in moodDates) { - setNotification(1, "Mood", "Evaluate your mood", date); + setNotification(index, "Mood", "Evaluate your mood", date); print("mood"); + index++; } for (var date in sleepDates) { - setNotification(1, "Sleep", "Evaluate your sleep", date); + setNotification(index, "Sleep", "Evaluate your sleep", date); print("sleep"); + print(date); + index++; } }