Skip to content

Commit

Permalink
notif [nfc]: Remove unused FlutterLocalNotificationsPlugin bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
rajveermalviya committed Oct 18, 2024
1 parent 5c4af29 commit aecd320
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 49 deletions.
7 changes: 0 additions & 7 deletions lib/model/binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:file_picker/file_picker.dart' as file_picker;
import 'package:firebase_core/firebase_core.dart' as firebase_core;
import 'package:firebase_messaging/firebase_messaging.dart' as firebase_messaging;
import 'package:flutter/foundation.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:image_picker/image_picker.dart' as image_picker;
import 'package:package_info_plus/package_info_plus.dart' as package_info_plus;
import 'package:url_launcher/url_launcher.dart' as url_launcher;
Expand Down Expand Up @@ -161,9 +160,6 @@ abstract class ZulipBinding {
/// Wraps [firebase_messaging.FirebaseMessaging.onBackgroundMessage].
void firebaseMessagingOnBackgroundMessage(firebase_messaging.BackgroundMessageHandler handler);

/// Wraps the [FlutterLocalNotificationsPlugin] singleton constructor.
FlutterLocalNotificationsPlugin get notifications;

/// Wraps the [AndroidNotificationHostApi] constructor.
AndroidNotificationHostApi get androidNotificationHost;

Expand Down Expand Up @@ -435,9 +431,6 @@ class LiveZulipBinding extends ZulipBinding {
firebase_messaging.FirebaseMessaging.onBackgroundMessage(handler);
}

@override
FlutterLocalNotificationsPlugin get notifications => FlutterLocalNotificationsPlugin();

@override
AndroidNotificationHostApi get androidNotificationHost => AndroidNotificationHostApi();

Expand Down
42 changes: 0 additions & 42 deletions test/model/binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'dart:async';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart' hide Person;
import 'package:test/fake.dart';
import 'package:url_launcher/url_launcher.dart' as url_launcher;
import 'package:zulip/host/android_notifications.dart';
Expand Down Expand Up @@ -273,17 +272,9 @@ class TestZulipBinding extends ZulipBinding {
}

void _resetNotifications() {
_notificationsPlugin = null;
_androidNotificationHostApi = null;
}

FakeFlutterLocalNotificationsPlugin? _notificationsPlugin;

@override
FakeFlutterLocalNotificationsPlugin get notifications {
return (_notificationsPlugin ??= FakeFlutterLocalNotificationsPlugin());
}

FakeAndroidNotificationHostApi? _androidNotificationHostApi;

@override
Expand Down Expand Up @@ -512,39 +503,6 @@ typedef FirebaseMessagingRequestPermissionCall = ({
bool sound,
});

class FakeFlutterLocalNotificationsPlugin extends Fake implements FlutterLocalNotificationsPlugin {
InitializationSettings? initializationSettings;
DidReceiveNotificationResponseCallback? onDidReceiveNotificationResponse;
DidReceiveBackgroundNotificationResponseCallback? onDidReceiveBackgroundNotificationResponse;

@override
Future<bool?> initialize(
InitializationSettings initializationSettings, {
DidReceiveNotificationResponseCallback? onDidReceiveNotificationResponse,
DidReceiveBackgroundNotificationResponseCallback? onDidReceiveBackgroundNotificationResponse,
}) async {
assert(this.initializationSettings == null);
this.initializationSettings = initializationSettings;
this.onDidReceiveNotificationResponse = onDidReceiveNotificationResponse;
this.onDidReceiveBackgroundNotificationResponse = onDidReceiveBackgroundNotificationResponse;
return true;
}

/// The value to be returned by [getNotificationAppLaunchDetails].
NotificationAppLaunchDetails? appLaunchDetails;

@override
Future<NotificationAppLaunchDetails?> getNotificationAppLaunchDetails() {
return Future.value(appLaunchDetails);
}

void receiveNotificationResponse(NotificationResponse details) {
if (onDidReceiveNotificationResponse != null) {
onDidReceiveNotificationResponse!(details);
}
}
}

class FakeAndroidNotificationHostApi implements AndroidNotificationHostApi {
/// Lists currently active channels, result is aggregated from calls made to
/// [createNotificationChannel] and [deleteNotificationChannel],
Expand Down

0 comments on commit aecd320

Please sign in to comment.