Commit 161e99ca by Yannick Maljaars Committed by GitHub

Add support for NEARBY_WIFI_DEVICES permission to platform packages (#928)

* Added support for the NEARBY_WIFI_DEVICES permission to platform packages

* Hotfix PermissionUtils.java
parent 14a22a03
## 10.1.0
* Added support for the new Android 13 permission: NEARBY_WIFI_DEVICES.
## 10.0.0 ## 10.0.0
* __BREAKING CHANGE__: Updated Android `compileSdkVersion` to `33` to handle the new `POST_NOTIFICATIONS` permission. * __BREAKING CHANGE__: Updated Android `compileSdkVersion` to `33` to handle the new `POST_NOTIFICATIONS` permission.
......
...@@ -46,6 +46,7 @@ final class PermissionConstants { ...@@ -46,6 +46,7 @@ final class PermissionConstants {
static final int PERMISSION_GROUP_BLUETOOTH_SCAN = 28; static final int PERMISSION_GROUP_BLUETOOTH_SCAN = 28;
static final int PERMISSION_GROUP_BLUETOOTH_ADVERTISE = 29; static final int PERMISSION_GROUP_BLUETOOTH_ADVERTISE = 29;
static final int PERMISSION_GROUP_BLUETOOTH_CONNECT = 30; static final int PERMISSION_GROUP_BLUETOOTH_CONNECT = 30;
static final int PERMISSION_GROUP_NEARBY_WIFI_DEVICES = 31;
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
...@@ -77,7 +78,8 @@ final class PermissionConstants { ...@@ -77,7 +78,8 @@ final class PermissionConstants {
PERMISSION_GROUP_ACCESS_NOTIFICATION_POLICY, PERMISSION_GROUP_ACCESS_NOTIFICATION_POLICY,
PERMISSION_GROUP_BLUETOOTH_SCAN, PERMISSION_GROUP_BLUETOOTH_SCAN,
PERMISSION_GROUP_BLUETOOTH_ADVERTISE, PERMISSION_GROUP_BLUETOOTH_ADVERTISE,
PERMISSION_GROUP_BLUETOOTH_CONNECT PERMISSION_GROUP_BLUETOOTH_CONNECT,
PERMISSION_GROUP_NEARBY_WIFI_DEVICES
}) })
@interface PermissionGroup { @interface PermissionGroup {
} }
......
...@@ -77,6 +77,8 @@ public class PermissionUtils { ...@@ -77,6 +77,8 @@ public class PermissionUtils {
return PermissionConstants.PERMISSION_GROUP_BLUETOOTH_CONNECT; return PermissionConstants.PERMISSION_GROUP_BLUETOOTH_CONNECT;
case Manifest.permission.POST_NOTIFICATIONS: case Manifest.permission.POST_NOTIFICATIONS:
return PermissionConstants.PERMISSION_GROUP_NOTIFICATION; return PermissionConstants.PERMISSION_GROUP_NOTIFICATION;
case Manifest.permission.NEARBY_WIFI_DEVICES:
return PermissionConstants.PERMISSION_GROUP_NEARBY_WIFI_DEVICES;
default: default:
return PermissionConstants.PERMISSION_GROUP_UNKNOWN; return PermissionConstants.PERMISSION_GROUP_UNKNOWN;
} }
...@@ -295,6 +297,12 @@ public class PermissionUtils { ...@@ -295,6 +297,12 @@ public class PermissionUtils {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && hasPermissionInManifest(context, permissionNames, Manifest.permission.POST_NOTIFICATIONS )) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && hasPermissionInManifest(context, permissionNames, Manifest.permission.POST_NOTIFICATIONS ))
permissionNames.add(Manifest.permission.POST_NOTIFICATIONS); permissionNames.add(Manifest.permission.POST_NOTIFICATIONS);
break; break;
case PermissionConstants.PERMISSION_GROUP_NEARBY_WIFI_DEVICES:
// The NEARBY_WIFI_DEVICES permission is introduced in Android 13, meaning we should
// not handle permissions on pre Android 13 devices.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && hasPermissionInManifest(context, permissionNames, Manifest.permission.NEARBY_WIFI_DEVICES ))
permissionNames.add(Manifest.permission.NEARBY_WIFI_DEVICES);
break;
case PermissionConstants.PERMISSION_GROUP_MEDIA_LIBRARY: case PermissionConstants.PERMISSION_GROUP_MEDIA_LIBRARY:
case PermissionConstants.PERMISSION_GROUP_PHOTOS: case PermissionConstants.PERMISSION_GROUP_PHOTOS:
case PermissionConstants.PERMISSION_GROUP_REMINDERS: case PermissionConstants.PERMISSION_GROUP_REMINDERS:
......
...@@ -60,11 +60,12 @@ ...@@ -60,11 +60,12 @@
<!-- Permissions options for the `ignoreBatteryOptimizations` group --> <!-- Permissions options for the `ignoreBatteryOptimizations` group -->
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" /> <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<!-- Permissions options for the `bluetooth` group --> <!-- Permissions options for the `nearby devices` group -->
<uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" /> <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" /> <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" /> <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES" />
<!-- Permissions options for the `manage external storage` group --> <!-- Permissions options for the `manage external storage` group -->
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
......
name: permission_handler_android name: permission_handler_android
description: Permission plugin for Flutter. This plugin provides the Android API to request and check permissions. description: Permission plugin for Flutter. This plugin provides the Android API to request and check permissions.
version: 10.0.0 version: 10.1.0
homepage: https://github.com/baseflow/flutter-permission-handler homepage: https://github.com/baseflow/flutter-permission-handler
environment: environment:
......
## 9.0.5
* Added new Android 13 NEARBY_WIFI_DEVICES permission to PermissionHandlerEnums.h
## 9.0.4 ## 9.0.4
* Add flag inside `UserDefaults` to save whether locationAlways has already been requested and prevent further requests, which would be left unanswered by the system. * Add flag inside `UserDefaults` to save whether locationAlways has already been requested and prevent further requests, which would be left unanswered by the system.
......
...@@ -142,6 +142,7 @@ typedef NS_ENUM(int, PermissionGroup) { ...@@ -142,6 +142,7 @@ typedef NS_ENUM(int, PermissionGroup) {
PermissionGroupBluetoothScan, PermissionGroupBluetoothScan,
PermissionGroupBluetoothAdvertise, PermissionGroupBluetoothAdvertise,
PermissionGroupBluetoothConnect, PermissionGroupBluetoothConnect,
PermissionGroupNearbyWifiDevices
}; };
typedef NS_ENUM(int, PermissionStatus) { typedef NS_ENUM(int, PermissionStatus) {
......
name: permission_handler_apple name: permission_handler_apple
description: Permission plugin for Flutter. This plugin provides the iOS API to request and check permissions. description: Permission plugin for Flutter. This plugin provides the iOS API to request and check permissions.
version: 9.0.4 version: 9.0.5
homepage: https://github.com/baseflow/flutter-permission-handler homepage: https://github.com/baseflow/flutter-permission-handler
environment: environment:
......
# 0.1.1
* Added new Android 13 NEARBY_WIFI_DEVICES permission to permission_constants.h
## 0.1.0 ## 0.1.0
* Adds an initial implementation of Windows support for the permission_handler plugin. * Adds an initial implementation of Windows support for the permission_handler plugin.
name: permission_handler_windows name: permission_handler_windows
description: Permission plugin for Flutter. This plugin provides the Windows API to request and check permissions. description: Permission plugin for Flutter. This plugin provides the Windows API to request and check permissions.
version: 0.1.0 version: 0.1.1
homepage: https://github.com/baseflow/flutter-permission-handler homepage: https://github.com/baseflow/flutter-permission-handler
flutter: flutter:
......
...@@ -41,7 +41,8 @@ public: ...@@ -41,7 +41,8 @@ public:
ACCESS_NOTIFICATION_POLICY = 27, ACCESS_NOTIFICATION_POLICY = 27,
BLUETOOTH_SCAN = 28, BLUETOOTH_SCAN = 28,
BLUETOOTH_ADVERTISE = 29, BLUETOOTH_ADVERTISE = 29,
BLUETOOTH_CONNECT = 30 BLUETOOTH_CONNECT = 30,
NEARBY_WIFI_DEVICES = 31
}; };
//PERMISSION_STATUS //PERMISSION_STATUS
......
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