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

[Bug]: iOS: Permission.criticalAlerts.request() does always return PermissionStatus.granted on the first request #1284

Open
3 of 5 tasks
pfraunlob opened this issue Feb 15, 2024 · 2 comments
Assignees

Comments

@pfraunlob
Copy link

pfraunlob commented Feb 15, 2024

Please check the following before submitting a new issue.

Please select affected platform(s)

  • Android
  • iOS
  • Windows

Steps to reproduce

  1. request critical alert permission on iOS with await Permission.criticalAlerts.request(); for the first time
  2. A iOS dialog is shown. Press "do not allow"

A workaround we currently use is to return Permission.criticalAlerts.status; after the request to get the correct status.

Expected results

returns PermissionStatus.permanentlyDenied

Actual results

returns PermissionStatus.granted

Code sample

Code sample
Future<PermissionStatus> requestCriticalAlertPermission() async {
final permissionStatus = await Permission.criticalAlerts.request();
// This will return PermissionStatus.granted on the first request even if the user has denied the permission.
return permissionStatus;
}

Screenshots or video

No response

Version

11.2.1

Flutter Doctor output

/Users/pfraunlob/dev/source/flutter/bin/flutter doctor --verbose
[✓] Flutter (Channel stable, 3.16.7, on macOS 14.3 23D56 darwin-x64, locale de-AT)
• Flutter version 3.16.7 on channel stable at /Users/pfraunlob/dev/source/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ef1af02aea (vor 5 Wochen), 2024-01-11 15:19:26 -0600
• Engine revision 4a585b7929
• Dart version 3.2.4
• DevTools version 2.28.5

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at /Users/pfraunlob/Library/Android/sdk
• Platform android-34, build-tools 33.0.1
• ANDROID_HOME = /Users/pfraunlob/Library/Android/sdk
• Java binary at: /Users/pfraunlob/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.11005911/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15C500b
• CocoaPods version 1.14.3

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
• Android Studio at /Users/pfraunlob/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.11005911/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] Android Studio (version 2022.3)
• Android Studio at /Users/pfraunlob/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/223.8836.35.2231.10811636/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] Connected device (3 available)
• iPhone 15 (mobile) • DEBA783D-8EDC-41B2-A2B9-9262A9F4A5D6 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 14.3 23D56 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 121.0.6167.160

[✓] Network resources
• All expected network resources are available.

• No issues found!
Process finished with exit code 0

@TimHoogstrate TimHoogstrate self-assigned this Feb 15, 2024
@LucyJeong
Copy link

LucyJeong commented Mar 14, 2024

I've encountered the same critical issue as well. On the iPhone, even when the permission for the first notification request is granted, the return value indicates it was denied. This has resulted in a significant loss of user trust.

first call is PermissionStatus.permanentlyDenied.
second call is granted.

@kkh975
Copy link

kkh975 commented May 27, 2024

me too. Does anyone know how to solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants