flutter-plugins icon indicating copy to clipboard operation
flutter-plugins copied to clipboard

[Health 8.1.0] HealthDataType.NUTRITION requests WRITE access when only READ is requested

Open alexrafuse opened this issue 1 year ago • 0 comments

Device / Emulator and OS

  • Device: iPhone Emulator, iPhone 8 Plus
  • OS: iOS 16.2

Describe the bug

When requesting "HealthDataType.NUTRITION" permissions during authorization using only READ requests, there are 4 WRITE permissions for NUTRITION related categories requested (Carbohydrates, Dietary Energy, Protein, Total Fat).

To Reproduce

Steps to reproduce the behavior.

  1. Create a new flutter app and install the plugin
  2. Request authorization
await health.requestAuthorization([
        HealthDataType.NUTRITION,
      ], permissions: [
        HealthDataAccess.READ
]);

Expected behavior

The Health popup will not ask for write permissions if none are requested in the requestAuthorization call

Actual behavior

The health widget requests for write permissions for things related to NUTRITION.

Screenshots

apple-health-permissions

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.8, on macOS 13.6 22G120 darwin-arm64, locale en-CA)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.84.2)
[✓] Connected device (3 available)
[✓] Network resources
• No issues found!

Also confirmed reproducible on Flutter 3.16.3,

Additional information

Removing the entry from our permissions request resolves the issue. Issue was introduced in https://github.com/cph-cachet/flutter-plugins/pull/832

alexrafuse avatar Dec 07 '23 19:12 alexrafuse