Watch
1
0
Fork
You've already forked nexus
0
forked from Nexus/nexus

smarter notif logic

This commit is contained in:
Henry Hiles 2026-08-26 11:55:20 -04:00
commit 0122feae1d
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
2 changed files with 47 additions and 24 deletions

View file

@ -1,9 +1,11 @@
import "dart:convert";
import "dart:io";
import "package:flutter_local_notifications/flutter_local_notifications.dart";
// ignore: implementation_imports
import "package:flutter_local_notifications_linux/src/model/hint.dart";
import "package:flutter_riverpod/flutter_riverpod.dart";
import "package:nexus/controllers/event.dart";
class NotificationsController
extends AsyncNotifier<FlutterLocalNotificationsPlugin> {
@ -26,7 +28,11 @@ class NotificationsController
linux: .new(defaultActionName: "Open"),
),
onDidReceiveNotificationResponse: (details) {
print(details.data);
if (details.payload case final payload?) {
final event = ref.watch(
EventController.provider(.fromJson(json.decode(payload))),
);
}
},
);
@ -75,8 +81,6 @@ class NotificationsController
"Messages",
largeIcon: icon == null ? null : FilePathAndroidBitmap(icon.path),
),
iOS: .new(),
macOS: .new(),
linux: .new(
customHints: icon == null
? null
@ -87,6 +91,9 @@ class NotificationsController
),
],
),
// TODO: See if icons can be added to iOS, macOS, and Windows notifications (#68)
iOS: .new(),
macOS: .new(),
windows: .new(),
);