Skip to content

Commit 916cad5

Browse files
committed
Add own fork of expo-permissions, from expo commit ba046bb1946ccc10ded80facdfde4bb67998e9f3.
1 parent ddc919f commit 916cad5

File tree

69 files changed

+3027
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+3027
-3
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ npm start
1010
- @nativescript-community/expo-contacts-nativescript-plugin
1111
- @nativescript-community/expo-nativescript-adapter
1212
- @nativescript-community/expo-nativescript-react-native-shim
13+
- @nativescript-community/expo-permissions
1314
- @nativescript-community/expo-permissions-nativescript-plugin
1415

1516
# How to use?

apps/demo-angular/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
"@nativescript-community/expo-nativescript-adapter": "file:../../dist/packages/expo-nativescript-adapter",
2424
"@nativescript-community/expo-permissions-nativescript-plugin": "file:../../dist/packages/expo-permissions-nativescript-plugin",
2525
"@nativescript-community/expo-contacts-nativescript-plugin": "file:../../dist/packages/expo-contacts-nativescript-plugin",
26-
"@nativescript-community/expo-nativescript-react-native-shim": "file:../../dist/packages/expo-nativescript-react-native-shim"
26+
"@nativescript-community/expo-nativescript-react-native-shim": "file:../../dist/packages/expo-nativescript-react-native-shim",
27+
"@nativescript-community/expo-permissions": "file:../../dist/packages/expo-permissions"
2728
},
2829
"devDependencies": {
2930
"@angular/compiler-cli": "file:../../node_modules/@angular/compiler-cli",

apps/demo-angular/src/app-routing.module.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const routes: Routes = [
1010
{ path: 'expo-contacts-nativescript-plugin', loadChildren: () => import('./plugin-demos/expo-contacts-nativescript-plugin.module').then((m) => m.ExpoContactsNativescriptPluginModule) },
1111
{ path: 'expo-nativescript-adapter', loadChildren: () => import('./plugin-demos/expo-nativescript-adapter.module').then((m) => m.ExpoNativescriptAdapterModule) },
1212
{ path: 'expo-nativescript-react-native-shim', loadChildren: () => import('./plugin-demos/expo-nativescript-react-native-shim.module').then((m) => m.ExpoNativescriptReactNativeShimModule) },
13+
{ path: 'expo-permissions', loadChildren: () => import('./plugin-demos/expo-permissions.module').then((m) => m.ExpoPermissionsModule) },
1314
{ path: 'expo-permissions-nativescript-plugin', loadChildren: () => import('./plugin-demos/expo-permissions-nativescript-plugin.module').then((m) => m.ExpoPermissionsNativescriptPluginModule) },
1415
];
1516

apps/demo-angular/src/home.component.ts

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ export class HomeComponent {
1515
{
1616
name: 'expo-nativescript-react-native-shim',
1717
},
18+
{
19+
name: 'expo-permissions',
20+
},
1821
{
1922
name: 'expo-permissions-nativescript-plugin',
2023
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<ActionBar title="expo-permissions" class="action-bar"> </ActionBar>
2+
<StackLayout class="p-20">
3+
<ScrollView class="h-full">
4+
<StackLayout>
5+
<Button text="Test expo-permissions" (tap)="demoShared.testIt()" class="btn btn-primary"></Button>
6+
</StackLayout>
7+
</ScrollView>
8+
</StackLayout>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Component, NgZone } from '@angular/core';
2+
import { DemoSharedExpoPermissions } from '@demo/shared';
3+
import {} from '@nativescript-community/expo-permissions';
4+
5+
@Component({
6+
selector: 'demo-expo-permissions',
7+
templateUrl: 'expo-permissions.component.html',
8+
})
9+
export class ExpoPermissionsComponent {
10+
demoShared: DemoSharedExpoPermissions;
11+
12+
constructor(private _ngZone: NgZone) {}
13+
14+
ngOnInit() {
15+
this.demoShared = new DemoSharedExpoPermissions();
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
2+
import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular';
3+
import { ExpoPermissionsComponent } from './expo-permissions.component';
4+
5+
@NgModule({
6+
imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: ExpoPermissionsComponent }])],
7+
declarations: [ExpoPermissionsComponent],
8+
schemas: [NO_ERRORS_SCHEMA],
9+
})
10+
export class ExpoPermissionsModule {}

apps/demo/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"unimodules-file-system-interface": "file:../../node_modules/unimodules-file-system-interface",
1515
"unimodules-permissions-interface": "file:../../node_modules/unimodules-permissions-interface",
1616
"@nativescript-community/expo-contacts-nativescript-plugin": "file:../../packages/expo-contacts-nativescript-plugin",
17-
"@nativescript-community/expo-nativescript-react-native-shim": "file:../../packages/expo-nativescript-react-native-shim"
17+
"@nativescript-community/expo-nativescript-react-native-shim": "file:../../packages/expo-nativescript-react-native-shim",
18+
"@nativescript-community/expo-permissions": "file:../../packages/expo-permissions"
1819
},
1920
"devDependencies": {
2021
"@nativescript/android": "7.0.1",

apps/demo/src/main-page.xml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<Button text="expo-permissions-nativescript-plugin" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
1111
<Button text="expo-contacts-nativescript-plugin" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
1212
<Button text="expo-nativescript-react-native-shim" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
13+
<Button text="expo-permissions" tap="{{ viewDemo }}" class="btn btn-primary view-demo"/>
1314
</StackLayout>
1415
</ScrollView>
1516
</StackLayout>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { Observable, EventData, Page } from '@nativescript/core';
2+
import { DemoSharedExpoPermissions } from '@demo/shared';
3+
import {} from '@nativescript-community/expo-permissions';
4+
5+
export function navigatingTo(args: EventData) {
6+
const page = <Page>args.object;
7+
page.bindingContext = new DemoModel();
8+
}
9+
10+
export class DemoModel extends DemoSharedExpoPermissions {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" class="page">
2+
<Page.actionBar>
3+
<ActionBar title="expo-permissions" icon="" class="action-bar">
4+
</ActionBar>
5+
</Page.actionBar>
6+
<StackLayout class="p-20">
7+
<ScrollView class="h-full">
8+
<StackLayout>
9+
<Button text="Test expo-permissions" tap="{{ testIt }}" class="btn btn-primary"/>
10+
11+
</StackLayout>
12+
</ScrollView>
13+
</StackLayout>
14+
</Page>

nx.json

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
},
3838
"expo-nativescript-react-native-shim": {
3939
"tags": []
40+
},
41+
"expo-permissions": {
42+
"tags": []
4043
}
4144
},
4245
"workspaceLayout": {
+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Changelog
2+
3+
## Unpublished
4+
5+
### 🛠 Breaking changes
6+
7+
### 🎉 New features
8+
9+
### 🐛 Bug fixes
10+
11+
## 10.0.0 — 2020-11-17
12+
13+
### 🛠 Breaking changes
14+
15+
- Make background location an opt-in permission on Android. ([#10989](https://github.com/expo/expo/pull/10989) by [@bycedric](https://github.com/bycedric))
16+
- Upgrade `androidx.appcompat` to `1.2.0`. ([#11018](https://github.com/expo/expo/pull/11018) by [@bbarthec](https://github.com/bbarthec))
17+
18+
## 9.3.0 — 2020-08-18
19+
20+
### 🛠 Breaking changes
21+
22+
- Fixed motion permission bug on web. ([#9670](https://github.com/expo/expo/pull/9670) by [@EvanBacon](https://github.com/EvanBacon))
23+
24+
## 9.2.0 — 2020-08-11
25+
26+
### 🎉 New features
27+
28+
- Added support for the limited `CAMERA_ROLL` permission on iOS 14. ([#9423](https://github.com/expo/expo/pull/9423) by [@lukmccall](https://github.com/lukmccall))
29+
30+
## 9.1.0 — 2020-07-27
31+
32+
### 🎉 New features
33+
34+
- Add `usePermissions` hook to simplify permission handling. ([#8788](https://github.com/expo/expo/pull/8788) by [@bycedric](https://github.com/bycedric))
35+
36+
### 🐛 Bug fixes
37+
38+
- Ensure browser globals `DeviceMotionEvent` and `DeviceOrientationEvent` exist before attempting to read from them. ([#9236](https://github.com/expo/expo/pull/9236) by [@evanbacon](https://github.com/evanbacon))
39+
- Fixed `askAsync` rejecting with `permission cannot be null or empty` in the bare workflow. ([#8910](https://github.com/expo/expo/pull/8910) by [@lukmccall](https://github.com/lukmccall))
40+
- Fixed `getPermissionsAsync` returning incorrect status in the Expo Client app on iOS. ([#9060](https://github.com/expo/expo/pull/9060) by [@lukmccall](https://github.com/lukmccall))
41+
- Remove require cycle for `usePermissions` hook. ([#9219](https://github.com/expo/expo/pull/9219) by [@EvanBacon](https://github.com/EvanBacon))
42+
43+
## 9.0.1 — 2020-05-29
44+
45+
### 🎉 New features
46+
47+
- If permission is not recognized, show the correct expo package to link. ([#8546])(https://github.com/expo/expo/pull/8046) by [@jarvisluong](https://github.com/jarvisluong)
48+
49+
## 9.0.0 — 2020-05-28
50+
51+
### 🛠 Breaking changes
52+
53+
- Removed support for fetching notifications-related permissions (they have been moved to `expo-notifications` package). You no longer will be able to call `getAsync` or `askAsync` with `.NOTIFICATIONS` or `.USER_FACING_NOTIFICATIONS` without having `expo-notifications` package installed. ([#8486](https://github.com/expo/expo/pull/8486) by [@sjchmiela](https://github.com/sjchmiela))
54+
55+
### 🐛 Bug fixes
56+
57+
- Fixed `Permissions.NOTIFICATIONS` was granted even if notifications were disabled. ([#8539](https://github.com/expo/expo/pull/8539) by [@lukmccall](https://github.com/lukmccall))
58+
59+
## 8.2.0 — 2020-05-27
60+
61+
### 🐛 Bug fixes
62+
63+
- Fix permissions in the headless mode. ([#7962](https://github.com/expo/expo/pull/7962) by [@lukmccall](https://github.com/lukmccall))
64+
- Fixed `permission cannot be null or empty` error when asking for `WRITE_SETTINGS` permission on Android. ([#7276](https://github.com/expo/expo/pull/7276) by [@lukmccall](https://github.com/lukmccall))
65+
- Fixed a rare undetermined behavior that may have been a result of misuse of `dispatch_once_t` on iOS ([#7576](https://github.com/expo/expo/pull/7576) by [@sjchmiela](https://github.com/sjchmiela))

packages/expo-permissions/README.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# expo-permissions
2+
3+
Note: This, `@nativescript-community/expo-permissions`, is simply a minor fork of [`expo-permissions`](https://github.com/expo/expo/tree/master/packages/expo-permissions) as a workaround to decouple the Android implementation from React Native. The fork was taken from the state of the `expo` monorepo on commit `ba046bb1946ccc10ded80facdfde4bb67998e9f3` (dated 11th December 2020).
4+
5+
Allows you prompt for various permissions to access device sensors, personal data, etc.
6+
7+
# API documentation
8+
9+
- [Documentation for the master branch](https://github.com/expo/expo/blob/master/docs/pages/versions/unversioned/sdk/permissions.md)
10+
- [Documentation for the latest stable release](https://docs.expo.io/versions/latest/sdk/permissions/)
11+
12+
# Installation in managed Expo projects
13+
14+
For managed [managed](https://docs.expo.io/versions/latest/introduction/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](https://docs.expo.io/versions/latest/sdk/permissions/).
15+
16+
# Installation in bare React Native projects
17+
18+
For bare React Native projects, this package is included in [`react-native-unimodules`](https://github.com/expo/expo/tree/master/packages/react-native-unimodules). Please refer to those installation instructions to install this package.
19+
20+
# Contributing
21+
22+
Contributions are very welcome! Please refer to guidelines described in the [contributing guide](https://github.com/expo/expo#contributing).

0 commit comments

Comments
 (0)