2
0
mirror of synced 2025-02-09 13:03:24 +00:00

[notifications] Rename onNotificationOpened to onNotificationOpen

This commit is contained in:
Chris Bianca 2018-03-06 18:20:49 +00:00
parent b9df258402
commit 7b9269fec5
4 changed files with 18 additions and 18 deletions

View File

@ -90,8 +90,8 @@ public class RNFirebaseNotifications extends ReactContextBaseJavaModule implemen
if (getCurrentActivity() == null) { if (getCurrentActivity() == null) {
promise.resolve(null); promise.resolve(null);
} else { } else {
WritableMap notificationOpenedMap = parseIntentForRemoteNotification(getCurrentActivity().getIntent()); WritableMap notificationOpenMap = parseIntentForRemoteNotification(getCurrentActivity().getIntent());
promise.resolve(notificationOpenedMap); promise.resolve(notificationOpenMap);
} }
} }
@ -173,10 +173,10 @@ public class RNFirebaseNotifications extends ReactContextBaseJavaModule implemen
@Override @Override
public void onNewIntent(Intent intent) { public void onNewIntent(Intent intent) {
WritableMap notificationOpenedMap = parseIntentForRemoteNotification(intent); WritableMap notificationOpenMap = parseIntentForRemoteNotification(intent);
if (notificationOpenedMap != null) { if (notificationOpenMap != null) {
Log.d(TAG, "onNewIntent called with new remote notification"); 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); notificationMap.putMap("data", dataMap);
WritableMap notificationOpenedMap = Arguments.createMap(); WritableMap notificationOpenMap = Arguments.createMap();
notificationOpenedMap.putString("action", intent.getAction()); notificationOpenMap.putString("action", intent.getAction());
notificationOpenedMap.putMap("notification", notificationMap); notificationOpenMap.putMap("notification", notificationMap);
return notificationOpenedMap; return notificationOpenMap;
} }
private WritableMap parseNotificationBundle(Bundle notification) { private WritableMap parseNotificationBundle(Bundle notification) {

View File

@ -9,7 +9,7 @@ import { generatePushID, isObject } from '../../utils';
import type { NativeNotification } from './types'; import type { NativeNotification } from './types';
export type NotificationOpened = { export type NotificationOpen = {
action: string, action: string,
notification: Notification, notification: Notification,
}; };

View File

@ -22,10 +22,10 @@ import {
} from './types'; } from './types';
import type App from '../core/app'; import type App from '../core/app';
import type { NotificationOpened } from './Notification'; import type { NotificationOpen } from './Notification';
import type { import type {
NativeNotification, NativeNotification,
NativeNotificationOpened, NativeNotificationOpen,
Schedule, Schedule,
} from './types'; } from './types';
@ -35,10 +35,10 @@ type OnNotificationObserver = {
next: OnNotification, next: OnNotification,
}; };
type OnNotificationOpened = NotificationOpened => any; type OnNotificationOpened = NotificationOpen => any;
type OnNotificationOpenedObserver = { type OnNotificationOpenedObserver = {
next: OnNotificationOpened, next: OnNotificationOpen,
}; };
const NATIVE_EVENTS = [ const NATIVE_EVENTS = [
@ -95,10 +95,10 @@ export default class Notifications extends ModuleBase {
// sub to internal native event - this fans out to // sub to internal native event - this fans out to
// public event name: onNotificationOpened // public event name: onNotificationOpened
'notifications_notification_opened', 'notifications_notification_opened',
(notificationOpened: NativeNotificationOpened) => { (notificationOpen: NativeNotificationOpen) => {
SharedEventEmitter.emit('onNotificationOpened', { SharedEventEmitter.emit('onNotificationOpened', {
action: notificationOpened.action, action: notificationOpen.action,
notification: new Notification(notificationOpened.notification), notification: new Notification(notificationOpen.notification),
}); });
} }
); );

View File

@ -172,7 +172,7 @@ export type NativeNotification = {|
title: string, title: string,
|}; |};
export type NativeNotificationOpened = {| export type NativeNotificationOpen = {|
action: string, action: string,
notification: NativeNotification, notification: NativeNotification,
|}; |};