Skip to content

Commit

Permalink
notif: Implement NotificationService.unregisterToken
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbobbe committed Oct 17, 2024
1 parent ab9ce6d commit b4b9569
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/notifications/receive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,22 @@ class NotificationService {
}
}

static Future<void> unregisterToken(ApiConnection connection, {required String token}) async {
switch (defaultTargetPlatform) {
case TargetPlatform.android:
await removeFcmToken(connection, token: token);

case TargetPlatform.iOS:
await removeApnsToken(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);
Expand Down

0 comments on commit b4b9569

Please sign in to comment.