From 7b9269fec5c18714a09d3e4430366670d21375df Mon Sep 17 00:00:00 2001 From: Chris Bianca Date: Tue, 6 Mar 2018 18:20:49 +0000 Subject: [PATCH] [notifications] Rename `onNotificationOpened` to `onNotificationOpen` --- .../notifications/RNFirebaseNotifications.java | 18 +++++++++--------- lib/modules/notifications/Notification.js | 2 +- lib/modules/notifications/index.js | 14 +++++++------- lib/modules/notifications/types.js | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotifications.java b/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotifications.java index dad5af46..2e9de173 100644 --- a/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotifications.java +++ b/android/src/main/java/io/invertase/firebase/notifications/RNFirebaseNotifications.java @@ -90,8 +90,8 @@ public class RNFirebaseNotifications extends ReactContextBaseJavaModule implemen if (getCurrentActivity() == null) { promise.resolve(null); } else { - WritableMap notificationOpenedMap = parseIntentForRemoteNotification(getCurrentActivity().getIntent()); - promise.resolve(notificationOpenedMap); + WritableMap notificationOpenMap = parseIntentForRemoteNotification(getCurrentActivity().getIntent()); + promise.resolve(notificationOpenMap); } } @@ -173,10 +173,10 @@ public class RNFirebaseNotifications extends ReactContextBaseJavaModule implemen @Override public void onNewIntent(Intent intent) { - WritableMap notificationOpenedMap = parseIntentForRemoteNotification(intent); - if (notificationOpenedMap != null) { + WritableMap notificationOpenMap = parseIntentForRemoteNotification(intent); + if (notificationOpenMap != null) { Log.d(TAG, "onNewIntent called with new remote notification"); - Utils.sendEvent(getReactApplicationContext(), "notifications_notification_opened", notificationOpenedMap); + Utils.sendEvent(getReactApplicationContext(), "notifications_notification_opened", notificationOpenMap); } } ////////////////////////////////////////////////////////////////////// @@ -231,11 +231,11 @@ public class RNFirebaseNotifications extends ReactContextBaseJavaModule implemen } notificationMap.putMap("data", dataMap); - WritableMap notificationOpenedMap = Arguments.createMap(); - notificationOpenedMap.putString("action", intent.getAction()); - notificationOpenedMap.putMap("notification", notificationMap); + WritableMap notificationOpenMap = Arguments.createMap(); + notificationOpenMap.putString("action", intent.getAction()); + notificationOpenMap.putMap("notification", notificationMap); - return notificationOpenedMap; + return notificationOpenMap; } private WritableMap parseNotificationBundle(Bundle notification) { diff --git a/lib/modules/notifications/Notification.js b/lib/modules/notifications/Notification.js index ad38e9e1..37ccb2bc 100644 --- a/lib/modules/notifications/Notification.js +++ b/lib/modules/notifications/Notification.js @@ -9,7 +9,7 @@ import { generatePushID, isObject } from '../../utils'; import type { NativeNotification } from './types'; -export type NotificationOpened = { +export type NotificationOpen = { action: string, notification: Notification, }; diff --git a/lib/modules/notifications/index.js b/lib/modules/notifications/index.js index 649831a9..3f862a31 100644 --- a/lib/modules/notifications/index.js +++ b/lib/modules/notifications/index.js @@ -22,10 +22,10 @@ import { } from './types'; import type App from '../core/app'; -import type { NotificationOpened } from './Notification'; +import type { NotificationOpen } from './Notification'; import type { NativeNotification, - NativeNotificationOpened, + NativeNotificationOpen, Schedule, } from './types'; @@ -35,10 +35,10 @@ type OnNotificationObserver = { next: OnNotification, }; -type OnNotificationOpened = NotificationOpened => any; +type OnNotificationOpened = NotificationOpen => any; type OnNotificationOpenedObserver = { - next: OnNotificationOpened, + next: OnNotificationOpen, }; const NATIVE_EVENTS = [ @@ -95,10 +95,10 @@ export default class Notifications extends ModuleBase { // sub to internal native event - this fans out to // public event name: onNotificationOpened 'notifications_notification_opened', - (notificationOpened: NativeNotificationOpened) => { + (notificationOpen: NativeNotificationOpen) => { SharedEventEmitter.emit('onNotificationOpened', { - action: notificationOpened.action, - notification: new Notification(notificationOpened.notification), + action: notificationOpen.action, + notification: new Notification(notificationOpen.notification), }); } ); diff --git a/lib/modules/notifications/types.js b/lib/modules/notifications/types.js index a9c9f107..5a77c74a 100644 --- a/lib/modules/notifications/types.js +++ b/lib/modules/notifications/types.js @@ -172,7 +172,7 @@ export type NativeNotification = {| title: string, |}; -export type NativeNotificationOpened = {| +export type NativeNotificationOpen = {| action: string, notification: NativeNotification, |};