Add support for "thread-id" in PushNotificationIOS
Summary: `thread-id` is an Apple-defined key. `PushNotificationIOS.getDeliveredNotifications()` includes it, but the notification object currently ignores it. Since it's in the `aps` key, it's impossible to access without this change, as `getData()` does not include it. Closes https://github.com/facebook/react-native/pull/17499 Differential Revision: D6696577 Pulled By: shergin fbshipit-source-id: e0f48efd640bf5addb24a8d4352f9bb23f42612a
This commit is contained in:
parent
c249e52096
commit
a8f429d3a8
|
@ -129,6 +129,7 @@ class PushNotificationIOS {
|
|||
_notificationId: string;
|
||||
_isRemote: boolean;
|
||||
_remoteNotificationCompleteCallbackCalled: boolean;
|
||||
_threadID: string;
|
||||
|
||||
static FetchResult: FetchResult = {
|
||||
NewData: 'UIBackgroundFetchResultNewData',
|
||||
|
@ -424,6 +425,7 @@ class PushNotificationIOS {
|
|||
this._badgeCount = notifVal.badge;
|
||||
this._category = notifVal.category;
|
||||
this._contentAvailable = notifVal['content-available'];
|
||||
this._threadID = notifVal['thread-id'];
|
||||
} else {
|
||||
this._data[notifKey] = notifVal;
|
||||
}
|
||||
|
@ -451,7 +453,7 @@ class PushNotificationIOS {
|
|||
* If you do not call this method your background remote notifications could
|
||||
* be throttled, to read more about it see the above documentation link.
|
||||
*/
|
||||
finish(fetchResult: FetchResult) {
|
||||
finish(fetchResult: string) {
|
||||
if (!this._isRemote || !this._notificationId || this._remoteNotificationCompleteCallbackCalled) {
|
||||
return;
|
||||
}
|
||||
|
@ -509,6 +511,13 @@ class PushNotificationIOS {
|
|||
getData(): ?Object {
|
||||
return this._data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the thread ID on the notif
|
||||
*/
|
||||
getThreadID(): ?string {
|
||||
return this._threadID;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = PushNotificationIOS;
|
||||
|
|
Loading…
Reference in New Issue