|
@@ -42,7 +42,15 @@ class ReactNativePermissions {
|
42
|
42
|
)
|
43
|
43
|
}
|
44
|
44
|
|
45
|
|
- request = (permission, type) => {
|
|
45
|
+ request = (permission, options) => {
|
|
46
|
+ let type = null;
|
|
47
|
+ if (typeof options === 'string' || options instanceof Array) {
|
|
48
|
+ console.warn('[react-native-permissions] : You are using a deprecated version of request(). You should use an object as second parameter. Please check the documentation for more information : https://github.com/yonahforst/react-native-permissions');
|
|
49
|
+ type = options;
|
|
50
|
+ } else if (options != null) {
|
|
51
|
+ type = options.type;
|
|
52
|
+ }
|
|
53
|
+
|
46
|
54
|
if (!permissionTypes.includes(permission)) {
|
47
|
55
|
return Promise.reject(
|
48
|
56
|
`ReactNativePermissions: ${
|
|
@@ -57,6 +65,8 @@ class ReactNativePermissions {
|
57
|
65
|
)
|
58
|
66
|
}
|
59
|
67
|
|
|
68
|
+
|
|
69
|
+
|
60
|
70
|
return PermissionsIOS.requestPermission(
|
61
|
71
|
permission,
|
62
|
72
|
type || DEFAULTS[permission],
|