瀏覽代碼

fix default location permission. Make sure you always return a promise from checkMultiplePermissions

Yonah Forst 8 年之前
父節點
當前提交
477c991d16
共有 1 個檔案被更改,包括 3 行新增3 行删除
  1. 3
    3
      ReactNativePermissions.js

+ 3
- 3
ReactNativePermissions.js 查看文件

71
 		if (!this.getPermissionTypes().includes(permission)) {
71
 		if (!this.getPermissionTypes().includes(permission)) {
72
 			return Promise.reject(`ReactNativePermissions: ${permission} is not a valid permission type on ${Platform.OS}`)
72
 			return Promise.reject(`ReactNativePermissions: ${permission} is not a valid permission type on ${Platform.OS}`)
73
 		} else if (permission == 'backgroundRefresh'){
73
 		} else if (permission == 'backgroundRefresh'){
74
-			return Promise.reject('You cannot request backgroundRefresh')
74
+			return Promise.reject('ReactNativePermissions: You cannot request backgroundRefresh')
75
 		} else if (permission == 'location') {
75
 		} else if (permission == 'location') {
76
-			options = type || 'always'
76
+			options = type || 'whenInUse'
77
 		} else if (permission == 'notification') {
77
 		} else if (permission == 'notification') {
78
 			options = type || ['alert', 'badge', 'sound']
78
 			options = type || ['alert', 'badge', 'sound']
79
 		}
79
 		}
91
 			let p = permissions[i]
91
 			let p = permissions[i]
92
 			
92
 			
93
 			if (!p) {
93
 			if (!p) {
94
-				return obj
94
+				return Promise.resolve(obj)
95
 			}
95
 			}
96
 
96
 
97
 			return that.getPermissionStatus(p)
97
 			return that.getPermissionStatus(p)