Skip to content

Commit

Permalink
Small fix on notification.
Browse files Browse the repository at this point in the history
  • Loading branch information
azchohfi committed Mar 28, 2022
1 parent d2f66e9 commit d363e5c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand All @@ -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());
}
Expand Down Expand Up @@ -899,11 +899,12 @@ class WindowsFlutterLocalNotificationsPlugin
'group': group,
});

Future<void> _onMethodCallFromNative(MethodCall call) async {
Future<void> _handleMethod(MethodCall call) async {
print('call $call');
switch (call.method) {
case 'selectNotification':
print('notification selected');
_onSelectNotification?.call(call.arguments);
break;
}
}
Expand Down
6 changes: 2 additions & 4 deletions flutter_local_notifications/windows/registration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#include <shlobj.h>
#include <propvarutil.h>
#include <propkey.h>
#include <atlbase.h>
#include <atlconv.h>
#include <NotificationActivationCallback.h>
#include <notificationactivationcallback.h>
#include <winrt/Windows.UI.Notifications.h>
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -251,7 +249,7 @@ void RegisterCallback(std::shared_ptr<PluginMethodChannel> channel) {
CALLBACK_GUID,
factory,
CLSCTX_LOCAL_SERVER,
REGCLS_SINGLEUSE,
REGCLS_MULTIPLEUSE,
&registration));
}

Expand Down

0 comments on commit d363e5c

Please sign in to comment.