diff --git a/lib/service/date_service.dart b/lib/service/date_service.dart index f703fa6..b422509 100644 --- a/lib/service/date_service.dart +++ b/lib/service/date_service.dart @@ -38,7 +38,9 @@ Future> getDatesforSleep() async { List createTZDateTimes( List? selectedDays, int? selectedHours, int? selectedMinutes) { - List tzDateTimes = []; + final List tzDateTimes = []; + final DateTime now = DateTime.now(); + final Duration offset = now.timeZoneOffset; if (selectedDays == null || selectedHours == null || selectedMinutes == null) { @@ -47,14 +49,14 @@ List createTZDateTimes( final Iterable selectedDaysInt = selectedDays.map((day) => weekDays[day]); for (int i = 0; i < trainingTime; 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, - selectedHours, selectedMinutes, 0, 0, 0)); + selectedHours, selectedMinutes, 0, 0, 0) + .subtract(offset)); } } return tzDateTimes; diff --git a/lib/service/notification_service.dart b/lib/service/notification_service.dart index c2e3bfd..2f564ce 100644 --- a/lib/service/notification_service.dart +++ b/lib/service/notification_service.dart @@ -33,9 +33,7 @@ class NotificationService { android: initializationSettingsAndroid, iOS: initializationSettingsIOS); // the initialization settings are initialized after they are setted - bool? initialized = await flutterLocalNotificationsPlugin - .initialize(initializationSettings); - print(initialized); + await flutterLocalNotificationsPlugin.initialize(initializationSettings); } Future showNotification() async { @@ -67,13 +65,10 @@ class NotificationService { int index = 0; for (var date in moodDates) { setNotification(index, "Mood", "Evaluate your mood", date); - print("mood"); index++; } for (var date in sleepDates) { setNotification(index, "Sleep", "Evaluate your sleep", date); - print("sleep"); - print(date); index++; } }