Skip to content

Commit 20606c7

Browse files
authored
Merge branch 'develop' into ios_permission_selectivity
2 parents 770fac4 + 5784c0d commit 20606c7

File tree

9 files changed

+38
-13
lines changed

9 files changed

+38
-13
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
### :thinking: Checklist before submitting
2020

2121
- [ ] All projects build
22-
- [ ] Follows style guide lines ([code style guide](https://github.com/BaseflowIT/flutter-geolocator/blob/develop/CONTRIBUTING.md))
22+
- [ ] Follows style guide lines ([code style guide](https://github.com/Baseflow/flutter-permission-handler/blob/develop/CONTRIBUTING.md))
2323
- [ ] Relevant documentation was updated
24-
- [ ] Rebased onto current develop
24+
- [ ] Rebased onto current develop

CONTRIBUTING.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ What you will need
1212
Setting up your development environment
1313
---------------------------------------
1414

15-
* 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.
15+
* 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.
1616
* If you haven't configured your machine with an SSH key that's known to github, then
1717
follow [GitHub's directions](https://help.github.com/articles/generating-ssh-keys/)
1818
to generate an SSH key.
1919
* Clone your forked repo on your local development machine: `git clone [email protected]:<your_name_here>/flutter-permission-handler.git`
2020
* Change into the `flutter-permission-handler` directory: `cd flutter-permission-handler`
21-
* Add an upstream to the original repo, so that fetch from the master repository and not your clone: `git remote add upstream [email protected]:BaseflowIT/flutter-permission-handler.git`
21+
* Add an upstream to the original repo, so that fetch from the master repository and not your clone: `git remote add upstream [email protected]:Baseflow/flutter-permission-handler.git`
2222

2323
Running the example project
2424
---------------------------
@@ -44,6 +44,6 @@ We really appreciate contributions via GitHub pull requests. To contribute take
4444

4545
Send us your pull request:
4646

47-
* Go to `https://github.com/BaseflowIT/flutter-permission-handler` and click the "Compare & pull request" button.
47+
* Go to `https://github.com/Baseflow/flutter-permission-handler` and click the "Compare & pull request" button.
4848

4949
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.

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ dependencies:
5050

5151
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:
5252

53-
- [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);
54-
- [Info.plist](https://github.com/BaseflowIT/flutter-permission-handler/blob/develop/example/ios/Runner/Info.plist)
53+
- [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);
54+
- [Info.plist](https://github.com/Baseflow/flutter-permission-handler/blob/develop/example/ios/Runner/Info.plist)
5555

5656
> 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).
5757
> 1. Add the following to your "Podfile" file:
@@ -274,11 +274,11 @@ enum ServiceStatus {
274274

275275
## Issues
276276

277-
Please file any issues, bugs or feature request as an issue on our [GitHub](https://github.com/BaseflowIT/flutter-permission-handler/issues) page.
277+
Please file any issues, bugs or feature request as an issue on our [GitHub](https://github.com/Baseflow/flutter-permission-handler/issues) page.
278278

279279
## Want to contribute
280280

281-
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).
281+
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).
282282

283283
## Author
284284

android/src/main/java/com/baseflow/permissionhandler/PermissionHandlerPlugin.java

+13-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public class PermissionHandlerPlugin implements MethodCallHandler {
6262
private static final int PERMISSION_GROUP_STORAGE = 14;
6363
private static final int PERMISSION_GROUP_IGNORE_BATTERY_OPTIMIZATIONS = 15;
6464
private static final int PERMISSION_GROUP_NOTIFICATION = 16;
65-
private static final int PERMISSION_GROUP_UNKNOWN = 17;
65+
private static final int PERMISSION_GROUP_ACCESS_MEDIA_LOCATION = 17;
66+
private static final int PERMISSION_GROUP_UNKNOWN = 18;
6667

6768
private PermissionHandlerPlugin(Registrar mRegistrar) {
6869
this.mRegistrar = mRegistrar;
@@ -87,6 +88,7 @@ private PermissionHandlerPlugin(Registrar mRegistrar) {
8788
PERMISSION_GROUP_STORAGE,
8889
PERMISSION_GROUP_IGNORE_BATTERY_OPTIMIZATIONS,
8990
PERMISSION_GROUP_NOTIFICATION,
91+
PERMISSION_GROUP_ACCESS_MEDIA_LOCATION,
9092
PERMISSION_GROUP_UNKNOWN,
9193
})
9294
private @interface PermissionGroup {
@@ -195,6 +197,8 @@ private static int parseManifestName(String permission) {
195197
case Manifest.permission.READ_EXTERNAL_STORAGE:
196198
case Manifest.permission.WRITE_EXTERNAL_STORAGE:
197199
return PERMISSION_GROUP_STORAGE;
200+
case Manifest.permission.ACCESS_MEDIA_LOCATION:
201+
return PERMISSION_GROUP_ACCESS_MEDIA_LOCATION;
198202
default:
199203
return PERMISSION_GROUP_UNKNOWN;
200204
}
@@ -623,6 +627,9 @@ private List<String> getManifestNames(@PermissionGroup int permission) {
623627
if (hasPermissionInManifest(Manifest.permission.BIND_CALL_REDIRECTION_SERVICE))
624628
permissionNames.add(Manifest.permission.BIND_CALL_REDIRECTION_SERVICE);
625629

630+
if (VERSION.SDK_INT >= VERSION_CODES.O && hasPermissionInManifest(Manifest.permission.ANSWER_PHONE_CALLS))
631+
permissionNames.add(Manifest.permission.ANSWER_PHONE_CALLS);
632+
626633
break;
627634

628635
case PERMISSION_GROUP_SENSORS:
@@ -663,6 +670,11 @@ private List<String> getManifestNames(@PermissionGroup int permission) {
663670
permissionNames.add(Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
664671
break;
665672

673+
case PERMISSION_GROUP_ACCESS_MEDIA_LOCATION:
674+
if (VERSION.SDK_INT >= VERSION_CODES.Q && hasPermissionInManifest(Manifest.permission.ACCESS_MEDIA_LOCATION))
675+
permissionNames.add(Manifest.permission.ACCESS_MEDIA_LOCATION);
676+
break;
677+
666678
case PERMISSION_GROUP_NOTIFICATION:
667679
case PERMISSION_GROUP_MEDIA_LIBRARY:
668680
case PERMISSION_GROUP_PHOTOS:

example/android/app/src/debug/AndroidManifest.xml

+4
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,8 @@
4646

4747
<!-- Permissions options for the `sensors` group -->
4848
<uses-permission android:name="android.permission.BODY_SENSORS" />
49+
50+
<!-- Permissions options for the `access_media_location` group -->
51+
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
52+
4953
</manifest>

example/android/app/src/main/AndroidManifest.xml

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
<!-- Permissions options for the `sensors` group -->
5252
<uses-permission android:name="android.permission.BODY_SENSORS" />
5353

54+
<!-- Permissions options for the `access_media_location` group -->
55+
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
56+
5457
<application
5558
android:name="io.flutter.app.FlutterApplication"
5659
android:icon="@mipmap/ic_launcher"

example/lib/main.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class MyApp extends StatelessWidget {
3030
return permission != PermissionGroup.unknown &&
3131
permission != PermissionGroup.sms &&
3232
permission != PermissionGroup.storage &&
33-
permission !=
34-
PermissionGroup.ignoreBatteryOptimizations;
33+
permission != PermissionGroup.ignoreBatteryOptimizations &&
34+
permission != PermissionGroup.access_media_location;
3535
} else {
3636
return permission != PermissionGroup.unknown &&
3737
permission != PermissionGroup.mediaLibrary &&

ios/Classes/PermissionHandlerEnums.h

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ typedef NS_ENUM(int, PermissionGroup) {
9999
PermissionGroupStorage,
100100
PermissionGroupIgnoreBatteryOptimizations,
101101
PermissionGroupNotification,
102+
PermissionGroupAccessMediaLocation,
102103
PermissionGroupUnknown,
103104
};
104105

lib/src/permission_enums.dart

+6-1
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,11 @@ class PermissionGroup {
153153
/// iOS: Notification
154154
static const PermissionGroup notification = PermissionGroup._(16);
155155

156+
/// Android: Allows an application to access any geographic locations persisted in the user's shared collection.
157+
static const PermissionGroup access_media_location = PermissionGroup._(17);
158+
156159
/// The unknown permission only used for return type, never requested
157-
static const PermissionGroup unknown = PermissionGroup._(17);
160+
static const PermissionGroup unknown = PermissionGroup._(18);
158161

159162
static const List<PermissionGroup> values = <PermissionGroup>[
160163
calendar,
@@ -174,6 +177,7 @@ class PermissionGroup {
174177
storage,
175178
ignoreBatteryOptimizations,
176179
notification,
180+
access_media_location,
177181
unknown,
178182
];
179183

@@ -195,6 +199,7 @@ class PermissionGroup {
195199
'storage',
196200
'ignoreBatteryOptimizations',
197201
'notification',
202+
'access_media_location',
198203
'unknown',
199204
];
200205

0 commit comments

Comments
 (0)