-
Notifications
You must be signed in to change notification settings - Fork 174
/
Copy pathwithViro.ts
75 lines (68 loc) · 1.88 KB
/
withViro.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { ConfigPlugin } from "@expo/config-plugins";
import { withViroAndroid } from "./withViroAndroid";
import { withViroIos } from "./withViroIos";
const CAMERA_USAGE = "Allow $(PRODUCT_NAME) to use your camera";
const MICROPHONE_USAGE = "Allow $(PRODUCT_NAME) to use your microphone";
const READ_PHOTOS_USAGE = "Allow $(PRODUCT_NAME) to access your photos";
const WRITE_PHOTOS_USAGE = "Allow $(PRODUCT_NAME) to save photos";
export type XrMode = "GVR" | "AR" | "OVR_MOBILE";
/**
* Options interface for configuring expo plugin
*/
export interface ViroConfigurationOptions {
ios?: {
/**
* String for app to use for camera usage.
*
* DEFAULTS TO: 'Allow $(PRODUCT_NAME) to use your camera'
*/
cameraUsagePermission?: string;
/**
* String for app to use for microphone usage.
*
* DEFAULTS TO: "Allow $(PRODUCT_NAME) to use your microphone"
*/
microphoneUsagePermission?: string;
/**
* String for app to read photos.
*
* DEFAULTS TO: 'Allow $(PRODUCT_NAME) to access your photos'
*/
photosPermission?: string;
/**
* String for app to save photos
*
* DEFAULTS TO: 'Allow $(PRODUCT_NAME) to save photos'
*/
savePhotosPermission?: string;
};
android?: {
xRMode?: XrMode[];
};
}
/**
* Default options
*/
export const DEFAULTS = {
ios: {
cameraUsagePermission: CAMERA_USAGE,
microphoneUsagePermission: MICROPHONE_USAGE,
photosPermission: READ_PHOTOS_USAGE,
savePhotosPermission: WRITE_PHOTOS_USAGE,
},
android: {
xRMode: ["GVR", "AR"],
},
};
/**
* Configures Viro to work with Expo projects.
*
* @param config Expo ConfigPlugin
* @returns expo configuration
*/
const withViro: ConfigPlugin<ViroConfigurationOptions> = (config, props) => {
config = withViroIos(config, props);
config = withViroAndroid(config, props);
return config;
};
export default withViro;