Commit 20606c77 by Maurits van Beusekom Committed by GitHub

Merge branch 'develop' into ios_permission_selectivity

parents 770fac45 5784c0de
......@@ -19,6 +19,6 @@
### :thinking: Checklist before submitting
- [ ] All projects build
- [ ] Follows style guide lines ([code style guide](https://github.com/BaseflowIT/flutter-geolocator/blob/develop/CONTRIBUTING.md))
- [ ] Follows style guide lines ([code style guide](https://github.com/Baseflow/flutter-permission-handler/blob/develop/CONTRIBUTING.md))
- [ ] Relevant documentation was updated
- [ ] Rebased onto current develop
\ No newline at end of file
- [ ] Rebased onto current develop
......@@ -12,13 +12,13 @@ What you will need
Setting up your development environment
---------------------------------------
* Fork `https://github.com/BaseflowIT/flutter-permission-handler` into your own GitHub account. If you already have a fork and moving to a new computer, make sure you update you fork.
* Fork `https://github.com/Baseflow/flutter-permission-handler` into your own GitHub account. If you already have a fork and moving to a new computer, make sure you update you fork.
* If you haven't configured your machine with an SSH key that's known to github, then
follow [GitHub's directions](https://help.github.com/articles/generating-ssh-keys/)
to generate an SSH key.
* Clone your forked repo on your local development machine: `git clone git@github.com:<your_name_here>/flutter-permission-handler.git`
* Change into the `flutter-permission-handler` directory: `cd flutter-permission-handler`
* Add an upstream to the original repo, so that fetch from the master repository and not your clone: `git remote add upstream git@github.com:BaseflowIT/flutter-permission-handler.git`
* Add an upstream to the original repo, so that fetch from the master repository and not your clone: `git remote add upstream git@github.com:Baseflow/flutter-permission-handler.git`
Running the example project
---------------------------
......@@ -44,6 +44,6 @@ We really appreciate contributions via GitHub pull requests. To contribute take
Send us your pull request:
* Go to `https://github.com/BaseflowIT/flutter-permission-handler` and click the "Compare & pull request" button.
* Go to `https://github.com/Baseflow/flutter-permission-handler` and click the "Compare & pull request" button.
Please make sure you solved all warnings and errors reported by the static code analyses and that you fill in the full pull request template. Failing to do so will result in us asking you to fix it.
......@@ -50,8 +50,8 @@ dependencies:
For this plugin to work you will have to add permission configuration to your `AndroidManifest.xml` (Android) and `Info.plist` (iOS) files. This will tell the platform which hardware or software features your app needs. Complete lists of these permission options can be found in our example app here:
- [AndroidManifest.xml](https://github.com/BaseflowIT/flutter-permission-handler/blob/develop/example/android/app/src/main/AndroidManifest.xml) (note that there is a debug, main and profile version which are used depending on how you start your App. In general it is sufficient to add permissions only to the `main` version);
- [Info.plist](https://github.com/BaseflowIT/flutter-permission-handler/blob/develop/example/ios/Runner/Info.plist)
- [AndroidManifest.xml](https://github.com/Baseflow/flutter-permission-handler/blob/develop/example/android/app/src/main/AndroidManifest.xml) (note that there is a debug, main and profile version which are used depending on how you start your App. In general it is sufficient to add permissions only to the `main` version);
- [Info.plist](https://github.com/Baseflow/flutter-permission-handler/blob/develop/example/ios/Runner/Info.plist)
> IMPORTANT: ~~On iOS you will have to include all permission options when you want to submit your App.~~ This is because the `permission_handler` plugin touches all different SDKs and because the static code analyser (run by Apple upon App submission) detects this and will assert if it cannot find a matching permission option in the `Info.plist`. More information about this can be found [here](https://github.com/BaseflowIT/flutter-permission-handler/issues/26).
> 1. Add the following to your "Podfile" file:
......@@ -274,11 +274,11 @@ enum ServiceStatus {
## Issues
Please file any issues, bugs or feature request as an issue on our [GitHub](https://github.com/BaseflowIT/flutter-permission-handler/issues) page.
Please file any issues, bugs or feature request as an issue on our [GitHub](https://github.com/Baseflow/flutter-permission-handler/issues) page.
## Want to contribute
If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our [contribution guide](CONTRIBUTING.md) and send us your [pull request](https://github.com/BaseflowIT/flutter-permission-handler/pulls).
If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our [contribution guide](CONTRIBUTING.md) and send us your [pull request](https://github.com/Baseflow/flutter-permission-handler/pulls).
## Author
......
......@@ -62,7 +62,8 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
private static final int PERMISSION_GROUP_STORAGE = 14;
private static final int PERMISSION_GROUP_IGNORE_BATTERY_OPTIMIZATIONS = 15;
private static final int PERMISSION_GROUP_NOTIFICATION = 16;
private static final int PERMISSION_GROUP_UNKNOWN = 17;
private static final int PERMISSION_GROUP_ACCESS_MEDIA_LOCATION = 17;
private static final int PERMISSION_GROUP_UNKNOWN = 18;
private PermissionHandlerPlugin(Registrar mRegistrar) {
this.mRegistrar = mRegistrar;
......@@ -87,6 +88,7 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
PERMISSION_GROUP_STORAGE,
PERMISSION_GROUP_IGNORE_BATTERY_OPTIMIZATIONS,
PERMISSION_GROUP_NOTIFICATION,
PERMISSION_GROUP_ACCESS_MEDIA_LOCATION,
PERMISSION_GROUP_UNKNOWN,
})
private @interface PermissionGroup {
......@@ -195,6 +197,8 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
case Manifest.permission.READ_EXTERNAL_STORAGE:
case Manifest.permission.WRITE_EXTERNAL_STORAGE:
return PERMISSION_GROUP_STORAGE;
case Manifest.permission.ACCESS_MEDIA_LOCATION:
return PERMISSION_GROUP_ACCESS_MEDIA_LOCATION;
default:
return PERMISSION_GROUP_UNKNOWN;
}
......@@ -623,6 +627,9 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
if (hasPermissionInManifest(Manifest.permission.BIND_CALL_REDIRECTION_SERVICE))
permissionNames.add(Manifest.permission.BIND_CALL_REDIRECTION_SERVICE);
if (VERSION.SDK_INT >= VERSION_CODES.O && hasPermissionInManifest(Manifest.permission.ANSWER_PHONE_CALLS))
permissionNames.add(Manifest.permission.ANSWER_PHONE_CALLS);
break;
case PERMISSION_GROUP_SENSORS:
......@@ -663,6 +670,11 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
permissionNames.add(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
break;
case PERMISSION_GROUP_ACCESS_MEDIA_LOCATION:
if (VERSION.SDK_INT >= VERSION_CODES.Q && hasPermissionInManifest(Manifest.permission.ACCESS_MEDIA_LOCATION))
permissionNames.add(Manifest.permission.ACCESS_MEDIA_LOCATION);
break;
case PERMISSION_GROUP_NOTIFICATION:
case PERMISSION_GROUP_MEDIA_LIBRARY:
case PERMISSION_GROUP_PHOTOS:
......
......@@ -46,4 +46,8 @@
<!-- Permissions options for the `sensors` group -->
<uses-permission android:name="android.permission.BODY_SENSORS" />
<!-- Permissions options for the `access_media_location` group -->
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
</manifest>
......@@ -51,6 +51,9 @@
<!-- Permissions options for the `sensors` group -->
<uses-permission android:name="android.permission.BODY_SENSORS" />
<!-- Permissions options for the `access_media_location` group -->
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
<application
android:name="io.flutter.app.FlutterApplication"
android:icon="@mipmap/ic_launcher"
......
......@@ -30,8 +30,8 @@ class MyApp extends StatelessWidget {
return permission != PermissionGroup.unknown &&
permission != PermissionGroup.sms &&
permission != PermissionGroup.storage &&
permission !=
PermissionGroup.ignoreBatteryOptimizations;
permission != PermissionGroup.ignoreBatteryOptimizations &&
permission != PermissionGroup.access_media_location;
} else {
return permission != PermissionGroup.unknown &&
permission != PermissionGroup.mediaLibrary &&
......
......@@ -99,6 +99,7 @@ typedef NS_ENUM(int, PermissionGroup) {
PermissionGroupStorage,
PermissionGroupIgnoreBatteryOptimizations,
PermissionGroupNotification,
PermissionGroupAccessMediaLocation,
PermissionGroupUnknown,
};
......
......@@ -153,8 +153,11 @@ class PermissionGroup {
/// iOS: Notification
static const PermissionGroup notification = PermissionGroup._(16);
/// Android: Allows an application to access any geographic locations persisted in the user's shared collection.
static const PermissionGroup access_media_location = PermissionGroup._(17);
/// The unknown permission only used for return type, never requested
static const PermissionGroup unknown = PermissionGroup._(17);
static const PermissionGroup unknown = PermissionGroup._(18);
static const List<PermissionGroup> values = <PermissionGroup>[
calendar,
......@@ -174,6 +177,7 @@ class PermissionGroup {
storage,
ignoreBatteryOptimizations,
notification,
access_media_location,
unknown,
];
......@@ -195,6 +199,7 @@ class PermissionGroup {
'storage',
'ignoreBatteryOptimizations',
'notification',
'access_media_location',
'unknown',
];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment