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

Fix permission popup not showing when current status is provisional #30

Merged
merged 1 commit into from
Sep 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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