@amazon-devices/expo-application 2.0.9000000000 → 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/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 |
@@ -1 +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"}
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"}
@@ -1,5 +1,5 @@
1
1
  import { TurboModuleRegistry } from '@amazon-devices/keplerscript-turbomodule-api';
2
- const nativeModule = TurboModuleRegistry.getEnforcing('ExpoApplication');
2
+ const nativeModule = TurboModuleRegistry.getEnforcing('ExpoApplicationAppTM');
3
3
  const module = {
4
4
  get applicationId() {
5
5
  return nativeModule.applicationId();
@@ -14,12 +14,10 @@ const module = {
14
14
  return nativeModule.nativeBuildVersion();
15
15
  },
16
16
  async getInstallationTimeAsync() {
17
- const installationTime = await nativeModule.getInstallationTimeAsync();
18
- return Number.parseInt(installationTime) * 1000;
17
+ return nativeModule.getInstallationTimeAsync();
19
18
  },
20
19
  async getLastUpdateTimeAsync() {
21
- const lastUpdateTime = await nativeModule.getLastUpdateTimeAsync();
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":"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"]}
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"]}
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@amazon-devices/expo-application", "version": "2.0.9000000000+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": "*"}}
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"]}
@@ -10,9 +10,11 @@ module.exports = {
10
10
  platforms: {
11
11
  kepler: {
12
12
  autolink: {
13
- ExpoApplicationLib: {
14
- provider: 'system',
15
- turbomodules: ['ExpoApplication'],
13
+ ExpoApplicationAppLib: {
14
+ provider: 'application',
15
+ linkDynamic: true,
16
+ libraryName: 'libexpo-application-3.so',
17
+ turbomodules: ['ExpoApplicationAppTM'],
16
18
  },
17
19
  },
18
20
  },
package/.eslintrc.js DELETED
@@ -1,2 +0,0 @@
1
- // @generated by expo-module-scripts
2
- module.exports = require('expo-module-scripts/eslintrc.base.js');
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,46 +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
- target_link_libraries(
21
- ${PACKAGE_NAME}
22
- PUBLIC
23
- keplerui::keplerscript-${KEPLER_REACT_NATIVE_MAJOR_VERSION}
24
- )
25
-
26
- add_library(${AUTO_LINK_PACKAGE_NAME} SHARED kepler/KeplerInit.cpp)
27
-
28
- set_target_properties(${AUTO_LINK_PACKAGE_NAME} PROPERTIES SOVERSION ${KEPLER_REACT_NATIVE_MAJOR_VERSION}.${KEPLER_REACT_NATIVE_MINOR_VERSION})
29
-
30
- target_link_libraries(
31
- ${AUTO_LINK_PACKAGE_NAME}
32
- PRIVATE
33
- ${PACKAGE_NAME}
34
- )
35
-
36
- # Helps in checking undefined references
37
- add_executable(${AUTO_LINK_PACKAGE_NAME}_exe kepler/KeplerInit.cpp)
38
- target_link_libraries(${AUTO_LINK_PACKAGE_NAME}_exe
39
- PRIVATE
40
- ${AUTO_LINK_PACKAGE_NAME}
41
- keplerui::keplerscript-${KEPLER_REACT_NATIVE_MAJOR_VERSION}
42
- )
43
-
44
- install(TARGETS ${AUTO_LINK_PACKAGE_NAME}
45
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
46
- )
@@ -1,4 +0,0 @@
1
- License from package.json:
2
- ==============================
3
-
4
- MIT
@@ -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,2 +0,0 @@
1
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
- </manifest>
@@ -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
- }
@@ -1,10 +0,0 @@
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
- }
@@ -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
- }