Add runtime permission request to post notification#145
Add runtime permission request to post notification#145HarelM wants to merge 2 commits intocapacitor-community:masterfrom
Conversation
| requestPermissionForAlias("location", call, "locationPermissionsCallback"); | ||
| } else { | ||
| call.reject("Permission denied.", "NOT_AUTHORIZED"); | ||
| } |
There was a problem hiding this comment.
I think these nested if blocks are easier to understand. Why did you change it?
There was a problem hiding this comment.
I had a hard time understanding the flow... I guess it's a matter of taste...
I also saw that keepAlive was called in a place it didn't need to be called due to the nesting of the ifs...
| requestPermissionForAlias("notifications", call, "notificationsPermissionsCallback"); | ||
| return; | ||
| } | ||
| service.addWatcher( |
There was a problem hiding this comment.
Should this be replaced with a direct call to notificationsPermissionsCallback?
|
This PR certainly needs to implement equivalent functionality for iOS before being merged. |
|
I don't think there's an iOS equivalent to this, this is an Android requirement as far as I understand. |
|
Excellent point. |
|
I've moved to maintain the following plugin: Sorry for splitting the echosystem and community, but I needed full control over the code due to the importance of this plugin in my app. Feel free to copy anything you'd like, or close issues I opened. |
|
Thanks, that is absolutely fine with me. I have little time to maintain this plugin beyond fixing bugs. |
In this PR I did the following:
backgroundMessageis definedThis also solves an issue for when running the app for the first time and there was a code flow that would create the notification and create a watcher even though the permission is not granted, so there was an error in the logcat.