react-native-push-notification / ios

React Native Push Notification API for iOS.
MIT License
745 stars 285 forks source link

Time sensitive notification doesn't work #390

Open abdulghani opened 1 year ago

abdulghani commented 1 year ago

I see the implementation for param mapping for the iOS notification interruptionLevel

@implementation RCTConvert (UNNotificationInterruptionLevel)

RCT_ENUM_CONVERTER(UNNotificationInterruptionLevel,
                   (@{
                      @"passive": @(UNNotificationInterruptionLevelPassive),
                      @"active": @(UNNotificationInterruptionLevelActive),
                      @"timeSensitive": @(UNNotificationInterruptionLevelTimeSensitive),
                      @"critical": @(UNNotificationInterruptionLevelCritical)
                      }),
                   0,
                   integerValue)

@end

and

    if (@available(iOS 15.0, *)) {
        UNNotificationInterruptionLevel interruptionLevel =[RCTConvert UNNotificationInterruptionLevel:details[@"interruptionLevel"]];
        if(interruptionLevel) {
        content.interruptionLevel = interruptionLevel;
        }
    }

with values enum converted

passive
active
timeSensitive
critical

I tried the following code to invoke local notification

PushNotificationIOS.addNotificationRequest({
    id,
    title: 'hello world',
    body: 'Lorem ipsum',
    interruptionLevel: 'timeSensitive',
});

notification doesn't show in focus mode while time-sensitive notifications are allowed, just show in the summary while in focus

also, the TS type for the NotificationRequest param doesn't have the interruptionLevel key either