From a057d91493b324e317d5466a4939808a0cd4adbb Mon Sep 17 00:00:00 2001 From: Lea Date: Fri, 6 Oct 2023 14:43:04 +0200 Subject: [PATCH] ???? --- android/app/src/main/AndroidManifest.xml | 3 + lib/notification.dart | 81 ++++++++++++++++++++---- 2 files changed, 70 insertions(+), 14 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index fecbea7..53b0a76 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,4 +1,7 @@ + + + TZDateTime( + local, + currentTime.year, + currentTime.month, + currentTime.day, + item[0], + item[1], + )) + .toList(); + + // For all entries in the past, add 1 day + for (var time in notificationTimes + .where((element) => element.compareTo(currentTime) < 0)) { + time.add(const Duration(days: 1)); + } + + // Sort the array so we can find the closest time + notificationTimes.sort((a, b) => a.compareTo(b)); + + await FlutterLocalNotificationsPlugin().zonedSchedule( + 1, + null, + null, + notificationTimes[0], + details, + uiLocalNotificationDateInterpretation: + UILocalNotificationDateInterpretation.absoluteTime, ); }