diff --git a/local-notifications/README.md b/local-notifications/README.md index b9256806c..c45739244 100644 --- a/local-notifications/README.md +++ b/local-notifications/README.md @@ -23,8 +23,8 @@ npx cap sync * [`listChannels()`](#listchannels) * [`checkPermissions()`](#checkpermissions) * [`requestPermissions()`](#requestpermissions) -* [`addListener('received', ...)`](#addlistenerreceived-) -* [`addListener('actionPerformed', ...)`](#addlisteneractionperformed-) +* [`addListener('localNotificationReceived', ...)`](#addlistenerlocalnotificationreceived-) +* [`addListener('localNotificationActionPerformed', ...)`](#addlistenerlocalnotificationactionperformed-) * [`removeAllListeners()`](#removealllisteners) * [Interfaces](#interfaces) * [Type Aliases](#type-aliases) @@ -204,17 +204,17 @@ Request permission to display local notifications. -------------------- -### addListener('received', ...) +### addListener('localNotificationReceived', ...) ```typescript -addListener(eventName: 'received', listenerFunc: (notification: LocalNotificationSchema) => void) => PluginListenerHandle +addListener(eventName: 'localNotificationReceived', listenerFunc: (notification: LocalNotificationSchema) => void) => PluginListenerHandle ``` Listen for when notifications are displayed. | Param | Type | | ------------------ | ------------------------------------------------------------------------------------------------------ | -| **`eventName`** | 'received' | +| **`eventName`** | 'localNotificationReceived' | | **`listenerFunc`** | (notification: LocalNotificationSchema) => void | **Returns:** PluginListenerHandle @@ -224,17 +224,17 @@ Listen for when notifications are displayed. -------------------- -### addListener('actionPerformed', ...) +### addListener('localNotificationActionPerformed', ...) ```typescript -addListener(eventName: 'actionPerformed', listenerFunc: (notificationAction: ActionPerformed) => void) => PluginListenerHandle +addListener(eventName: 'localNotificationActionPerformed', listenerFunc: (notificationAction: ActionPerformed) => void) => PluginListenerHandle ``` Listen for when an action is performed on a notification. | Param | Type | | ------------------ | -------------------------------------------------------------------------------------------- | -| **`eventName`** | 'actionPerformed' | +| **`eventName`** | 'localNotificationActionPerformed' | | **`listenerFunc`** | (notificationAction: ActionPerformed) => void | **Returns:** PluginListenerHandle diff --git a/local-notifications/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationsPlugin.java b/local-notifications/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationsPlugin.java index 2983c99bc..8936c5d93 100644 --- a/local-notifications/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationsPlugin.java +++ b/local-notifications/android/src/main/java/com/capacitorjs/plugins/localnotifications/LocalNotificationsPlugin.java @@ -36,7 +36,7 @@ protected void handleOnNewIntent(Intent data) { } JSObject dataJson = manager.handleNotificationActionPerformed(data, notificationStorage); if (dataJson != null) { - notifyListeners("actionPerformed", dataJson, true); + notifyListeners("localNotificationActionPerformed", dataJson, true); } } diff --git a/local-notifications/ios/Plugin/LocalNotificationsHandler.swift b/local-notifications/ios/Plugin/LocalNotificationsHandler.swift index 427a5d5bf..dd42743f4 100644 --- a/local-notifications/ios/Plugin/LocalNotificationsHandler.swift +++ b/local-notifications/ios/Plugin/LocalNotificationsHandler.swift @@ -26,7 +26,7 @@ public class LocalNotificationsHandler: NSObject, NotificationHandlerProtocol { public func willPresent(notification: UNNotification) -> UNNotificationPresentationOptions { let notificationData = makeNotificationRequestJSObject(notification.request) - self.plugin?.notifyListeners("received", data: notificationData) + self.plugin?.notifyListeners("localNotificationReceived", data: notificationData) if let options = notificationRequestLookup[notification.request.identifier] { let silent = options["silent"] as? Bool ?? false @@ -66,7 +66,7 @@ public class LocalNotificationsHandler: NSObject, NotificationHandlerProtocol { data["notification"] = makeNotificationRequestJSObject(originalNotificationRequest) - self.plugin?.notifyListeners("actionPerformed", data: data, retainUntilConsumed: true) + self.plugin?.notifyListeners("localNotificationActionPerformed", data: data, retainUntilConsumed: true) } /** diff --git a/local-notifications/src/definitions.ts b/local-notifications/src/definitions.ts index 606a488ce..3f9fe329f 100644 --- a/local-notifications/src/definitions.ts +++ b/local-notifications/src/definitions.ts @@ -129,7 +129,7 @@ export interface LocalNotificationsPlugin { * @since 1.0.0 */ addListener( - eventName: 'received', + eventName: 'localNotificationReceived', listenerFunc: (notification: LocalNotificationSchema) => void, ): PluginListenerHandle; @@ -139,7 +139,7 @@ export interface LocalNotificationsPlugin { * @since 1.0.0 */ addListener( - eventName: 'actionPerformed', + eventName: 'localNotificationActionPerformed', listenerFunc: (notificationAction: ActionPerformed) => void, ): PluginListenerHandle;