diff --git a/lib/notifications/receive.dart b/lib/notifications/receive.dart index 740f3ad09e..94a5ed870c 100644 --- a/lib/notifications/receive.dart +++ b/lib/notifications/receive.dart @@ -159,6 +159,22 @@ class NotificationService { } } + static Future unregisterToken(ApiConnection connection, {required String token}) async { + switch (defaultTargetPlatform) { + case TargetPlatform.android: + await unregisterFcmToken(connection, token: token); + + case TargetPlatform.iOS: + await unregisterApnsToken(connection, token: token); + + case TargetPlatform.linux: + case TargetPlatform.macOS: + case TargetPlatform.windows: + case TargetPlatform.fuchsia: + assert(false); + } + } + static void _onForegroundMessage(FirebaseRemoteMessage message) { assert(debugLog("notif message: ${message.data}")); _onRemoteMessage(message);