Skip to content

Commit b4b2f86

Browse files
committed
add category property for iOS remote notification
1 parent 8a2a241 commit b4b2f86

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

index.ios.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ declare class IOSNotification {
9494
private _alert: string | IOSNotification.IOSAlert;
9595
private _sound: string;
9696
private _badgeCount: number;
97+
private _category: string;
9798

9899
static presentLocalNotification(details: IOSNotification.LocalNotification): void;
99100
static scheduleLocalNotification(details: IOSNotification.FutureLocalNotification): void;
@@ -126,6 +127,7 @@ declare class IOSNotification {
126127
public getMessage(): string | IOSNotification.IOSAlert;
127128
public getSound(): string;
128129
public getBadgeCount(): number;
130+
public getCategory(): string;
129131
public getData(): any;
130132
}
131133

ios/AzureNotificationHubIOS.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ class AzureNotificationHubIOS {
124124
_alert: string | Object;
125125
_sound: string;
126126
_badgeCount: number;
127+
_category: string;
127128

128129
/**
129130
* Schedules the localNotification for immediate presentation.
@@ -216,7 +217,7 @@ class AzureNotificationHubIOS {
216217
*/
217218
static addEventListener(type: PushNotificationEventName, handler: Function) {
218219
invariant(
219-
type === 'notification' || type === 'register' || type === 'registrationError' ||
220+
type === 'notification' || type === 'register' || type === 'registrationError' ||
220221
type === 'registerAzureNotificationHub' || type === 'azureNotificationHubRegistrationError' || type === 'localNotification',
221222
'AzureNotificationHubIOS only supports `notification`, `register`, `registrationError`, `registerAzureNotificationHub`, `azureNotificationHubRegistrationError` and `localNotification` events'
222223
);
@@ -273,7 +274,7 @@ class AzureNotificationHubIOS {
273274
*/
274275
static removeEventListener(type: PushNotificationEventName, handler: Function) {
275276
invariant(
276-
type === 'notification' || type === 'register' || type === 'registrationError' ||
277+
type === 'notification' || type === 'register' || type === 'registrationError' ||
277278
type === 'registerAzureNotificationHub' || type === 'azureNotificationHubRegistrationError' || type === 'localNotification',
278279
'AzureNotificationHubIOS only supports `notification`, `register`, `registrationError`, `registerAzureNotificationHub`, `azureNotificationHubRegistrationError` and `localNotification` events'
279280
);
@@ -400,6 +401,7 @@ class AzureNotificationHubIOS {
400401
this._alert = notifVal.alert;
401402
this._sound = notifVal.sound;
402403
this._badgeCount = notifVal.badge;
404+
this._category = notifVal.category;
403405
} else {
404406
this._data[notifKey] = notifVal;
405407
}
@@ -442,6 +444,13 @@ class AzureNotificationHubIOS {
442444
return this._badgeCount;
443445
}
444446

447+
/**
448+
* Gets the category from the `aps` object
449+
*/
450+
getCategory(): ?string {
451+
return this._category;
452+
}
453+
445454
/**
446455
* Gets the data object on the notif
447456
*/

0 commit comments

Comments
 (0)