simplified code across the app and consolidated duplicated helpers
This commit is contained in:
@@ -15,7 +15,7 @@ import '../widget/info_dialog.dart';
|
||||
import 'notification_tasks.dart';
|
||||
|
||||
/// Bridges FCM lifecycle callbacks to the push pipeline. Background messages are
|
||||
/// handled directly by [PushMessageHandler.onBackgroundMessage]; this class
|
||||
/// handled directly by `pushOnBackgroundMessage`; this class
|
||||
/// covers the foreground and app-opened paths where a [BuildContext] is
|
||||
/// available.
|
||||
class NotificationController {
|
||||
|
||||
@@ -27,17 +27,13 @@ class NotificationTasks {
|
||||
}
|
||||
}
|
||||
|
||||
/// Per-chat tag scheme — canonical definition lives beside the stacked
|
||||
/// notification id in chat_thread_store.dart.
|
||||
static String chatTag(String chatToken) => chatNotificationTag(chatToken);
|
||||
|
||||
/// Removes tray notifications belonging to [chatToken]. Eraser handles
|
||||
/// iOS (where the plugin's `getActiveNotifications` returns null ids
|
||||
/// for FCM posts and can't cancel them); the local-notifications sweep
|
||||
/// handles Android and acts as a fallback while Eraser's native side
|
||||
/// isn't built in yet.
|
||||
static Future<void> clearNotificationsForChat(String chatToken) async {
|
||||
final tag = chatTag(chatToken);
|
||||
final tag = chatNotificationTag(chatToken);
|
||||
try {
|
||||
await Eraser.clearAppNotificationsByTag(tag);
|
||||
} on MissingPluginException {
|
||||
|
||||
Reference in New Issue
Block a user