Skip to content

Commit

Permalink
Merge pull request #30 from DuncanKelbie/ios_request_permissions_fix
Browse files Browse the repository at this point in the history
Fix permission popup not showing when current status is provisional
  • Loading branch information
Vanethos committed Sep 14, 2020
2 parents ef43d02 + 9606609 commit c505b59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
var permGranted = "granted";
var permDenied = "denied";
var permUnknown = "unknown";
var permProvisional = "provisional";

@override
void initState() {
Expand Down Expand Up @@ -50,6 +51,8 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
return permGranted;
case PermissionStatus.unknown:
return permUnknown;
case PermissionStatus.provisional:
return permProvisional;
default:
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion ios/Classes/SwiftNotificationPermissionsPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class SwiftNotificationPermissionsPlugin: NSObject, FlutterPlugin {
if (call.method == "requestNotificationPermissions") {
// check if we can ask for permissions
getNotificationStatus(completion: { status in
if (status == self.permissionUnknown) {
if (status == self.permissionUnknown || status == self.permissionProvisional) {
if #available(iOS 10.0, *) {
let center = UNUserNotificationCenter.current()
var options = UNAuthorizationOptions()
Expand Down

0 comments on commit c505b59

Please sign in to comment.