expo-constants 12.0.0 → 12.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/README.md +1 -1
- package/android/build.gradle +2 -2
- package/build/Constants.js +49 -10
- package/build/Constants.js.map +1 -1
- package/build/Constants.types.d.ts +6 -0
- package/build/Constants.types.js.map +1 -1
- package/ios/EXConstants/EXConstantsService.m +62 -42
- package/package.json +3 -3
- package/src/Constants.ts +59 -11
- package/src/Constants.types.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,34 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 12.1.3 — 2021-10-22
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- Don't include fonts from family "System Font" (introduced by iOS 15) ([#14577](https://github.com/expo/expo/pull/14577) by [@brentvatne](https://github.com/brentvatne))
|
|
18
|
+
- Fix `Constants.deviceId has been deprecated in favor of generating and storing your own ID.` warnings in classic react-native projects. ([#14837](https://github.com/expo/expo/pull/14837) by [@kudo](https://github.com/kudo))
|
|
19
|
+
|
|
20
|
+
## 12.1.2 — 2021-10-21
|
|
21
|
+
|
|
22
|
+
_This version does not introduce any user-facing changes._
|
|
23
|
+
|
|
24
|
+
## 12.1.1 — 2021-10-15
|
|
25
|
+
|
|
26
|
+
### 🛠 Breaking changes
|
|
27
|
+
|
|
28
|
+
- Deprecated `Constants.deviceYearClass`, moved to `expo-device` - `Device.deviceYearClass` ([#14691](https://github.com/expo/expo/pull/14691) by [@EvanBacon](https://github.com/EvanBacon))
|
|
29
|
+
- Deprecated `Constants.platform.ios.model`, moved to `expo-device` - `Device.modelName` ([#14691](https://github.com/expo/expo/pull/14691) by [@EvanBacon](https://github.com/EvanBacon))
|
|
30
|
+
|
|
31
|
+
### 🎉 New features
|
|
32
|
+
|
|
33
|
+
- Added support for iOS 15.0 devices ([#14640](https://github.com/expo/expo/pull/14640) by [@EvanBacon](https://github.com/EvanBacon))
|
|
34
|
+
|
|
35
|
+
## 12.1.0 — 2021-10-01
|
|
36
|
+
|
|
37
|
+
### 🐛 Bug fixes
|
|
38
|
+
|
|
39
|
+
- Don't include fonts from family "System Font" (introduced by iOS 15) ([#14577](https://github.com/expo/expo/pull/14577) by [@brentvatne](https://github.com/brentvatne))
|
|
40
|
+
|
|
13
41
|
## 12.0.0 — 2021-09-28
|
|
14
42
|
|
|
15
43
|
### 🛠 Breaking changes
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ For managed [managed](https://docs.expo.io/versions/latest/introduction/managed-
|
|
|
13
13
|
|
|
14
14
|
# Installation in bare React Native projects
|
|
15
15
|
|
|
16
|
-
For bare React Native projects, you must ensure that you have [installed and configured the `
|
|
16
|
+
For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
|
|
17
17
|
|
|
18
18
|
### Add the package to your npm dependencies
|
|
19
19
|
|
package/android/build.gradle
CHANGED
|
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '12.
|
|
6
|
+
version = '12.1.3'
|
|
7
7
|
|
|
8
8
|
apply from: "../scripts/get-app-config-android.gradle"
|
|
9
9
|
|
|
@@ -63,7 +63,7 @@ android {
|
|
|
63
63
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
64
64
|
targetSdkVersion safeExtGet("targetSdkVersion", 30)
|
|
65
65
|
versionCode 33
|
|
66
|
-
versionName "12.
|
|
66
|
+
versionName "12.1.3"
|
|
67
67
|
}
|
|
68
68
|
lintOptions {
|
|
69
69
|
abortOnError false
|
package/build/Constants.js
CHANGED
|
@@ -39,6 +39,8 @@ if (!rawManifest && ExponentConstants && ExponentConstants.manifest) {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
const { name, appOwnership, ...nativeConstants } = (ExponentConstants || {});
|
|
42
|
+
let warnedAboutDeviceYearClass = false;
|
|
43
|
+
let warnedAboutIosModel = false;
|
|
42
44
|
let warnedAboutInstallationId = false;
|
|
43
45
|
let warnedAboutDeviceId = false;
|
|
44
46
|
let warnedAboutLinkingUrl = false;
|
|
@@ -46,8 +48,18 @@ const constants = {
|
|
|
46
48
|
...nativeConstants,
|
|
47
49
|
// Ensure this is null in bare workflow
|
|
48
50
|
appOwnership: appOwnership ?? null,
|
|
51
|
+
};
|
|
52
|
+
const constantsPropertiesGetter = {
|
|
49
53
|
// Deprecated fields
|
|
50
|
-
|
|
54
|
+
deviceYearClass() {
|
|
55
|
+
if (!warnedAboutDeviceYearClass) {
|
|
56
|
+
console.warn(`Constants.deviceYearClass has been deprecated in favor of expo-device's Device.deviceYearClass property. This API will be removed in SDK 45.`);
|
|
57
|
+
warnedAboutDeviceYearClass = true;
|
|
58
|
+
}
|
|
59
|
+
return nativeConstants.deviceYearClass;
|
|
60
|
+
},
|
|
61
|
+
// Deprecated fields
|
|
62
|
+
installationId() {
|
|
51
63
|
if (!warnedAboutInstallationId) {
|
|
52
64
|
console.warn(`Constants.installationId has been deprecated in favor of generating and storing your own ID. Implement it using expo-application's androidId on Android and a storage API such as expo-secure-store on iOS and localStorage on the web. This API will be removed in SDK 44.`);
|
|
53
65
|
warnedAboutInstallationId = true;
|
|
@@ -55,28 +67,28 @@ const constants = {
|
|
|
55
67
|
return nativeConstants.installationId;
|
|
56
68
|
},
|
|
57
69
|
// Legacy aliases
|
|
58
|
-
|
|
70
|
+
deviceId() {
|
|
59
71
|
if (!warnedAboutDeviceId) {
|
|
60
72
|
console.warn(`Constants.deviceId has been deprecated in favor of generating and storing your own ID. This API will be removed in SDK 44.`);
|
|
61
73
|
warnedAboutDeviceId = true;
|
|
62
74
|
}
|
|
63
75
|
return nativeConstants.installationId;
|
|
64
76
|
},
|
|
65
|
-
|
|
77
|
+
linkingUrl() {
|
|
66
78
|
if (!warnedAboutLinkingUrl) {
|
|
67
79
|
console.warn(`Constants.linkingUrl has been renamed to Constants.linkingUri. Consider using the Linking API directly. Constants.linkingUrl will be removed in SDK 44.`);
|
|
68
80
|
warnedAboutLinkingUrl = true;
|
|
69
81
|
}
|
|
70
82
|
return nativeConstants.linkingUri;
|
|
71
83
|
},
|
|
72
|
-
|
|
84
|
+
manifest() {
|
|
73
85
|
const maybeManifest = getManifest();
|
|
74
86
|
if (!maybeManifest || !isAppManifest(maybeManifest)) {
|
|
75
87
|
return null;
|
|
76
88
|
}
|
|
77
89
|
return maybeManifest;
|
|
78
90
|
},
|
|
79
|
-
|
|
91
|
+
manifest2() {
|
|
80
92
|
const maybeManifest = getManifest();
|
|
81
93
|
if (!maybeManifest || !isManifest(maybeManifest)) {
|
|
82
94
|
return null;
|
|
@@ -89,27 +101,54 @@ const constants = {
|
|
|
89
101
|
* It behaves similarly to the original one, but suppresses warning upon no manifest available.
|
|
90
102
|
* `expo-asset` uses it to prevent users from seeing mentioned warning.
|
|
91
103
|
*/
|
|
92
|
-
|
|
104
|
+
__unsafeNoWarnManifest() {
|
|
93
105
|
const maybeManifest = getManifest(true);
|
|
94
106
|
if (!maybeManifest || !isAppManifest(maybeManifest)) {
|
|
95
107
|
return null;
|
|
96
108
|
}
|
|
97
109
|
return maybeManifest;
|
|
98
110
|
},
|
|
99
|
-
|
|
111
|
+
__unsafeNoWarnManifest2() {
|
|
100
112
|
const maybeManifest = getManifest(true);
|
|
101
113
|
if (!maybeManifest || !isManifest(maybeManifest)) {
|
|
102
114
|
return null;
|
|
103
115
|
}
|
|
104
116
|
return maybeManifest;
|
|
105
117
|
},
|
|
106
|
-
|
|
118
|
+
};
|
|
119
|
+
definePropertiesGetter(constants, constantsPropertiesGetter);
|
|
120
|
+
Object.defineProperty(constants, '__rawManifest_TEST', {
|
|
121
|
+
get() {
|
|
107
122
|
return rawManifest;
|
|
108
123
|
},
|
|
109
|
-
set
|
|
124
|
+
set(value) {
|
|
110
125
|
rawManifest = value;
|
|
111
126
|
},
|
|
112
|
-
|
|
127
|
+
// Prevent the warning from being thrown, or the value from being used when the user interacts with the entire object.
|
|
128
|
+
enumerable: false,
|
|
129
|
+
});
|
|
130
|
+
// Add deprecation warning for `platform.ios.model`
|
|
131
|
+
if (constants?.platform?.ios) {
|
|
132
|
+
const originalModel = nativeConstants.platform.ios.model;
|
|
133
|
+
definePropertiesGetter(constants.platform.ios, {
|
|
134
|
+
model() {
|
|
135
|
+
if (!warnedAboutIosModel) {
|
|
136
|
+
console.warn(`Constants.platform.ios.model has been deprecated in favor of expo-device's Device.modelName property. This API will be removed in SDK 45.`);
|
|
137
|
+
warnedAboutIosModel = true;
|
|
138
|
+
}
|
|
139
|
+
return originalModel;
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function definePropertiesGetter(target, props) {
|
|
144
|
+
for (const [name, func] of Object.entries(props)) {
|
|
145
|
+
Object.defineProperty(target, name, {
|
|
146
|
+
get: func,
|
|
147
|
+
// Prevent the warning from being thrown, or the value from being used when the user interacts with the entire object.
|
|
148
|
+
enumerable: false,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
113
152
|
function isAppManifest(manifest) {
|
|
114
153
|
return !isManifest(manifest);
|
|
115
154
|
}
|
package/build/Constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../src/Constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAGL,YAAY,EAEZ,oBAAoB,EAKpB,kBAAkB,GAEnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAEL,YAAY,EAEZ,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C,WAAW;YACzE,eAAe,CAAC,oBAAoB,KAAK,oBAAoB,CAAC,UAAU,EACxE;YACA,sEAAsE;YACtE,mEAAmE;YACnE,MAAM,IAAI,UAAU,CAClB,oCAAoC,EACpC,yBAAyB,mBAAmB,sBAAsB,CACnE,CAAC;SACH;KACF;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,eAAe,SAAsB,CAAC","sourcesContent":["import { CodedError, NativeModulesProxy } from 'expo-modules-core';\nimport { Platform, NativeModules } from 'react-native';\n\nimport {\n AndroidManifest,\n AppManifest,\n AppOwnership,\n Constants,\n ExecutionEnvironment,\n IOSManifest,\n Manifest,\n NativeConstants,\n PlatformManifest,\n UserInterfaceIdiom,\n WebManifest,\n} from './Constants.types';\nimport ExponentConstants from './ExponentConstants';\n\nexport {\n AndroidManifest,\n AppOwnership,\n Constants,\n ExecutionEnvironment,\n IOSManifest,\n NativeConstants,\n PlatformManifest,\n UserInterfaceIdiom,\n WebManifest,\n};\n\nif (!ExponentConstants) {\n console.warn(\n \"No native ExponentConstants module found, are you sure the expo-constants's module is linked properly?\"\n );\n}\n\nlet rawManifest: AppManifest | Manifest | null = null;\n// If expo-updates defines a non-empty manifest, prefer that one\nif (NativeModulesProxy.ExpoUpdates) {\n let updatesManifest;\n if (NativeModulesProxy.ExpoUpdates.manifest) {\n updatesManifest = NativeModulesProxy.ExpoUpdates.manifest;\n } else if (NativeModulesProxy.ExpoUpdates.manifestString) {\n updatesManifest = JSON.parse(NativeModulesProxy.ExpoUpdates.manifestString);\n }\n if (updatesManifest && Object.keys(updatesManifest).length > 0) {\n rawManifest = updatesManifest;\n }\n}\n\n// If dev-launcher defines a non-empty manifest, prefer that one\nif (NativeModules.EXDevLauncher) {\n let devLauncherManifest;\n if (NativeModules.EXDevLauncher.manifestString) {\n devLauncherManifest = JSON.parse(NativeModules.EXDevLauncher.manifestString);\n }\n\n if (devLauncherManifest && Object.keys(devLauncherManifest).length > 0) {\n rawManifest = devLauncherManifest;\n }\n}\n\n// Fall back to ExponentConstants.manifest if we don't have one from Updates\nif (!rawManifest && ExponentConstants && ExponentConstants.manifest) {\n rawManifest = ExponentConstants.manifest;\n // On Android we pass the manifest in JSON form so this step is necessary\n if (typeof rawManifest === 'string') {\n rawManifest = JSON.parse(rawManifest);\n }\n}\n\nconst { name, appOwnership, ...nativeConstants } = (ExponentConstants || {}) as any;\n\nlet warnedAboutInstallationId = false;\nlet warnedAboutDeviceId = false;\nlet warnedAboutLinkingUrl = false;\n\nconst constants = {\n ...nativeConstants,\n // Ensure this is null in bare workflow\n appOwnership: appOwnership ?? null,\n // Deprecated fields\n get installationId() {\n if (!warnedAboutInstallationId) {\n console.warn(\n `Constants.installationId has been deprecated in favor of generating and storing your own ID. Implement it using expo-application's androidId on Android and a storage API such as expo-secure-store on iOS and localStorage on the web. This API will be removed in SDK 44.`\n );\n warnedAboutInstallationId = true;\n }\n return nativeConstants.installationId;\n },\n // Legacy aliases\n get deviceId() {\n if (!warnedAboutDeviceId) {\n console.warn(\n `Constants.deviceId has been deprecated in favor of generating and storing your own ID. This API will be removed in SDK 44.`\n );\n warnedAboutDeviceId = true;\n }\n return nativeConstants.installationId;\n },\n get linkingUrl() {\n if (!warnedAboutLinkingUrl) {\n console.warn(\n `Constants.linkingUrl has been renamed to Constants.linkingUri. Consider using the Linking API directly. Constants.linkingUrl will be removed in SDK 44.`\n );\n warnedAboutLinkingUrl = true;\n }\n return nativeConstants.linkingUri;\n },\n get manifest(): AppManifest | null {\n const maybeManifest = getManifest();\n if (!maybeManifest || !isAppManifest(maybeManifest)) {\n return null;\n }\n return maybeManifest;\n },\n get manifest2(): Manifest | null {\n const maybeManifest = getManifest();\n if (!maybeManifest || !isManifest(maybeManifest)) {\n return null;\n }\n return maybeManifest;\n },\n /**\n * Use `manifest` property by default.\n * This property is only used for internal purposes.\n * It behaves similarly to the original one, but suppresses warning upon no manifest available.\n * `expo-asset` uses it to prevent users from seeing mentioned warning.\n */\n get __unsafeNoWarnManifest(): AppManifest | Manifest | null {\n const maybeManifest = getManifest(true);\n if (!maybeManifest || !isAppManifest(maybeManifest)) {\n return null;\n }\n return maybeManifest;\n },\n get __unsafeNoWarnManifest2(): Manifest | Manifest | null {\n const maybeManifest = getManifest(true);\n if (!maybeManifest || !isManifest(maybeManifest)) {\n return null;\n }\n return maybeManifest;\n },\n get __rawManifest_TEST(): AppManifest | Manifest | null {\n return rawManifest;\n },\n set __rawManifest_TEST(value: AppManifest | Manifest | null) {\n rawManifest = value;\n },\n} as Constants;\n\nfunction isAppManifest(manifest: AppManifest | Manifest): manifest is AppManifest {\n return !isManifest(manifest);\n}\n\nfunction isManifest(manifest: AppManifest | Manifest): manifest is Manifest {\n return 'metadata' in manifest;\n}\n\nfunction getManifest(suppressWarning = false): AppManifest | Manifest | null {\n if (!rawManifest) {\n const invalidManifestType = rawManifest === null ? 'null' : 'undefined';\n if (\n nativeConstants.executionEnvironment === ExecutionEnvironment.Bare &&\n Platform.OS !== 'web'\n ) {\n if (!suppressWarning) {\n console.warn(\n `Constants.manifest is ${invalidManifestType} because the embedded app.config could not be read. Ensure that you have installed the expo-constants build scripts if you need to read from Constants.manifest.`\n );\n }\n } else if (\n nativeConstants.executionEnvironment === ExecutionEnvironment.StoreClient ||\n nativeConstants.executionEnvironment === ExecutionEnvironment.Standalone\n ) {\n // If we somehow get here, this is a truly exceptional state to be in.\n // Constants.manifest should *always* be defined in those contexts.\n throw new CodedError(\n 'ERR_CONSTANTS_MANIFEST_UNAVAILABLE',\n `Constants.manifest is ${invalidManifestType}, must be an object.`\n );\n }\n }\n return rawManifest;\n}\n\nexport default constants as Constants;\n"]}
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../src/Constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAGL,YAAY,EA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AAW;YACzE,eAAe,CAAC,oBAAoB,KAAK,oBAAoB,CAAC,UAAU,EACxE;YACA,sEAAsE;YACtE,mEAAmE;YACnE,MAAM,IAAI,UAAU,CAClB,oCAAoC,EACpC,yBAAyB,mBAAmB,sBAAsB,CACnE,CAAC;SACH;KACF;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,eAAe,SAAsB,CAAC","sourcesContent":["import { CodedError, NativeModulesProxy } from 'expo-modules-core';\nimport { Platform, NativeModules } from 'react-native';\n\nimport {\n AndroidManifest,\n AppManifest,\n AppOwnership,\n Constants,\n ExecutionEnvironment,\n IOSManifest,\n Manifest,\n NativeConstants,\n PlatformManifest,\n UserInterfaceIdiom,\n WebManifest,\n} from './Constants.types';\nimport ExponentConstants from './ExponentConstants';\n\nexport {\n AndroidManifest,\n AppOwnership,\n Constants,\n ExecutionEnvironment,\n IOSManifest,\n NativeConstants,\n PlatformManifest,\n UserInterfaceIdiom,\n WebManifest,\n};\n\nif (!ExponentConstants) {\n console.warn(\n \"No native ExponentConstants module found, are you sure the expo-constants's module is linked properly?\"\n );\n}\n\nlet rawManifest: AppManifest | Manifest | null = null;\n// If expo-updates defines a non-empty manifest, prefer that one\nif (NativeModulesProxy.ExpoUpdates) {\n let updatesManifest;\n if (NativeModulesProxy.ExpoUpdates.manifest) {\n updatesManifest = NativeModulesProxy.ExpoUpdates.manifest;\n } else if (NativeModulesProxy.ExpoUpdates.manifestString) {\n updatesManifest = JSON.parse(NativeModulesProxy.ExpoUpdates.manifestString);\n }\n if (updatesManifest && Object.keys(updatesManifest).length > 0) {\n rawManifest = updatesManifest;\n }\n}\n\n// If dev-launcher defines a non-empty manifest, prefer that one\nif (NativeModules.EXDevLauncher) {\n let devLauncherManifest;\n if (NativeModules.EXDevLauncher.manifestString) {\n devLauncherManifest = JSON.parse(NativeModules.EXDevLauncher.manifestString);\n }\n\n if (devLauncherManifest && Object.keys(devLauncherManifest).length > 0) {\n rawManifest = devLauncherManifest;\n }\n}\n\n// Fall back to ExponentConstants.manifest if we don't have one from Updates\nif (!rawManifest && ExponentConstants && ExponentConstants.manifest) {\n rawManifest = ExponentConstants.manifest;\n // On Android we pass the manifest in JSON form so this step is necessary\n if (typeof rawManifest === 'string') {\n rawManifest = JSON.parse(rawManifest);\n }\n}\n\nconst { name, appOwnership, ...nativeConstants } = (ExponentConstants || {}) as any;\n\nlet warnedAboutDeviceYearClass = false;\nlet warnedAboutIosModel = false;\nlet warnedAboutInstallationId = false;\nlet warnedAboutDeviceId = false;\nlet warnedAboutLinkingUrl = false;\n\nconst constants: Constants = {\n ...nativeConstants,\n // Ensure this is null in bare workflow\n appOwnership: appOwnership ?? null,\n};\n\nconst constantsPropertiesGetter: AccessorProps = {\n // Deprecated fields\n deviceYearClass() {\n if (!warnedAboutDeviceYearClass) {\n console.warn(\n `Constants.deviceYearClass has been deprecated in favor of expo-device's Device.deviceYearClass property. This API will be removed in SDK 45.`\n );\n warnedAboutDeviceYearClass = true;\n }\n return nativeConstants.deviceYearClass;\n },\n // Deprecated fields\n installationId() {\n if (!warnedAboutInstallationId) {\n console.warn(\n `Constants.installationId has been deprecated in favor of generating and storing your own ID. Implement it using expo-application's androidId on Android and a storage API such as expo-secure-store on iOS and localStorage on the web. This API will be removed in SDK 44.`\n );\n warnedAboutInstallationId = true;\n }\n return nativeConstants.installationId;\n },\n // Legacy aliases\n deviceId() {\n if (!warnedAboutDeviceId) {\n console.warn(\n `Constants.deviceId has been deprecated in favor of generating and storing your own ID. This API will be removed in SDK 44.`\n );\n warnedAboutDeviceId = true;\n }\n return nativeConstants.installationId;\n },\n linkingUrl() {\n if (!warnedAboutLinkingUrl) {\n console.warn(\n `Constants.linkingUrl has been renamed to Constants.linkingUri. Consider using the Linking API directly. Constants.linkingUrl will be removed in SDK 44.`\n );\n warnedAboutLinkingUrl = true;\n }\n return nativeConstants.linkingUri;\n },\n manifest(): AppManifest | null {\n const maybeManifest = getManifest();\n if (!maybeManifest || !isAppManifest(maybeManifest)) {\n return null;\n }\n return maybeManifest;\n },\n manifest2(): Manifest | null {\n const maybeManifest = getManifest();\n if (!maybeManifest || !isManifest(maybeManifest)) {\n return null;\n }\n return maybeManifest;\n },\n /**\n * Use `manifest` property by default.\n * This property is only used for internal purposes.\n * It behaves similarly to the original one, but suppresses warning upon no manifest available.\n * `expo-asset` uses it to prevent users from seeing mentioned warning.\n */\n __unsafeNoWarnManifest(): AppManifest | Manifest | null {\n const maybeManifest = getManifest(true);\n if (!maybeManifest || !isAppManifest(maybeManifest)) {\n return null;\n }\n return maybeManifest;\n },\n __unsafeNoWarnManifest2(): Manifest | Manifest | null {\n const maybeManifest = getManifest(true);\n if (!maybeManifest || !isManifest(maybeManifest)) {\n return null;\n }\n return maybeManifest;\n },\n};\ndefinePropertiesGetter(constants, constantsPropertiesGetter);\n\nObject.defineProperty(constants, '__rawManifest_TEST', {\n get(): AppManifest | Manifest | null {\n return rawManifest;\n },\n set(value: AppManifest | Manifest | null) {\n rawManifest = value;\n },\n // Prevent the warning from being thrown, or the value from being used when the user interacts with the entire object.\n enumerable: false,\n});\n\n// Add deprecation warning for `platform.ios.model`\nif (constants?.platform?.ios) {\n const originalModel = nativeConstants.platform.ios.model;\n definePropertiesGetter(constants.platform.ios, {\n model() {\n if (!warnedAboutIosModel) {\n console.warn(\n `Constants.platform.ios.model has been deprecated in favor of expo-device's Device.modelName property. This API will be removed in SDK 45.`\n );\n warnedAboutIosModel = true;\n }\n return originalModel;\n },\n });\n}\n\ntype AccessorProps = Record<string, () => any>;\nfunction definePropertiesGetter(target: object, props: AccessorProps) {\n for (const [name, func] of Object.entries(props)) {\n Object.defineProperty(target, name, {\n get: func,\n // Prevent the warning from being thrown, or the value from being used when the user interacts with the entire object.\n enumerable: false,\n });\n }\n}\n\nfunction isAppManifest(manifest: AppManifest | Manifest): manifest is AppManifest {\n return !isManifest(manifest);\n}\n\nfunction isManifest(manifest: AppManifest | Manifest): manifest is Manifest {\n return 'metadata' in manifest;\n}\n\nfunction getManifest(suppressWarning = false): AppManifest | Manifest | null {\n if (!rawManifest) {\n const invalidManifestType = rawManifest === null ? 'null' : 'undefined';\n if (\n nativeConstants.executionEnvironment === ExecutionEnvironment.Bare &&\n Platform.OS !== 'web'\n ) {\n if (!suppressWarning) {\n console.warn(\n `Constants.manifest is ${invalidManifestType} because the embedded app.config could not be read. Ensure that you have installed the expo-constants build scripts if you need to read from Constants.manifest.`\n );\n }\n } else if (\n nativeConstants.executionEnvironment === ExecutionEnvironment.StoreClient ||\n nativeConstants.executionEnvironment === ExecutionEnvironment.Standalone\n ) {\n // If we somehow get here, this is a truly exceptional state to be in.\n // Constants.manifest should *always* be defined in those contexts.\n throw new CodedError(\n 'ERR_CONSTANTS_MANIFEST_UNAVAILABLE',\n `Constants.manifest is ${invalidManifestType}, must be an object.`\n );\n }\n }\n return rawManifest;\n}\n\nexport default constants as Constants;\n"]}
|
|
@@ -17,6 +17,9 @@ export declare enum UserInterfaceIdiom {
|
|
|
17
17
|
export interface IOSManifest {
|
|
18
18
|
buildNumber: string;
|
|
19
19
|
platform: string;
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated Moved to `expo-device` - `Device.modelName`
|
|
22
|
+
*/
|
|
20
23
|
model: string | null;
|
|
21
24
|
userInterfaceIdiom: UserInterfaceIdiom;
|
|
22
25
|
systemVersion: string;
|
|
@@ -133,6 +136,9 @@ export interface NativeConstants {
|
|
|
133
136
|
appOwnership: AppOwnership | null;
|
|
134
137
|
debugMode: boolean;
|
|
135
138
|
deviceName?: string;
|
|
139
|
+
/**
|
|
140
|
+
* @deprecated Moved to `expo-device` - `Device.deviceYearClass`
|
|
141
|
+
*/
|
|
136
142
|
deviceYearClass: number | null;
|
|
137
143
|
executionEnvironment: ExecutionEnvironment;
|
|
138
144
|
experienceUrl: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.types.js","sourceRoot":"","sources":["../src/Constants.types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,yCAAyB,CAAA;IACzB,6BAAa,CAAA;IACb,+BAAe,CAAA;AACjB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,MAAM,CAAN,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,qCAAa,CAAA;IACb,iDAAyB,CAAA;IACzB,mDAA2B,CAAA;AAC7B,CAAC,EAJW,oBAAoB,KAApB,oBAAoB,QAI/B;AAED,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,uCAAiB,CAAA;IACjB,iDAA2B,CAAA;AAC7B,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nexport enum AppOwnership {\n Standalone = 'standalone',\n Expo = 'expo',\n Guest = 'guest',\n}\n\nexport enum ExecutionEnvironment {\n Bare = 'bare',\n Standalone = 'standalone',\n StoreClient = 'storeClient',\n}\n\nexport enum UserInterfaceIdiom {\n Handset = 'handset',\n Tablet = 'tablet',\n Unsupported = 'unsupported',\n}\n\nexport interface IOSManifest {\n buildNumber: string;\n platform: string;\n model: string | null;\n userInterfaceIdiom: UserInterfaceIdiom;\n systemVersion: string;\n [key: string]: any;\n}\n\nexport interface AndroidManifest {\n versionCode: number;\n [key: string]: any;\n}\n\nexport interface WebManifest {\n [key: string]: any;\n}\n\nexport interface ManifestAsset {\n url: string;\n}\n\n/**\n * A modern manifest.\n */\nexport type Manifest = {\n id: string;\n createdAt: string;\n runtimeVersion: string;\n launchAsset: ManifestAsset;\n assets: ManifestAsset[];\n metadata: object;\n extra?: ClientScopingConfig & {\n expoClient?: ExpoClientConfig;\n expoGo?: ExpoGoConfig;\n eas?: EASConfig;\n };\n};\n\nexport type EASConfig = {\n /**\n * The ID for this project if it's using EAS. UUID. This value will not change when a project is transferred\n * between accounts or renamed.\n */\n projectId?: string;\n};\n\nexport type ClientScopingConfig = {\n /**\n * An opaque unique string for scoping client-side data to this project. This value\n * will not change when a project is transferred between accounts or renamed.\n */\n scopeKey?: string;\n};\n\nexport type ExpoGoConfig = {\n mainModuleName?: string;\n debuggerHost?: string;\n logUrl?: string;\n developer?: {\n tool?: string;\n [key: string]: any;\n };\n packagerOpts?: {\n hostType?: string;\n dev?: boolean;\n strict?: boolean;\n minify?: boolean;\n urlType?: string;\n urlRandomness?: string;\n lanType?: string;\n [key: string]: any;\n };\n};\n\nexport type ExpoClientConfig = ExpoConfig & {\n /** Published Apps Only */\n releaseId?: string;\n revisionId?: string;\n releaseChannel?: string;\n bundleUrl: string;\n hostUri?: string;\n publishedTime?: string;\n\n /**\n * The Expo account name and slug for this project.\n * @deprecated - Prefer `projectId` or `originalFullName` instead for identification and `scopeKey` for\n * scoping due to immutability.\n */\n id?: string;\n\n /**\n * The original Expo account name and slug for this project. Formatted like `@username/slug`.\n * When unauthenticated, the username is `@anonymous`. For published projects, this value\n * will not change when a project is transferred between accounts or renamed.\n */\n originalFullName?: string;\n\n /**\n * The Expo account name and slug used for display purposes. Formatted like `@username/slug`.\n * When unauthenticated, the username is `@anonymous`. For published projects, this value\n * may change when a project is transferred between accounts or renamed.\n */\n currentFullName?: string;\n};\n\n/**\n * A classic manifest https://docs.expo.io/guides/how-expo-works/#expo-manifest\n */\nexport type AppManifest = ExpoClientConfig &\n ExpoGoConfig &\n EASConfig &\n ClientScopingConfig & {\n [key: string]: any;\n };\n\nexport interface PlatformManifest {\n ios?: IOSManifest;\n android?: AndroidManifest;\n web?: WebManifest;\n detach?: {\n scheme?: string;\n [key: string]: any;\n };\n logUrl?: string;\n scheme?: string;\n hostUri?: string;\n developer?: string;\n [key: string]: any;\n}\n\nexport interface NativeConstants {\n name: 'ExponentConstants';\n appOwnership: AppOwnership | null;\n debugMode: boolean;\n deviceName?: string;\n deviceYearClass: number | null;\n executionEnvironment: ExecutionEnvironment;\n experienceUrl: string;\n // only nullable on web\n expoRuntimeVersion: string | null;\n /**\n * The version string of the Expo client currently running.\n * Returns `null` in bare workflow and web.\n */\n expoVersion: string | null;\n isDetached?: boolean;\n intentUri?: string;\n /**\n * @deprecated Constants.installationId is deprecated in favor of generating your own ID and\n * storing it. This API will be removed in SDK 44.\n */\n installationId: string;\n isDevice: boolean;\n isHeadless: boolean;\n linkingUri: string;\n nativeAppVersion: string | null;\n nativeBuildVersion: string | null;\n /**\n * Classic manifest for Expo apps using classic updates.\n * Returns `null` in bare workflow and when `manifest2` is non-null.\n */\n manifest: AppManifest | null;\n /**\n * New manifest for Expo apps using modern Expo Updates.\n * Returns `null` in bare workflow and when `manifest` is non-null.\n */\n manifest2: Manifest | null;\n sessionId: string;\n statusBarHeight: number;\n systemFonts: string[];\n systemVersion?: number;\n platform?: PlatformManifest;\n [key: string]: any;\n\n getWebViewUserAgentAsync: () => Promise<string | null>;\n}\n\nexport interface Constants extends NativeConstants {\n /**\n * @deprecated Constants.deviceId is deprecated in favor of generating your own ID and storing it.\n * This API will be removed in SDK 44.\n */\n deviceId?: string;\n /**\n * @deprecated Constants.linkingUrl has been renamed to Constants.linkingUri. Consider using the\n * Linking API directly. Constants.linkingUrl will be removed in SDK 44.\n */\n linkingUrl?: string;\n /**\n * @warning do not use this property. Use `manifest` by default.\n *\n * In certain cases accessing manifest via this property\n * suppresses important warning about missing manifest.\n */\n __unsafeNoWarnManifest?: AppManifest;\n /**\n * @warning do not use this property. Use `manifest2` by default.\n *\n * In certain cases accessing manifest via this property\n * suppresses important warning about missing manifest.\n */\n __unsafeNoWarnManifest2?: Manifest;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Constants.types.js","sourceRoot":"","sources":["../src/Constants.types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,yCAAyB,CAAA;IACzB,6BAAa,CAAA;IACb,+BAAe,CAAA;AACjB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,MAAM,CAAN,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,qCAAa,CAAA;IACb,iDAAyB,CAAA;IACzB,mDAA2B,CAAA;AAC7B,CAAC,EAJW,oBAAoB,KAApB,oBAAoB,QAI/B;AAED,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,uCAAiB,CAAA;IACjB,iDAA2B,CAAA;AAC7B,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B","sourcesContent":["import { ExpoConfig } from '@expo/config-types';\n\nexport enum AppOwnership {\n Standalone = 'standalone',\n Expo = 'expo',\n Guest = 'guest',\n}\n\nexport enum ExecutionEnvironment {\n Bare = 'bare',\n Standalone = 'standalone',\n StoreClient = 'storeClient',\n}\n\nexport enum UserInterfaceIdiom {\n Handset = 'handset',\n Tablet = 'tablet',\n Unsupported = 'unsupported',\n}\n\nexport interface IOSManifest {\n buildNumber: string;\n platform: string;\n /**\n * @deprecated Moved to `expo-device` - `Device.modelName`\n */\n model: string | null;\n userInterfaceIdiom: UserInterfaceIdiom;\n systemVersion: string;\n [key: string]: any;\n}\n\nexport interface AndroidManifest {\n versionCode: number;\n [key: string]: any;\n}\n\nexport interface WebManifest {\n [key: string]: any;\n}\n\nexport interface ManifestAsset {\n url: string;\n}\n\n/**\n * A modern manifest.\n */\nexport type Manifest = {\n id: string;\n createdAt: string;\n runtimeVersion: string;\n launchAsset: ManifestAsset;\n assets: ManifestAsset[];\n metadata: object;\n extra?: ClientScopingConfig & {\n expoClient?: ExpoClientConfig;\n expoGo?: ExpoGoConfig;\n eas?: EASConfig;\n };\n};\n\nexport type EASConfig = {\n /**\n * The ID for this project if it's using EAS. UUID. This value will not change when a project is transferred\n * between accounts or renamed.\n */\n projectId?: string;\n};\n\nexport type ClientScopingConfig = {\n /**\n * An opaque unique string for scoping client-side data to this project. This value\n * will not change when a project is transferred between accounts or renamed.\n */\n scopeKey?: string;\n};\n\nexport type ExpoGoConfig = {\n mainModuleName?: string;\n debuggerHost?: string;\n logUrl?: string;\n developer?: {\n tool?: string;\n [key: string]: any;\n };\n packagerOpts?: {\n hostType?: string;\n dev?: boolean;\n strict?: boolean;\n minify?: boolean;\n urlType?: string;\n urlRandomness?: string;\n lanType?: string;\n [key: string]: any;\n };\n};\n\nexport type ExpoClientConfig = ExpoConfig & {\n /** Published Apps Only */\n releaseId?: string;\n revisionId?: string;\n releaseChannel?: string;\n bundleUrl: string;\n hostUri?: string;\n publishedTime?: string;\n\n /**\n * The Expo account name and slug for this project.\n * @deprecated - Prefer `projectId` or `originalFullName` instead for identification and `scopeKey` for\n * scoping due to immutability.\n */\n id?: string;\n\n /**\n * The original Expo account name and slug for this project. Formatted like `@username/slug`.\n * When unauthenticated, the username is `@anonymous`. For published projects, this value\n * will not change when a project is transferred between accounts or renamed.\n */\n originalFullName?: string;\n\n /**\n * The Expo account name and slug used for display purposes. Formatted like `@username/slug`.\n * When unauthenticated, the username is `@anonymous`. For published projects, this value\n * may change when a project is transferred between accounts or renamed.\n */\n currentFullName?: string;\n};\n\n/**\n * A classic manifest https://docs.expo.io/guides/how-expo-works/#expo-manifest\n */\nexport type AppManifest = ExpoClientConfig &\n ExpoGoConfig &\n EASConfig &\n ClientScopingConfig & {\n [key: string]: any;\n };\n\nexport interface PlatformManifest {\n ios?: IOSManifest;\n android?: AndroidManifest;\n web?: WebManifest;\n detach?: {\n scheme?: string;\n [key: string]: any;\n };\n logUrl?: string;\n scheme?: string;\n hostUri?: string;\n developer?: string;\n [key: string]: any;\n}\n\nexport interface NativeConstants {\n name: 'ExponentConstants';\n appOwnership: AppOwnership | null;\n debugMode: boolean;\n deviceName?: string;\n /**\n * @deprecated Moved to `expo-device` - `Device.deviceYearClass`\n */\n deviceYearClass: number | null;\n executionEnvironment: ExecutionEnvironment;\n experienceUrl: string;\n // only nullable on web\n expoRuntimeVersion: string | null;\n /**\n * The version string of the Expo client currently running.\n * Returns `null` in bare workflow and web.\n */\n expoVersion: string | null;\n isDetached?: boolean;\n intentUri?: string;\n /**\n * @deprecated Constants.installationId is deprecated in favor of generating your own ID and\n * storing it. This API will be removed in SDK 44.\n */\n installationId: string;\n isDevice: boolean;\n isHeadless: boolean;\n linkingUri: string;\n nativeAppVersion: string | null;\n nativeBuildVersion: string | null;\n /**\n * Classic manifest for Expo apps using classic updates.\n * Returns `null` in bare workflow and when `manifest2` is non-null.\n */\n manifest: AppManifest | null;\n /**\n * New manifest for Expo apps using modern Expo Updates.\n * Returns `null` in bare workflow and when `manifest` is non-null.\n */\n manifest2: Manifest | null;\n sessionId: string;\n statusBarHeight: number;\n systemFonts: string[];\n systemVersion?: number;\n platform?: PlatformManifest;\n [key: string]: any;\n\n getWebViewUserAgentAsync: () => Promise<string | null>;\n}\n\nexport interface Constants extends NativeConstants {\n /**\n * @deprecated Constants.deviceId is deprecated in favor of generating your own ID and storing it.\n * This API will be removed in SDK 44.\n */\n deviceId?: string;\n /**\n * @deprecated Constants.linkingUrl has been renamed to Constants.linkingUri. Consider using the\n * Linking API directly. Constants.linkingUrl will be removed in SDK 44.\n */\n linkingUrl?: string;\n /**\n * @warning do not use this property. Use `manifest` by default.\n *\n * In certain cases accessing manifest via this property\n * suppresses important warning about missing manifest.\n */\n __unsafeNoWarnManifest?: AppManifest;\n /**\n * @warning do not use this property. Use `manifest2` by default.\n *\n * In certain cases accessing manifest via this property\n * suppresses important warning about missing manifest.\n */\n __unsafeNoWarnManifest2?: Manifest;\n}\n"]}
|
|
@@ -130,10 +130,20 @@ EX_REGISTER_MODULE();
|
|
|
130
130
|
NSArray<NSString *> *familyNames = [UIFont familyNames];
|
|
131
131
|
NSMutableArray<NSString *> *fontNames = [NSMutableArray array];
|
|
132
132
|
for (NSString *familyName in familyNames) {
|
|
133
|
-
[
|
|
134
|
-
|
|
133
|
+
// "System Font" is added to [UIFont familyNames] in iOS 15, and the font names that
|
|
134
|
+
// correspond with it are dot prefixed .SFUI-* fonts which log the following warning
|
|
135
|
+
// when passed in to [UIFont fontNamesForFamilyName:name]:
|
|
136
|
+
// CoreText note: Client requested name “.SFUI-HeavyItalic”, it will get TimesNewRomanPSMT rather than the intended font.
|
|
137
|
+
// All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[UIFont systemFontOfSize:]
|
|
138
|
+
//
|
|
139
|
+
if (![familyName isEqualToString:@"System Font"]) {
|
|
140
|
+
[fontNames addObject:familyName];
|
|
141
|
+
[fontNames addObjectsFromArray:[UIFont fontNamesForFamilyName:familyName]];
|
|
142
|
+
}
|
|
135
143
|
}
|
|
136
|
-
|
|
144
|
+
|
|
145
|
+
// Remove duplciates and sort alphabetically
|
|
146
|
+
return [[[NSSet setWithArray:fontNames] allObjects] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];
|
|
137
147
|
}
|
|
138
148
|
|
|
139
149
|
# pragma mark - device info
|
|
@@ -187,21 +197,13 @@ EX_REGISTER_MODULE();
|
|
|
187
197
|
@"Watch6,4": @"Apple Watch Series 6",
|
|
188
198
|
|
|
189
199
|
// iPhone
|
|
190
|
-
|
|
191
|
-
@"iPhone1,2": @"iPhone 3G",
|
|
192
|
-
@"iPhone2,1": @"iPhone 3GS",
|
|
193
|
-
@"iPhone3,1": @"iPhone 4",
|
|
194
|
-
@"iPhone3,2": @"iPhone 4",
|
|
195
|
-
@"iPhone3,3": @"iPhone 4 (CDMA)",
|
|
196
|
-
@"iPhone4,1": @"iPhone 4S",
|
|
197
|
-
@"iPhone5,1": @"iPhone 5 (GSM)",
|
|
198
|
-
@"iPhone5,2": @"iPhone 5 (GSM+CDMA)",
|
|
199
|
-
@"iPhone5,3": @"iPhone 5C (GSM)",
|
|
200
|
-
@"iPhone5,4": @"iPhone 5C (GSM+CDMA)",
|
|
200
|
+
// iOS 12+
|
|
201
201
|
@"iPhone6,1": @"iPhone 5S (GSM)",
|
|
202
202
|
@"iPhone6,2": @"iPhone 5S (GSM+CDMA)",
|
|
203
203
|
@"iPhone7,1": @"iPhone 6 Plus",
|
|
204
204
|
@"iPhone7,2": @"iPhone 6",
|
|
205
|
+
|
|
206
|
+
// iOS 13+
|
|
205
207
|
@"iPhone8,1": @"iPhone 6s",
|
|
206
208
|
@"iPhone8,2": @"iPhone 6s Plus",
|
|
207
209
|
@"iPhone8,4": @"iPhone SE",
|
|
@@ -228,6 +230,11 @@ EX_REGISTER_MODULE();
|
|
|
228
230
|
@"iPhone13,3": @"iPhone 12 Pro",
|
|
229
231
|
@"iPhone13,4": @"iPhone 12 Pro Max",
|
|
230
232
|
|
|
233
|
+
@"iPhone14,2": @"iPhone 13 Pro",
|
|
234
|
+
@"iPhone14,3": @"iPhone 13 Pro Max",
|
|
235
|
+
@"iPhone14,4": @"iPhone 13 Mini",
|
|
236
|
+
@"iPhone14,5": @"iPhone 13",
|
|
237
|
+
|
|
231
238
|
// iPod
|
|
232
239
|
@"iPod1,1": @"iPod Touch",
|
|
233
240
|
@"iPod2,1": @"iPod Touch 2G",
|
|
@@ -287,11 +294,25 @@ EX_REGISTER_MODULE();
|
|
|
287
294
|
@"iPad8,6": @"iPad Pro 12.9-inch (3rd generation)",
|
|
288
295
|
@"iPad8,7": @"iPad Pro 12.9-inch (3rd generation)",
|
|
289
296
|
@"iPad8,8": @"iPad Pro 12.9-inch (3rd generation)",
|
|
290
|
-
@"iPad11,1": @"iPad Mini
|
|
291
|
-
@"iPad11,2": @"iPad Mini
|
|
292
|
-
@"iPad11,3": @"iPad Air (3rd generation)",
|
|
297
|
+
@"iPad11,1": @"iPad Mini (5th generation) (WiFi)",
|
|
298
|
+
@"iPad11,2": @"iPad Mini (5th generation)",
|
|
299
|
+
@"iPad11,3": @"iPad Air (3rd generation) (WiFi)",
|
|
293
300
|
@"iPad11,4": @"iPad Air (3rd generation)",
|
|
294
301
|
|
|
302
|
+
@"iPad11,6": @"iPad (8th generation)",
|
|
303
|
+
@"iPad11,7": @"iPad (8th generation)",
|
|
304
|
+
@"iPad13,1": @"iPad Air (4th generation) (WiFi)",
|
|
305
|
+
@"iPad13,2": @"iPad Air (4th generation) (WiFi+Cellular)",
|
|
306
|
+
@"iPad13,4": @"iPad Pro 11 inch (3th generation)",
|
|
307
|
+
@"iPad13,5": @"iPad Pro 11 inch (3th generation)",
|
|
308
|
+
@"iPad13,6": @"iPad Pro 11 inch (3th generation)",
|
|
309
|
+
@"iPad13,7": @"iPad Pro 11 inch (3th generation)",
|
|
310
|
+
@"iPad13,8": @"iPad Pro 12.9 inch (5th generation)",
|
|
311
|
+
@"iPad13,9": @"iPad Pro 12.9 inch (5th generation)",
|
|
312
|
+
@"iPad13,10": @"iPad Pro 12.9 inch (5th generation)",
|
|
313
|
+
@"iPad13,11": @"iPad Pro 12.9 inch (5th generation)",
|
|
314
|
+
@"iPad14,1": @"iPad Mini (6th generation) (WiFi)",
|
|
315
|
+
@"iPad14,2": @"iPad Mini (6th generation) (WiFi+Cellular)",
|
|
295
316
|
// Simulator
|
|
296
317
|
@"i386": @"Simulator",
|
|
297
318
|
@"arm64": @"Simulator",
|
|
@@ -322,30 +343,6 @@ EX_REGISTER_MODULE();
|
|
|
322
343
|
|
|
323
344
|
// TODO: apple TV and apple watch
|
|
324
345
|
NSDictionary *mapping = @{
|
|
325
|
-
// iPhone 1
|
|
326
|
-
@"iPhone1,1": @2007,
|
|
327
|
-
|
|
328
|
-
// iPhone 3G
|
|
329
|
-
@"iPhone1,2": @2008,
|
|
330
|
-
|
|
331
|
-
// iPhone 3GS
|
|
332
|
-
@"iPhone2,1": @2009,
|
|
333
|
-
|
|
334
|
-
// iPhone 4
|
|
335
|
-
@"iPhone3,1": @2010,
|
|
336
|
-
@"iPhone3,2": @2010,
|
|
337
|
-
@"iPhone3,3": @2010,
|
|
338
|
-
|
|
339
|
-
// iPhone 4S
|
|
340
|
-
@"iPhone4,1": @2011,
|
|
341
|
-
|
|
342
|
-
// iPhone 5
|
|
343
|
-
@"iPhone5,1": @2012,
|
|
344
|
-
@"iPhone5,2": @2012,
|
|
345
|
-
|
|
346
|
-
// iPhone 5S and 5C
|
|
347
|
-
@"iPhone5,3": @2013,
|
|
348
|
-
@"iPhone5,4": @2013,
|
|
349
346
|
@"iPhone6,1": @2013,
|
|
350
347
|
@"iPhone6,2": @2013,
|
|
351
348
|
|
|
@@ -371,7 +368,16 @@ EX_REGISTER_MODULE();
|
|
|
371
368
|
@"iPhone12,1": @2019, // iPhone 11
|
|
372
369
|
@"iPhone12,3": @2019, // iPhone 11 Pro
|
|
373
370
|
@"iPhone12,5": @2019, // iPhone 11 Pro Max
|
|
374
|
-
|
|
371
|
+
@"iPhone12,8": @2020, // iPhone SE 2nd Gen
|
|
372
|
+
@"iPhone13,1": @2020, // iPhone 12 mini
|
|
373
|
+
@"iPhone13,2": @2020, // iPhone 12
|
|
374
|
+
@"iPhone13,3": @2020, // iPhone 12 Pro
|
|
375
|
+
@"iPhone13,4": @2020, // iPhone 12 Pro Max
|
|
376
|
+
@"iPhone14,2": @2021, // iPhone 13 Pro
|
|
377
|
+
@"iPhone14,3": @2021, // iPhone 13 Pro Max
|
|
378
|
+
@"iPhone14,4": @2021, // iPhone 13 Mini
|
|
379
|
+
@"iPhone14,5": @2021, // iPhone 13
|
|
380
|
+
|
|
375
381
|
// iPod
|
|
376
382
|
@"iPod1,1": @2007,
|
|
377
383
|
@"iPod2,1": @2008,
|
|
@@ -435,6 +441,20 @@ EX_REGISTER_MODULE();
|
|
|
435
441
|
@"iPad11,2": @2019, // iPad Mini 5th Gen
|
|
436
442
|
@"iPad11,3": @2019, // iPad Air 3rd Gen (WiFi)
|
|
437
443
|
@"iPad11,4": @2019, // iPad Air 3rd Gen
|
|
444
|
+
@"iPad11,6": @2020, // iPad 8th Gen
|
|
445
|
+
@"iPad11,7": @2020, // iPad 8th Gen
|
|
446
|
+
@"iPad13,1": @2020, // iPad Air 4th Gen (WiFi)
|
|
447
|
+
@"iPad13,2": @2020, // iPad Air 4th Gen (WiFi+Cellular)
|
|
448
|
+
@"iPad13,4": @2021, // iPad Pro 11-inch 3rd Gen
|
|
449
|
+
@"iPad13,5": @2021, // iPad Pro 11-inch 3rd Gen
|
|
450
|
+
@"iPad13,6": @2021, // iPad Pro 11-inch 3rd Gen
|
|
451
|
+
@"iPad13,7": @2021, // iPad Pro 11-inch 3rd Gen
|
|
452
|
+
@"iPad13,8": @2021, // iPad Pro 12.9-inch 5th Gen
|
|
453
|
+
@"iPad13,9": @2021, // iPad Pro 12.9-inch 5th Gen
|
|
454
|
+
@"iPad13,10": @2021, // iPad Pro 12.9-inch 5th Gen
|
|
455
|
+
@"iPad13,11": @2021, // iPad Pro 12.9-inch 5th Gen
|
|
456
|
+
@"iPad14,1": @2021, // iPad mini (6th generation) (WiFi)
|
|
457
|
+
@"iPad14,2": @2021 // iPad mini (6th generation) (WiFi + cellular)
|
|
438
458
|
};
|
|
439
459
|
|
|
440
460
|
NSNumber *deviceYear = mapping[platform];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-constants",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.1.3",
|
|
4
4
|
"description": "Provides system information that remains constant throughout the lifetime of your app.",
|
|
5
5
|
"main": "build/Constants.js",
|
|
6
6
|
"types": "build/Constants.d.ts",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@expo/config": "^5.0.9",
|
|
38
|
-
"expo-modules-core": "~0.4.
|
|
38
|
+
"expo-modules-core": "~0.4.4",
|
|
39
39
|
"uuid": "^3.3.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"expo-module-scripts": "^2.0.0"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "33b6a1b7ac70e664ccbe5965e707c0df6d704549"
|
|
45
45
|
}
|
package/src/Constants.ts
CHANGED
|
@@ -71,16 +71,31 @@ if (!rawManifest && ExponentConstants && ExponentConstants.manifest) {
|
|
|
71
71
|
|
|
72
72
|
const { name, appOwnership, ...nativeConstants } = (ExponentConstants || {}) as any;
|
|
73
73
|
|
|
74
|
+
let warnedAboutDeviceYearClass = false;
|
|
75
|
+
let warnedAboutIosModel = false;
|
|
74
76
|
let warnedAboutInstallationId = false;
|
|
75
77
|
let warnedAboutDeviceId = false;
|
|
76
78
|
let warnedAboutLinkingUrl = false;
|
|
77
79
|
|
|
78
|
-
const constants = {
|
|
80
|
+
const constants: Constants = {
|
|
79
81
|
...nativeConstants,
|
|
80
82
|
// Ensure this is null in bare workflow
|
|
81
83
|
appOwnership: appOwnership ?? null,
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const constantsPropertiesGetter: AccessorProps = {
|
|
82
87
|
// Deprecated fields
|
|
83
|
-
|
|
88
|
+
deviceYearClass() {
|
|
89
|
+
if (!warnedAboutDeviceYearClass) {
|
|
90
|
+
console.warn(
|
|
91
|
+
`Constants.deviceYearClass has been deprecated in favor of expo-device's Device.deviceYearClass property. This API will be removed in SDK 45.`
|
|
92
|
+
);
|
|
93
|
+
warnedAboutDeviceYearClass = true;
|
|
94
|
+
}
|
|
95
|
+
return nativeConstants.deviceYearClass;
|
|
96
|
+
},
|
|
97
|
+
// Deprecated fields
|
|
98
|
+
installationId() {
|
|
84
99
|
if (!warnedAboutInstallationId) {
|
|
85
100
|
console.warn(
|
|
86
101
|
`Constants.installationId has been deprecated in favor of generating and storing your own ID. Implement it using expo-application's androidId on Android and a storage API such as expo-secure-store on iOS and localStorage on the web. This API will be removed in SDK 44.`
|
|
@@ -90,7 +105,7 @@ const constants = {
|
|
|
90
105
|
return nativeConstants.installationId;
|
|
91
106
|
},
|
|
92
107
|
// Legacy aliases
|
|
93
|
-
|
|
108
|
+
deviceId() {
|
|
94
109
|
if (!warnedAboutDeviceId) {
|
|
95
110
|
console.warn(
|
|
96
111
|
`Constants.deviceId has been deprecated in favor of generating and storing your own ID. This API will be removed in SDK 44.`
|
|
@@ -99,7 +114,7 @@ const constants = {
|
|
|
99
114
|
}
|
|
100
115
|
return nativeConstants.installationId;
|
|
101
116
|
},
|
|
102
|
-
|
|
117
|
+
linkingUrl() {
|
|
103
118
|
if (!warnedAboutLinkingUrl) {
|
|
104
119
|
console.warn(
|
|
105
120
|
`Constants.linkingUrl has been renamed to Constants.linkingUri. Consider using the Linking API directly. Constants.linkingUrl will be removed in SDK 44.`
|
|
@@ -108,14 +123,14 @@ const constants = {
|
|
|
108
123
|
}
|
|
109
124
|
return nativeConstants.linkingUri;
|
|
110
125
|
},
|
|
111
|
-
|
|
126
|
+
manifest(): AppManifest | null {
|
|
112
127
|
const maybeManifest = getManifest();
|
|
113
128
|
if (!maybeManifest || !isAppManifest(maybeManifest)) {
|
|
114
129
|
return null;
|
|
115
130
|
}
|
|
116
131
|
return maybeManifest;
|
|
117
132
|
},
|
|
118
|
-
|
|
133
|
+
manifest2(): Manifest | null {
|
|
119
134
|
const maybeManifest = getManifest();
|
|
120
135
|
if (!maybeManifest || !isManifest(maybeManifest)) {
|
|
121
136
|
return null;
|
|
@@ -128,27 +143,60 @@ const constants = {
|
|
|
128
143
|
* It behaves similarly to the original one, but suppresses warning upon no manifest available.
|
|
129
144
|
* `expo-asset` uses it to prevent users from seeing mentioned warning.
|
|
130
145
|
*/
|
|
131
|
-
|
|
146
|
+
__unsafeNoWarnManifest(): AppManifest | Manifest | null {
|
|
132
147
|
const maybeManifest = getManifest(true);
|
|
133
148
|
if (!maybeManifest || !isAppManifest(maybeManifest)) {
|
|
134
149
|
return null;
|
|
135
150
|
}
|
|
136
151
|
return maybeManifest;
|
|
137
152
|
},
|
|
138
|
-
|
|
153
|
+
__unsafeNoWarnManifest2(): Manifest | Manifest | null {
|
|
139
154
|
const maybeManifest = getManifest(true);
|
|
140
155
|
if (!maybeManifest || !isManifest(maybeManifest)) {
|
|
141
156
|
return null;
|
|
142
157
|
}
|
|
143
158
|
return maybeManifest;
|
|
144
159
|
},
|
|
145
|
-
|
|
160
|
+
};
|
|
161
|
+
definePropertiesGetter(constants, constantsPropertiesGetter);
|
|
162
|
+
|
|
163
|
+
Object.defineProperty(constants, '__rawManifest_TEST', {
|
|
164
|
+
get(): AppManifest | Manifest | null {
|
|
146
165
|
return rawManifest;
|
|
147
166
|
},
|
|
148
|
-
set
|
|
167
|
+
set(value: AppManifest | Manifest | null) {
|
|
149
168
|
rawManifest = value;
|
|
150
169
|
},
|
|
151
|
-
|
|
170
|
+
// Prevent the warning from being thrown, or the value from being used when the user interacts with the entire object.
|
|
171
|
+
enumerable: false,
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// Add deprecation warning for `platform.ios.model`
|
|
175
|
+
if (constants?.platform?.ios) {
|
|
176
|
+
const originalModel = nativeConstants.platform.ios.model;
|
|
177
|
+
definePropertiesGetter(constants.platform.ios, {
|
|
178
|
+
model() {
|
|
179
|
+
if (!warnedAboutIosModel) {
|
|
180
|
+
console.warn(
|
|
181
|
+
`Constants.platform.ios.model has been deprecated in favor of expo-device's Device.modelName property. This API will be removed in SDK 45.`
|
|
182
|
+
);
|
|
183
|
+
warnedAboutIosModel = true;
|
|
184
|
+
}
|
|
185
|
+
return originalModel;
|
|
186
|
+
},
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
type AccessorProps = Record<string, () => any>;
|
|
191
|
+
function definePropertiesGetter(target: object, props: AccessorProps) {
|
|
192
|
+
for (const [name, func] of Object.entries(props)) {
|
|
193
|
+
Object.defineProperty(target, name, {
|
|
194
|
+
get: func,
|
|
195
|
+
// Prevent the warning from being thrown, or the value from being used when the user interacts with the entire object.
|
|
196
|
+
enumerable: false,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
152
200
|
|
|
153
201
|
function isAppManifest(manifest: AppManifest | Manifest): manifest is AppManifest {
|
|
154
202
|
return !isManifest(manifest);
|
package/src/Constants.types.ts
CHANGED
|
@@ -21,6 +21,9 @@ export enum UserInterfaceIdiom {
|
|
|
21
21
|
export interface IOSManifest {
|
|
22
22
|
buildNumber: string;
|
|
23
23
|
platform: string;
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated Moved to `expo-device` - `Device.modelName`
|
|
26
|
+
*/
|
|
24
27
|
model: string | null;
|
|
25
28
|
userInterfaceIdiom: UserInterfaceIdiom;
|
|
26
29
|
systemVersion: string;
|
|
@@ -154,6 +157,9 @@ export interface NativeConstants {
|
|
|
154
157
|
appOwnership: AppOwnership | null;
|
|
155
158
|
debugMode: boolean;
|
|
156
159
|
deviceName?: string;
|
|
160
|
+
/**
|
|
161
|
+
* @deprecated Moved to `expo-device` - `Device.deviceYearClass`
|
|
162
|
+
*/
|
|
157
163
|
deviceYearClass: number | null;
|
|
158
164
|
executionEnvironment: ExecutionEnvironment;
|
|
159
165
|
experienceUrl: string;
|