You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At some point, I've not been able to see notification actions on iOS yet. Notification actions do appear on macOS though. Upon digging further the culprit seems to be around this code
Here the code is querying the list of currently registered categories and then appending to that list the categories that was specified via the APIs exposed by the plugin. As far as I can tell from various docs/articles and my own testing, querying and then appending isn't necessary. It's sufficient to replace the logic with a single call to [center setNotificationCategories:newCategories].
If I'm not mistaken, the logic in its current state (i.e. where it merges the categories) could potentially lead to bugs where if apps call initialize() multiple times with different categories, the older categories aren't remain even though the semantics of that imply that the categories in the last call should be the ones that remain.
@ened have I missed a reason why the plugin should query the list of notification categories and should spend to it instead of overriding it?
Note: interestingly similar logic exists on macOS but I haven't run into this issue
The text was updated successfully, but these errors were encountered:
Closing this as the change has been done and it fixed the issue I was experiencing. Furthermore, saw that at least one other notifications library for other cross-platform frameworks approach this the same way where they don't append to the existing categories
At some point, I've not been able to see notification actions on iOS yet. Notification actions do appear on macOS though. Upon digging further the culprit seems to be around this code
flutter_local_notifications/flutter_local_notifications/ios/Classes/FlutterLocalNotificationsPlugin.m
Line 348 in f126ddb
Here the code is querying the list of currently registered categories and then appending to that list the categories that was specified via the APIs exposed by the plugin. As far as I can tell from various docs/articles and my own testing, querying and then appending isn't necessary. It's sufficient to replace the logic with a single call to
[center setNotificationCategories:newCategories]
.If I'm not mistaken, the logic in its current state (i.e. where it merges the categories) could potentially lead to bugs where if apps call
initialize()
multiple times with different categories, the older categories aren't remain even though the semantics of that imply that the categories in the last call should be the ones that remain.@ened have I missed a reason why the plugin should query the list of notification categories and should spend to it instead of overriding it?
Note: interestingly similar logic exists on macOS but I haven't run into this issue
The text was updated successfully, but these errors were encountered: