@amazon-devices/expo-application 2.0.1758683737 → 2.0.9000000001
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/CMakeLists.txt +11 -2
- package/README.kepler.md +1 -0
- package/THIRD_PARTY_NOTICES.txt +1 -21
- package/build/ExpoApplication.kepler.d.ts.map +1 -1
- package/build/ExpoApplication.kepler.js +2 -4
- package/build/ExpoApplication.kepler.js.map +1 -1
- package/kepler/ExpoApplication.cpp +58 -26
- package/kepler/ExpoApplication.h +12 -19
- package/kepler/KeplerInit.cpp +6 -11
- package/kepler/test/ExpoApplication.cpp +0 -14
- package/kepler-compatibility.json +7 -0
- package/package.json +1 -1
- package/react-native.config.js +1 -0
- package/src/ExpoApplication.kepler.ts +32 -33
package/CMakeLists.txt
CHANGED
|
@@ -17,10 +17,18 @@ set(SOURCES_KEPLER kepler/ExpoApplication.cpp)
|
|
|
17
17
|
|
|
18
18
|
add_library(${PACKAGE_NAME} STATIC ${SOURCES_KEPLER})
|
|
19
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
|
+
|
|
20
27
|
target_link_libraries(
|
|
21
28
|
${PACKAGE_NAME}
|
|
22
29
|
PUBLIC
|
|
23
|
-
|
|
30
|
+
turbomoduleAPI::turbomoduleAPI
|
|
31
|
+
idl_pkg
|
|
24
32
|
)
|
|
25
33
|
|
|
26
34
|
add_library(${AUTO_LINK_PACKAGE_NAME} SHARED kepler/KeplerInit.cpp)
|
|
@@ -38,7 +46,8 @@ add_executable(${AUTO_LINK_PACKAGE_NAME}_exe kepler/KeplerInit.cpp)
|
|
|
38
46
|
target_link_libraries(${AUTO_LINK_PACKAGE_NAME}_exe
|
|
39
47
|
PRIVATE
|
|
40
48
|
${AUTO_LINK_PACKAGE_NAME}
|
|
41
|
-
|
|
49
|
+
turbomoduleAPI::turbomoduleAPI
|
|
50
|
+
idl_pkg
|
|
42
51
|
)
|
|
43
52
|
|
|
44
53
|
install(TARGETS ${AUTO_LINK_PACKAGE_NAME}
|
package/README.kepler.md
CHANGED
|
@@ -101,3 +101,4 @@ Check out the dedicated documentation page for info about this library, API refe
|
|
|
101
101
|
| Package version | Based on | @amazon-devices/react-native-kepler version |
|
|
102
102
|
| ---------------- | -------- | --------------------------------- |
|
|
103
103
|
| 2.0.x | expo-application v5.6.0 | 2.0.x |
|
|
104
|
+
| 2.0.x | expo-application v5.6.0 | 4.0.x+rn0.83.0 |
|
package/THIRD_PARTY_NOTICES.txt
CHANGED
|
@@ -1,24 +1,4 @@
|
|
|
1
1
|
License from package.json:
|
|
2
2
|
==============================
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)
|
|
7
|
-
|
|
8
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
10
|
-
in the Software without restriction, including without limitation the rights
|
|
11
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
13
|
-
furnished to do so, subject to the following conditions:
|
|
14
|
-
|
|
15
|
-
The above copyright notice and this permission notice shall be included in all
|
|
16
|
-
copies or substantial portions of the Software.
|
|
17
|
-
|
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
-
SOFTWARE.
|
|
4
|
+
MIT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoApplication.kepler.d.ts","sourceRoot":"","sources":["../src/ExpoApplication.kepler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExpoApplication.kepler.d.ts","sourceRoot":"","sources":["../src/ExpoApplication.kepler.ts"],"names":[],"mappings":"AAcA,UAAU,qBAAqB;IAC7B,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;CAC/C;AAED,QAAA,MAAM,MAAM,EAAE,qBAmBb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -14,12 +14,10 @@ const module = {
|
|
|
14
14
|
return nativeModule.nativeBuildVersion();
|
|
15
15
|
},
|
|
16
16
|
async getInstallationTimeAsync() {
|
|
17
|
-
|
|
18
|
-
return Number.parseInt(installationTime) * 1000;
|
|
17
|
+
return nativeModule.getInstallationTimeAsync();
|
|
19
18
|
},
|
|
20
19
|
async getLastUpdateTimeAsync() {
|
|
21
|
-
|
|
22
|
-
return Number.parseInt(lastUpdateTime) * 1000;
|
|
20
|
+
return nativeModule.getLastUpdateTimeAsync();
|
|
23
21
|
},
|
|
24
22
|
};
|
|
25
23
|
export default module;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoApplication.kepler.js","sourceRoot":"","sources":["../src/ExpoApplication.kepler.ts"],"names":[],"mappings":"
|
|
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,iBAAiB,CAAS,CAAC;AAWvF,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>('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 return nativeModule.getInstallationTimeAsync();\n },\n async getLastUpdateTimeAsync(): Promise<number> {\n return nativeModule.getLastUpdateTimeAsync();\n },\n};\n\nexport default module;\n"]}
|
|
@@ -8,57 +8,88 @@
|
|
|
8
8
|
|
|
9
9
|
#include "ExpoApplication.h"
|
|
10
10
|
|
|
11
|
-
#include <
|
|
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>
|
|
12
21
|
|
|
13
|
-
|
|
22
|
+
#include <stdexcept>
|
|
14
23
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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;
|
|
18
30
|
|
|
19
|
-
ExpoApplication::ExpoApplication(
|
|
20
|
-
|
|
31
|
+
ExpoApplication::ExpoApplication() : com::amazon::kepler::turbomodule::KeplerTurboModule("ExpoApplication") {
|
|
32
|
+
TMDEBUG(fmt::format("ExpoApplication constructor {}", name()));
|
|
21
33
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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");
|
|
25
52
|
}
|
|
26
53
|
}
|
|
27
54
|
|
|
28
55
|
std::string ExpoApplication::applicationId() {
|
|
29
|
-
return packageInfo
|
|
56
|
+
return packageInfo->getId();
|
|
30
57
|
}
|
|
31
58
|
|
|
32
59
|
std::string ExpoApplication::applicationName() {
|
|
33
|
-
|
|
60
|
+
auto title = packageInfo->getTitle();
|
|
61
|
+
if (title != nullptr) {
|
|
62
|
+
return title->getValue();
|
|
63
|
+
}
|
|
64
|
+
return {};
|
|
34
65
|
}
|
|
35
66
|
|
|
36
67
|
std::string ExpoApplication::nativeApplicationVersion() {
|
|
37
|
-
return packageInfo
|
|
68
|
+
return packageInfo->getVersion();
|
|
38
69
|
}
|
|
39
70
|
|
|
40
71
|
std::string ExpoApplication::nativeBuildVersion() {
|
|
41
|
-
return packageInfo
|
|
72
|
+
return packageInfo->getVersion();
|
|
42
73
|
}
|
|
43
74
|
|
|
44
|
-
|
|
45
|
-
return
|
|
75
|
+
Promise ExpoApplication::getInstallationTimeAsync() {
|
|
76
|
+
return Promise([this](std::shared_ptr<Promise> promise) {
|
|
77
|
+
auto installationTime = packageInfo->getInstalledTime();
|
|
46
78
|
try {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
promise->resolve(installationTimeStr);
|
|
79
|
+
std::int64_t milliseconds = installationTime.time.seconds * 1000;
|
|
80
|
+
promise->resolve(milliseconds);
|
|
50
81
|
} catch (std::exception& e) {
|
|
51
82
|
promise->reject(std::string{"getInstallationTimeAsync() error: " + std::string(e.what())});
|
|
52
83
|
}
|
|
53
84
|
});
|
|
54
85
|
}
|
|
55
86
|
|
|
56
|
-
|
|
57
|
-
return
|
|
87
|
+
Promise ExpoApplication::getLastUpdateTimeAsync() {
|
|
88
|
+
return Promise([this](std::shared_ptr<Promise> promise) {
|
|
89
|
+
auto lastUpdateTime = packageInfo->getUpdatedTime();
|
|
58
90
|
try {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
promise->resolve(lastUpdateTimeStr);
|
|
91
|
+
std::int64_t milliseconds = lastUpdateTime.time.seconds * 1000;
|
|
92
|
+
promise->resolve(milliseconds);
|
|
62
93
|
} catch (std::exception& e) {
|
|
63
94
|
promise->reject(std::string{"getLastUpdateTimeAsync() error: " + std::string(e.what())});
|
|
64
95
|
}
|
|
@@ -66,8 +97,9 @@ volta::react::Promise ExpoApplication::getLastUpdateTimeAsync() {
|
|
|
66
97
|
}
|
|
67
98
|
|
|
68
99
|
void ExpoApplication::aggregateMethods(
|
|
69
|
-
|
|
70
|
-
|
|
100
|
+
com::amazon::kepler::turbomodule::MethodAggregator<com::amazon::kepler::turbomodule::KeplerTurboModule>&
|
|
101
|
+
methodAggregator) const noexcept {
|
|
102
|
+
TMDEBUG("methodAggregator");
|
|
71
103
|
|
|
72
104
|
methodAggregator.addMethod("applicationId", 0, &ExpoApplication::applicationId);
|
|
73
105
|
methodAggregator.addMethod("applicationName", 0, &ExpoApplication::applicationName);
|
package/kepler/ExpoApplication.h
CHANGED
|
@@ -6,23 +6,19 @@
|
|
|
6
6
|
* Use is subject to license terms.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
#include <
|
|
10
|
-
#include
|
|
9
|
+
#include <Kepler/turbomodule/KeplerTurboModule.h>
|
|
10
|
+
#include "expo-export.h"
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
virtual ~IPackageManager() = default;
|
|
15
|
-
virtual orpheus::framework::status::Status getSelfPackageInfo(orpheus::framework::packageManager::PackageInfo& packageInfo) const = 0;
|
|
16
|
-
};
|
|
12
|
+
#include <apmf/iface/com/amazon/kepler/experimental_mr33/packages/IPackage.h>
|
|
13
|
+
#include <apmf/ptr.h>
|
|
17
14
|
|
|
18
|
-
class
|
|
15
|
+
class EXPO_EXPORT ExpoApplication : public com::amazon::kepler::turbomodule::KeplerTurboModule {
|
|
19
16
|
public:
|
|
20
|
-
|
|
21
|
-
};
|
|
17
|
+
ExpoApplication();
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
void aggregateMethods(
|
|
20
|
+
com::amazon::kepler::turbomodule::MethodAggregator<com::amazon::kepler::turbomodule::KeplerTurboModule>&
|
|
21
|
+
methodAggregator) const noexcept override;
|
|
26
22
|
|
|
27
23
|
#ifndef UNIT_TEST
|
|
28
24
|
protected:
|
|
@@ -31,14 +27,11 @@ protected:
|
|
|
31
27
|
std::string applicationName();
|
|
32
28
|
std::string nativeApplicationVersion();
|
|
33
29
|
std::string nativeBuildVersion();
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
void aggregateMethods(
|
|
38
|
-
volta::react::MethodAggregator<volta::react::KeplerTurboModule>& methodAggregator) const noexcept override;
|
|
30
|
+
com::amazon::kepler::turbomodule::Promise getInstallationTimeAsync();
|
|
31
|
+
com::amazon::kepler::turbomodule::Promise getLastUpdateTimeAsync();
|
|
39
32
|
|
|
40
33
|
#ifndef UNIT_TEST
|
|
41
34
|
private:
|
|
42
35
|
#endif
|
|
43
|
-
|
|
36
|
+
apmf::Ptr<apmf::iface::com::amazon::kepler::experimental_mr33::packages::IPackage> packageInfo;
|
|
44
37
|
};
|
package/kepler/KeplerInit.cpp
CHANGED
|
@@ -6,23 +6,18 @@
|
|
|
6
6
|
* Use is subject to license terms.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
#include <
|
|
10
|
-
#include <
|
|
11
|
-
#include <keplerui-072/keplerscript-export.h>
|
|
9
|
+
#include <Kepler/turbomodule/KeplerTurboModuleRegistration.h>
|
|
10
|
+
#include <Kepler/turbomodule/TMLog.h>
|
|
12
11
|
|
|
13
12
|
#include "ExpoApplication.h"
|
|
14
|
-
#include "RegisterModule.h"
|
|
15
13
|
|
|
16
14
|
extern "C" {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
REGISTER_MODULE(autoLinkInfo, ExpoApplication, "ExpoApplication");
|
|
21
|
-
|
|
22
|
-
volta::react::KPLog.debug("after registering module");
|
|
15
|
+
__attribute__((visibility("default"))) void autoLinkKeplerTurboModulesV1() noexcept {
|
|
16
|
+
TMDEBUG("autoLinkKeplerTurboModulesV1 for expo-application");
|
|
17
|
+
KEPLER_REGISTER_TURBO_MODULE_WITH_NAME("ExpoApplication", ExpoApplication);
|
|
23
18
|
}
|
|
24
19
|
}
|
|
25
20
|
|
|
26
21
|
int main() {
|
|
27
22
|
return 0;
|
|
28
|
-
}
|
|
23
|
+
}
|
|
@@ -15,20 +15,6 @@
|
|
|
15
15
|
|
|
16
16
|
#include "../ExpoApplication.h"
|
|
17
17
|
|
|
18
|
-
using namespace volta::react;
|
|
19
|
-
|
|
20
|
-
class MockPackageManager : public IPackageManager {
|
|
21
|
-
public:
|
|
22
|
-
orpheus::framework::status::Status getSelfPackageInfo(orpheus::framework::packageManager::PackageInfo &packageInfo) const override {
|
|
23
|
-
packageInfo.id = "testID";
|
|
24
|
-
packageInfo.title = "testTitle";
|
|
25
|
-
packageInfo.version = "testVersion";
|
|
26
|
-
packageInfo.installTime = static_cast<std::time_t>(999);
|
|
27
|
-
packageInfo.updateTime = static_cast<std::time_t>(111);
|
|
28
|
-
return orpheus::framework::status::Status{};
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
18
|
// std::shared_ptr<Promise> getPromiseCallback(std::string& result) {
|
|
33
19
|
// return std::make_shared<Promise>(
|
|
34
20
|
// Callback([&result](auto v) {
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@amazon-devices/expo-application", "version": "2.0.
|
|
1
|
+
{"name": "@amazon-devices/expo-application", "version": "2.0.9000000001+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": {"expo": "^50.0.0-alpha.1"}}
|
package/react-native.config.js
CHANGED
|
@@ -1,46 +1,45 @@
|
|
|
1
|
-
import {KeplerTurboModule
|
|
1
|
+
import type { KeplerTurboModule } from '@amazon-devices/keplerscript-turbomodule-api';
|
|
2
|
+
import { TurboModuleRegistry } from '@amazon-devices/keplerscript-turbomodule-api';
|
|
2
3
|
|
|
3
4
|
interface Spec extends KeplerTurboModule {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
applicationId: () => string;
|
|
6
|
+
applicationName: () => string;
|
|
7
|
+
nativeApplicationVersion: () => string;
|
|
8
|
+
nativeBuildVersion: () => string;
|
|
9
|
+
getInstallationTimeAsync: () => Promise<number>;
|
|
10
|
+
getLastUpdateTimeAsync: () => Promise<number>;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
const nativeModule = TurboModuleRegistry.getEnforcing<Spec>('ExpoApplication') as Spec;
|
|
13
14
|
|
|
14
15
|
interface KeplerExpoApplication {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
applicationId: string;
|
|
17
|
+
applicationName: string;
|
|
18
|
+
nativeApplicationVersion: string;
|
|
19
|
+
nativeBuildVersion: string;
|
|
20
|
+
getInstallationTimeAsync: () => Promise<number>;
|
|
21
|
+
getLastUpdateTimeAsync: () => Promise<number>;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
const module: KeplerExpoApplication = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return Number.parseInt(lastUpdateTime) * 1000;
|
|
43
|
-
},
|
|
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
|
+
},
|
|
44
43
|
};
|
|
45
44
|
|
|
46
45
|
export default module;
|