Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Push notifications plugin does not have #areEnabled method #2683

Closed
2 of 4 tasks
dminkovsky opened this issue Apr 3, 2020 · 9 comments
Closed
2 of 4 tasks

feat: Push notifications plugin does not have #areEnabled method #2683

dminkovsky opened this issue Apr 3, 2020 · 9 comments
Labels

Comments

@dminkovsky
Copy link

dminkovsky commented Apr 3, 2020

Feature Request

Describe the Feature Request

The local notifications plugin features an areEnabled method. This would be useful for push notifications as well. On iOS this can be supported with:

UNUserNotificationCenter.current().getNotificationSettings { (settings) in
   print("Notification settings: \(settings)")
   // return authorizationstatus to plugin
}

(https://developer.apple.com/documentation/usernotifications/unnotificationsettings/1648391-authorizationstatus)

Not sure about other platforms, but I suspect it's possible.

Platform Support Requested

  • Android
  • iOS
  • Electron
  • Web

Describe Preferred Solution

A method like LocalNotifications#areEnabled()

@jcesarmobile
Copy link
Member

There is a permissions plugin where you can check the permissions, or you can use the new requestPermissions that will prompt if not prompted before and return the result of the prompt, or you can use the LocalNotifications one since the result is the same as the underlying native framework is the same.

@dminkovsky
Copy link
Author

Yes, I'm on 2.0.0 beta and am using the new requestPermission(). I am not seeing the Permissions plugin though...

Screen Shot 2020-04-03 at 10 30 40 AM

@jcesarmobile
Copy link
Member

yeah, it's not documented, I have it on my TODO list for the final 2.0

@dminkovsky
Copy link
Author

I found Permissions in the code. Assuming it's on the Plugins object like the others.

https://github.com/ionic-team/capacitor/blob/ee8f63af8bf9d493e34396f44dbb53ef65ec0c38/ios/Capacitor/Capacitor/Plugins/Permissions.swift

And also, yes, LocalNotifications#areEnabled() is, indeed, that same native call. Why not just copy paste it for PushNotifications?

@dminkovsky
Copy link
Author

yeah, it's not documented, I have it on my TODO list for the final 2.0

Oh okay. Thank you.

@dminkovsky
Copy link
Author

Can I use the API in the Permissions plugin or is that planned to change?

@jcesarmobile
Copy link
Member

You can use it, it's been available for a long time, but just not documented

@jcesarmobile
Copy link
Member

the page was created when the plugin was implemented back in August, but was not added to the side menu, just added it
#2684

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 12, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants