Browse Source

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

Yonah Forst 8 years ago
parent
commit
477c991d16
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      ReactNativePermissions.js

+ 3
- 3
ReactNativePermissions.js View File

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)