Skip to content

Commit 1405cc1

Browse files
committed
notif: Ensure NotificationDisplayManager only supports Android
1 parent 27d5ce8 commit 1405cc1

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/notifications/display.dart

+7
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,12 @@ class NotificationChannelManager {
217217
/// Service for managing the notifications shown to the user.
218218
class NotificationDisplayManager {
219219
static Future<void> init() async {
220+
assert(defaultTargetPlatform == TargetPlatform.android);
220221
await NotificationChannelManager.ensureChannel();
221222
}
222223

223224
static void onFcmMessage(FcmMessage data, Map<String, dynamic> dataJson) {
225+
assert(defaultTargetPlatform == TargetPlatform.android);
224226
switch (data) {
225227
case MessageFcmMessage(): _onMessageFcmMessage(data, dataJson);
226228
case RemoveFcmMessage(): _onRemoveFcmMessage(data);
@@ -471,6 +473,8 @@ class NotificationDisplayManager {
471473
required BuildContext context,
472474
required Uri url,
473475
}) {
476+
assert(defaultTargetPlatform == TargetPlatform.android);
477+
474478
final globalStore = GlobalStoreWidget.of(context);
475479

476480
assert(debugLog('got notif: url: $url'));
@@ -499,6 +503,7 @@ class NotificationDisplayManager {
499503
/// generated with [NotificationOpenPayload.buildUrl] while creating
500504
/// the notification.
501505
static Future<void> navigateForNotification(Uri url) async {
506+
assert(defaultTargetPlatform == TargetPlatform.android);
502507
assert(debugLog('opened notif: url: $url'));
503508

504509
NavigatorState navigator = await ZulipApp.navigator;
@@ -527,6 +532,8 @@ class NotificationDisplayManager {
527532
}
528533

529534
static Future<void> removeNotificationsForAccount(Uri realmUri, int userId) async {
535+
assert(defaultTargetPlatform == TargetPlatform.android);
536+
530537
final groupKey = _groupKey(realmUri, userId);
531538
final activeNotifications = await _androidHost.getActiveNotifications(desiredExtras: [kExtraLastZulipMessageId]);
532539
for (final statusBarNotification in activeNotifications) {

0 commit comments

Comments
 (0)