Skip to content

Commit 6a6f145

Browse files
committed
notif: Implement NotificationService.unregisterToken
1 parent d647114 commit 6a6f145

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/notifications/receive.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,22 @@ class NotificationService {
159159
}
160160
}
161161

162+
static Future<void> unregisterToken(ApiConnection connection, {required String token}) async {
163+
switch (defaultTargetPlatform) {
164+
case TargetPlatform.android:
165+
await removeFcmToken(connection, token: token);
166+
167+
case TargetPlatform.iOS:
168+
await removeApnsToken(connection, token: token);
169+
170+
case TargetPlatform.linux:
171+
case TargetPlatform.macOS:
172+
case TargetPlatform.windows:
173+
case TargetPlatform.fuchsia:
174+
assert(false);
175+
}
176+
}
177+
162178
static void _onForegroundMessage(FirebaseRemoteMessage message) {
163179
assert(debugLog("notif message: ${message.data}"));
164180
_onRemoteMessage(message);

0 commit comments

Comments
 (0)