Local Notification Category and Action Options are exclusive instead of or'able.
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Read LocalNotifications.swift, focusing on makeActionOptions and makeCategoryOptions, and compare their behavior with Apple’s UNNotification option sets. Exercise combinations of the documented flags on iOS; done when multiple selected options are preserved together for both action and category options.
Written by the indexing model from the issue text.
Description
Bug Report
Plugin(s)
@capacitor/local-notifications
Capacitor Version
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 7.4.3
@capacitor/core: 7.4.3
@capacitor/android: 7.4.3
@capacitor/ios: 7.4.3
Installed Dependencies:
@capacitor/cli: 7.4.3
@capacitor/android: 7.4.3
@capacitor/core: 7.4.3
@capacitor/ios: 7.4.3
[success] iOS looking great! 👌
[success] Android looking great! 👌
Platform(s)
iOS
Current Behavior
The iOS implementation of makeCategoryOptions and makeActionOptions in LocalNotifications.swift currently evaluates category option flags in an exclusive “first match wins” manner instead of combining them as intended by Apple’s UNNotificationCategoryOptions.
/**
* Make options for UNNotificationActions
*/
func makeActionOptions(_ action: JSObject) -> UNNotificationActionOptions {
let foreground = action["foreground"] as? Bool ?? false
let destructive = action["destructive"] as? Bool ?? false
let requiresAuthentication = action["requiresAuthentication"] as? Bool ?? false
if foreground {
return .foreground
}
if destructive {
return .destructive
}
if requiresAuthentication {
return .authenticationRequired
}
return UNNotificationActionOptions(rawValue: 0)
}
/**
* Make options for UNNotificationCategoryActions
*/
func makeCategoryOptions(_ type: JSObject) -> UNNotificationCategoryOptions {
let customDismiss = type["iosCustomDismissAction"] as? Bool ?? false
let carPlay = type["iosAllowInCarPlay"] as? Bool ?? false
let hiddenPreviewsShowTitle = type["iosHiddenPreviewsShowTitle"] as? Bool ?? false
let hiddenPreviewsShowSubtitle = type["iosHiddenPreviewsShowSubtitle"] as? Bool ?? false
if customDismiss {
return .customDismissAction
}
if carPlay {
return .allowInCarPlay
}
if hiddenPreviewsShowTitle {
return .hiddenPreviewsShowTitle
}
if hiddenPreviewsShowSubtitle {
return .hiddenPreviewsShowSubtitle
}
return UNNotificationCategoryOptions(rawValue: 0)
}
What’s wrong:
- The function returns immediately upon encountering the first truthy flag.
- As a result, if multiple flags are set (iosCustomDismissAction + iosAllowInCarPlay, for example), only the first one is applied.
- UNNotificationCategoryOptions is an OptionSet intended for bitwise combination (OR’ing multiple options), but the current logic prevents that.
Impact:
- Users cannot enable multiple options for a notification category simultaneously.
- Features like .customDismissAction + .allowInCarPlay together are effectively impossible.
- This behavior has existed since the method’s inception, but it only surfaces if multiple flags are needed at once.
Expected Behavior
Users should be able to set mix and match the respective options.
Code Reproduction
Other Technical Details
Additional Context
- Dominant language
- Kotlin
- Stars
- 0
- Forks
- 0
- Avg merge
- 11h 50m
- Merged PRs (30d)
- 2
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ionic-team/capacitor-local-notifications
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug: local-notifications (Android): autoCancel: false is ignored when the notification is tapped Open
Difficulty 2/5 1-3 hours Newbie friendliness 20/100
-
feat(@capacitor/local-notifications): Support `largeIcon` from local file/URI (file://, content://) Open
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
ionic-team/capacitor-local-notifications#5 · 1 comment ·
All issues in ionic-team/capacitor-local-notifications
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bitcoindevkit/bdk-ffi#1125 ·
-
helsemelding-json-schema json-schema-core
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
contributor: external needs review
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100