mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 09:45:04 +00:00
Add repeatInterval to PushNotificationIOS
Summary: This just cleans up the work done in #7219 by adamterlson based on grabbou's feedback Closes https://github.com/facebook/react-native/pull/10337 Differential Revision: D4001540 Pulled By: javache fbshipit-source-id: c73b5fef912fa71d1d988dae41094c9c46dc610b
This commit is contained in:
parent
0f3d24c7fb
commit
9a8b5fcf61
@ -135,6 +135,7 @@ class PushNotificationIOS {
|
||||
* - `category` : The category of this notification, required for actionable notifications (optional).
|
||||
* - `userInfo` : An optional object containing additional notification data.
|
||||
* - `applicationIconBadgeNumber` (optional) : The number to display as the app's icon badge. Setting the number to 0 removes the icon badge.
|
||||
* - `repeatInterval` : The interval to repeat as a string. Possible values: `minute`, `hour`, `day`, `week`, `month`, `year`.
|
||||
*/
|
||||
static scheduleLocalNotification(details: Object) {
|
||||
RCTPushNotificationManager.scheduleLocalNotification(details);
|
||||
|
@ -22,6 +22,22 @@ NSString *const RCTRegisterUserNotificationSettings = @"RegisterUserNotification
|
||||
NSString *const RCTErrorUnableToRequestPermissions = @"E_UNABLE_TO_REQUEST_PERMISSIONS";
|
||||
NSString *const RCTErrorRemoteNotificationRegistrationFailed = @"E_FAILED_TO_REGISTER_FOR_REMOTE_NOTIFICATIONS";
|
||||
|
||||
@implementation RCTConvert (NSCalendarUnit)
|
||||
|
||||
RCT_ENUM_CONVERTER(NSCalendarUnit,
|
||||
(@{
|
||||
@"year": @(NSCalendarUnitYear),
|
||||
@"month": @(NSCalendarUnitMonth),
|
||||
@"week": @(NSCalendarUnitWeekOfYear),
|
||||
@"day": @(NSCalendarUnitDay),
|
||||
@"hour": @(NSCalendarUnitHour),
|
||||
@"minute": @(NSCalendarUnitMinute)
|
||||
}),
|
||||
0,
|
||||
integerValue)
|
||||
|
||||
@end
|
||||
|
||||
@implementation RCTConvert (UILocalNotification)
|
||||
|
||||
+ (UILocalNotification *)UILocalNotification:(id)json
|
||||
@ -34,6 +50,7 @@ NSString *const RCTErrorRemoteNotificationRegistrationFailed = @"E_FAILED_TO_REG
|
||||
notification.soundName = [RCTConvert NSString:details[@"soundName"]] ?: UILocalNotificationDefaultSoundName;
|
||||
notification.userInfo = [RCTConvert NSDictionary:details[@"userInfo"]];
|
||||
notification.category = [RCTConvert NSString:details[@"category"]];
|
||||
notification.repeatInterval = [RCTConvert NSCalendarUnit:details[@"repeatInterval"]];
|
||||
if (details[@"applicationIconBadgeNumber"]) {
|
||||
notification.applicationIconBadgeNumber = [RCTConvert NSInteger:details[@"applicationIconBadgeNumber"]];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user