diff --git a/flutter_local_notifications/lib/src/platform_flutter_local_notifications.dart b/flutter_local_notifications/lib/src/platform_flutter_local_notifications.dart index a73eb0b1e..7347b8675 100644 --- a/flutter_local_notifications/lib/src/platform_flutter_local_notifications.dart +++ b/flutter_local_notifications/lib/src/platform_flutter_local_notifications.dart @@ -855,7 +855,7 @@ class MacOSFlutterLocalNotificationsPlugin /// Windows implementation of the flutter_local_notifications plugin. class WindowsFlutterLocalNotificationsPlugin extends MethodChannelFlutterLocalNotificationsPlugin { - SelectNotificationCallback? onSelectNotification; + SelectNotificationCallback? _onSelectNotification; /// Initializes the plugin. /// @@ -870,8 +870,8 @@ class WindowsFlutterLocalNotificationsPlugin WindowsInitializationSettings settings, { SelectNotificationCallback? onSelectNotification, }) { - this.onSelectNotification = onSelectNotification; - _channel.setMethodCallHandler(_onMethodCallFromNative); + this._onSelectNotification = onSelectNotification; + _channel.setMethodCallHandler(_handleMethod); return _channel.invokeMethod('initialize', settings.toMap()); } @@ -899,11 +899,12 @@ class WindowsFlutterLocalNotificationsPlugin 'group': group, }); - Future _onMethodCallFromNative(MethodCall call) async { + Future _handleMethod(MethodCall call) async { print('call $call'); switch (call.method) { case 'selectNotification': print('notification selected'); + _onSelectNotification?.call(call.arguments); break; } } diff --git a/flutter_local_notifications/windows/registration.cpp b/flutter_local_notifications/windows/registration.cpp index 62a4301a2..59171d439 100644 --- a/flutter_local_notifications/windows/registration.cpp +++ b/flutter_local_notifications/windows/registration.cpp @@ -9,8 +9,6 @@ #include #include #include -#include -#include #include #include #include @@ -131,7 +129,7 @@ void UpdateRegistry( RegistryKey key; // create registry key - // HKEY_CURRENT_USER\Software\Microsoft\\Windows\CurrentVersion\PushNotifications\Backup + // HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\PushNotifications\Backup winrt::check_win32(RegCreateKeyExA( HKEY_CURRENT_USER, notifSettingsKeyPath.c_str(), @@ -251,7 +249,7 @@ void RegisterCallback(std::shared_ptr channel) { CALLBACK_GUID, factory, CLSCTX_LOCAL_SERVER, - REGCLS_SINGLEUSE, + REGCLS_MULTIPLEUSE, ®istration)); }