expo-permissions
Advanced tools
Comparing version 12.1.1 to 13.0.0
import { PermissionStatus } from './Permissions.types'; | ||
export function coalesceStatuses(permissions) { | ||
const statuses = Object.keys(permissions).map(type => permissions[type].status); | ||
const statuses = Object.keys(permissions).map((type) => permissions[type].status); | ||
statuses.sort((status1, status2) => _getStatusWeight(status1) - _getStatusWeight(status2)); | ||
@@ -25,3 +25,3 @@ // We choose the "heaviest" status with the most implications | ||
const maxExpiration = 9007199254740991; // Number.MAX_SAFE_INTEGER | ||
const expirations = Object.keys(permissions).map(type => permissions[type].expires); | ||
const expirations = Object.keys(permissions).map((type) => permissions[type].expires); | ||
expirations.sort((e1, e2) => (e1 == null || e1 === 'never' ? maxExpiration : e1) - | ||
@@ -28,0 +28,0 @@ (e2 == null || e2 === 'never' ? maxExpiration : e2)); |
@@ -1,2 +0,2 @@ | ||
declare const _default: import("@unimodules/core").ProxyNativeModule; | ||
declare const _default: import("expo-modules-core").ProxyNativeModule; | ||
export default _default; |
@@ -1,3 +0,3 @@ | ||
import { NativeModulesProxy } from '@unimodules/core'; | ||
import { NativeModulesProxy } from 'expo-modules-core'; | ||
export default NativeModulesProxy.ExpoPermissions; | ||
//# sourceMappingURL=ExpoPermissions.js.map |
@@ -71,3 +71,3 @@ import { PermissionStatus, } from './Permissions.types'; | ||
async function askForLocationPermissionAsync() { | ||
return new Promise(resolve => { | ||
return new Promise((resolve) => { | ||
navigator.geolocation.getCurrentPosition(() => resolve({ | ||
@@ -74,0 +74,0 @@ status: PermissionStatus.GRANTED, |
@@ -27,3 +27,3 @@ import { useCallback, useRef, useEffect, useState } from 'react'; | ||
// to prevent unnecessary function instances we need to listen to the "raw" value. | ||
const askPermissions = useCallback(() => askAsync(...types).then(response => { | ||
const askPermissions = useCallback(() => askAsync(...types).then((response) => { | ||
if (isMounted.current) { | ||
@@ -33,3 +33,3 @@ setData(response); | ||
}), [type]); | ||
const getPermissions = useCallback(() => getAsync(...types).then(response => { | ||
const getPermissions = useCallback(() => getAsync(...types).then((response) => { | ||
if (isMounted.current) { | ||
@@ -36,0 +36,0 @@ setData(response); |
@@ -13,6 +13,16 @@ # Changelog | ||
## 12.1.1 — 2021-06-22 | ||
## 13.0.0 — 2021-09-28 | ||
_This version does not introduce any user-facing changes._ | ||
### 🛠 Breaking changes | ||
- Dropped support for iOS 11.0 ([#14383](https://github.com/expo/expo/pull/14383) by [@cruzach](https://github.com/cruzach)) | ||
### 🐛 Bug fixes | ||
- Fix building errors from use_frameworks! in Podfile. ([#14523](https://github.com/expo/expo/pull/14523) by [@kudo](https://github.com/kudo)) | ||
### 💡 Others | ||
- Migrated from `@unimodules/core` to `expo-modules-core`. ([#13757](https://github.com/expo/expo/pull/13757) by [@tsapeta](https://github.com/tsapeta)) | ||
## 12.1.0 — 2021-06-16 | ||
@@ -19,0 +29,0 @@ |
{ | ||
"name": "expo-permissions", | ||
"version": "12.1.1", | ||
"version": "13.0.0", | ||
"description": "Allows you prompt for various permissions to access device sensors, personal data, etc.", | ||
@@ -32,3 +32,3 @@ "main": "build/index.js", | ||
"license": "MIT", | ||
"homepage": "https://docs.expo.io/versions/latest/sdk/permissions/", | ||
"homepage": "https://docs.expo.dev/versions/latest/sdk/permissions/", | ||
"jest": { | ||
@@ -38,3 +38,3 @@ "preset": "expo-module-scripts/ios" | ||
"dependencies": { | ||
"expo-modules-core": "~0.2.0" | ||
"expo-modules-core": "~0.4.0" | ||
}, | ||
@@ -45,3 +45,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "6e8cfadff90f106d6321d0dd8c4158f12a973d30" | ||
"gitHead": "1fffde73411ee7a642b98f1506a8de921805d52b" | ||
} |
import { PermissionExpiration, PermissionMap, PermissionStatus } from './Permissions.types'; | ||
export function coalesceStatuses(permissions: PermissionMap): PermissionStatus { | ||
const statuses = Object.keys(permissions).map(type => permissions[type].status); | ||
const statuses = Object.keys(permissions).map((type) => permissions[type].status); | ||
statuses.sort((status1, status2) => _getStatusWeight(status1) - _getStatusWeight(status2)); | ||
@@ -28,3 +28,3 @@ // We choose the "heaviest" status with the most implications | ||
const maxExpiration = 9007199254740991; // Number.MAX_SAFE_INTEGER | ||
const expirations = Object.keys(permissions).map(type => permissions[type].expires); | ||
const expirations = Object.keys(permissions).map((type) => permissions[type].expires); | ||
expirations.sort( | ||
@@ -31,0 +31,0 @@ (e1, e2) => |
@@ -1,2 +0,2 @@ | ||
import { NativeModulesProxy } from '@unimodules/core'; | ||
import { NativeModulesProxy } from 'expo-modules-core'; | ||
export default NativeModulesProxy.ExpoPermissions; |
@@ -29,3 +29,3 @@ import { | ||
(navigator as any).mozGetUserMedia || | ||
function() { | ||
function () { | ||
const error: any = new Error('Permission unimplemented'); | ||
@@ -87,3 +87,3 @@ error.code = 0; | ||
async function askForLocationPermissionAsync(): Promise<PermissionInfo> { | ||
return new Promise(resolve => { | ||
return new Promise((resolve) => { | ||
navigator.geolocation.getCurrentPosition( | ||
@@ -97,3 +97,3 @@ () => | ||
}), | ||
({ code }: PositionError) => { | ||
({ code }: GeolocationPositionError) => { | ||
// https://developer.mozilla.org/en-US/docs/Web/API/PositionError/code | ||
@@ -100,0 +100,0 @@ if (code === 1) { |
@@ -37,3 +37,3 @@ import { useCallback, useRef, useEffect, useState } from 'react'; | ||
() => | ||
askAsync(...types).then(response => { | ||
askAsync(...types).then((response) => { | ||
if (isMounted.current) { | ||
@@ -48,3 +48,3 @@ setData(response); | ||
() => | ||
getAsync(...types).then(response => { | ||
getAsync(...types).then((response) => { | ||
if (isMounted.current) { | ||
@@ -51,0 +51,0 @@ setData(response); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
121734
+ Addedcompare-versions@3.6.0(transitive)
+ Addedexpo-modules-core@0.4.10(transitive)
+ Addedinvariant@2.2.4(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
- Removedexpo-modules-core@0.2.0(transitive)
Updatedexpo-modules-core@~0.4.0