Ver Fonte

Merge pull request #163 from convoyinc/v1.0.1

Fixed request logic for OS versions prior to Android M (6.0 that is)
Yonah Forst há 8 anos atrás
pai
commit
0ecbb90bf5
1 ficheiros alterados com 3 adições e 0 exclusões
  1. 3 0
      index.android.js

+ 3 - 0
index.android.js

@@ -70,6 +70,9 @@ class ReactNativePermissions {
 
 		return RNPermissions.request(androidPermission)
 			.then(res => {
+				// RNPermissions.request() to native module resolves to boolean
+				// rather than string if running on OS version prior to Android M 
+				if (typeof res === 'boolean') return res ? 'authorized' : 'denied';
 				return setDidAskOnce(permission)
 					.then(() => RESULTS[res])
 			});