File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 1313+ (NSCalendarUnit )NSCalendarUnit : (id )json ;
1414@end
1515
16+ @interface RCTConvert (UNNotificationInterruptionLevel)
17+ + (UNNotificationInterruptionLevel)UNNotificationInterruptionLevel : (id )json API_AVAILABLE(ios(15.0 ));
18+ @end
19+
1620/* *
1721 * Type deprecated in iOS 10.0
1822 * TODO: This method will be removed in the next major version
Original file line number Diff line number Diff line change @@ -24,6 +24,20 @@ @implementation RCTConvert (NSCalendarUnit)
2424@end
2525
2626
27+ @implementation RCTConvert (UNNotificationInterruptionLevel)
28+
29+ RCT_ENUM_CONVERTER(UNNotificationInterruptionLevel,
30+ (@{
31+ @" passive" : @(UNNotificationInterruptionLevelPassive),
32+ @" active" : @(UNNotificationInterruptionLevelActive),
33+ @" timeSensitive" : @(UNNotificationInterruptionLevelTimeSensitive),
34+ @" critical" : @(UNNotificationInterruptionLevelCritical)
35+ }),
36+ 0,
37+ integerValue)
38+
39+ @end
40+
2741
2842/* *
2943 * Type deprecated in iOS 10.0
@@ -110,6 +124,13 @@ + (UNNotificationRequest *)UNNotificationRequest:(id)json
110124 content.badge = [RCTConvert NSNumber: details[@" badge" ]];
111125 content.categoryIdentifier = [RCTConvert NSString: details[@" category" ]];
112126
127+ if (@available (iOS 15.0 , *)) {
128+ UNNotificationInterruptionLevel interruptionLevel =[RCTConvert UNNotificationInterruptionLevel: details[@" interruptionLevel" ]];
129+ if (interruptionLevel) {
130+ content.interruptionLevel = interruptionLevel;
131+ }
132+ }
133+
113134 NSString * threadIdentifier = [RCTConvert NSString: details[@" threadId" ]];
114135 if (threadIdentifier){
115136 content.threadIdentifier = threadIdentifier;
You can’t perform that action at this time.
0 commit comments