mirror of
https://github.com/go-vikunja/app
synced 2024-06-06 12:39:51 +00:00
fixed notifications caused by weird bug
This commit is contained in:
parent
32cdfea6d0
commit
aef7ce3fbb
|
@ -75,14 +75,14 @@ class VikunjaGlobalState extends State<VikunjaGlobal> {
|
|||
new LabelTaskBulkAPIService(client);
|
||||
|
||||
var androidSpecificsDueDate = notifs.AndroidNotificationDetails(
|
||||
"Vikunja Due",
|
||||
"Vikunja1",
|
||||
"Due Date Notifications",
|
||||
channelDescription: "description",
|
||||
icon: 'ic_launcher_foreground',
|
||||
importance: notifs.Importance.high
|
||||
);
|
||||
var androidSpecificsReminders = notifs.AndroidNotificationDetails(
|
||||
"Vikunja Reminders",
|
||||
"Vikunja2",
|
||||
"Reminder Notifications",
|
||||
channelDescription: "description",
|
||||
icon: 'ic_launcher_foreground',
|
||||
|
@ -97,12 +97,12 @@ class VikunjaGlobalState extends State<VikunjaGlobal> {
|
|||
super.initState();
|
||||
_loadCurrentUser();
|
||||
tz.initializeTimeZones();
|
||||
notificationInitializer();
|
||||
iOSSpecifics = notifs.IOSNotificationDetails();
|
||||
platformChannelSpecificsDueDate = notifs.NotificationDetails(
|
||||
android: androidSpecificsDueDate, iOS: iOSSpecifics);
|
||||
platformChannelSpecificsReminders = notifs.NotificationDetails(
|
||||
android: androidSpecificsReminders, iOS: iOSSpecifics);
|
||||
notificationInitializer();
|
||||
}
|
||||
|
||||
void changeUser(User newUser, {String token, String base}) async {
|
||||
|
@ -134,12 +134,11 @@ class VikunjaGlobalState extends State<VikunjaGlobal> {
|
|||
notifLaunch = await notificationsPlugin.getNotificationAppLaunchDetails();
|
||||
await notifications.initNotifications(notificationsPlugin);
|
||||
requestIOSPermissions(notificationsPlugin);
|
||||
|
||||
}
|
||||
|
||||
void scheduleDueNotifications() {
|
||||
notificationsPlugin.cancelAll().then((value) {
|
||||
taskService.getAll().then((value) =>
|
||||
taskService.getByOptions(taskServiceOptions).then((value) =>
|
||||
value.forEach((task) {
|
||||
if(task.reminderDates != null)
|
||||
task.reminderDates.forEach((reminder) {
|
||||
|
|
|
@ -23,7 +23,7 @@ class NotificationClass{
|
|||
|
||||
Future<void> initNotifications(notifs.FlutterLocalNotificationsPlugin notifsPlugin) async {
|
||||
var initializationSettingsAndroid =
|
||||
notifs.AndroidInitializationSettings('vikunja_logo');
|
||||
notifs.AndroidInitializationSettings('ic_launcher_foreground');
|
||||
var initializationSettingsIOS = notifs.IOSInitializationSettings(
|
||||
requestAlertPermission: false,
|
||||
requestBadgePermission: false,
|
||||
|
@ -55,7 +55,6 @@ Future<void> scheduleNotification(String title, String description,
|
|||
id = Random().nextInt(1000000);
|
||||
final String currentTimeZone = await FlutterNativeTimezone.getLocalTimezone();
|
||||
tz.TZDateTime time = tz.TZDateTime.from(scheduledTime,tz.getLocation(currentTimeZone));
|
||||
//time.add(Duration(hours: -2));
|
||||
await notifsPlugin.zonedSchedule(id, title, description,
|
||||
time, platformChannelSpecifics, androidAllowWhileIdle: true, uiLocalNotificationDateInterpretation: notifs.UILocalNotificationDateInterpretation.wallClockTime); // This literally schedules the notification
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user