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]: checkPermission() does not reflect correct state after granting permissions via requestPermission() in Safari. #1396

Open
4 of 8 tasks
jdbenito opened this issue Dec 18, 2023 · 0 comments
Labels
P2 Important issues not at the top of the work list. type: bug Something isn't working

Comments

@jdbenito
Copy link

jdbenito commented Dec 18, 2023

Please check the following before submitting a new issue.

Please select affected platform(s)

  • Android
  • iOS
  • Linux
  • macOS
  • Web
  • Windows

Steps to reproduce

  • Grant permissions to Safari within the Settings app
    • Mac OS: System Settings > Privacy & Security > Location Services (ON) > Safari (ON)
    • (iOS): Settings > Privacy & Security > Location Services > Safari > While Using the App
  • Execute your Flutter web in Safari
  • Within your code, add some workflow that will trigger the following workflow:
...
var currentPermission = await Geolocator.checkPermission();
if (!isLocationPermissionGranted(currentPermission)) {
  await Geolocator.requestPermission();   /// Grant while-in-use
}
currentPermission = await Geolocator.checkPermission();
assert(currentPermission, LocationPermission.whileInUse);
...

Tested in:

  • Safari desktop 17.1.2
  • geolocator plugin v10.1.0

Expected results

The assertion should pass in all supported platforms.

Actual results

This fails in Safari (desktop and mobile).

Code sample

Code sample
...
var currentPermission = await Geolocator.checkPermission();
if (!isLocationPermissionGranted(currentPermission)) {
  await Geolocator.requestPermission();   /// Grant while-in-use
}
currentPermission = await Geolocator.checkPermission();
assert(currentPermission, LocationPermission.whileInUse);
...

Screenshots or video

No response

Version

10.1.0

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.13.9, on macOS 14.1.2 23B92 darwin-arm64, locale en-CA)
    • Flutter version 3.13.9 on channel stable at /Users/jdbenito/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d211f42860 (8 weeks ago), 2023-10-25 13:42:25 -0700
    • Engine revision 0545f8705d
    • Dart version 3.1.5
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/jdbenito/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/jdbenito/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

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

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

[✓] Android Studio (version 2022.1)
    • Android Studio at /Applications/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 11.0.15+0-b2043.56-8887301)

[✓] VS Code (version 1.85.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.78.0

[✓] Connected device (4 available)
    • sdk gphone64 arm64 (mobile)            • emulator-5554             • android-arm64  • Android 13 (API 33) (emulator)
    • JD Personal iPhone 13 Pro Max (mobile) • 00008110-001068C226A1801E • ios            • iOS 17.1.2 21B101
    • macOS (desktop)                        • macos                     • darwin-arm64   • macOS 14.1.2 23B92 darwin-arm64
    • Chrome (web)                           • chrome                    • web-javascript • Google Chrome 120.0.6099.109

[✓] Network resources
    • All expected network resources are available.
@jdbenito jdbenito changed the title [Bug]: checkPermission() does not reflect correct state after perms are granted via requestPermission() in Safari. [Bug]: checkPermission() does not reflect correct state after granting permissions via requestPermission() in Safari. Dec 18, 2023
@TimHoogstrate TimHoogstrate added P2 Important issues not at the top of the work list. type: bug Something isn't working labels Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Important issues not at the top of the work list. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants