@amazon-devices/expo-application 2.0.9000000001 → 3.0.0
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/build/ExpoApplication.kepler.js +1 -1
- package/build/ExpoApplication.kepler.js.map +1 -1
- package/lib/aarch64-release/libexpo-application-3.so +0 -0
- package/lib/armv7-release/libexpo-application-3.so +0 -0
- package/lib/x86_64-release/libexpo-application-3.so +0 -0
- package/package.json +1 -1
- package/react-native.config.js +5 -4
- package/.eslintrc.js +0 -2
- package/CHANGELOG.md +0 -176
- package/CMakeLists.txt +0 -55
- package/THIRD_PARTY_NOTICES.txt +0 -4
- package/android/build.gradle +0 -115
- package/android/src/main/AndroidManifest.xml +0 -2
- package/android/src/main/java/expo/modules/application/ApplicationModule.kt +0 -125
- package/expo-module.config.json +0 -10
- package/ios/ApplicationExceptions.swift +0 -19
- package/ios/ApplicationModule.swift +0 -48
- package/ios/ApplicationModuleProvisioningProfile.swift +0 -75
- package/ios/ExpoApplication.podspec +0 -32
- package/kepler/ExpoApplication.cpp +0 -110
- package/kepler/ExpoApplication.h +0 -37
- package/kepler/KeplerInit.cpp +0 -23
- package/kepler/test/ExpoApplication.cpp +0 -80
- package/kepler-compatibility.json +0 -7
- package/src/.gitkeep +0 -0
- package/src/Application.ts +0 -196
- package/src/Application.types.ts +0 -14
- package/src/ExpoApplication.kepler.ts +0 -45
- package/src/ExpoApplication.ts +0 -3
- package/src/ExpoApplication.web.ts +0 -23
- package/tsconfig.json +0 -9
- package/unimodule.json +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TurboModuleRegistry } from '@amazon-devices/keplerscript-turbomodule-api';
|
|
2
|
-
const nativeModule = TurboModuleRegistry.getEnforcing('
|
|
2
|
+
const nativeModule = TurboModuleRegistry.getEnforcing('ExpoApplicationAppTM');
|
|
3
3
|
const module = {
|
|
4
4
|
get applicationId() {
|
|
5
5
|
return nativeModule.applicationId();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoApplication.kepler.js","sourceRoot":"","sources":["../src/ExpoApplication.kepler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAWzE,MAAM,YAAY,GAAG,mBAAmB,CAAC,YAAY,CAAO,
|
|
1
|
+
{"version":3,"file":"ExpoApplication.kepler.js","sourceRoot":"","sources":["../src/ExpoApplication.kepler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAWzE,MAAM,YAAY,GAAG,mBAAmB,CAAC,YAAY,CAAO,sBAAsB,CAAS,CAAC;AAW5F,MAAM,MAAM,GAA0B;IACpC,IAAI,aAAa;QACf,OAAO,YAAY,CAAC,aAAa,EAAE,CAAC;IACtC,CAAC;IACD,IAAI,eAAe;QACjB,OAAO,YAAY,CAAC,eAAe,EAAE,CAAC;IACxC,CAAC;IACD,IAAI,wBAAwB;QAC1B,OAAO,YAAY,CAAC,wBAAwB,EAAE,CAAC;IACjD,CAAC;IACD,IAAI,kBAAkB;QACpB,OAAO,YAAY,CAAC,kBAAkB,EAAE,CAAC;IAC3C,CAAC;IACD,KAAK,CAAC,wBAAwB;QAC5B,OAAO,YAAY,CAAC,wBAAwB,EAAE,CAAC;IACjD,CAAC;IACD,KAAK,CAAC,sBAAsB;QAC1B,OAAO,YAAY,CAAC,sBAAsB,EAAE,CAAC;IAC/C,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import type { KeplerTurboModule } from '@amazon-devices/keplerscript-turbomodule-api';\nimport { 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<number>;\n getLastUpdateTimeAsync: () => Promise<number>;\n}\n\nconst nativeModule = TurboModuleRegistry.getEnforcing<Spec>('ExpoApplicationAppTM') 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 return nativeModule.getInstallationTimeAsync();\n },\n async getLastUpdateTimeAsync(): Promise<number> {\n return nativeModule.getLastUpdateTimeAsync();\n },\n};\n\nexport default module;\n"]}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@amazon-devices/expo-application", "version": "
|
|
1
|
+
{"name": "@amazon-devices/expo-application", "version": "3.0.0+5.6.0", "description": "A universal module that gets native application information such as its ID, app name, and build version at runtime", "main": "build/Application.js", "types": "build/Application.d.ts", "scripts": {"build": "expo-module build", "clean": "expo-module clean", "lint": "expo-module lint", "test": "expo-module test", "prepublishOnly": "expo-module prepublishOnly", "expo-module": "expo-module"}, "kepler": {"temporary-alias-for-package": {"name": "expo-application", "version": "5.6.0"}}, "keywords": ["react-native", "expo", "expo-application"], "repository": {"type": "git", "url": "https://github.com/expo/expo.git", "directory": "packages/expo-application"}, "bugs": {"url": "https://github.com/expo/expo/issues"}, "author": "650 Industries, Inc.", "license": "See license in LICENSE", "homepage": "https://docs.expo.dev/versions/latest/sdk/application/", "jest": {"preset": "expo-module-scripts"}, "dependencies": {"@amazon-devices/keplerscript-turbomodule-api": "^1.0.0"}, "devDependencies": {"expo-module-scripts": "^3.0.0"}, "peerDependencies": {"react-native": "*", "expo": "^50.0.0-alpha.1"}, "files": ["build", "lib", "react-native.config.js", "mocks"]}
|
package/react-native.config.js
CHANGED
|
@@ -10,10 +10,11 @@ module.exports = {
|
|
|
10
10
|
platforms: {
|
|
11
11
|
kepler: {
|
|
12
12
|
autolink: {
|
|
13
|
-
|
|
14
|
-
provider: '
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
ExpoApplicationAppLib: {
|
|
14
|
+
provider: 'application',
|
|
15
|
+
linkDynamic: true,
|
|
16
|
+
libraryName: 'libexpo-application-3.so',
|
|
17
|
+
turbomodules: ['ExpoApplicationAppTM'],
|
|
17
18
|
},
|
|
18
19
|
},
|
|
19
20
|
},
|
package/.eslintrc.js
DELETED
package/CHANGELOG.md
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## Unpublished
|
|
4
|
-
|
|
5
|
-
### 🛠 Breaking changes
|
|
6
|
-
|
|
7
|
-
### 🎉 New features
|
|
8
|
-
|
|
9
|
-
### 🐛 Bug fixes
|
|
10
|
-
|
|
11
|
-
### 💡 Others
|
|
12
|
-
|
|
13
|
-
## 5.6.0 — 2023-10-17
|
|
14
|
-
|
|
15
|
-
### 🛠 Breaking changes
|
|
16
|
-
|
|
17
|
-
- Dropped support for Android SDK 21 and 22. ([#24201](https://github.com/expo/expo/pull/24201) by [@behenate](https://github.com/behenate))
|
|
18
|
-
- Removed `androidId` constant in favor of a method (`getAndroidId`) to comply with Huawei and Xiaomi's app store policies. ([#22585](https://github.com/expo/expo/pull/22585) by [@fobos531](https://github.com/fobos531))
|
|
19
|
-
|
|
20
|
-
### 🎉 New features
|
|
21
|
-
|
|
22
|
-
- Migrate iOS module to Expo modules API. ([#24871](https://github.com/expo/expo/pull/24871) by [@reichhartd](https://github.com/reichhartd))
|
|
23
|
-
- Android module is now written using the Sweet API. ([#22395](https://github.com/expo/expo/pull/22585) by [@fobos531](https://github.com/fobos531))
|
|
24
|
-
|
|
25
|
-
## 5.5.0 — 2023-09-15
|
|
26
|
-
|
|
27
|
-
### 🎉 New features
|
|
28
|
-
|
|
29
|
-
- Added support for Apple tvOS. ([#24329](https://github.com/expo/expo/pull/24329) by [@douglowder](https://github.com/douglowder))
|
|
30
|
-
|
|
31
|
-
## 5.4.0 — 2023-09-04
|
|
32
|
-
|
|
33
|
-
### 🎉 New features
|
|
34
|
-
|
|
35
|
-
- Added support for React Native 0.73. ([#24018](https://github.com/expo/expo/pull/24018) by [@kudo](https://github.com/kudo))
|
|
36
|
-
|
|
37
|
-
## 5.3.1 — 2023-08-02
|
|
38
|
-
|
|
39
|
-
_This version does not introduce any user-facing changes._
|
|
40
|
-
|
|
41
|
-
## 5.3.0 — 2023-06-13
|
|
42
|
-
|
|
43
|
-
### 📚 3rd party library updates
|
|
44
|
-
|
|
45
|
-
- Updated `robolectric` to `4.10` and `junit` to `4.13.2`. ([#22395](https://github.com/expo/expo/pull/22395) by [@josephyanks](https://github.com/josephyanks))
|
|
46
|
-
|
|
47
|
-
### 🐛 Bug fixes
|
|
48
|
-
|
|
49
|
-
- Fixed Android build warnings for Gradle version 8. ([#22537](https://github.com/expo/expo/pull/22537), [#22609](https://github.com/expo/expo/pull/22609) by [@kudo](https://github.com/kudo))
|
|
50
|
-
|
|
51
|
-
## 5.2.0 — 2023-05-08
|
|
52
|
-
|
|
53
|
-
_This version does not introduce any user-facing changes._
|
|
54
|
-
|
|
55
|
-
## 5.1.1 — 2023-02-09
|
|
56
|
-
|
|
57
|
-
_This version does not introduce any user-facing changes._
|
|
58
|
-
|
|
59
|
-
## 5.1.0 — 2023-02-03
|
|
60
|
-
|
|
61
|
-
### 💡 Others
|
|
62
|
-
|
|
63
|
-
- On Android bump `compileSdkVersion` and `targetSdkVersion` to `33`. ([#20721](https://github.com/expo/expo/pull/20721) by [@lukmccall](https://github.com/lukmccall))
|
|
64
|
-
|
|
65
|
-
## 5.0.1 — 2022-10-28
|
|
66
|
-
|
|
67
|
-
_This version does not introduce any user-facing changes._
|
|
68
|
-
|
|
69
|
-
## 5.0.0 — 2022-10-06
|
|
70
|
-
|
|
71
|
-
### 🛠 Breaking changes
|
|
72
|
-
|
|
73
|
-
- Bumped iOS deployment target to 13.0 and deprecated support for iOS 12. ([#18873](https://github.com/expo/expo/pull/18873) by [@tsapeta](https://github.com/tsapeta))
|
|
74
|
-
|
|
75
|
-
## 4.2.2 — 2022-07-19
|
|
76
|
-
|
|
77
|
-
_This version does not introduce any user-facing changes._
|
|
78
|
-
|
|
79
|
-
## 4.2.1 — 2022-07-18
|
|
80
|
-
|
|
81
|
-
### 💡 Others
|
|
82
|
-
|
|
83
|
-
- Clarify that `getIosPushNotificationServiceEnvironmentAsync` returns `null` on the simulator. ([#18282](https://github.com/expo/expo/pull/18282) by [@tsapeta](https://github.com/tsapeta))
|
|
84
|
-
|
|
85
|
-
## 4.2.0 — 2022-07-07
|
|
86
|
-
|
|
87
|
-
_This version does not introduce any user-facing changes._
|
|
88
|
-
|
|
89
|
-
## 4.1.0 — 2022-04-18
|
|
90
|
-
|
|
91
|
-
### ⚠️ Notices
|
|
92
|
-
|
|
93
|
-
- On Android bump `compileSdkVersion` to `31`, `targetSdkVersion` to `31` and `Java` version to `11`. ([#16941](https://github.com/expo/expo/pull/16941) by [@bbarthec](https://github.com/bbarthec))
|
|
94
|
-
|
|
95
|
-
## 4.0.2 - 2022-02-01
|
|
96
|
-
|
|
97
|
-
### 🐛 Bug fixes
|
|
98
|
-
|
|
99
|
-
- Fix `Plugin with id 'maven' not found` build error from Android Gradle 7. ([#16080](https://github.com/expo/expo/pull/16080) by [@kudo](https://github.com/kudo))
|
|
100
|
-
|
|
101
|
-
## 4.0.1 — 2021-11-17
|
|
102
|
-
|
|
103
|
-
_This version does not introduce any user-facing changes._
|
|
104
|
-
|
|
105
|
-
## 4.0.0 — 2021-09-28
|
|
106
|
-
|
|
107
|
-
### 🛠 Breaking changes
|
|
108
|
-
|
|
109
|
-
- Dropped support for iOS 11.0 ([#14383](https://github.com/expo/expo/pull/14383) by [@cruzach](https://github.com/cruzach))
|
|
110
|
-
|
|
111
|
-
### 🐛 Bug fixes
|
|
112
|
-
|
|
113
|
-
- Fix building errors from use_frameworks! in Podfile. ([#14523](https://github.com/expo/expo/pull/14523) by [@kudo](https://github.com/kudo))
|
|
114
|
-
|
|
115
|
-
## 3.3.0 — 2021-09-08
|
|
116
|
-
|
|
117
|
-
### 💡 Others
|
|
118
|
-
|
|
119
|
-
- Rewrite android code to Kotlin ([#13792](https://github.com/expo/expo/pull/13792) by [@kkafar](https://github.com/kkafar))
|
|
120
|
-
- Add basic unit tests to Kotlin. ([#13792](https://github.com/expo/expo/pull/13792) by [@kkafar](https://github.com/kkafar))
|
|
121
|
-
|
|
122
|
-
## 3.2.0 — 2021-06-16
|
|
123
|
-
|
|
124
|
-
### 🐛 Bug fixes
|
|
125
|
-
|
|
126
|
-
- Enable kotlin in all modules. ([#12716](https://github.com/expo/expo/pull/12716) by [@wschurman](https://github.com/wschurman))
|
|
127
|
-
|
|
128
|
-
### 💡 Others
|
|
129
|
-
|
|
130
|
-
- Build Android code using Java 8 to fix Android instrumented test build error. ([#12939](https://github.com/expo/expo/pull/12939) by [@kudo](https://github.com/kudo))
|
|
131
|
-
|
|
132
|
-
## 3.1.2 — 2021-04-13
|
|
133
|
-
|
|
134
|
-
_This version does not introduce any user-facing changes._
|
|
135
|
-
|
|
136
|
-
## 3.1.1 — 2021-04-09
|
|
137
|
-
|
|
138
|
-
_This version does not introduce any user-facing changes._
|
|
139
|
-
|
|
140
|
-
## 3.1.0 — 2021-03-10
|
|
141
|
-
|
|
142
|
-
### 🎉 New features
|
|
143
|
-
|
|
144
|
-
- Updated Android build configuration to target Android 11 (added support for Android SDK 30). ([#11647](https://github.com/expo/expo/pull/11647) by [@bbarthec](https://github.com/bbarthec))
|
|
145
|
-
|
|
146
|
-
### 🐛 Bug fixes
|
|
147
|
-
|
|
148
|
-
- Remove peerDependencies and unimodulePeerDependencies from Expo modules. ([#11980](https://github.com/expo/expo/pull/11980) by [@brentvatne](https://github.com/brentvatne))
|
|
149
|
-
|
|
150
|
-
## 3.0.0 — 2021-01-15
|
|
151
|
-
|
|
152
|
-
### 🛠 Breaking changes
|
|
153
|
-
|
|
154
|
-
- Dropped support for iOS 10.0 ([#11344](https://github.com/expo/expo/pull/11344) by [@tsapeta](https://github.com/tsapeta))
|
|
155
|
-
|
|
156
|
-
## 2.4.1 — 2020-11-25
|
|
157
|
-
|
|
158
|
-
### 🐛 Bug fixes
|
|
159
|
-
|
|
160
|
-
- Fixed return type of `getIosIdForVendorAsync` to include possible `null` value which can be returned if the device hasn't been unlocked yet (for more information consult the [Apple documentation for `identifierForVendor`](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor?language=objc)). ([#10997](https://github.com/expo/expo/pull/10997) by [@sjchmiela](https://github.com/sjchmiela))
|
|
161
|
-
|
|
162
|
-
## 2.4.0 — 2020-11-17
|
|
163
|
-
|
|
164
|
-
_This version does not introduce any user-facing changes._
|
|
165
|
-
|
|
166
|
-
## 2.3.0 — 2020-08-18
|
|
167
|
-
|
|
168
|
-
_This version does not introduce any user-facing changes._
|
|
169
|
-
|
|
170
|
-
## 2.2.1 — 2020-05-28
|
|
171
|
-
|
|
172
|
-
_This version does not introduce any user-facing changes._
|
|
173
|
-
|
|
174
|
-
## 2.2.0 — 2020-05-27
|
|
175
|
-
|
|
176
|
-
_This version does not introduce any user-facing changes._
|
package/CMakeLists.txt
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# Copyright 2023 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
3
|
-
#
|
|
4
|
-
# AMAZON PROPRIETARY/CONFIDENTIAL
|
|
5
|
-
#
|
|
6
|
-
# You may not use this file except in compliance with the terms and conditions
|
|
7
|
-
# set forth in the accompanying LICENSE.TXT file.
|
|
8
|
-
#
|
|
9
|
-
# THESE MATERIALS ARE PROVIDED ON AN "AS IS" BASIS. AMAZON SPECIFICALLY
|
|
10
|
-
# DISCLAIMS, WITH RESPECT TO THESE MATERIALS, ALL WARRANTIES, EXPRESS,
|
|
11
|
-
# IMPLIED, OR STATUTORY, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
|
|
12
|
-
# FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
13
|
-
#
|
|
14
|
-
set(PACKAGE_NAME "expo-application")
|
|
15
|
-
set(AUTO_LINK_PACKAGE_NAME "${PACKAGE_NAME}-${KEPLER_REACT_NATIVE_MAJOR_VERSION}")
|
|
16
|
-
set(SOURCES_KEPLER kepler/ExpoApplication.cpp)
|
|
17
|
-
|
|
18
|
-
add_library(${PACKAGE_NAME} STATIC ${SOURCES_KEPLER})
|
|
19
|
-
|
|
20
|
-
kepler_add_idl_import_library(
|
|
21
|
-
idl_pkg
|
|
22
|
-
PACKAGES
|
|
23
|
-
com.amazon.kepler.experimental_mr33.packages
|
|
24
|
-
com.amazon.kepler.security
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
target_link_libraries(
|
|
28
|
-
${PACKAGE_NAME}
|
|
29
|
-
PUBLIC
|
|
30
|
-
turbomoduleAPI::turbomoduleAPI
|
|
31
|
-
idl_pkg
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
add_library(${AUTO_LINK_PACKAGE_NAME} SHARED kepler/KeplerInit.cpp)
|
|
35
|
-
|
|
36
|
-
set_target_properties(${AUTO_LINK_PACKAGE_NAME} PROPERTIES SOVERSION ${KEPLER_REACT_NATIVE_MAJOR_VERSION}.${KEPLER_REACT_NATIVE_MINOR_VERSION})
|
|
37
|
-
|
|
38
|
-
target_link_libraries(
|
|
39
|
-
${AUTO_LINK_PACKAGE_NAME}
|
|
40
|
-
PRIVATE
|
|
41
|
-
${PACKAGE_NAME}
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
# Helps in checking undefined references
|
|
45
|
-
add_executable(${AUTO_LINK_PACKAGE_NAME}_exe kepler/KeplerInit.cpp)
|
|
46
|
-
target_link_libraries(${AUTO_LINK_PACKAGE_NAME}_exe
|
|
47
|
-
PRIVATE
|
|
48
|
-
${AUTO_LINK_PACKAGE_NAME}
|
|
49
|
-
turbomoduleAPI::turbomoduleAPI
|
|
50
|
-
idl_pkg
|
|
51
|
-
)
|
|
52
|
-
|
|
53
|
-
install(TARGETS ${AUTO_LINK_PACKAGE_NAME}
|
|
54
|
-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
55
|
-
)
|
package/THIRD_PARTY_NOTICES.txt
DELETED
package/android/build.gradle
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
apply plugin: 'com.android.library'
|
|
2
|
-
apply plugin: 'kotlin-android'
|
|
3
|
-
apply plugin: 'maven-publish'
|
|
4
|
-
|
|
5
|
-
group = 'host.exp.exponent'
|
|
6
|
-
version = '5.6.0'
|
|
7
|
-
|
|
8
|
-
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
9
|
-
if (expoModulesCorePlugin.exists()) {
|
|
10
|
-
apply from: expoModulesCorePlugin
|
|
11
|
-
applyKotlinExpoModulesCorePlugin()
|
|
12
|
-
// Remove this check, but keep the contents after SDK49 support is dropped
|
|
13
|
-
if (safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
14
|
-
useExpoPublishing()
|
|
15
|
-
useCoreDependencies()
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
buildscript {
|
|
20
|
-
// Simple helper that allows the root project to override versions declared by this library.
|
|
21
|
-
ext.safeExtGet = { prop, fallback ->
|
|
22
|
-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Ensures backward compatibility
|
|
26
|
-
ext.getKotlinVersion = {
|
|
27
|
-
if (ext.has("kotlinVersion")) {
|
|
28
|
-
ext.kotlinVersion()
|
|
29
|
-
} else {
|
|
30
|
-
ext.safeExtGet("kotlinVersion", "1.8.10")
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
repositories {
|
|
35
|
-
mavenCentral()
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
dependencies {
|
|
39
|
-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
44
|
-
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
45
|
-
afterEvaluate {
|
|
46
|
-
publishing {
|
|
47
|
-
publications {
|
|
48
|
-
release(MavenPublication) {
|
|
49
|
-
from components.release
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
repositories {
|
|
53
|
-
maven {
|
|
54
|
-
url = mavenLocal().url
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
android {
|
|
62
|
-
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
63
|
-
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
64
|
-
compileSdkVersion safeExtGet("compileSdkVersion", 33)
|
|
65
|
-
|
|
66
|
-
defaultConfig {
|
|
67
|
-
minSdkVersion safeExtGet("minSdkVersion", 23)
|
|
68
|
-
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
publishing {
|
|
72
|
-
singleVariant("release") {
|
|
73
|
-
withSourcesJar()
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
lintOptions {
|
|
78
|
-
abortOnError false
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
83
|
-
if (agpVersion.tokenize('.')[0].toInteger() < 8) {
|
|
84
|
-
compileOptions {
|
|
85
|
-
sourceCompatibility JavaVersion.VERSION_11
|
|
86
|
-
targetCompatibility JavaVersion.VERSION_11
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
kotlinOptions {
|
|
90
|
-
jvmTarget = JavaVersion.VERSION_11.majorVersion
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
namespace "expo.modules.application"
|
|
95
|
-
defaultConfig {
|
|
96
|
-
versionCode 12
|
|
97
|
-
versionName '5.6.0'
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
dependencies {
|
|
102
|
-
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
103
|
-
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
104
|
-
implementation project(':expo-modules-core')
|
|
105
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
implementation 'com.android.installreferrer:installreferrer:1.0'
|
|
109
|
-
|
|
110
|
-
if (project.findProject(':expo-modules-test-core')) {
|
|
111
|
-
testImplementation project(':expo-modules-test-core')
|
|
112
|
-
}
|
|
113
|
-
testImplementation "org.robolectric:robolectric:4.10"
|
|
114
|
-
testImplementation 'junit:junit:4.13.2'
|
|
115
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
package expo.modules.application
|
|
2
|
-
|
|
3
|
-
import android.content.Context
|
|
4
|
-
import android.content.pm.PackageInfo
|
|
5
|
-
import android.content.pm.PackageManager
|
|
6
|
-
import android.os.Build
|
|
7
|
-
import android.os.RemoteException
|
|
8
|
-
import android.provider.Settings
|
|
9
|
-
import com.android.installreferrer.api.InstallReferrerClient
|
|
10
|
-
import com.android.installreferrer.api.InstallReferrerStateListener
|
|
11
|
-
import expo.modules.kotlin.Promise
|
|
12
|
-
import expo.modules.kotlin.exception.CodedException
|
|
13
|
-
import expo.modules.kotlin.exception.Exceptions
|
|
14
|
-
import expo.modules.kotlin.modules.Module
|
|
15
|
-
import expo.modules.kotlin.modules.ModuleDefinition
|
|
16
|
-
|
|
17
|
-
class ApplicationPackageNameNotFoundException(cause: PackageManager.NameNotFoundException) :
|
|
18
|
-
CodedException(message = "Unable to get install time of this application. Could not get package info or package name.", cause = cause)
|
|
19
|
-
|
|
20
|
-
class ApplicationModule : Module() {
|
|
21
|
-
private val context: Context
|
|
22
|
-
get() = appContext.reactContext ?: throw Exceptions.ReactContextLost()
|
|
23
|
-
|
|
24
|
-
override fun definition() = ModuleDefinition {
|
|
25
|
-
Name("ExpoApplication")
|
|
26
|
-
|
|
27
|
-
Constants {
|
|
28
|
-
return@Constants mapOf(
|
|
29
|
-
"applicationName" to applicationName,
|
|
30
|
-
"applicationId" to packageName,
|
|
31
|
-
"nativeApplicationVersion" to versionName,
|
|
32
|
-
"nativeBuildVersion" to versionCode.toString(),
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
Property("androidId") {
|
|
37
|
-
Settings.Secure.getString(context.contentResolver, Settings.Secure.ANDROID_ID)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
AsyncFunction("getInstallationTimeAsync") {
|
|
41
|
-
val packageManager = context.packageManager
|
|
42
|
-
val packageName = context.packageName
|
|
43
|
-
packageManager
|
|
44
|
-
.getPackageInfoCompat(packageName, 0)
|
|
45
|
-
.firstInstallTime
|
|
46
|
-
.toDouble()
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
AsyncFunction("getLastUpdateTimeAsync") {
|
|
50
|
-
val packageManager = context.packageManager
|
|
51
|
-
val packageName = context.packageName
|
|
52
|
-
packageManager
|
|
53
|
-
.getPackageInfoCompat(packageName, 0)
|
|
54
|
-
.lastUpdateTime
|
|
55
|
-
.toDouble()
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
AsyncFunction("getInstallReferrerAsync") { promise: Promise ->
|
|
59
|
-
val installReferrer = StringBuilder()
|
|
60
|
-
|
|
61
|
-
val referrerClient = InstallReferrerClient.newBuilder(context).build()
|
|
62
|
-
|
|
63
|
-
referrerClient.startConnection(object : InstallReferrerStateListener {
|
|
64
|
-
override fun onInstallReferrerSetupFinished(responseCode: Int) {
|
|
65
|
-
when (responseCode) {
|
|
66
|
-
InstallReferrerClient.InstallReferrerResponse.OK -> {
|
|
67
|
-
// Connection established and response received
|
|
68
|
-
try {
|
|
69
|
-
val response = referrerClient.installReferrer
|
|
70
|
-
installReferrer.append(response.installReferrer)
|
|
71
|
-
} catch (e: RemoteException) {
|
|
72
|
-
promise.reject("ERR_APPLICATION_INSTALL_REFERRER_REMOTE_EXCEPTION", "RemoteException getting install referrer information. This may happen if the process hosting the remote object is no longer available.", e)
|
|
73
|
-
return
|
|
74
|
-
}
|
|
75
|
-
promise.resolve(installReferrer.toString())
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
InstallReferrerClient.InstallReferrerResponse.FEATURE_NOT_SUPPORTED -> // API not available in the current Play Store app
|
|
79
|
-
promise.reject("ERR_APPLICATION_INSTALL_REFERRER_UNAVAILABLE", "The current Play Store app doesn't provide the installation referrer API, or the Play Store may not be installed.", null)
|
|
80
|
-
|
|
81
|
-
InstallReferrerClient.InstallReferrerResponse.SERVICE_UNAVAILABLE -> // Connection could not be established
|
|
82
|
-
promise.reject("ERR_APPLICATION_INSTALL_REFERRER", "General error retrieving the install referrer: response code $responseCode", null)
|
|
83
|
-
|
|
84
|
-
else -> promise.reject("ERR_APPLICATION_INSTALL_REFERRER", "General error retrieving the install referrer: response code $responseCode", null)
|
|
85
|
-
}
|
|
86
|
-
referrerClient.endConnection()
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
override fun onInstallReferrerServiceDisconnected() {
|
|
90
|
-
promise.reject("ERR_APPLICATION_INSTALL_REFERRER_SERVICE_DISCONNECTED", "Connection to install referrer service was lost.", null)
|
|
91
|
-
}
|
|
92
|
-
})
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
private val applicationName
|
|
97
|
-
get() = context.applicationInfo.loadLabel(context.packageManager).toString()
|
|
98
|
-
private val packageName
|
|
99
|
-
get() = context.packageName
|
|
100
|
-
private val packageManager
|
|
101
|
-
get() = context.packageManager
|
|
102
|
-
private val versionName
|
|
103
|
-
get() = packageManager.getPackageInfoCompat(packageName, 0).versionName
|
|
104
|
-
private val versionCode
|
|
105
|
-
get() = getLongVersionCode(packageManager.getPackageInfoCompat(packageName, 0)).toInt()
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
private fun PackageManager.getPackageInfoCompat(packageName: String, flags: Int = 0): PackageInfo =
|
|
109
|
-
try {
|
|
110
|
-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
111
|
-
getPackageInfo(packageName, PackageManager.PackageInfoFlags.of(flags.toLong()))
|
|
112
|
-
} else {
|
|
113
|
-
@Suppress("DEPRECATION") getPackageInfo(packageName, flags)
|
|
114
|
-
}
|
|
115
|
-
} catch (e: PackageManager.NameNotFoundException) {
|
|
116
|
-
throw ApplicationPackageNameNotFoundException(e)
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
private fun getLongVersionCode(info: PackageInfo): Long {
|
|
120
|
-
return if (Build.VERSION.SDK_INT >= 28) {
|
|
121
|
-
info.longVersionCode
|
|
122
|
-
} else {
|
|
123
|
-
@Suppress("DEPRECATION") info.versionCode.toLong()
|
|
124
|
-
}
|
|
125
|
-
}
|
package/expo-module.config.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
|
|
3
|
-
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
|
|
4
|
-
|
|
5
|
-
Pod::Spec.new do |s|
|
|
6
|
-
s.name = 'ExpoApplication'
|
|
7
|
-
s.version = package['version']
|
|
8
|
-
s.summary = package['description']
|
|
9
|
-
s.description = package['description']
|
|
10
|
-
s.license = package['license']
|
|
11
|
-
s.author = package['author']
|
|
12
|
-
s.homepage = package['homepage']
|
|
13
|
-
s.platforms = { :ios => '13.0', :tvos => '13.0'}
|
|
14
|
-
s.swift_version = '5.4'
|
|
15
|
-
s.source = { git: 'https://github.com/expo/expo.git' }
|
|
16
|
-
s.static_framework = true
|
|
17
|
-
|
|
18
|
-
s.dependency 'ExpoModulesCore'
|
|
19
|
-
|
|
20
|
-
# Swift/Objective-C compatibility
|
|
21
|
-
s.pod_target_xcconfig = {
|
|
22
|
-
'DEFINES_MODULE' => 'YES',
|
|
23
|
-
'SWIFT_COMPILATION_MODE' => 'wholemodule'
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if !$ExpoUseSources&.include?(package['name']) && ENV['EXPO_USE_SOURCE'].to_i == 0 && File.exist?("#{s.name}.xcframework") && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
|
|
27
|
-
s.source_files = "#{s.name}/**/*.h"
|
|
28
|
-
s.vendored_frameworks = "#{s.name}.xcframework"
|
|
29
|
-
else
|
|
30
|
-
s.source_files = "**/*.{h,m,swift}"
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* PROPRIETARY/CONFIDENTIAL
|
|
5
|
-
*
|
|
6
|
-
* Use is subject to license terms.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
#include "ExpoApplication.h"
|
|
10
|
-
|
|
11
|
-
#include <Kepler/turbomodule/TMLog.h>
|
|
12
|
-
#include <apmf/iface/com/amazon/apmf/ICredential.h>
|
|
13
|
-
#include <apmf/iface/com/amazon/apmf/RealTimeInstant.h>
|
|
14
|
-
#include <apmf/iface/com/amazon/kepler/experimental_mr33/packages/IKeplerPackageManagerModule.h>
|
|
15
|
-
#include <apmf/iface/com/amazon/kepler/experimental_mr33/packages/ILocaleString.h>
|
|
16
|
-
#include <apmf/iface/com/amazon/kepler/experimental_mr33/packages/IPackageRegistry3.h>
|
|
17
|
-
#include <apmf/iface/com/amazon/kepler/security/IKeplerSecurityModule.h>
|
|
18
|
-
#include <apmf/process.h>
|
|
19
|
-
#include <apmf/string.h>
|
|
20
|
-
#include <fmt/format.h>
|
|
21
|
-
|
|
22
|
-
#include <stdexcept>
|
|
23
|
-
|
|
24
|
-
using apmf::ICredential;
|
|
25
|
-
using apmf::iface::com::amazon::kepler::experimental_mr33::packages::IKeplerPackageManagerModule;
|
|
26
|
-
using apmf::iface::com::amazon::kepler::experimental_mr33::packages::IPackage;
|
|
27
|
-
using apmf::iface::com::amazon::kepler::experimental_mr33::packages::IPackageRegistry3;
|
|
28
|
-
using apmf::iface::com::amazon::kepler::security::IKeplerSecurityModule;
|
|
29
|
-
using com::amazon::kepler::turbomodule::Promise;
|
|
30
|
-
|
|
31
|
-
ExpoApplication::ExpoApplication() : com::amazon::kepler::turbomodule::KeplerTurboModule("ExpoApplication") {
|
|
32
|
-
TMDEBUG(fmt::format("ExpoApplication constructor {}", name()));
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
apmf::Ptr<IKeplerPackageManagerModule> packageManagerModule =
|
|
36
|
-
apmf::GetProcessObject()
|
|
37
|
-
->getComponent("/com.amazon.kepler.experimental_mr33.packages")
|
|
38
|
-
.QueryInterface<IKeplerPackageManagerModule>();
|
|
39
|
-
apmf::Ptr<IKeplerSecurityModule> securityInterface = apmf::GetProcessObject()
|
|
40
|
-
->getComponent("/com.amazon.kepler.security")
|
|
41
|
-
.QueryInterface<IKeplerSecurityModule>();
|
|
42
|
-
apmf::Ptr<ICredential> credentials = securityInterface->getCurrentContextCredential();
|
|
43
|
-
apmf::Ptr<IPackageRegistry3> iPackageRegistry3 =
|
|
44
|
-
packageManagerModule->makePackageRegistry().TryQueryInterface<IPackageRegistry3>();
|
|
45
|
-
packageInfo = iPackageRegistry3->tryGetPackageByCredential(credentials);
|
|
46
|
-
} catch (const std::exception& e) {
|
|
47
|
-
TMERROR(fmt::format("Exception caught: {}", e.what()));
|
|
48
|
-
throw std::runtime_error(e.what());
|
|
49
|
-
} catch (...) {
|
|
50
|
-
TMERROR("Unknown error caught");
|
|
51
|
-
throw std::runtime_error("Unknown error caught in ExpoApplication constructor");
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
std::string ExpoApplication::applicationId() {
|
|
56
|
-
return packageInfo->getId();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
std::string ExpoApplication::applicationName() {
|
|
60
|
-
auto title = packageInfo->getTitle();
|
|
61
|
-
if (title != nullptr) {
|
|
62
|
-
return title->getValue();
|
|
63
|
-
}
|
|
64
|
-
return {};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
std::string ExpoApplication::nativeApplicationVersion() {
|
|
68
|
-
return packageInfo->getVersion();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
std::string ExpoApplication::nativeBuildVersion() {
|
|
72
|
-
return packageInfo->getVersion();
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
Promise ExpoApplication::getInstallationTimeAsync() {
|
|
76
|
-
return Promise([this](std::shared_ptr<Promise> promise) {
|
|
77
|
-
auto installationTime = packageInfo->getInstalledTime();
|
|
78
|
-
try {
|
|
79
|
-
std::int64_t milliseconds = installationTime.time.seconds * 1000;
|
|
80
|
-
promise->resolve(milliseconds);
|
|
81
|
-
} catch (std::exception& e) {
|
|
82
|
-
promise->reject(std::string{"getInstallationTimeAsync() error: " + std::string(e.what())});
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
Promise ExpoApplication::getLastUpdateTimeAsync() {
|
|
88
|
-
return Promise([this](std::shared_ptr<Promise> promise) {
|
|
89
|
-
auto lastUpdateTime = packageInfo->getUpdatedTime();
|
|
90
|
-
try {
|
|
91
|
-
std::int64_t milliseconds = lastUpdateTime.time.seconds * 1000;
|
|
92
|
-
promise->resolve(milliseconds);
|
|
93
|
-
} catch (std::exception& e) {
|
|
94
|
-
promise->reject(std::string{"getLastUpdateTimeAsync() error: " + std::string(e.what())});
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
void ExpoApplication::aggregateMethods(
|
|
100
|
-
com::amazon::kepler::turbomodule::MethodAggregator<com::amazon::kepler::turbomodule::KeplerTurboModule>&
|
|
101
|
-
methodAggregator) const noexcept {
|
|
102
|
-
TMDEBUG("methodAggregator");
|
|
103
|
-
|
|
104
|
-
methodAggregator.addMethod("applicationId", 0, &ExpoApplication::applicationId);
|
|
105
|
-
methodAggregator.addMethod("applicationName", 0, &ExpoApplication::applicationName);
|
|
106
|
-
methodAggregator.addMethod("nativeApplicationVersion", 0, &ExpoApplication::nativeApplicationVersion);
|
|
107
|
-
methodAggregator.addMethod("nativeBuildVersion", 0, &ExpoApplication::nativeBuildVersion);
|
|
108
|
-
methodAggregator.addMethod("getInstallationTimeAsync", 0, &ExpoApplication::getInstallationTimeAsync);
|
|
109
|
-
methodAggregator.addMethod("getLastUpdateTimeAsync", 0, &ExpoApplication::getLastUpdateTimeAsync);
|
|
110
|
-
}
|
package/kepler/ExpoApplication.h
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* PROPRIETARY/CONFIDENTIAL
|
|
5
|
-
*
|
|
6
|
-
* Use is subject to license terms.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
#include <Kepler/turbomodule/KeplerTurboModule.h>
|
|
10
|
-
#include "expo-export.h"
|
|
11
|
-
|
|
12
|
-
#include <apmf/iface/com/amazon/kepler/experimental_mr33/packages/IPackage.h>
|
|
13
|
-
#include <apmf/ptr.h>
|
|
14
|
-
|
|
15
|
-
class EXPO_EXPORT ExpoApplication : public com::amazon::kepler::turbomodule::KeplerTurboModule {
|
|
16
|
-
public:
|
|
17
|
-
ExpoApplication();
|
|
18
|
-
|
|
19
|
-
void aggregateMethods(
|
|
20
|
-
com::amazon::kepler::turbomodule::MethodAggregator<com::amazon::kepler::turbomodule::KeplerTurboModule>&
|
|
21
|
-
methodAggregator) const noexcept override;
|
|
22
|
-
|
|
23
|
-
#ifndef UNIT_TEST
|
|
24
|
-
protected:
|
|
25
|
-
#endif
|
|
26
|
-
std::string applicationId();
|
|
27
|
-
std::string applicationName();
|
|
28
|
-
std::string nativeApplicationVersion();
|
|
29
|
-
std::string nativeBuildVersion();
|
|
30
|
-
com::amazon::kepler::turbomodule::Promise getInstallationTimeAsync();
|
|
31
|
-
com::amazon::kepler::turbomodule::Promise getLastUpdateTimeAsync();
|
|
32
|
-
|
|
33
|
-
#ifndef UNIT_TEST
|
|
34
|
-
private:
|
|
35
|
-
#endif
|
|
36
|
-
apmf::Ptr<apmf::iface::com::amazon::kepler::experimental_mr33::packages::IPackage> packageInfo;
|
|
37
|
-
};
|
package/kepler/KeplerInit.cpp
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* PROPRIETARY/CONFIDENTIAL
|
|
5
|
-
*
|
|
6
|
-
* Use is subject to license terms.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
#include <Kepler/turbomodule/KeplerTurboModuleRegistration.h>
|
|
10
|
-
#include <Kepler/turbomodule/TMLog.h>
|
|
11
|
-
|
|
12
|
-
#include "ExpoApplication.h"
|
|
13
|
-
|
|
14
|
-
extern "C" {
|
|
15
|
-
__attribute__((visibility("default"))) void autoLinkKeplerTurboModulesV1() noexcept {
|
|
16
|
-
TMDEBUG("autoLinkKeplerTurboModulesV1 for expo-application");
|
|
17
|
-
KEPLER_REGISTER_TURBO_MODULE_WITH_NAME("ExpoApplication", ExpoApplication);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
int main() {
|
|
22
|
-
return 0;
|
|
23
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
*
|
|
4
|
-
* PROPRIETARY/CONFIDENTIAL
|
|
5
|
-
*
|
|
6
|
-
* Use is subject to license terms.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
#include <gmock/gmock-actions.h>
|
|
10
|
-
#include <gmock/gmock.h>
|
|
11
|
-
#include <gtest/gtest.h>
|
|
12
|
-
|
|
13
|
-
#include "catch.hpp"
|
|
14
|
-
#include "JSObjectsConversion.h"
|
|
15
|
-
|
|
16
|
-
#include "../ExpoApplication.h"
|
|
17
|
-
|
|
18
|
-
// std::shared_ptr<Promise> getPromiseCallback(std::string& result) {
|
|
19
|
-
// return std::make_shared<Promise>(
|
|
20
|
-
// Callback([&result](auto v) {
|
|
21
|
-
// result = std::get<std::string>(v[0]);
|
|
22
|
-
// }),
|
|
23
|
-
// Callback([&result](auto v) {
|
|
24
|
-
// NativeJSObject m = ExpoUtils::convertJsonContainerToNativeJSObject(std::get<utils::json::JsonContainer>(v[0]));
|
|
25
|
-
// result = std::get<std::string>(m["message"]);
|
|
26
|
-
// }));
|
|
27
|
-
// }
|
|
28
|
-
|
|
29
|
-
TEST_CASE("ExpoApplication") {
|
|
30
|
-
ExpoApplication testExpoApplication{MockPackageManager()};
|
|
31
|
-
|
|
32
|
-
SECTION("ExpoApplication::applicationId") {
|
|
33
|
-
auto result = testExpoApplication.applicationId();
|
|
34
|
-
REQUIRE(result == "testID");
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
SECTION("ExpoApplication::applicationName") {
|
|
38
|
-
auto result = testExpoApplication.applicationName();
|
|
39
|
-
REQUIRE(result == "testTitle");
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
SECTION("ExpoApplication::nativeApplicationVersion") {
|
|
43
|
-
auto result = testExpoApplication.nativeApplicationVersion();
|
|
44
|
-
REQUIRE(result == "testVersion");
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
SECTION("ExpoApplication::nativeBuildVersion") {
|
|
48
|
-
auto result = testExpoApplication.nativeBuildVersion();
|
|
49
|
-
REQUIRE(result == "testVersion");
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Unable to test due to lack of 'Promise' support
|
|
53
|
-
// SECTION("ExpoApplication::getInstallationTimeAsync") {
|
|
54
|
-
// std::string result;
|
|
55
|
-
// auto promise = testExpoApplication.getInstallationTimeAsync();
|
|
56
|
-
// auto action = getPromiseCallback(result);
|
|
57
|
-
// promise.promiseOperation_(action);
|
|
58
|
-
// REQUIRE(result == "999");
|
|
59
|
-
// }
|
|
60
|
-
|
|
61
|
-
// Unable to test due to lack of 'Promise' support
|
|
62
|
-
// SECTION("ExpoApplication::getLastUpdateTimeAsync") {
|
|
63
|
-
// std::string result;
|
|
64
|
-
// auto promise = testExpoApplication.getLastUpdateTimeAsync();
|
|
65
|
-
// auto action = getPromiseCallback(result);
|
|
66
|
-
// promise.promiseOperation_(action);
|
|
67
|
-
// REQUIRE(result == "111");
|
|
68
|
-
// }
|
|
69
|
-
|
|
70
|
-
SECTION("ExpoApplication::aggregateMethods") {
|
|
71
|
-
std::weak_ptr<facebook::react::Instance> instance;
|
|
72
|
-
REQUIRE(testExpoApplication.methodContainerMap_.size() == 0);
|
|
73
|
-
testExpoApplication.triggerMethodAggregation(*testExpoApplication.jsQueue_, instance);
|
|
74
|
-
std::vector<std::string> propNames = {"applicationId", "applicationName", "nativeApplicationVersion", "nativeBuildVersion", "getInstallationTimeAsync", "getLastUpdateTimeAsync"};
|
|
75
|
-
for (auto& propName : propNames) {
|
|
76
|
-
REQUIRE(testExpoApplication.methodContainerMap_.find(propName) != testExpoApplication.methodContainerMap_.end());
|
|
77
|
-
}
|
|
78
|
-
REQUIRE(testExpoApplication.methodContainerMap_.size() == 8); // "addListener" and "removeListeners" are added by default
|
|
79
|
-
}
|
|
80
|
-
}
|
package/src/.gitkeep
DELETED
|
File without changes
|
package/src/Application.ts
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { Platform, UnavailabilityError } from 'expo-modules-core';
|
|
2
|
-
|
|
3
|
-
import { ApplicationReleaseType, PushNotificationServiceEnvironment } from './Application.types';
|
|
4
|
-
import ExpoApplication from './ExpoApplication';
|
|
5
|
-
|
|
6
|
-
// @needsAudit
|
|
7
|
-
/**
|
|
8
|
-
* The human-readable version of the native application that may be displayed in the app store.
|
|
9
|
-
* This is the `Info.plist` value for `CFBundleShortVersionString` on iOS and the version name set
|
|
10
|
-
* by `version` in `app.json` on Android at the time the native app was built.
|
|
11
|
-
* On web, this value is `null`.
|
|
12
|
-
* @example `"2.11.0"`
|
|
13
|
-
*/
|
|
14
|
-
export const nativeApplicationVersion: string | null = ExpoApplication
|
|
15
|
-
? ExpoApplication.nativeApplicationVersion || null
|
|
16
|
-
: null;
|
|
17
|
-
|
|
18
|
-
// @needsAudit
|
|
19
|
-
/**
|
|
20
|
-
* The internal build version of the native application that the app store may use to distinguish
|
|
21
|
-
* between different binaries. This is the `Info.plist` value for `CFBundleVersion` on iOS (set with
|
|
22
|
-
* `ios.buildNumber` value in `app.json` in a standalone app) and the version code set by
|
|
23
|
-
* `android.versionCode` in `app.json` on Android at the time the native app was built. On web, this
|
|
24
|
-
* value is `null`. The return type on Android and iOS is `string`.
|
|
25
|
-
* @example iOS: `"2.11.0"`, Android: `"114"`
|
|
26
|
-
*/
|
|
27
|
-
export const nativeBuildVersion: string | null = ExpoApplication
|
|
28
|
-
? ExpoApplication.nativeBuildVersion || null
|
|
29
|
-
: null;
|
|
30
|
-
|
|
31
|
-
// @needsAudit
|
|
32
|
-
/**
|
|
33
|
-
* The human-readable name of the application that is displayed with the app's icon on the device's
|
|
34
|
-
* home screen or desktop. On Android and iOS, this value is a `string` unless the name could not be
|
|
35
|
-
* retrieved, in which case this value will be `null`. On web this value is `null`.
|
|
36
|
-
* @example `"Expo"`, `"Yelp"`, `"Instagram"`
|
|
37
|
-
*/
|
|
38
|
-
export const applicationName: string | null = ExpoApplication
|
|
39
|
-
? ExpoApplication.applicationName || null
|
|
40
|
-
: null;
|
|
41
|
-
|
|
42
|
-
// @needsAudit
|
|
43
|
-
/**
|
|
44
|
-
* The ID of the application. On Android, this is the application ID. On iOS, this is the bundle ID.
|
|
45
|
-
* On web, this is `null`.
|
|
46
|
-
* @example `"com.cocoacasts.scribbles"`, `"com.apple.Pages"`
|
|
47
|
-
*/
|
|
48
|
-
export const applicationId: string | null = ExpoApplication
|
|
49
|
-
? ExpoApplication.applicationId || null
|
|
50
|
-
: null;
|
|
51
|
-
|
|
52
|
-
// @needsAudit
|
|
53
|
-
/**
|
|
54
|
-
* Gets the value of [`Settings.Secure.ANDROID_ID`](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).
|
|
55
|
-
* This is a hexadecimal `string` unique to each combination of app-signing key, user, and device.
|
|
56
|
-
* The value may change if a factory reset is performed on the device or if an APK signing key changes.
|
|
57
|
-
* For more information about how the platform handles `ANDROID_ID` in Android 8.0 (API level 26)
|
|
58
|
-
* and higher, see [Android 8.0 Behavior Changes](https://developer.android.com/about/versions/oreo/android-8.0-changes.html#privacy-all).
|
|
59
|
-
* On iOS and web, this function is unavailable.
|
|
60
|
-
* > In versions of the platform lower than Android 8.0 (API level 26), this value remains constant
|
|
61
|
-
* > for the lifetime of the user's device. See the [ANDROID_ID](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID)
|
|
62
|
-
* > official docs for more information.
|
|
63
|
-
* @example `"dd96dec43fb81c97"`
|
|
64
|
-
* @platform android
|
|
65
|
-
*/
|
|
66
|
-
export function getAndroidId(): string {
|
|
67
|
-
if (Platform.OS !== 'android') {
|
|
68
|
-
throw new UnavailabilityError('expo-application', 'androidId');
|
|
69
|
-
}
|
|
70
|
-
return ExpoApplication.androidId;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// @needsAudit
|
|
74
|
-
/**
|
|
75
|
-
* Gets the referrer URL of the installed app with the [`Install Referrer API`](https://developer.android.com/google/play/installreferrer)
|
|
76
|
-
* from the Google Play Store. In practice, the referrer URL may not be a complete, absolute URL.
|
|
77
|
-
* @return A `Promise` that fulfills with a `string` of the referrer URL of the installed app.
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```ts
|
|
81
|
-
* await Application.getInstallReferrerAsync();
|
|
82
|
-
* // "utm_source=google-play&utm_medium=organic"
|
|
83
|
-
* ```
|
|
84
|
-
* @platform android
|
|
85
|
-
*/
|
|
86
|
-
export async function getInstallReferrerAsync(): Promise<string> {
|
|
87
|
-
if (!ExpoApplication.getInstallReferrerAsync) {
|
|
88
|
-
throw new UnavailabilityError('expo-application', 'getInstallReferrerAsync');
|
|
89
|
-
}
|
|
90
|
-
return await ExpoApplication.getInstallReferrerAsync();
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// @needsAudit
|
|
94
|
-
/**
|
|
95
|
-
* Gets the iOS "identifier for vendor" ([IDFV](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor))
|
|
96
|
-
* value, a string ID that uniquely identifies a device to the app’s vendor. This method may
|
|
97
|
-
* sometimes return `nil`, in which case wait and call the method again later. This might happen
|
|
98
|
-
* when the device has been restarted before the user has unlocked the device.
|
|
99
|
-
*
|
|
100
|
-
* The OS will change the vendor identifier if all apps from the current app's vendor have been
|
|
101
|
-
* uninstalled.
|
|
102
|
-
*
|
|
103
|
-
* @return A `Promise` that fulfills with a `string` specifying the app's vendor ID. Apps from the
|
|
104
|
-
* same vendor will return the same ID. See Apple's documentation for more information about the
|
|
105
|
-
* vendor ID's semantics.
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* ```ts
|
|
109
|
-
* await Application.getIosIdForVendorAsync();
|
|
110
|
-
* // "68753A44-4D6F-1226-9C60-0050E4C00067"
|
|
111
|
-
* ```
|
|
112
|
-
* @platform ios
|
|
113
|
-
*/
|
|
114
|
-
export async function getIosIdForVendorAsync(): Promise<string | null> {
|
|
115
|
-
if (!ExpoApplication.getIosIdForVendorAsync) {
|
|
116
|
-
throw new UnavailabilityError('expo-application', 'getIosIdForVendorAsync');
|
|
117
|
-
}
|
|
118
|
-
return await ExpoApplication.getIosIdForVendorAsync();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// @needsAudit
|
|
122
|
-
/**
|
|
123
|
-
* Gets the iOS application release type.
|
|
124
|
-
* @return Returns a promise which fulfills with an [`ApplicationReleaseType`](#applicationreleasetype).
|
|
125
|
-
* @platform ios
|
|
126
|
-
*/
|
|
127
|
-
export async function getIosApplicationReleaseTypeAsync(): Promise<ApplicationReleaseType> {
|
|
128
|
-
if (!ExpoApplication.getApplicationReleaseTypeAsync) {
|
|
129
|
-
throw new UnavailabilityError('expo-application', 'getApplicationReleaseTypeAsync');
|
|
130
|
-
}
|
|
131
|
-
return await ExpoApplication.getApplicationReleaseTypeAsync();
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// @needsAudit
|
|
135
|
-
/**
|
|
136
|
-
* Gets the current [Apple Push Notification (APN)](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment?language=objc)
|
|
137
|
-
* service environment.
|
|
138
|
-
* @return Returns a promise fulfilled with the string, either `'development'` or `'production'`,
|
|
139
|
-
* based on the current APN environment, or `null` on the simulator as it does not support registering with APNs.
|
|
140
|
-
* @platform ios
|
|
141
|
-
*/
|
|
142
|
-
export async function getIosPushNotificationServiceEnvironmentAsync(): Promise<PushNotificationServiceEnvironment> {
|
|
143
|
-
if (!ExpoApplication.getPushNotificationServiceEnvironmentAsync) {
|
|
144
|
-
throw new UnavailabilityError('expo-application', 'getPushNotificationServiceEnvironmentAsync');
|
|
145
|
-
}
|
|
146
|
-
return await ExpoApplication.getPushNotificationServiceEnvironmentAsync();
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// @needsAudit
|
|
150
|
-
/**
|
|
151
|
-
* Gets the time the app was installed onto the device, not counting subsequent updates. If the app
|
|
152
|
-
* is uninstalled and reinstalled, this method returns the time the app was reinstalled.
|
|
153
|
-
* - On iOS, this method uses the [`NSFileCreationDate`](https://developer.apple.com/documentation/foundation/nsfilecreationdate?language=objc)
|
|
154
|
-
* of the app's document root directory.
|
|
155
|
-
* - On Android, this method uses [`PackageInfo.firstInstallTime`](https://developer.android.com/reference/android/content/pm/PackageInfo.html#firstInstallTime).
|
|
156
|
-
* - On web, this method returns `null`.
|
|
157
|
-
*
|
|
158
|
-
* @return Returns a `Promise` that fulfills with a `Date` object that specifies the time the app
|
|
159
|
-
* was installed on the device.
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
* ```ts
|
|
163
|
-
* await Application.getInstallationTimeAsync();
|
|
164
|
-
* // 2019-07-18T18:08:26.121Z
|
|
165
|
-
* ```
|
|
166
|
-
*/
|
|
167
|
-
export async function getInstallationTimeAsync(): Promise<Date> {
|
|
168
|
-
if (!ExpoApplication.getInstallationTimeAsync) {
|
|
169
|
-
throw new UnavailabilityError('expo-application', 'getInstallationTimeAsync');
|
|
170
|
-
}
|
|
171
|
-
const installationTime = await ExpoApplication.getInstallationTimeAsync();
|
|
172
|
-
return new Date(installationTime);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// @needsAudit
|
|
176
|
-
/**
|
|
177
|
-
* Gets the last time the app was updated from the Google Play Store.
|
|
178
|
-
* @return Returns a `Promise` that fulfills with a `Date` object that specifies the last time
|
|
179
|
-
* the app was updated via the Google Play Store).
|
|
180
|
-
*
|
|
181
|
-
* @example
|
|
182
|
-
* ```ts
|
|
183
|
-
* await Application.getLastUpdateTimeAsync();
|
|
184
|
-
* // 2019-07-18T21:20:16.887Z
|
|
185
|
-
* ```
|
|
186
|
-
* @platform android
|
|
187
|
-
*/
|
|
188
|
-
export async function getLastUpdateTimeAsync(): Promise<Date> {
|
|
189
|
-
if (!ExpoApplication.getLastUpdateTimeAsync) {
|
|
190
|
-
throw new UnavailabilityError('expo-application', 'getLastUpdateTimeAsync');
|
|
191
|
-
}
|
|
192
|
-
const lastUpdateTime = await ExpoApplication.getLastUpdateTimeAsync();
|
|
193
|
-
return new Date(lastUpdateTime);
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
export { ApplicationReleaseType, PushNotificationServiceEnvironment };
|
package/src/Application.types.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// @docsMissing
|
|
2
|
-
export enum ApplicationReleaseType {
|
|
3
|
-
UNKNOWN = 0,
|
|
4
|
-
SIMULATOR = 1,
|
|
5
|
-
ENTERPRISE = 2,
|
|
6
|
-
DEVELOPMENT = 3,
|
|
7
|
-
AD_HOC = 4,
|
|
8
|
-
APP_STORE = 5,
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Maps to the [`aps-environment`](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment) key in the native target's registered entitlements.
|
|
13
|
-
*/
|
|
14
|
-
export type PushNotificationServiceEnvironment = 'development' | 'production' | null;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { KeplerTurboModule } from '@amazon-devices/keplerscript-turbomodule-api';
|
|
2
|
-
import { TurboModuleRegistry } from '@amazon-devices/keplerscript-turbomodule-api';
|
|
3
|
-
|
|
4
|
-
interface Spec extends KeplerTurboModule {
|
|
5
|
-
applicationId: () => string;
|
|
6
|
-
applicationName: () => string;
|
|
7
|
-
nativeApplicationVersion: () => string;
|
|
8
|
-
nativeBuildVersion: () => string;
|
|
9
|
-
getInstallationTimeAsync: () => Promise<number>;
|
|
10
|
-
getLastUpdateTimeAsync: () => Promise<number>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const nativeModule = TurboModuleRegistry.getEnforcing<Spec>('ExpoApplication') as Spec;
|
|
14
|
-
|
|
15
|
-
interface KeplerExpoApplication {
|
|
16
|
-
applicationId: string;
|
|
17
|
-
applicationName: string;
|
|
18
|
-
nativeApplicationVersion: string;
|
|
19
|
-
nativeBuildVersion: string;
|
|
20
|
-
getInstallationTimeAsync: () => Promise<number>;
|
|
21
|
-
getLastUpdateTimeAsync: () => Promise<number>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const module: KeplerExpoApplication = {
|
|
25
|
-
get applicationId() {
|
|
26
|
-
return nativeModule.applicationId();
|
|
27
|
-
},
|
|
28
|
-
get applicationName() {
|
|
29
|
-
return nativeModule.applicationName();
|
|
30
|
-
},
|
|
31
|
-
get nativeApplicationVersion() {
|
|
32
|
-
return nativeModule.nativeApplicationVersion();
|
|
33
|
-
},
|
|
34
|
-
get nativeBuildVersion() {
|
|
35
|
-
return nativeModule.nativeBuildVersion();
|
|
36
|
-
},
|
|
37
|
-
async getInstallationTimeAsync(): Promise<number> {
|
|
38
|
-
return nativeModule.getInstallationTimeAsync();
|
|
39
|
-
},
|
|
40
|
-
async getLastUpdateTimeAsync(): Promise<number> {
|
|
41
|
-
return nativeModule.getLastUpdateTimeAsync();
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export default module;
|
package/src/ExpoApplication.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
get name(): string {
|
|
3
|
-
return 'ExpoApplication';
|
|
4
|
-
},
|
|
5
|
-
get applicationName(): null {
|
|
6
|
-
return null;
|
|
7
|
-
},
|
|
8
|
-
get bundleId(): null {
|
|
9
|
-
return null;
|
|
10
|
-
},
|
|
11
|
-
get nativeApplicationVersion(): null {
|
|
12
|
-
return null;
|
|
13
|
-
},
|
|
14
|
-
get nativeBuildVersion(): null {
|
|
15
|
-
return null;
|
|
16
|
-
},
|
|
17
|
-
get androidId(): null {
|
|
18
|
-
return null;
|
|
19
|
-
},
|
|
20
|
-
async getInstallationTimeAsync(): Promise<null> {
|
|
21
|
-
return null;
|
|
22
|
-
},
|
|
23
|
-
};
|
package/tsconfig.json
DELETED
package/unimodule.json
DELETED