From 9255b4be109cbca7c9070fa0adceb2f3606e61d7 Mon Sep 17 00:00:00 2001 From: Chris Bianca Date: Fri, 16 Feb 2018 09:46:53 +0000 Subject: [PATCH] [notifications] Minor fixes --- ios/RNFirebase/notifications/RNFirebaseNotifications.m | 3 ++- lib/modules/notifications/Notification.js | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ios/RNFirebase/notifications/RNFirebaseNotifications.m b/ios/RNFirebase/notifications/RNFirebaseNotifications.m index 12456a63..58f0fee4 100644 --- a/ios/RNFirebase/notifications/RNFirebaseNotifications.m +++ b/ios/RNFirebase/notifications/RNFirebaseNotifications.m @@ -1,6 +1,7 @@ #import "RNFirebaseNotifications.h" #if __has_include() +#import "RNFirebaseEvents.h" #import #if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 @@ -372,7 +373,7 @@ RCT_EXPORT_METHOD(scheduleNotification:(NSDictionary*) notification } - (NSArray *)supportedEvents { - return @[]; + return @[NOTIFICATIONS_NOTIFICATION_RECEIVED]; } + (BOOL)requiresMainQueueSetup diff --git a/lib/modules/notifications/Notification.js b/lib/modules/notifications/Notification.js index 88389505..bcaae87b 100644 --- a/lib/modules/notifications/Notification.js +++ b/lib/modules/notifications/Notification.js @@ -2,6 +2,7 @@ * @flow * Notification representation wrapper */ +import { Platform } from 'react-native'; import AndroidNotification from './AndroidNotification'; import IOSNotification from './IOSNotification'; import { generatePushID, isObject } from '../../utils'; @@ -11,10 +12,10 @@ import type { NativeIOSNotification } from './IOSNotification'; import type { Schedule } from './'; type NativeNotification = {| - android: NativeAndroidNotification, + android?: NativeAndroidNotification, body: string, data: { [string]: string }, - ios: NativeIOSNotification, + ios?: NativeIOSNotification, notificationId: string, schedule?: Schedule, sound?: string, @@ -128,10 +129,10 @@ export default class Notification { } return { - android: this._android.build(), + android: Platform.OS === 'android' ? this._android.build() : undefined, body: this._body, data: this._data, - ios: this._ios.build(), + ios: Platform.OS === 'ios' ? this._ios.build() : undefined, notificationId: this._notificationId, sound: this._sound, subtitle: this._subtitle,