@amazon-devices/expo-application 2.0.1758683737

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.
Files changed (49) hide show
  1. package/.eslintrc.js +2 -0
  2. package/CHANGELOG.md +176 -0
  3. package/CMakeLists.txt +46 -0
  4. package/LICENSE +7 -0
  5. package/README.kepler.md +103 -0
  6. package/README.md +25 -0
  7. package/THIRD_PARTY_NOTICES.txt +24 -0
  8. package/android/build.gradle +115 -0
  9. package/android/src/main/AndroidManifest.xml +2 -0
  10. package/android/src/main/java/expo/modules/application/ApplicationModule.kt +125 -0
  11. package/build/Application.d.ts +126 -0
  12. package/build/Application.d.ts.map +1 -0
  13. package/build/Application.js +184 -0
  14. package/build/Application.js.map +1 -0
  15. package/build/Application.types.d.ts +13 -0
  16. package/build/Application.types.d.ts.map +1 -0
  17. package/build/Application.types.js +11 -0
  18. package/build/Application.types.js.map +1 -0
  19. package/build/ExpoApplication.d.ts +3 -0
  20. package/build/ExpoApplication.d.ts.map +1 -0
  21. package/build/ExpoApplication.js +3 -0
  22. package/build/ExpoApplication.js.map +1 -0
  23. package/build/ExpoApplication.kepler.d.ts +11 -0
  24. package/build/ExpoApplication.kepler.d.ts.map +1 -0
  25. package/build/ExpoApplication.kepler.js +26 -0
  26. package/build/ExpoApplication.kepler.js.map +1 -0
  27. package/build/ExpoApplication.web.d.ts +11 -0
  28. package/build/ExpoApplication.web.d.ts.map +1 -0
  29. package/build/ExpoApplication.web.js +24 -0
  30. package/build/ExpoApplication.web.js.map +1 -0
  31. package/expo-module.config.json +10 -0
  32. package/ios/ApplicationExceptions.swift +19 -0
  33. package/ios/ApplicationModule.swift +48 -0
  34. package/ios/ApplicationModuleProvisioningProfile.swift +75 -0
  35. package/ios/ExpoApplication.podspec +32 -0
  36. package/kepler/ExpoApplication.cpp +78 -0
  37. package/kepler/ExpoApplication.h +44 -0
  38. package/kepler/KeplerInit.cpp +28 -0
  39. package/kepler/test/ExpoApplication.cpp +94 -0
  40. package/package.json +1 -0
  41. package/react-native.config.js +21 -0
  42. package/src/.gitkeep +0 -0
  43. package/src/Application.ts +196 -0
  44. package/src/Application.types.ts +14 -0
  45. package/src/ExpoApplication.kepler.ts +46 -0
  46. package/src/ExpoApplication.ts +3 -0
  47. package/src/ExpoApplication.web.ts +23 -0
  48. package/tsconfig.json +9 -0
  49. package/unimodule.json +4 -0
@@ -0,0 +1,126 @@
1
+ import { ApplicationReleaseType, PushNotificationServiceEnvironment } from './Application.types';
2
+ /**
3
+ * The human-readable version of the native application that may be displayed in the app store.
4
+ * This is the `Info.plist` value for `CFBundleShortVersionString` on iOS and the version name set
5
+ * by `version` in `app.json` on Android at the time the native app was built.
6
+ * On web, this value is `null`.
7
+ * @example `"2.11.0"`
8
+ */
9
+ export declare const nativeApplicationVersion: string | null;
10
+ /**
11
+ * The internal build version of the native application that the app store may use to distinguish
12
+ * between different binaries. This is the `Info.plist` value for `CFBundleVersion` on iOS (set with
13
+ * `ios.buildNumber` value in `app.json` in a standalone app) and the version code set by
14
+ * `android.versionCode` in `app.json` on Android at the time the native app was built. On web, this
15
+ * value is `null`. The return type on Android and iOS is `string`.
16
+ * @example iOS: `"2.11.0"`, Android: `"114"`
17
+ */
18
+ export declare const nativeBuildVersion: string | null;
19
+ /**
20
+ * The human-readable name of the application that is displayed with the app's icon on the device's
21
+ * home screen or desktop. On Android and iOS, this value is a `string` unless the name could not be
22
+ * retrieved, in which case this value will be `null`. On web this value is `null`.
23
+ * @example `"Expo"`, `"Yelp"`, `"Instagram"`
24
+ */
25
+ export declare const applicationName: string | null;
26
+ /**
27
+ * The ID of the application. On Android, this is the application ID. On iOS, this is the bundle ID.
28
+ * On web, this is `null`.
29
+ * @example `"com.cocoacasts.scribbles"`, `"com.apple.Pages"`
30
+ */
31
+ export declare const applicationId: string | null;
32
+ /**
33
+ * Gets the value of [`Settings.Secure.ANDROID_ID`](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).
34
+ * This is a hexadecimal `string` unique to each combination of app-signing key, user, and device.
35
+ * The value may change if a factory reset is performed on the device or if an APK signing key changes.
36
+ * For more information about how the platform handles `ANDROID_ID` in Android 8.0 (API level 26)
37
+ * and higher, see [Android 8.0 Behavior Changes](https://developer.android.com/about/versions/oreo/android-8.0-changes.html#privacy-all).
38
+ * On iOS and web, this function is unavailable.
39
+ * > In versions of the platform lower than Android 8.0 (API level 26), this value remains constant
40
+ * > for the lifetime of the user's device. See the [ANDROID_ID](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID)
41
+ * > official docs for more information.
42
+ * @example `"dd96dec43fb81c97"`
43
+ * @platform android
44
+ */
45
+ export declare function getAndroidId(): string;
46
+ /**
47
+ * Gets the referrer URL of the installed app with the [`Install Referrer API`](https://developer.android.com/google/play/installreferrer)
48
+ * from the Google Play Store. In practice, the referrer URL may not be a complete, absolute URL.
49
+ * @return A `Promise` that fulfills with a `string` of the referrer URL of the installed app.
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * await Application.getInstallReferrerAsync();
54
+ * // "utm_source=google-play&utm_medium=organic"
55
+ * ```
56
+ * @platform android
57
+ */
58
+ export declare function getInstallReferrerAsync(): Promise<string>;
59
+ /**
60
+ * Gets the iOS "identifier for vendor" ([IDFV](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor))
61
+ * value, a string ID that uniquely identifies a device to the app’s vendor. This method may
62
+ * sometimes return `nil`, in which case wait and call the method again later. This might happen
63
+ * when the device has been restarted before the user has unlocked the device.
64
+ *
65
+ * The OS will change the vendor identifier if all apps from the current app's vendor have been
66
+ * uninstalled.
67
+ *
68
+ * @return A `Promise` that fulfills with a `string` specifying the app's vendor ID. Apps from the
69
+ * same vendor will return the same ID. See Apple's documentation for more information about the
70
+ * vendor ID's semantics.
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * await Application.getIosIdForVendorAsync();
75
+ * // "68753A44-4D6F-1226-9C60-0050E4C00067"
76
+ * ```
77
+ * @platform ios
78
+ */
79
+ export declare function getIosIdForVendorAsync(): Promise<string | null>;
80
+ /**
81
+ * Gets the iOS application release type.
82
+ * @return Returns a promise which fulfills with an [`ApplicationReleaseType`](#applicationreleasetype).
83
+ * @platform ios
84
+ */
85
+ export declare function getIosApplicationReleaseTypeAsync(): Promise<ApplicationReleaseType>;
86
+ /**
87
+ * Gets the current [Apple Push Notification (APN)](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment?language=objc)
88
+ * service environment.
89
+ * @return Returns a promise fulfilled with the string, either `'development'` or `'production'`,
90
+ * based on the current APN environment, or `null` on the simulator as it does not support registering with APNs.
91
+ * @platform ios
92
+ */
93
+ export declare function getIosPushNotificationServiceEnvironmentAsync(): Promise<PushNotificationServiceEnvironment>;
94
+ /**
95
+ * Gets the time the app was installed onto the device, not counting subsequent updates. If the app
96
+ * is uninstalled and reinstalled, this method returns the time the app was reinstalled.
97
+ * - On iOS, this method uses the [`NSFileCreationDate`](https://developer.apple.com/documentation/foundation/nsfilecreationdate?language=objc)
98
+ * of the app's document root directory.
99
+ * - On Android, this method uses [`PackageInfo.firstInstallTime`](https://developer.android.com/reference/android/content/pm/PackageInfo.html#firstInstallTime).
100
+ * - On web, this method returns `null`.
101
+ *
102
+ * @return Returns a `Promise` that fulfills with a `Date` object that specifies the time the app
103
+ * was installed on the device.
104
+ *
105
+ * @example
106
+ * ```ts
107
+ * await Application.getInstallationTimeAsync();
108
+ * // 2019-07-18T18:08:26.121Z
109
+ * ```
110
+ */
111
+ export declare function getInstallationTimeAsync(): Promise<Date>;
112
+ /**
113
+ * Gets the last time the app was updated from the Google Play Store.
114
+ * @return Returns a `Promise` that fulfills with a `Date` object that specifies the last time
115
+ * the app was updated via the Google Play Store).
116
+ *
117
+ * @example
118
+ * ```ts
119
+ * await Application.getLastUpdateTimeAsync();
120
+ * // 2019-07-18T21:20:16.887Z
121
+ * ```
122
+ * @platform android
123
+ */
124
+ export declare function getLastUpdateTimeAsync(): Promise<Date>;
125
+ export { ApplicationReleaseType, PushNotificationServiceEnvironment };
126
+ //# sourceMappingURL=Application.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../src/Application.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAC;AAIjG;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,GAAG,IAExC,CAAC;AAGT;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,GAAG,IAElC,CAAC;AAGT;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,GAAG,IAE/B,CAAC;AAGT;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,GAAG,IAE7B,CAAC;AAGT;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAKrC;AAGD;;;;;;;;;;;GAWG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC,CAK/D;AAGD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKrE;AAGD;;;;GAIG;AACH,wBAAsB,iCAAiC,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAKzF;AAGD;;;;;;GAMG;AACH,wBAAsB,6CAA6C,IAAI,OAAO,CAAC,kCAAkC,CAAC,CAKjH;AAGD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC,CAM9D;AAGD;;;;;;;;;;;GAWG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAM5D;AAED,OAAO,EAAE,sBAAsB,EAAE,kCAAkC,EAAE,CAAC"}
@@ -0,0 +1,184 @@
1
+ import { Platform, UnavailabilityError } from 'expo-modules-core';
2
+ import { ApplicationReleaseType } from './Application.types';
3
+ import ExpoApplication from './ExpoApplication';
4
+ // @needsAudit
5
+ /**
6
+ * The human-readable version of the native application that may be displayed in the app store.
7
+ * This is the `Info.plist` value for `CFBundleShortVersionString` on iOS and the version name set
8
+ * by `version` in `app.json` on Android at the time the native app was built.
9
+ * On web, this value is `null`.
10
+ * @example `"2.11.0"`
11
+ */
12
+ export const nativeApplicationVersion = ExpoApplication
13
+ ? ExpoApplication.nativeApplicationVersion || null
14
+ : null;
15
+ // @needsAudit
16
+ /**
17
+ * The internal build version of the native application that the app store may use to distinguish
18
+ * between different binaries. This is the `Info.plist` value for `CFBundleVersion` on iOS (set with
19
+ * `ios.buildNumber` value in `app.json` in a standalone app) and the version code set by
20
+ * `android.versionCode` in `app.json` on Android at the time the native app was built. On web, this
21
+ * value is `null`. The return type on Android and iOS is `string`.
22
+ * @example iOS: `"2.11.0"`, Android: `"114"`
23
+ */
24
+ export const nativeBuildVersion = ExpoApplication
25
+ ? ExpoApplication.nativeBuildVersion || null
26
+ : null;
27
+ // @needsAudit
28
+ /**
29
+ * The human-readable name of the application that is displayed with the app's icon on the device's
30
+ * home screen or desktop. On Android and iOS, this value is a `string` unless the name could not be
31
+ * retrieved, in which case this value will be `null`. On web this value is `null`.
32
+ * @example `"Expo"`, `"Yelp"`, `"Instagram"`
33
+ */
34
+ export const applicationName = ExpoApplication
35
+ ? ExpoApplication.applicationName || null
36
+ : null;
37
+ // @needsAudit
38
+ /**
39
+ * The ID of the application. On Android, this is the application ID. On iOS, this is the bundle ID.
40
+ * On web, this is `null`.
41
+ * @example `"com.cocoacasts.scribbles"`, `"com.apple.Pages"`
42
+ */
43
+ export const applicationId = ExpoApplication
44
+ ? ExpoApplication.applicationId || null
45
+ : null;
46
+ // @needsAudit
47
+ /**
48
+ * Gets the value of [`Settings.Secure.ANDROID_ID`](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).
49
+ * This is a hexadecimal `string` unique to each combination of app-signing key, user, and device.
50
+ * The value may change if a factory reset is performed on the device or if an APK signing key changes.
51
+ * For more information about how the platform handles `ANDROID_ID` in Android 8.0 (API level 26)
52
+ * and higher, see [Android 8.0 Behavior Changes](https://developer.android.com/about/versions/oreo/android-8.0-changes.html#privacy-all).
53
+ * On iOS and web, this function is unavailable.
54
+ * > In versions of the platform lower than Android 8.0 (API level 26), this value remains constant
55
+ * > for the lifetime of the user's device. See the [ANDROID_ID](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID)
56
+ * > official docs for more information.
57
+ * @example `"dd96dec43fb81c97"`
58
+ * @platform android
59
+ */
60
+ export function getAndroidId() {
61
+ if (Platform.OS !== 'android') {
62
+ throw new UnavailabilityError('expo-application', 'androidId');
63
+ }
64
+ return ExpoApplication.androidId;
65
+ }
66
+ // @needsAudit
67
+ /**
68
+ * Gets the referrer URL of the installed app with the [`Install Referrer API`](https://developer.android.com/google/play/installreferrer)
69
+ * from the Google Play Store. In practice, the referrer URL may not be a complete, absolute URL.
70
+ * @return A `Promise` that fulfills with a `string` of the referrer URL of the installed app.
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * await Application.getInstallReferrerAsync();
75
+ * // "utm_source=google-play&utm_medium=organic"
76
+ * ```
77
+ * @platform android
78
+ */
79
+ export async function getInstallReferrerAsync() {
80
+ if (!ExpoApplication.getInstallReferrerAsync) {
81
+ throw new UnavailabilityError('expo-application', 'getInstallReferrerAsync');
82
+ }
83
+ return await ExpoApplication.getInstallReferrerAsync();
84
+ }
85
+ // @needsAudit
86
+ /**
87
+ * Gets the iOS "identifier for vendor" ([IDFV](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor))
88
+ * value, a string ID that uniquely identifies a device to the app’s vendor. This method may
89
+ * sometimes return `nil`, in which case wait and call the method again later. This might happen
90
+ * when the device has been restarted before the user has unlocked the device.
91
+ *
92
+ * The OS will change the vendor identifier if all apps from the current app's vendor have been
93
+ * uninstalled.
94
+ *
95
+ * @return A `Promise` that fulfills with a `string` specifying the app's vendor ID. Apps from the
96
+ * same vendor will return the same ID. See Apple's documentation for more information about the
97
+ * vendor ID's semantics.
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * await Application.getIosIdForVendorAsync();
102
+ * // "68753A44-4D6F-1226-9C60-0050E4C00067"
103
+ * ```
104
+ * @platform ios
105
+ */
106
+ export async function getIosIdForVendorAsync() {
107
+ if (!ExpoApplication.getIosIdForVendorAsync) {
108
+ throw new UnavailabilityError('expo-application', 'getIosIdForVendorAsync');
109
+ }
110
+ return await ExpoApplication.getIosIdForVendorAsync();
111
+ }
112
+ // @needsAudit
113
+ /**
114
+ * Gets the iOS application release type.
115
+ * @return Returns a promise which fulfills with an [`ApplicationReleaseType`](#applicationreleasetype).
116
+ * @platform ios
117
+ */
118
+ export async function getIosApplicationReleaseTypeAsync() {
119
+ if (!ExpoApplication.getApplicationReleaseTypeAsync) {
120
+ throw new UnavailabilityError('expo-application', 'getApplicationReleaseTypeAsync');
121
+ }
122
+ return await ExpoApplication.getApplicationReleaseTypeAsync();
123
+ }
124
+ // @needsAudit
125
+ /**
126
+ * Gets the current [Apple Push Notification (APN)](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment?language=objc)
127
+ * service environment.
128
+ * @return Returns a promise fulfilled with the string, either `'development'` or `'production'`,
129
+ * based on the current APN environment, or `null` on the simulator as it does not support registering with APNs.
130
+ * @platform ios
131
+ */
132
+ export async function getIosPushNotificationServiceEnvironmentAsync() {
133
+ if (!ExpoApplication.getPushNotificationServiceEnvironmentAsync) {
134
+ throw new UnavailabilityError('expo-application', 'getPushNotificationServiceEnvironmentAsync');
135
+ }
136
+ return await ExpoApplication.getPushNotificationServiceEnvironmentAsync();
137
+ }
138
+ // @needsAudit
139
+ /**
140
+ * Gets the time the app was installed onto the device, not counting subsequent updates. If the app
141
+ * is uninstalled and reinstalled, this method returns the time the app was reinstalled.
142
+ * - On iOS, this method uses the [`NSFileCreationDate`](https://developer.apple.com/documentation/foundation/nsfilecreationdate?language=objc)
143
+ * of the app's document root directory.
144
+ * - On Android, this method uses [`PackageInfo.firstInstallTime`](https://developer.android.com/reference/android/content/pm/PackageInfo.html#firstInstallTime).
145
+ * - On web, this method returns `null`.
146
+ *
147
+ * @return Returns a `Promise` that fulfills with a `Date` object that specifies the time the app
148
+ * was installed on the device.
149
+ *
150
+ * @example
151
+ * ```ts
152
+ * await Application.getInstallationTimeAsync();
153
+ * // 2019-07-18T18:08:26.121Z
154
+ * ```
155
+ */
156
+ export async function getInstallationTimeAsync() {
157
+ if (!ExpoApplication.getInstallationTimeAsync) {
158
+ throw new UnavailabilityError('expo-application', 'getInstallationTimeAsync');
159
+ }
160
+ const installationTime = await ExpoApplication.getInstallationTimeAsync();
161
+ return new Date(installationTime);
162
+ }
163
+ // @needsAudit
164
+ /**
165
+ * Gets the last time the app was updated from the Google Play Store.
166
+ * @return Returns a `Promise` that fulfills with a `Date` object that specifies the last time
167
+ * the app was updated via the Google Play Store).
168
+ *
169
+ * @example
170
+ * ```ts
171
+ * await Application.getLastUpdateTimeAsync();
172
+ * // 2019-07-18T21:20:16.887Z
173
+ * ```
174
+ * @platform android
175
+ */
176
+ export async function getLastUpdateTimeAsync() {
177
+ if (!ExpoApplication.getLastUpdateTimeAsync) {
178
+ throw new UnavailabilityError('expo-application', 'getLastUpdateTimeAsync');
179
+ }
180
+ const lastUpdateTime = await ExpoApplication.getLastUpdateTimeAsync();
181
+ return new Date(lastUpdateTime);
182
+ }
183
+ export { ApplicationReleaseType };
184
+ //# sourceMappingURL=Application.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Application.js","sourceRoot":"","sources":["../src/Application.ts"],"names":[],"mappings":"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","sourcesContent":["import { Platform, UnavailabilityError } from 'expo-modules-core';\n\nimport { ApplicationReleaseType, PushNotificationServiceEnvironment } from './Application.types';\nimport ExpoApplication from './ExpoApplication';\n\n// @needsAudit\n/**\n * The human-readable version of the native application that may be displayed in the app store.\n * This is the `Info.plist` value for `CFBundleShortVersionString` on iOS and the version name set\n * by `version` in `app.json` on Android at the time the native app was built.\n * On web, this value is `null`.\n * @example `\"2.11.0\"`\n */\nexport const nativeApplicationVersion: string | null = ExpoApplication\n ? ExpoApplication.nativeApplicationVersion || null\n : null;\n\n// @needsAudit\n/**\n * The internal build version of the native application that the app store may use to distinguish\n * between different binaries. This is the `Info.plist` value for `CFBundleVersion` on iOS (set with\n * `ios.buildNumber` value in `app.json` in a standalone app) and the version code set by\n * `android.versionCode` in `app.json` on Android at the time the native app was built. On web, this\n * value is `null`. The return type on Android and iOS is `string`.\n * @example iOS: `\"2.11.0\"`, Android: `\"114\"`\n */\nexport const nativeBuildVersion: string | null = ExpoApplication\n ? ExpoApplication.nativeBuildVersion || null\n : null;\n\n// @needsAudit\n/**\n * The human-readable name of the application that is displayed with the app's icon on the device's\n * home screen or desktop. On Android and iOS, this value is a `string` unless the name could not be\n * retrieved, in which case this value will be `null`. On web this value is `null`.\n * @example `\"Expo\"`, `\"Yelp\"`, `\"Instagram\"`\n */\nexport const applicationName: string | null = ExpoApplication\n ? ExpoApplication.applicationName || null\n : null;\n\n// @needsAudit\n/**\n * The ID of the application. On Android, this is the application ID. On iOS, this is the bundle ID.\n * On web, this is `null`.\n * @example `\"com.cocoacasts.scribbles\"`, `\"com.apple.Pages\"`\n */\nexport const applicationId: string | null = ExpoApplication\n ? ExpoApplication.applicationId || null\n : null;\n\n// @needsAudit\n/**\n * Gets the value of [`Settings.Secure.ANDROID_ID`](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).\n * This is a hexadecimal `string` unique to each combination of app-signing key, user, and device.\n * The value may change if a factory reset is performed on the device or if an APK signing key changes.\n * For more information about how the platform handles `ANDROID_ID` in Android 8.0 (API level 26)\n * and higher, see [Android 8.0 Behavior Changes](https://developer.android.com/about/versions/oreo/android-8.0-changes.html#privacy-all).\n * On iOS and web, this function is unavailable.\n * > In versions of the platform lower than Android 8.0 (API level 26), this value remains constant\n * > for the lifetime of the user's device. See the [ANDROID_ID](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID)\n * > official docs for more information.\n * @example `\"dd96dec43fb81c97\"`\n * @platform android\n */\nexport function getAndroidId(): string {\n if (Platform.OS !== 'android') {\n throw new UnavailabilityError('expo-application', 'androidId');\n }\n return ExpoApplication.androidId;\n}\n\n// @needsAudit\n/**\n * Gets the referrer URL of the installed app with the [`Install Referrer API`](https://developer.android.com/google/play/installreferrer)\n * from the Google Play Store. In practice, the referrer URL may not be a complete, absolute URL.\n * @return A `Promise` that fulfills with a `string` of the referrer URL of the installed app.\n *\n * @example\n * ```ts\n * await Application.getInstallReferrerAsync();\n * // \"utm_source=google-play&utm_medium=organic\"\n * ```\n * @platform android\n */\nexport async function getInstallReferrerAsync(): Promise<string> {\n if (!ExpoApplication.getInstallReferrerAsync) {\n throw new UnavailabilityError('expo-application', 'getInstallReferrerAsync');\n }\n return await ExpoApplication.getInstallReferrerAsync();\n}\n\n// @needsAudit\n/**\n * Gets the iOS \"identifier for vendor\" ([IDFV](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor))\n * value, a string ID that uniquely identifies a device to the app’s vendor. This method may\n * sometimes return `nil`, in which case wait and call the method again later. This might happen\n * when the device has been restarted before the user has unlocked the device.\n *\n * The OS will change the vendor identifier if all apps from the current app's vendor have been\n * uninstalled.\n *\n * @return A `Promise` that fulfills with a `string` specifying the app's vendor ID. Apps from the\n * same vendor will return the same ID. See Apple's documentation for more information about the\n * vendor ID's semantics.\n *\n * @example\n * ```ts\n * await Application.getIosIdForVendorAsync();\n * // \"68753A44-4D6F-1226-9C60-0050E4C00067\"\n * ```\n * @platform ios\n */\nexport async function getIosIdForVendorAsync(): Promise<string | null> {\n if (!ExpoApplication.getIosIdForVendorAsync) {\n throw new UnavailabilityError('expo-application', 'getIosIdForVendorAsync');\n }\n return await ExpoApplication.getIosIdForVendorAsync();\n}\n\n// @needsAudit\n/**\n * Gets the iOS application release type.\n * @return Returns a promise which fulfills with an [`ApplicationReleaseType`](#applicationreleasetype).\n * @platform ios\n */\nexport async function getIosApplicationReleaseTypeAsync(): Promise<ApplicationReleaseType> {\n if (!ExpoApplication.getApplicationReleaseTypeAsync) {\n throw new UnavailabilityError('expo-application', 'getApplicationReleaseTypeAsync');\n }\n return await ExpoApplication.getApplicationReleaseTypeAsync();\n}\n\n// @needsAudit\n/**\n * Gets the current [Apple Push Notification (APN)](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment?language=objc)\n * service environment.\n * @return Returns a promise fulfilled with the string, either `'development'` or `'production'`,\n * based on the current APN environment, or `null` on the simulator as it does not support registering with APNs.\n * @platform ios\n */\nexport async function getIosPushNotificationServiceEnvironmentAsync(): Promise<PushNotificationServiceEnvironment> {\n if (!ExpoApplication.getPushNotificationServiceEnvironmentAsync) {\n throw new UnavailabilityError('expo-application', 'getPushNotificationServiceEnvironmentAsync');\n }\n return await ExpoApplication.getPushNotificationServiceEnvironmentAsync();\n}\n\n// @needsAudit\n/**\n * Gets the time the app was installed onto the device, not counting subsequent updates. If the app\n * is uninstalled and reinstalled, this method returns the time the app was reinstalled.\n * - On iOS, this method uses the [`NSFileCreationDate`](https://developer.apple.com/documentation/foundation/nsfilecreationdate?language=objc)\n * of the app's document root directory.\n * - On Android, this method uses [`PackageInfo.firstInstallTime`](https://developer.android.com/reference/android/content/pm/PackageInfo.html#firstInstallTime).\n * - On web, this method returns `null`.\n *\n * @return Returns a `Promise` that fulfills with a `Date` object that specifies the time the app\n * was installed on the device.\n *\n * @example\n * ```ts\n * await Application.getInstallationTimeAsync();\n * // 2019-07-18T18:08:26.121Z\n * ```\n */\nexport async function getInstallationTimeAsync(): Promise<Date> {\n if (!ExpoApplication.getInstallationTimeAsync) {\n throw new UnavailabilityError('expo-application', 'getInstallationTimeAsync');\n }\n const installationTime = await ExpoApplication.getInstallationTimeAsync();\n return new Date(installationTime);\n}\n\n// @needsAudit\n/**\n * Gets the last time the app was updated from the Google Play Store.\n * @return Returns a `Promise` that fulfills with a `Date` object that specifies the last time\n * the app was updated via the Google Play Store).\n *\n * @example\n * ```ts\n * await Application.getLastUpdateTimeAsync();\n * // 2019-07-18T21:20:16.887Z\n * ```\n * @platform android\n */\nexport async function getLastUpdateTimeAsync(): Promise<Date> {\n if (!ExpoApplication.getLastUpdateTimeAsync) {\n throw new UnavailabilityError('expo-application', 'getLastUpdateTimeAsync');\n }\n const lastUpdateTime = await ExpoApplication.getLastUpdateTimeAsync();\n return new Date(lastUpdateTime);\n}\n\nexport { ApplicationReleaseType, PushNotificationServiceEnvironment };\n"]}
@@ -0,0 +1,13 @@
1
+ export declare enum ApplicationReleaseType {
2
+ UNKNOWN = 0,
3
+ SIMULATOR = 1,
4
+ ENTERPRISE = 2,
5
+ DEVELOPMENT = 3,
6
+ AD_HOC = 4,
7
+ APP_STORE = 5
8
+ }
9
+ /**
10
+ * Maps to the [`aps-environment`](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment) key in the native target's registered entitlements.
11
+ */
12
+ export type PushNotificationServiceEnvironment = 'development' | 'production' | null;
13
+ //# sourceMappingURL=Application.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Application.types.d.ts","sourceRoot":"","sources":["../src/Application.types.ts"],"names":[],"mappings":"AACA,oBAAY,sBAAsB;IAChC,OAAO,IAAI;IACX,SAAS,IAAI;IACb,UAAU,IAAI;IACd,WAAW,IAAI;IACf,MAAM,IAAI;IACV,SAAS,IAAI;CACd;AAED;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG,aAAa,GAAG,YAAY,GAAG,IAAI,CAAC"}
@@ -0,0 +1,11 @@
1
+ // @docsMissing
2
+ export var ApplicationReleaseType;
3
+ (function (ApplicationReleaseType) {
4
+ ApplicationReleaseType[ApplicationReleaseType["UNKNOWN"] = 0] = "UNKNOWN";
5
+ ApplicationReleaseType[ApplicationReleaseType["SIMULATOR"] = 1] = "SIMULATOR";
6
+ ApplicationReleaseType[ApplicationReleaseType["ENTERPRISE"] = 2] = "ENTERPRISE";
7
+ ApplicationReleaseType[ApplicationReleaseType["DEVELOPMENT"] = 3] = "DEVELOPMENT";
8
+ ApplicationReleaseType[ApplicationReleaseType["AD_HOC"] = 4] = "AD_HOC";
9
+ ApplicationReleaseType[ApplicationReleaseType["APP_STORE"] = 5] = "APP_STORE";
10
+ })(ApplicationReleaseType || (ApplicationReleaseType = {}));
11
+ //# sourceMappingURL=Application.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Application.types.js","sourceRoot":"","sources":["../src/Application.types.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,MAAM,CAAN,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,yEAAW,CAAA;IACX,6EAAa,CAAA;IACb,+EAAc,CAAA;IACd,iFAAe,CAAA;IACf,uEAAU,CAAA;IACV,6EAAa,CAAA;AACf,CAAC,EAPW,sBAAsB,KAAtB,sBAAsB,QAOjC","sourcesContent":["// @docsMissing\nexport enum ApplicationReleaseType {\n UNKNOWN = 0,\n SIMULATOR = 1,\n ENTERPRISE = 2,\n DEVELOPMENT = 3,\n AD_HOC = 4,\n APP_STORE = 5,\n}\n\n/**\n * Maps to the [`aps-environment`](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment) key in the native target's registered entitlements.\n */\nexport type PushNotificationServiceEnvironment = 'development' | 'production' | null;\n"]}
@@ -0,0 +1,3 @@
1
+ declare const _default: any;
2
+ export default _default;
3
+ //# sourceMappingURL=ExpoApplication.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoApplication.d.ts","sourceRoot":"","sources":["../src/ExpoApplication.ts"],"names":[],"mappings":";AAEA,wBAAsD"}
@@ -0,0 +1,3 @@
1
+ import { requireNativeModule } from 'expo-modules-core';
2
+ export default requireNativeModule('ExpoApplication');
3
+ //# sourceMappingURL=ExpoApplication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoApplication.js","sourceRoot":"","sources":["../src/ExpoApplication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,eAAe,mBAAmB,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\n\nexport default requireNativeModule('ExpoApplication');\n"]}
@@ -0,0 +1,11 @@
1
+ interface KeplerExpoApplication {
2
+ applicationId: string;
3
+ applicationName: string;
4
+ nativeApplicationVersion: string;
5
+ nativeBuildVersion: string;
6
+ getInstallationTimeAsync: () => Promise<number>;
7
+ getLastUpdateTimeAsync: () => Promise<number>;
8
+ }
9
+ declare const module: KeplerExpoApplication;
10
+ export default module;
11
+ //# sourceMappingURL=ExpoApplication.kepler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoApplication.kepler.d.ts","sourceRoot":"","sources":["../src/ExpoApplication.kepler.ts"],"names":[],"mappings":"AAaA,UAAU,qBAAqB;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,wBAAwB,EAAE,MAAM,CAAC;IACjC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,wBAAwB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,sBAAsB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;CACjD;AAED,QAAA,MAAM,MAAM,EAAE,qBAqBb,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { TurboModuleRegistry } from '@amazon-devices/keplerscript-turbomodule-api';
2
+ const nativeModule = TurboModuleRegistry.getEnforcing('ExpoApplication');
3
+ const module = {
4
+ get applicationId() {
5
+ return nativeModule.applicationId();
6
+ },
7
+ get applicationName() {
8
+ return nativeModule.applicationName();
9
+ },
10
+ get nativeApplicationVersion() {
11
+ return nativeModule.nativeApplicationVersion();
12
+ },
13
+ get nativeBuildVersion() {
14
+ return nativeModule.nativeBuildVersion();
15
+ },
16
+ async getInstallationTimeAsync() {
17
+ const installationTime = await nativeModule.getInstallationTimeAsync();
18
+ return Number.parseInt(installationTime) * 1000;
19
+ },
20
+ async getLastUpdateTimeAsync() {
21
+ const lastUpdateTime = await nativeModule.getLastUpdateTimeAsync();
22
+ return Number.parseInt(lastUpdateTime) * 1000;
23
+ },
24
+ };
25
+ export default module;
26
+ //# sourceMappingURL=ExpoApplication.kepler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoApplication.kepler.js","sourceRoot":"","sources":["../src/ExpoApplication.kepler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AAW1F,MAAM,YAAY,GAAG,mBAAmB,CAAC,YAAY,CAAO,iBAAiB,CAAS,CAAC;AAWvF,MAAM,MAAM,GAA0B;IAClC,IAAI,aAAa;QACb,OAAO,YAAY,CAAC,aAAa,EAAE,CAAC;IACxC,CAAC;IACD,IAAI,eAAe;QACf,OAAO,YAAY,CAAC,eAAe,EAAE,CAAC;IAC1C,CAAC;IACD,IAAI,wBAAwB;QACxB,OAAO,YAAY,CAAC,wBAAwB,EAAE,CAAC;IACnD,CAAC;IACD,IAAI,kBAAkB;QAClB,OAAO,YAAY,CAAC,kBAAkB,EAAE,CAAC;IAC7C,CAAC;IACD,KAAK,CAAC,wBAAwB;QAC1B,MAAM,gBAAgB,GAAG,MAAM,YAAY,CAAC,wBAAwB,EAAE,CAAC;QACvE,OAAO,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;IACpD,CAAC;IACD,KAAK,CAAC,sBAAsB;QACxB,MAAM,cAAc,GAAG,MAAM,YAAY,CAAC,sBAAsB,EAAE,CAAC;QACnE,OAAO,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;IAClD,CAAC;CACJ,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import {KeplerTurboModule, TurboModuleRegistry} from '@amazon-devices/keplerscript-turbomodule-api';\n\ninterface Spec extends KeplerTurboModule {\n applicationId: () => string;\n applicationName: () => string;\n nativeApplicationVersion: () => string;\n nativeBuildVersion: () => string;\n getInstallationTimeAsync: () => Promise<string>;\n getLastUpdateTimeAsync: () => Promise<string>;\n}\n\nconst nativeModule = TurboModuleRegistry.getEnforcing<Spec>('ExpoApplication') as Spec;\n\ninterface KeplerExpoApplication {\n applicationId: string;\n applicationName: string;\n nativeApplicationVersion: string;\n nativeBuildVersion: string;\n getInstallationTimeAsync: () => Promise<number>;\n getLastUpdateTimeAsync: () => Promise<number>;\n}\n\nconst module: KeplerExpoApplication = {\n get applicationId() {\n return nativeModule.applicationId();\n },\n get applicationName() {\n return nativeModule.applicationName();\n },\n get nativeApplicationVersion() {\n return nativeModule.nativeApplicationVersion();\n },\n get nativeBuildVersion() {\n return nativeModule.nativeBuildVersion();\n },\n async getInstallationTimeAsync(): Promise<number> {\n const installationTime = await nativeModule.getInstallationTimeAsync();\n return Number.parseInt(installationTime) * 1000;\n },\n async getLastUpdateTimeAsync(): Promise<number> {\n const lastUpdateTime = await nativeModule.getLastUpdateTimeAsync();\n return Number.parseInt(lastUpdateTime) * 1000;\n },\n};\n\nexport default module;\n"]}
@@ -0,0 +1,11 @@
1
+ declare const _default: {
2
+ readonly name: string;
3
+ readonly applicationName: null;
4
+ readonly bundleId: null;
5
+ readonly nativeApplicationVersion: null;
6
+ readonly nativeBuildVersion: null;
7
+ readonly androidId: null;
8
+ getInstallationTimeAsync(): Promise<null>;
9
+ };
10
+ export default _default;
11
+ //# sourceMappingURL=ExpoApplication.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoApplication.web.d.ts","sourceRoot":"","sources":["../src/ExpoApplication.web.ts"],"names":[],"mappings":";mBACc,MAAM;8BAGK,IAAI;uBAGX,IAAI;uCAGY,IAAI;iCAGV,IAAI;wBAGb,IAAI;gCAGa,OAAO,CAAC,IAAI,CAAC;;AAnBjD,wBAsBE"}
@@ -0,0 +1,24 @@
1
+ export default {
2
+ get name() {
3
+ return 'ExpoApplication';
4
+ },
5
+ get applicationName() {
6
+ return null;
7
+ },
8
+ get bundleId() {
9
+ return null;
10
+ },
11
+ get nativeApplicationVersion() {
12
+ return null;
13
+ },
14
+ get nativeBuildVersion() {
15
+ return null;
16
+ },
17
+ get androidId() {
18
+ return null;
19
+ },
20
+ async getInstallationTimeAsync() {
21
+ return null;
22
+ },
23
+ };
24
+ //# sourceMappingURL=ExpoApplication.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoApplication.web.js","sourceRoot":"","sources":["../src/ExpoApplication.web.ts"],"names":[],"mappings":"AAAA,eAAe;IACb,IAAI,IAAI;QACN,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IACD,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,wBAAwB;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,kBAAkB;QACpB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,SAAS;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IACD,KAAK,CAAC,wBAAwB;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC","sourcesContent":["export default {\n get name(): string {\n return 'ExpoApplication';\n },\n get applicationName(): null {\n return null;\n },\n get bundleId(): null {\n return null;\n },\n get nativeApplicationVersion(): null {\n return null;\n },\n get nativeBuildVersion(): null {\n return null;\n },\n get androidId(): null {\n return null;\n },\n async getInstallationTimeAsync(): Promise<null> {\n return null;\n },\n};\n"]}
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "expo-application",
3
+ "platforms": ["ios", "android"],
4
+ "ios": {
5
+ "modules": ["ApplicationModule"]
6
+ },
7
+ "android": {
8
+ "modules": ["expo.modules.application.ApplicationModule"]
9
+ }
10
+ }
@@ -0,0 +1,19 @@
1
+ import ExpoModulesCore
2
+
3
+ internal class UrlDocumentDirectoryException: Exception {
4
+ override var reason: String {
5
+ "Unable to get url for document directory"
6
+ }
7
+ }
8
+
9
+ internal class InstallationTimeException: Exception {
10
+ override var reason: String {
11
+ "Unable to get installation time of this application"
12
+ }
13
+ }
14
+
15
+ internal class DateCastException: Exception {
16
+ override var reason: String {
17
+ "Invalid date format"
18
+ }
19
+ }
@@ -0,0 +1,48 @@
1
+ // Copyright 2018-present 650 Industries. All rights reserved.
2
+ import ExpoModulesCore
3
+
4
+ public class ApplicationModule: Module {
5
+ public func definition() -> ModuleDefinition {
6
+ Name("ExpoApplication")
7
+
8
+ Constants {
9
+ let infoPlist = Bundle.main.infoDictionary
10
+ return [
11
+ "applicationName": infoPlist?["CFBundleDisplayName"],
12
+ "applicationId": infoPlist?["CFBundleIdentifier"],
13
+ "nativeApplicationVersion": infoPlist?["CFBundleShortVersionString"],
14
+ "nativeBuildVersion": infoPlist?["CFBundleVersion"]
15
+ ]
16
+ }
17
+
18
+ AsyncFunction("getIosIdForVendorAsync") { () -> String? in
19
+ return UIDevice.current.identifierForVendor?.uuidString
20
+ }
21
+
22
+ AsyncFunction("getInstallationTimeAsync") { () -> Double in
23
+ guard let urlToDocumentsFolder = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).last else {
24
+ throw UrlDocumentDirectoryException()
25
+ }
26
+
27
+ do {
28
+ let fileAttributes = try FileManager.default.attributesOfItem(atPath: urlToDocumentsFolder.path)
29
+ if let installDate = fileAttributes[FileAttributeKey.creationDate] as? Date {
30
+ return installDate.timeIntervalSince1970 * 1000
31
+ }
32
+ throw DateCastException()
33
+ } catch {
34
+ throw InstallationTimeException()
35
+ }
36
+ }
37
+
38
+ AsyncFunction("getApplicationReleaseTypeAsync") { () -> Int in
39
+ let mainProvisioningProfile = ApplicationModuleProvisioningProfile.mainProvisioningProfile
40
+ return mainProvisioningProfile.appReleaseType().rawValue
41
+ }
42
+
43
+ AsyncFunction("getPushNotificationServiceEnvironmentAsync") { () -> String? in
44
+ let mainProvisioningProfile = ApplicationModuleProvisioningProfile.mainProvisioningProfile
45
+ return mainProvisioningProfile.notificationServiceEnvironment()
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,75 @@
1
+ // Copyright 2015-present 650 Industries. All rights reserved.
2
+ import ExpoModulesCore
3
+
4
+ class ApplicationModuleProvisioningProfile {
5
+ private let plist = readProvisioningProfilePlist()
6
+ static let mainProvisioningProfile = ApplicationModuleProvisioningProfile()
7
+
8
+ func notificationServiceEnvironment() -> String? {
9
+ guard let plist = plist else {
10
+ return nil
11
+ }
12
+
13
+ let entitlements = plist["Entitlements"] as? [String: Any]
14
+ return entitlements?["aps-environment"] as? String
15
+ }
16
+
17
+ func appReleaseType() -> AppReleaseType {
18
+ guard let provisioningPath = Bundle.main.path(forResource: "embedded", ofType: "mobileprovision") else {
19
+ #if targetEnvironment(simulator)
20
+ return .simulator
21
+ #else
22
+ return .appStore
23
+ #endif
24
+ }
25
+
26
+ guard let mobileProvision = plist else {
27
+ return .unknown
28
+ }
29
+
30
+ if let provisionsAllDevices = mobileProvision["ProvisionsAllDevices"] as? Bool, provisionsAllDevices {
31
+ return .enterprise
32
+ }
33
+ if let provisionedDevices = mobileProvision["ProvisionedDevices"] as? [String], !provisionedDevices.isEmpty {
34
+ let entitlements = mobileProvision["Entitlements"] as? [String: Any]
35
+ if let getTaskAllow = entitlements?["get-task-allow"] as? Bool, getTaskAllow {
36
+ return .dev
37
+ }
38
+ return .adHoc
39
+ }
40
+ return .appStore
41
+ }
42
+
43
+ private static func readProvisioningProfilePlist() -> [String: Any]? {
44
+ guard let profilePath = Bundle.main.path(forResource: "embedded", ofType: "mobileprovision") else {
45
+ return nil
46
+ }
47
+
48
+ do {
49
+ let profileString = try String(contentsOfFile: profilePath, encoding: .ascii)
50
+ guard let plistStart = profileString.range(of: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"),
51
+ let plistEnd = profileString.range(of: "</plist>") else {
52
+ return nil
53
+ }
54
+
55
+ let plistString = String(profileString[plistStart.lowerBound..<plistEnd.upperBound])
56
+ if let plistData = plistString.data(using: .utf8) {
57
+ return try PropertyListSerialization.propertyList(from: plistData, options: [], format: nil) as? [String: Any]
58
+ }
59
+ log.error("Failed to convert plistString to UTF-8 encoded data object.")
60
+ return nil
61
+ } catch {
62
+ log.error("Error reading provisioning profile: \(error.localizedDescription)")
63
+ return nil
64
+ }
65
+ }
66
+ }
67
+
68
+ enum AppReleaseType: Int, Enumerable {
69
+ case unknown = 0
70
+ case simulator = 1
71
+ case enterprise = 2
72
+ case dev = 3
73
+ case adHoc = 4
74
+ case appStore = 5
75
+ }