Commit bded6dda52b3081ffd9e054eb932a9f2506e9085

Authored by Thanh Phạm
Exists in master

Merge branch 'dev_checkOverlayAndroid' into 'master'

Dev check overlay android

Showing 6 changed files Side-by-side Diff

android/src/main/java/com/reactnativecommunity/rnpermissions/RNPermissionsModule.java
... ... @@ -242,7 +242,7 @@ public class RNPermissionsModule extends ReactContextBaseJavaModule {
242 242 }
243 243  
244 244 @ReactMethod
245   - public void checkOverlayAndroid(final Promise promise) {
  245 + public void checkOverlayPermission(final Promise promise) {
246 246 // Check if Android M or higher
247 247 final ReactApplicationContext reactContext = getReactApplicationContext();
248 248 if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M && !Settings.canDrawOverlays(reactContext)) {
... ... @@ -11,7 +11,7 @@ export interface Contract {
11 11  
12 12 check(permission: Permission): Promise<PermissionStatus>;
13 13  
14   - checkOverlayAndroid(): Promise<boolean>;
  14 + checkOverlayPermission(): Promise<boolean>;
15 15  
16 16 requestOverlayPermission(): Promise<PermissionStatus>;
17 17  
... ... @@ -14,7 +14,7 @@ export * from &#39;./types&#39;;
14 14  
15 15 export const openSettings = module.openSettings;
16 16 export const check = module.check;
17   -export const checkOverlayAndroid = module.checkOverlayAndroid;
  17 +export const checkOverlayPermission = module.checkOverlayPermission;
18 18 export const requestOverlayPermission = module.requestOverlayPermission;
19 19 export const request = module.request;
20 20 export const checkNotifications = module.checkNotifications;
... ... @@ -27,7 +27,7 @@ export default {
27 27 RESULTS,
28 28 openSettings,
29 29 check,
30   - checkOverlayAndroid,
  30 + checkOverlayPermission,
31 31 requestOverlayPermission,
32 32 request,
33 33 checkNotifications,
src/module.android.ts
... ... @@ -16,7 +16,7 @@ const RNP: {
16 16 checkNotifications: () => Promise<NotificationsResponse>;
17 17 openSettings: () => Promise<true>;
18 18 checkOrRequestOverlayPermission: () => Promise<true>;
19   - checkOverlayAndroid: () => Promise<boolean>;
  19 + checkOverlayPermission: () => Promise<boolean>;
20 20 requestOverlayPermission: () => Promise<PermissionStatus>;
21 21 getNonRequestables: () => Promise<Permission[]>;
22 22 isNonRequestable: (permission: Permission) => Promise<boolean>;
... ... @@ -70,8 +70,8 @@ async function check(permission: Permission): Promise&lt;PermissionStatus&gt; {
70 70 }
71 71 }
72 72  
73   -async function checkOverlayAndroid(): Promise<boolean> {
74   - return await RNP.checkOverlayAndroid();
  73 +async function checkOverlayPermission(): Promise<boolean> {
  74 + return await RNP.checkOverlayPermission();
75 75 }
76 76  
77 77 async function requestOverlayPermission(): Promise<PermissionStatus> {
... ... @@ -181,7 +181,7 @@ async function requestMultiple&lt;P extends Permission[]&gt;(
181 181 export const module: Contract = {
182 182 openSettings,
183 183 check,
184   - checkOverlayAndroid,
  184 + checkOverlayPermission,
185 185 requestOverlayPermission,
186 186 request,
187 187 checkNotifications,
... ... @@ -42,7 +42,7 @@ export function checkNotifications(): Promise&lt;NotificationsResponse&gt; {
42 42 return RNP.checkNotifications();
43 43 }
44 44  
45   -async function checkOverlayAndroid(): Promise<boolean> {
  45 +async function checkOverlayPermission(): Promise<boolean> {
46 46 return true;
47 47 }
48 48  
... ... @@ -93,7 +93,7 @@ async function requestMultiple&lt;P extends Permission[]&gt;(
93 93 export const module: Contract = {
94 94 openSettings,
95 95 check,
96   - checkOverlayAndroid,
  96 + checkOverlayPermission,
97 97 requestOverlayPermission,
98 98 request,
99 99 checkNotifications,
... ... @@ -6,7 +6,7 @@ async function check(): Promise&lt;PermissionStatus&gt; {
6 6 return RESULTS.UNAVAILABLE;
7 7 }
8 8  
9   -async function checkOverlayAndroid(): Promise<boolean> {
  9 +async function checkOverlayPermission(): Promise<boolean> {
10 10 return true;
11 11 }
12 12  
... ... @@ -31,7 +31,7 @@ async function checkMultiple&lt;P extends Permission[]&gt;(
31 31 export const module: Contract = {
32 32 openSettings: Promise.reject,
33 33 check,
34   - checkOverlayAndroid,
  34 + checkOverlayPermission,
35 35 requestOverlayPermission,
36 36 request: check,
37 37 checkNotifications,