Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(local-notifications): Use the old event names #215

Merged
merged 2 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
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
16 changes: 8 additions & 8 deletions local-notifications/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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`** | <code>'received'</code> |
| **`eventName`** | <code>'localNotificationReceived'</code> |
| **`listenerFunc`** | <code>(notification: <a href="#localnotificationschema">LocalNotificationSchema</a>) =&gt; void</code> |

**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
Expand All @@ -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`** | <code>'actionPerformed'</code> |
| **`eventName`** | <code>'localNotificationActionPerformed'</code> |
| **`listenerFunc`** | <code>(notificationAction: <a href="#actionperformed">ActionPerformed</a>) =&gt; void</code> |

**Returns:** <code><a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

/**
Expand Down
4 changes: 2 additions & 2 deletions local-notifications/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export interface LocalNotificationsPlugin {
* @since 1.0.0
*/
addListener(
eventName: 'received',
eventName: 'localNotificationReceived',
listenerFunc: (notification: LocalNotificationSchema) => void,
): PluginListenerHandle;

Expand All @@ -139,7 +139,7 @@ export interface LocalNotificationsPlugin {
* @since 1.0.0
*/
addListener(
eventName: 'actionPerformed',
eventName: 'localNotificationActionPerformed',
listenerFunc: (notificationAction: ActionPerformed) => void,
): PluginListenerHandle;

Expand Down