Skip to content

Commit ba3cac6

Browse files
cmcewenmng12689
authored andcommitted
Add repeatInterval to PushNotificationIOS
Summary: This just cleans up the work done in facebook#7219 by adamterlson based on grabbou's feedback Closes facebook#10337 Differential Revision: D4001540 Pulled By: javache fbshipit-source-id: c73b5fef912fa71d1d988dae41094c9c46dc610b
1 parent 2519010 commit ba3cac6

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

Libraries/PushNotificationIOS/PushNotificationIOS.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ class PushNotificationIOS {
135135
* - `category` : The category of this notification, required for actionable notifications (optional).
136136
* - `userInfo` : An optional object containing additional notification data.
137137
* - `applicationIconBadgeNumber` (optional) : The number to display as the app's icon badge. Setting the number to 0 removes the icon badge.
138+
* - `repeatInterval` : The interval to repeat as a string. Possible values: `minute`, `hour`, `day`, `week`, `month`, `year`.
138139
*/
139140
static scheduleLocalNotification(details: Object) {
140141
RCTPushNotificationManager.scheduleLocalNotification(details);

Libraries/PushNotificationIOS/RCTPushNotificationManager.m

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,22 @@
2222
NSString *const RCTErrorUnableToRequestPermissions = @"E_UNABLE_TO_REQUEST_PERMISSIONS";
2323
NSString *const RCTErrorRemoteNotificationRegistrationFailed = @"E_FAILED_TO_REGISTER_FOR_REMOTE_NOTIFICATIONS";
2424

25+
@implementation RCTConvert (NSCalendarUnit)
26+
27+
RCT_ENUM_CONVERTER(NSCalendarUnit,
28+
(@{
29+
@"year": @(NSCalendarUnitYear),
30+
@"month": @(NSCalendarUnitMonth),
31+
@"week": @(NSCalendarUnitWeekOfYear),
32+
@"day": @(NSCalendarUnitDay),
33+
@"hour": @(NSCalendarUnitHour),
34+
@"minute": @(NSCalendarUnitMinute)
35+
}),
36+
0,
37+
integerValue)
38+
39+
@end
40+
2541
@implementation RCTConvert (UILocalNotification)
2642

2743
+ (UILocalNotification *)UILocalNotification:(id)json
@@ -34,6 +50,7 @@ + (UILocalNotification *)UILocalNotification:(id)json
3450
notification.soundName = [RCTConvert NSString:details[@"soundName"]] ?: UILocalNotificationDefaultSoundName;
3551
notification.userInfo = [RCTConvert NSDictionary:details[@"userInfo"]];
3652
notification.category = [RCTConvert NSString:details[@"category"]];
53+
notification.repeatInterval = [RCTConvert NSCalendarUnit:details[@"repeatInterval"]];
3754
if (details[@"applicationIconBadgeNumber"]) {
3855
notification.applicationIconBadgeNumber = [RCTConvert NSInteger:details[@"applicationIconBadgeNumber"]];
3956
}

0 commit comments

Comments
 (0)