Skip to content

Commit c28b1ac

Browse files
notif: Remove usages of package:flutter_local_notifications
1 parent b21756f commit c28b1ac

File tree

3 files changed

+0
-55
lines changed

3 files changed

+0
-55
lines changed

lib/model/binding.dart

-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import 'package:file_picker/file_picker.dart' as file_picker;
33
import 'package:firebase_core/firebase_core.dart' as firebase_core;
44
import 'package:firebase_messaging/firebase_messaging.dart' as firebase_messaging;
55
import 'package:flutter/foundation.dart';
6-
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
76
import 'package:image_picker/image_picker.dart' as image_picker;
87
import 'package:package_info_plus/package_info_plus.dart' as package_info_plus;
98
import 'package:url_launcher/url_launcher.dart' as url_launcher;
@@ -152,9 +151,6 @@ abstract class ZulipBinding {
152151
/// Wraps [firebase_messaging.FirebaseMessaging.onBackgroundMessage].
153152
void firebaseMessagingOnBackgroundMessage(firebase_messaging.BackgroundMessageHandler handler);
154153

155-
/// Wraps the [FlutterLocalNotificationsPlugin] singleton constructor.
156-
FlutterLocalNotificationsPlugin get notifications;
157-
158154
/// Wraps the [AndroidNotificationHostApi] constructor.
159155
AndroidNotificationHostApi get androidNotificationHost;
160156

@@ -406,9 +402,6 @@ class LiveZulipBinding extends ZulipBinding {
406402
firebase_messaging.FirebaseMessaging.onBackgroundMessage(handler);
407403
}
408404

409-
@override
410-
FlutterLocalNotificationsPlugin get notifications => FlutterLocalNotificationsPlugin();
411-
412405
@override
413406
AndroidNotificationHostApi get androidNotificationHost => AndroidNotificationHostApi();
414407

lib/notifications/display.dart

-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'package:collection/collection.dart';
66
import 'package:crypto/crypto.dart';
77
import 'package:flutter/foundation.dart';
88
import 'package:flutter/widgets.dart';
9-
import 'package:flutter_local_notifications/flutter_local_notifications.dart' hide Person;
109

1110
import '../api/notifications.dart';
1211
import '../host/android_notifications.dart';
@@ -68,11 +67,6 @@ class NotificationChannelManager {
6867
/// Service for managing the notifications shown to the user.
6968
class NotificationDisplayManager {
7069
static Future<void> init() async {
71-
await ZulipBinding.instance.notifications.initialize(
72-
const InitializationSettings(
73-
android: AndroidInitializationSettings('zulip_notification'),
74-
),
75-
);
7670
await NotificationChannelManager._ensureChannel();
7771
}
7872

test/model/binding.dart

-42
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import 'dart:async';
33
import 'package:firebase_core/firebase_core.dart';
44
import 'package:firebase_messaging/firebase_messaging.dart';
55
import 'package:flutter/foundation.dart';
6-
import 'package:flutter_local_notifications/flutter_local_notifications.dart' hide Person;
76
import 'package:test/fake.dart';
87
import 'package:url_launcher/url_launcher.dart' as url_launcher;
98
import 'package:zulip/host/android_notifications.dart';
@@ -269,17 +268,9 @@ class TestZulipBinding extends ZulipBinding {
269268
}
270269

271270
void _resetNotifications() {
272-
_notificationsPlugin = null;
273271
_androidNotificationHostApi = null;
274272
}
275273

276-
FakeFlutterLocalNotificationsPlugin? _notificationsPlugin;
277-
278-
@override
279-
FakeFlutterLocalNotificationsPlugin get notifications {
280-
return (_notificationsPlugin ??= FakeFlutterLocalNotificationsPlugin());
281-
}
282-
283274
FakeAndroidNotificationHostApi? _androidNotificationHostApi;
284275

285276
@override
@@ -494,39 +485,6 @@ typedef FirebaseMessagingRequestPermissionCall = ({
494485
bool sound,
495486
});
496487

497-
class FakeFlutterLocalNotificationsPlugin extends Fake implements FlutterLocalNotificationsPlugin {
498-
InitializationSettings? initializationSettings;
499-
DidReceiveNotificationResponseCallback? onDidReceiveNotificationResponse;
500-
DidReceiveBackgroundNotificationResponseCallback? onDidReceiveBackgroundNotificationResponse;
501-
502-
@override
503-
Future<bool?> initialize(
504-
InitializationSettings initializationSettings, {
505-
DidReceiveNotificationResponseCallback? onDidReceiveNotificationResponse,
506-
DidReceiveBackgroundNotificationResponseCallback? onDidReceiveBackgroundNotificationResponse,
507-
}) async {
508-
assert(this.initializationSettings == null);
509-
this.initializationSettings = initializationSettings;
510-
this.onDidReceiveNotificationResponse = onDidReceiveNotificationResponse;
511-
this.onDidReceiveBackgroundNotificationResponse = onDidReceiveBackgroundNotificationResponse;
512-
return true;
513-
}
514-
515-
/// The value to be returned by [getNotificationAppLaunchDetails].
516-
NotificationAppLaunchDetails? appLaunchDetails;
517-
518-
@override
519-
Future<NotificationAppLaunchDetails?> getNotificationAppLaunchDetails() {
520-
return Future.value(appLaunchDetails);
521-
}
522-
523-
void receiveNotificationResponse(NotificationResponse details) {
524-
if (onDidReceiveNotificationResponse != null) {
525-
onDidReceiveNotificationResponse!(details);
526-
}
527-
}
528-
}
529-
530488
class FakeAndroidNotificationHostApi implements AndroidNotificationHostApi {
531489
/// Consume the log of calls made to [createNotificationChannel].
532490
///

0 commit comments

Comments
 (0)