Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,22 @@ public class FlutterLocalNotificationsPlugin: NSObject, FlutterPlugin, UNUserNot
var launchingAppFromNotification = false
let presentationOptionsUserDefaults = "flutter_local_notifications_presentation_options"

static var registered = false;

// MARK: - FlutterPlugin initialization and registration

init(fromChannel channel: FlutterMethodChannel) {
self.channel = channel
}

public static func register(with registrar: FlutterPluginRegistrar) {
if (registered) {
return;
}
registered = true;
// Above is a hacky workaround to prevent attempting to register (and replacing) the notification
// center delegate multiple times.

let channel = FlutterMethodChannel(name: "dexterous.com/flutter/local_notifications", binaryMessenger: registrar.messenger)
let instance = FlutterLocalNotificationsPlugin.init(fromChannel: channel)
if #available(macOS 10.14, *) {
Expand Down