mirror of
https://github.com/status-im/react-native.git
synced 2025-01-29 02:35:41 +00:00
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;
|
_notificationId: string;
|
||||||
_isRemote: boolean;
|
_isRemote: boolean;
|
||||||
_remoteNotificationCompleteCallbackCalled: boolean;
|
_remoteNotificationCompleteCallbackCalled: boolean;
|
||||||
|
_threadID: string;
|
||||||
|
|
||||||
static FetchResult: FetchResult = {
|
static FetchResult: FetchResult = {
|
||||||
NewData: 'UIBackgroundFetchResultNewData',
|
NewData: 'UIBackgroundFetchResultNewData',
|
||||||
@ -424,6 +425,7 @@ class PushNotificationIOS {
|
|||||||
this._badgeCount = notifVal.badge;
|
this._badgeCount = notifVal.badge;
|
||||||
this._category = notifVal.category;
|
this._category = notifVal.category;
|
||||||
this._contentAvailable = notifVal['content-available'];
|
this._contentAvailable = notifVal['content-available'];
|
||||||
|
this._threadID = notifVal['thread-id'];
|
||||||
} else {
|
} else {
|
||||||
this._data[notifKey] = notifVal;
|
this._data[notifKey] = notifVal;
|
||||||
}
|
}
|
||||||
@ -451,7 +453,7 @@ class PushNotificationIOS {
|
|||||||
* If you do not call this method your background remote notifications could
|
* If you do not call this method your background remote notifications could
|
||||||
* be throttled, to read more about it see the above documentation link.
|
* 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) {
|
if (!this._isRemote || !this._notificationId || this._remoteNotificationCompleteCallbackCalled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -509,6 +511,13 @@ class PushNotificationIOS {
|
|||||||
getData(): ?Object {
|
getData(): ?Object {
|
||||||
return this._data;
|
return this._data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the thread ID on the notif
|
||||||
|
*/
|
||||||
|
getThreadID(): ?string {
|
||||||
|
return this._threadID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = PushNotificationIOS;
|
module.exports = PushNotificationIOS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user