diff --git a/permission_handler_android/CHANGELOG.md b/permission_handler_android/CHANGELOG.md index 37874ccd3..7a0a29de3 100644 --- a/permission_handler_android/CHANGELOG.md +++ b/permission_handler_android/CHANGELOG.md @@ -1,152 +1,157 @@ +## 12.1.0 + +- Updates the package to correctly support Flutter 3.29. +- Migrates away from deprecated imperative Gradle plugins. + ## 12.0.13 -* Updates the Android min SDK to 19 (from 16). -* Migrates example app away from deprecated imperative apply in gradle (see: https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply). +- Updates the Android min SDK to 19 (from 16). +- Migrates example app away from deprecated imperative apply in gradle (see: https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply). ## 12.0.12 -* Fixes permission status returned from `Permission.photos.request()` or `Permission.videos.request()` when limited access selected +- Fixes permission status returned from `Permission.photos.request()` or `Permission.videos.request()` when limited access selected ## 12.0.11 -* Adds `TargetApi` annotation to `getManifestNames` method in `PermissionUtils.java`. +- Adds `TargetApi` annotation to `getManifestNames` method in `PermissionUtils.java`. ## 12.0.10 -* Fixes a bug that causes a `NullPointerException` when the application is restarted after being killed by Android during the request of special permissions (like, `Permission.ignoreBatteryOptimizations`, `Permission.systemAlertWindow`, `Permission.accessNotificationPolicy`, `Permission.scheduleExactAlarm` and `Permission.manageExternalStorage`). +- Fixes a bug that causes a `NullPointerException` when the application is restarted after being killed by Android during the request of special permissions (like, `Permission.ignoreBatteryOptimizations`, `Permission.systemAlertWindow`, `Permission.accessNotificationPolicy`, `Permission.scheduleExactAlarm` and `Permission.manageExternalStorage`). ## 12.0.9 -* Makes the status returned when requesting the READ_MEDIA_VISUAL_USER_SELECTED permission more accurate. +- Makes the status returned when requesting the READ_MEDIA_VISUAL_USER_SELECTED permission more accurate. ## 12.0.8 -* Adds support for limited photo and video permission on Android. +- Adds support for limited photo and video permission on Android. ## 12.0.7 -* Removes additional Android v1 embedding class reference. +- Removes additional Android v1 embedding class reference. ## 12.0.6 -* Removes deprecated support for Android V1 embedding as support will be removed from Flutter (see [flutter/flutter#144726](https://github.com/flutter/flutter/pull/144726)). +- Removes deprecated support for Android V1 embedding as support will be removed from Flutter (see [flutter/flutter#144726](https://github.com/flutter/flutter/pull/144726)). ## 12.0.5 -* Upgrades Gradle and Android Gradle plugin. +- Upgrades Gradle and Android Gradle plugin. ## 12.0.4 -* Returns `granted` on permission `Permission.scheduleExactAlarm` for devices running lower than Android S (API 31), before this change the default return was `denied`. -* Updates `minSdkVersion` version to `flutter.minSdkVersion`. +- Returns `granted` on permission `Permission.scheduleExactAlarm` for devices running lower than Android S (API 31), before this change the default return was `denied`. +- Updates `minSdkVersion` version to `flutter.minSdkVersion`. ## 12.0.3 -* Updates the dependency on `permission_handler_platform_interface` to version 4.1.0 (SiriKit support is only available for iOS or macOS). +- Updates the dependency on `permission_handler_platform_interface` to version 4.1.0 (SiriKit support is only available for iOS or macOS). ## 12.0.2 -* Fixes bug where Android activity is leaked when embedded in native Android application. +- Fixes bug where Android activity is leaked when embedded in native Android application. ## 12.0.1 -* Fixes a bug where the `ignoreBatteryOptimizations` permission didn't report the correct status when the permission is requested and granted. +- Fixes a bug where the `ignoreBatteryOptimizations` permission didn't report the correct status when the permission is requested and granted. ## 12.0.0 -* **BREAKING CHANGES:** - * Adds `Permission.calendarWriteOnly`. - * Removes `Permission.calendarReadOnly`. +- **BREAKING CHANGES:** + - Adds `Permission.calendarWriteOnly`. + - Removes `Permission.calendarReadOnly`. ## 11.1.0 -* Implements the `Permission.calendarReadOnly` and `PermissionCalendarFullAccess` permissions. +- Implements the `Permission.calendarReadOnly` and `PermissionCalendarFullAccess` permissions. ## 11.0.5 -* Removes the obsolete `updatePermissionShouldShowStatus` method from the Java code base. -* Fixes some analysis warnings in the Java code base. +- Removes the obsolete `updatePermissionShouldShowStatus` method from the Java code base. +- Fixes some analysis warnings in the Java code base. ## 11.0.4 -* Fixes a bug where the status of special permissions would incorrectly be reported as `denied`. +- Fixes a bug where the status of special permissions would incorrectly be reported as `denied`. ## 11.0.3 -* Fixes a bug where `Permission.notification.status` would never return `permanentlyDenied` on Android. +- Fixes a bug where `Permission.notification.status` would never return `permanentlyDenied` on Android. ## 11.0.2 -* Fixes a bug where `Permission.Phone` would always return 'denied' when requesting the permission status. -* Fixes a bug where Flutter permissions that require multiple Android permissions would base their status on the status of the first Android permission, as opposed to the result of all relevant Android permissions. +- Fixes a bug where `Permission.Phone` would always return 'denied' when requesting the permission status. +- Fixes a bug where Flutter permissions that require multiple Android permissions would base their status on the status of the first Android permission, as opposed to the result of all relevant Android permissions. ## 11.0.1 -* Fixes `java.lang.IllegalStateException: Reply already submitted` when requesting post notification permission. +- Fixes `java.lang.IllegalStateException: Reply already submitted` when requesting post notification permission. ## 11.0.0 -* **BREAKING CHANGE:** Fixes a bug where the permission status would return 'denied' regardless of whether the status was 'denied' or 'permanently denied'. +- **BREAKING CHANGE:** Fixes a bug where the permission status would return 'denied' regardless of whether the status was 'denied' or 'permanently denied'. ## 10.3.6 -* Fixes a bug where requesting multiple permissions would crash the app if at least one of the permissions was a [special permission](https://developer.android.com/guide/topics/permissions/overview#special). +- Fixes a bug where requesting multiple permissions would crash the app if at least one of the permissions was a [special permission](https://developer.android.com/guide/topics/permissions/overview#special). ## 10.3.5 -* Fixes a bug where `Permission.ScheduleExactAlarm` was not opening the settings +- Fixes a bug where `Permission.ScheduleExactAlarm` was not opening the settings screen. ## 10.3.4 -* Fixes a bug where the permission status would return 'permanently denied' +- Fixes a bug where the permission status would return 'permanently denied' instead of 'denied' when the user dismisses the permission dialog. ## 10.3.3 -* Migrates the Gradle compile arguments to the example app, so they are not enforced upon consumers of the plugin. +- Migrates the Gradle compile arguments to the example app, so they are not enforced upon consumers of the plugin. ## 10.3.2 -* Updates example app to show `Permission.photos` and hide `Permission.bluetooth`. +- Updates example app to show `Permission.photos` and hide `Permission.bluetooth`. ## 10.3.1 -* Fixes `java.lang.IllegalStateException: Reply already submitted` when checking the status of Bluetooth service. +- Fixes `java.lang.IllegalStateException: Reply already submitted` when checking the status of Bluetooth service. ## 10.3.0 -* Adds support for the new Android 13 permission: BODY_SENSORS_BACKGROUND. +- Adds support for the new Android 13 permission: BODY_SENSORS_BACKGROUND. ## 10.2.3 -* Fix missing POST_NOTIFICATIONS permission in the Android example project. +- Fix missing POST_NOTIFICATIONS permission in the Android example project. ## 10.2.2 -* Fixes the SCHEDULE_EXACT_ALARM status check on Android 12 and 13. +- Fixes the SCHEDULE_EXACT_ALARM status check on Android 12 and 13. ## 10.2.1 -* Adds compatibility with Android Gradle Plugin 8.0. +- Adds compatibility with Android Gradle Plugin 8.0. ## 10.2.0 -* Adds support for the new Android 13 permissions: SCHEDULE_EXACT_ALARM, READ_MEDIA_IMAGES, READ_MEDIA_VIDEO and READ_MEDIA_AUDIO +- Adds support for the new Android 13 permissions: SCHEDULE_EXACT_ALARM, READ_MEDIA_IMAGES, READ_MEDIA_VIDEO and READ_MEDIA_AUDIO ## 10.1.0 -* Adds support for the new Android 13 permission: NEARBY_WIFI_DEVICES. +- Adds support for the new Android 13 permission: NEARBY_WIFI_DEVICES. ## 10.0.0 -* **BREAKING CHANGE**: Updates Android `compileSdkVersion` to `33` to handle the new `POST_NOTIFICATIONS` permission. +- **BREAKING CHANGE**: Updates Android `compileSdkVersion` to `33` to handle the new `POST_NOTIFICATIONS` permission. > When updating to version 10.0.0 make sure to update the `android/app/build.gradle` file and set the `compileSdkVersion` to `33`. ## 9.0.2+1 -* Undoes PR [#765](https://github.com/baseflow/flutter-permission-handler/pull/765) which by mistake requests write_external_storage permission based on the target SDK instead of the actual SDK of the Android device. +- Undoes PR [#765](https://github.com/baseflow/flutter-permission-handler/pull/765) which by mistake requests write_external_storage permission based on the target SDK instead of the actual SDK of the Android device. ## 9.0.2 -* Moves Android implementation into its own package. +- Moves Android implementation into its own package. diff --git a/permission_handler_android/example/android/.gitignore b/permission_handler_android/example/android/.gitignore index 0a741cb43..be3943c96 100644 --- a/permission_handler_android/example/android/.gitignore +++ b/permission_handler_android/example/android/.gitignore @@ -5,7 +5,10 @@ gradle-wrapper.jar /gradlew.bat /local.properties GeneratedPluginRegistrant.java +.cxx/ # Remember to never publicly share your keystore. -# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +# See https://flutter.dev/to/reference-keystore key.properties +**/*.keystore +**/*.jks diff --git a/permission_handler_android/example/android/gradle/wrapper/gradle-wrapper.properties b/permission_handler_android/example/android/gradle/wrapper/gradle-wrapper.properties index e6b38c2d6..db18181ac 100644 --- a/permission_handler_android/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/permission_handler_android/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip diff --git a/permission_handler_android/example/android/settings.gradle b/permission_handler_android/example/android/settings.gradle index 68a23aebc..56eb85cb1 100644 --- a/permission_handler_android/example/android/settings.gradle +++ b/permission_handler_android/example/android/settings.gradle @@ -18,7 +18,7 @@ pluginManagement { plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" - id "com.android.application" version "8.1.0" apply false + id "com.android.application" version "8.7.0" apply false } include ":app" \ No newline at end of file diff --git a/permission_handler_android/example/lib/main.dart b/permission_handler_android/example/lib/main.dart index 0e9477d6e..4a0a6e052 100644 --- a/permission_handler_android/example/lib/main.dart +++ b/permission_handler_android/example/lib/main.dart @@ -3,33 +3,37 @@ import 'package:flutter/material.dart'; import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart'; void main() { - runApp(BaseflowPluginExample( + runApp( + BaseflowPluginExample( pluginName: 'Permission Handler', githubURL: 'https://github.com/Baseflow/flutter-permission-handler', pubDevURL: 'https://pub.dev/packages/permission_handler', - pages: [PermissionHandlerWidget.createPage()])); + pages: [PermissionHandlerWidget.createPage()], + ), + ); } ///Defines the main theme color final MaterialColor themeMaterialColor = BaseflowPluginExample.createMaterialColor( - const Color.fromRGBO(48, 49, 60, 1)); + const Color.fromRGBO(48, 49, 60, 1), + ); /// A Flutter application demonstrating the functionality of this plugin class PermissionHandlerWidget extends StatefulWidget { /// Creates a [PermissionHandlerWidget]. - const PermissionHandlerWidget({ - super.key, - }); + const PermissionHandlerWidget({super.key}); /// Create a page containing the functionality of this plugin static ExamplePage createPage() { return ExamplePage( - Icons.location_on, (context) => const PermissionHandlerWidget()); + Icons.location_on, + (context) => const PermissionHandlerWidget(), + ); } @override - _PermissionHandlerWidgetState createState() => + State createState() => _PermissionHandlerWidgetState(); } @@ -38,20 +42,22 @@ class _PermissionHandlerWidgetState extends State { Widget build(BuildContext context) { return Center( child: ListView( - children: Permission.values - .where((permission) { - return permission != Permission.unknown && - permission != Permission.mediaLibrary && - permission != Permission.photosAddOnly && - permission != Permission.reminders && - permission != Permission.bluetooth && - permission != Permission.appTrackingTransparency && - permission != Permission.criticalAlerts && - permission != Permission.assistant && - permission != Permission.backgroundRefresh; - }) - .map((permission) => PermissionWidget(permission)) - .toList()), + children: + Permission.values + .where((permission) { + return permission != Permission.unknown && + permission != Permission.mediaLibrary && + permission != Permission.photosAddOnly && + permission != Permission.reminders && + permission != Permission.bluetooth && + permission != Permission.appTrackingTransparency && + permission != Permission.criticalAlerts && + permission != Permission.assistant && + permission != Permission.backgroundRefresh; + }) + .map((permission) => PermissionWidget(permission)) + .toList(), + ), ); } } @@ -59,15 +65,12 @@ class _PermissionHandlerWidgetState extends State { /// Permission widget containing information about the passed [Permission] class PermissionWidget extends StatefulWidget { /// Constructs a [PermissionWidget] for the supplied [Permission] - const PermissionWidget( - this._permission, { - super.key, - }); + const PermissionWidget(this._permission, {super.key}); final Permission _permission; @override - _PermissionState createState() => _PermissionState(); + State createState() => _PermissionState(); } class _PermissionState extends State { @@ -85,8 +88,9 @@ class _PermissionState extends State { } void _listenForPermissionStatus() async { - final status = - await _permissionHandler.checkPermissionStatus(widget._permission); + final status = await _permissionHandler.checkPermissionStatus( + widget._permission, + ); setState(() => _permissionStatus = status); } @@ -114,17 +118,18 @@ class _PermissionState extends State { _permissionStatus.toString(), style: TextStyle(color: getPermissionColor()), ), - trailing: (widget._permission is PermissionWithService) - ? IconButton( - icon: const Icon( - Icons.info, - color: Colors.white, - ), - onPressed: () { - checkServiceStatus( - context, widget._permission as PermissionWithService); - }) - : null, + trailing: + (widget._permission is PermissionWithService) + ? IconButton( + icon: const Icon(Icons.info, color: Colors.white), + onPressed: () { + checkServiceStatus( + context, + widget._permission as PermissionWithService, + ); + }, + ) + : null, onTap: () { requestPermission(widget._permission); }, @@ -132,11 +137,16 @@ class _PermissionState extends State { } void checkServiceStatus( - BuildContext context, PermissionWithService permission) async { - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text( - (await _permissionHandler.checkServiceStatus(permission)).toString()), - )); + BuildContext context, + PermissionWithService permission, + ) async { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + (await _permissionHandler.checkServiceStatus(permission)).toString(), + ), + ), + ); } Future requestPermission(Permission permission) async { diff --git a/permission_handler_android/example/pubspec.yaml b/permission_handler_android/example/pubspec.yaml index 07a0784e8..e76011501 100644 --- a/permission_handler_android/example/pubspec.yaml +++ b/permission_handler_android/example/pubspec.yaml @@ -2,12 +2,13 @@ name: permission_handler_android_example description: Demonstrates how to use the permission_handler_android plugin. environment: - sdk: ">=2.17.0 <4.0.0" + sdk: ^3.7.0 dependencies: baseflow_plugin_template: ^2.1.2 flutter: sdk: flutter + permission_handler_platform_interface: ^4.2.0 dev_dependencies: flutter_test: diff --git a/permission_handler_android/pubspec.yaml b/permission_handler_android/pubspec.yaml index 7d32908fa..c0be53cd2 100644 --- a/permission_handler_android/pubspec.yaml +++ b/permission_handler_android/pubspec.yaml @@ -1,11 +1,11 @@ name: permission_handler_android description: Permission plugin for Flutter. This plugin provides the Android API to request and check permissions. homepage: https://github.com/baseflow/flutter-permission-handler -version: 12.0.13 +version: 12.1.0 environment: - sdk: ">=2.15.0 <4.0.0" - flutter: ">=2.8.0" + sdk: ^3.5.0 + flutter: ">=3.24.0" flutter: plugin: @@ -21,5 +21,5 @@ dependencies: permission_handler_platform_interface: ^4.2.0 dev_dependencies: - flutter_lints: ^1.0.4 + flutter_lints: ^5.0.0 plugin_platform_interface: ^2.0.0