expo-application 3.2.0 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +1 -1
- package/android/build.gradle +24 -28
- package/android/src/main/java/expo/modules/application/ApplicationModule.kt +133 -0
- package/android/src/main/java/expo/modules/application/ApplicationPackage.kt +11 -0
- package/build/Application.d.ts +21 -15
- package/build/Application.js +22 -16
- package/build/Application.js.map +1 -1
- package/build/ExpoApplication.d.ts +1 -1
- package/build/ExpoApplication.js +1 -1
- package/build/ExpoApplication.js.map +1 -1
- package/ios/EXApplication/EXApplication.h +2 -2
- package/ios/EXApplication/EXApplication.m +6 -6
- package/ios/EXApplication.podspec +3 -2
- package/package.json +7 -3
- package/src/Application.ts +22 -16
- package/src/ExpoApplication.ts +1 -1
- package/android/src/main/java/expo/modules/application/ApplicationModule.java +0 -156
- package/android/src/main/java/expo/modules/application/ApplicationPackage.java +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,33 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 4.0.2 — 2022-02-01
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- 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))
|
|
18
|
+
|
|
19
|
+
## 4.0.1 — 2021-11-17
|
|
20
|
+
|
|
21
|
+
_This version does not introduce any user-facing changes._
|
|
22
|
+
|
|
23
|
+
## 4.0.0 — 2021-09-28
|
|
24
|
+
|
|
25
|
+
### 🛠 Breaking changes
|
|
26
|
+
|
|
27
|
+
- Dropped support for iOS 11.0 ([#14383](https://github.com/expo/expo/pull/14383) by [@cruzach](https://github.com/cruzach))
|
|
28
|
+
|
|
29
|
+
### 🐛 Bug fixes
|
|
30
|
+
|
|
31
|
+
- Fix building errors from use_frameworks! in Podfile. ([#14523](https://github.com/expo/expo/pull/14523) by [@kudo](https://github.com/kudo))
|
|
32
|
+
|
|
33
|
+
## 3.3.0 — 2021-09-08
|
|
34
|
+
|
|
35
|
+
### 💡 Others
|
|
36
|
+
|
|
37
|
+
- Rewrite android code to Kotlin ([#13792](https://github.com/expo/expo/pull/13792) by [@kkafar](https://github.com/kkafar))
|
|
38
|
+
- Add basic unit tests to Kotlin. ([#13792](https://github.com/expo/expo/pull/13792) by [@kkafar](https://github.com/kkafar))
|
|
39
|
+
|
|
13
40
|
## 3.2.0 — 2021-06-16
|
|
14
41
|
|
|
15
42
|
### 🐛 Bug fixes
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ For managed [managed](https://docs.expo.io/versions/latest/introduction/managed-
|
|
|
12
12
|
|
|
13
13
|
# Installation in bare React Native projects
|
|
14
14
|
|
|
15
|
-
For bare React Native projects, you must ensure that you have [installed and configured the `
|
|
15
|
+
For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
|
|
16
16
|
|
|
17
17
|
### Add the package to your npm dependencies
|
|
18
18
|
|
package/android/build.gradle
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
2
|
apply plugin: 'kotlin-android'
|
|
3
|
-
apply plugin: 'maven'
|
|
3
|
+
apply plugin: 'maven-publish'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '
|
|
6
|
+
version = '4.0.2'
|
|
7
7
|
|
|
8
8
|
buildscript {
|
|
9
9
|
// Simple helper that allows the root project to override versions declared by this library.
|
|
@@ -20,27 +20,25 @@ buildscript {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
// Upload android library to maven with javadoc and android sources
|
|
24
|
-
configurations {
|
|
25
|
-
deployerJars
|
|
26
|
-
}
|
|
27
|
-
|
|
28
23
|
// Creating sources with comments
|
|
29
24
|
task androidSourcesJar(type: Jar) {
|
|
30
25
|
classifier = 'sources'
|
|
31
26
|
from android.sourceSets.main.java.srcDirs
|
|
32
27
|
}
|
|
33
28
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
29
|
+
afterEvaluate {
|
|
30
|
+
publishing {
|
|
31
|
+
publications {
|
|
32
|
+
release(MavenPublication) {
|
|
33
|
+
from components.release
|
|
34
|
+
// Add additional sourcesJar to artifacts
|
|
35
|
+
artifact(androidSourcesJar)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
repositories {
|
|
39
|
+
maven {
|
|
40
|
+
url = mavenLocal().url
|
|
41
|
+
}
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
44
|
}
|
|
@@ -57,24 +55,22 @@ android {
|
|
|
57
55
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
58
56
|
targetSdkVersion safeExtGet("targetSdkVersion", 30)
|
|
59
57
|
versionCode 12
|
|
60
|
-
versionName '
|
|
58
|
+
versionName '4.0.2'
|
|
61
59
|
}
|
|
62
60
|
lintOptions {
|
|
63
61
|
abortOnError false
|
|
64
62
|
}
|
|
65
63
|
}
|
|
66
64
|
|
|
67
|
-
if (new File(rootProject.projectDir.parentFile, 'package.json').exists()) {
|
|
68
|
-
apply from: project(":unimodules-core").file("../unimodules-core.gradle")
|
|
69
|
-
} else {
|
|
70
|
-
throw new GradleException(
|
|
71
|
-
'\'unimodules-core.gradle\' was not found in the usual React Native dependency location. ' +
|
|
72
|
-
'This package can only be used in such projects. Are you sure you\'ve installed the dependencies properly?')
|
|
73
|
-
}
|
|
74
|
-
|
|
75
65
|
dependencies {
|
|
76
|
-
|
|
77
|
-
implementation 'com.android.installreferrer:installreferrer:1.0'
|
|
66
|
+
implementation project(':expo-modules-core')
|
|
78
67
|
|
|
68
|
+
implementation 'com.android.installreferrer:installreferrer:1.0'
|
|
79
69
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '1.4.21')}"
|
|
70
|
+
|
|
71
|
+
if (project.findProject(':unimodules-test-core')) {
|
|
72
|
+
testImplementation project(':unimodules-test-core')
|
|
73
|
+
}
|
|
74
|
+
testImplementation "org.robolectric:robolectric:4.5.1"
|
|
75
|
+
testImplementation 'junit:junit:4.12'
|
|
80
76
|
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
package expo.modules.application
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.content.Context
|
|
5
|
+
import android.content.pm.PackageInfo
|
|
6
|
+
import android.content.pm.PackageManager.NameNotFoundException
|
|
7
|
+
import android.os.Build
|
|
8
|
+
import android.os.RemoteException
|
|
9
|
+
import android.provider.Settings
|
|
10
|
+
import android.util.Log
|
|
11
|
+
|
|
12
|
+
import com.android.installreferrer.api.InstallReferrerClient
|
|
13
|
+
import com.android.installreferrer.api.InstallReferrerStateListener
|
|
14
|
+
|
|
15
|
+
import expo.modules.core.ExportedModule
|
|
16
|
+
import expo.modules.core.ModuleRegistry
|
|
17
|
+
import expo.modules.core.Promise
|
|
18
|
+
import expo.modules.core.interfaces.ActivityProvider
|
|
19
|
+
import expo.modules.core.interfaces.ExpoMethod
|
|
20
|
+
import expo.modules.core.interfaces.RegistryLifecycleListener
|
|
21
|
+
|
|
22
|
+
import java.util.*
|
|
23
|
+
|
|
24
|
+
private const val NAME = "ExpoApplication"
|
|
25
|
+
private val TAG = ApplicationModule::class.java.simpleName
|
|
26
|
+
|
|
27
|
+
class ApplicationModule(private val mContext: Context) : ExportedModule(mContext), RegistryLifecycleListener {
|
|
28
|
+
private var mModuleRegistry: ModuleRegistry? = null
|
|
29
|
+
private var mActivityProvider: ActivityProvider? = null
|
|
30
|
+
private var mActivity: Activity? = null
|
|
31
|
+
|
|
32
|
+
override fun getName(): String {
|
|
33
|
+
return NAME
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
override fun onCreate(moduleRegistry: ModuleRegistry) {
|
|
37
|
+
mModuleRegistry = moduleRegistry
|
|
38
|
+
mActivityProvider = moduleRegistry.getModule(ActivityProvider::class.java)
|
|
39
|
+
mActivity = mActivityProvider?.currentActivity
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
override fun getConstants(): Map<String, Any?> {
|
|
43
|
+
val constants = HashMap<String, Any?>()
|
|
44
|
+
val applicationName = mContext.applicationInfo.loadLabel(mContext.packageManager).toString()
|
|
45
|
+
val packageName = mContext.packageName
|
|
46
|
+
|
|
47
|
+
constants["applicationName"] = applicationName
|
|
48
|
+
constants["applicationId"] = packageName
|
|
49
|
+
|
|
50
|
+
val packageManager = mContext.packageManager
|
|
51
|
+
try {
|
|
52
|
+
val pInfo = packageManager.getPackageInfo(packageName, 0)
|
|
53
|
+
constants["nativeApplicationVersion"] = pInfo.versionName
|
|
54
|
+
val versionCode = getLongVersionCode(pInfo).toInt()
|
|
55
|
+
constants["nativeBuildVersion"] = versionCode.toString()
|
|
56
|
+
} catch (e: NameNotFoundException) {
|
|
57
|
+
Log.e(TAG, "Exception: ", e)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
constants["androidId"] = Settings.Secure.getString(mContext.contentResolver, Settings.Secure.ANDROID_ID)
|
|
61
|
+
|
|
62
|
+
return constants
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@ExpoMethod
|
|
66
|
+
fun getInstallationTimeAsync(promise: Promise) {
|
|
67
|
+
val packageManager = mContext.packageManager
|
|
68
|
+
val packageName = mContext.packageName
|
|
69
|
+
try {
|
|
70
|
+
val info = packageManager.getPackageInfo(packageName, 0)
|
|
71
|
+
promise.resolve(info.firstInstallTime.toDouble())
|
|
72
|
+
} catch (e: NameNotFoundException) {
|
|
73
|
+
Log.e(TAG, "Exception: ", e)
|
|
74
|
+
promise.reject("ERR_APPLICATION_PACKAGE_NAME_NOT_FOUND", "Unable to get install time of this application. Could not get package info or package name.", e)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@ExpoMethod
|
|
79
|
+
fun getLastUpdateTimeAsync(promise: Promise) {
|
|
80
|
+
val packageManager = mContext.packageManager
|
|
81
|
+
val packageName = mContext.packageName
|
|
82
|
+
try {
|
|
83
|
+
val info = packageManager.getPackageInfo(packageName, 0)
|
|
84
|
+
promise.resolve(info.lastUpdateTime.toDouble())
|
|
85
|
+
} catch (e: NameNotFoundException) {
|
|
86
|
+
Log.e(TAG, "Exception: ", e)
|
|
87
|
+
promise.reject("ERR_APPLICATION_PACKAGE_NAME_NOT_FOUND", "Unable to get last update time of this application. Could not get package info or package name.", e)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@ExpoMethod
|
|
92
|
+
fun getInstallReferrerAsync(promise: Promise) {
|
|
93
|
+
val installReferrer = StringBuilder()
|
|
94
|
+
val referrerClient = InstallReferrerClient.newBuilder(mContext).build()
|
|
95
|
+
referrerClient.startConnection(object : InstallReferrerStateListener {
|
|
96
|
+
override fun onInstallReferrerSetupFinished(responseCode: Int) {
|
|
97
|
+
when (responseCode) {
|
|
98
|
+
InstallReferrerClient.InstallReferrerResponse.OK -> {
|
|
99
|
+
// Connection established and response received
|
|
100
|
+
try {
|
|
101
|
+
val response = referrerClient.installReferrer
|
|
102
|
+
installReferrer.append(response.installReferrer)
|
|
103
|
+
} catch (e: RemoteException) {
|
|
104
|
+
Log.e(TAG, "Exception: ", e)
|
|
105
|
+
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)
|
|
106
|
+
}
|
|
107
|
+
promise.resolve(installReferrer.toString())
|
|
108
|
+
}
|
|
109
|
+
InstallReferrerClient.InstallReferrerResponse.FEATURE_NOT_SUPPORTED -> // API not available in the current Play Store app
|
|
110
|
+
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.")
|
|
111
|
+
InstallReferrerClient.InstallReferrerResponse.SERVICE_UNAVAILABLE -> // Connection could not be established
|
|
112
|
+
promise.reject("ERR_APPLICATION_INSTALL_REFERRER_CONNECTION", "Could not establish a connection to Google Play")
|
|
113
|
+
else -> promise.reject("ERR_APPLICATION_INSTALL_REFERRER", "General error retrieving the install referrer: response code $responseCode")
|
|
114
|
+
}
|
|
115
|
+
referrerClient.endConnection()
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
override fun onInstallReferrerServiceDisconnected() {
|
|
119
|
+
promise.reject("ERR_APPLICATION_INSTALL_REFERRER_SERVICE_DISCONNECTED", "Connection to install referrer service was lost.")
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
companion object {
|
|
125
|
+
private fun getLongVersionCode(info: PackageInfo): Long {
|
|
126
|
+
return if (Build.VERSION.SDK_INT >= 28) {
|
|
127
|
+
info.longVersionCode
|
|
128
|
+
} else {
|
|
129
|
+
info.versionCode.toLong()
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
package expo.modules.application
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import expo.modules.core.BasePackage
|
|
5
|
+
import expo.modules.core.ExportedModule
|
|
6
|
+
|
|
7
|
+
class ApplicationPackage : BasePackage() {
|
|
8
|
+
override fun createExportedModules(context: Context): List<ExportedModule> {
|
|
9
|
+
return listOf(ApplicationModule(context) as ExportedModule)
|
|
10
|
+
}
|
|
11
|
+
}
|
package/build/Application.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* This is the `Info.plist` value for `CFBundleShortVersionString` on iOS and the version name set
|
|
4
4
|
* by `version` in `app.json` on Android at the time the native app was built.
|
|
5
5
|
* On web, this value is `null`.
|
|
6
|
-
*
|
|
6
|
+
* @example `"2.11.0"`
|
|
7
7
|
*/
|
|
8
8
|
export declare const nativeApplicationVersion: string | null;
|
|
9
9
|
/**
|
|
@@ -12,24 +12,24 @@ export declare const nativeApplicationVersion: string | null;
|
|
|
12
12
|
* `ios.buildNumber` value in `app.json` in a standalone app) and the version code set by
|
|
13
13
|
* `android.versionCode` in `app.json` on Android at the time the native app was built. On web, this
|
|
14
14
|
* value is `null`. The return type on Android and iOS is `string`.
|
|
15
|
-
*
|
|
15
|
+
* @example iOS: `"2.11.0"`, Android: `"114"`
|
|
16
16
|
*/
|
|
17
17
|
export declare const nativeBuildVersion: string | null;
|
|
18
18
|
/**
|
|
19
19
|
* The human-readable name of the application that is displayed with the app's icon on the device's
|
|
20
20
|
* home screen or desktop. On Android and iOS, this value is a `string` unless the name could not be
|
|
21
21
|
* retrieved, in which case this value will be `null`. On web this value is `null`.
|
|
22
|
-
*
|
|
22
|
+
* @example `"Expo"`, `"Yelp"`, `"Instagram"`
|
|
23
23
|
*/
|
|
24
24
|
export declare const applicationName: string | null;
|
|
25
25
|
/**
|
|
26
26
|
* The ID of the application. On Android, this is the application ID. On iOS, this is the bundle ID.
|
|
27
27
|
* On web, this is `null`.
|
|
28
|
-
*
|
|
28
|
+
* @example `"com.cocoacasts.scribbles"`, `"com.apple.Pages"`
|
|
29
29
|
*/
|
|
30
30
|
export declare const applicationId: string | null;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* The value of [`Settings.Secure.ANDROID_ID`](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).
|
|
33
33
|
* This is a hexadecimal `string` unique to each combination of app-signing key, user, and device.
|
|
34
34
|
* The value may change if a factory reset is performed on the device or if an APK signing key changes.
|
|
35
35
|
* For more information about how the platform handles `ANDROID_ID` in Android 8.0 (API level 26)
|
|
@@ -38,23 +38,25 @@ export declare const applicationId: string | null;
|
|
|
38
38
|
* > In versions of the platform lower than Android 8.0 (API level 26), this value remains constant
|
|
39
39
|
* > for the lifetime of the user's device. See the [ANDROID_ID](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID)
|
|
40
40
|
* > official docs for more information.
|
|
41
|
-
*
|
|
41
|
+
* @example `"dd96dec43fb81c97"`
|
|
42
|
+
* @platform android
|
|
42
43
|
*/
|
|
43
44
|
export declare const androidId: string | null;
|
|
44
45
|
/**
|
|
45
|
-
*
|
|
46
|
+
* Gets the referrer URL of the installed app with the [`Install Referrer API`](https://developer.android.com/google/play/installreferrer)
|
|
46
47
|
* from the Google Play Store. In practice, the referrer URL may not be a complete, absolute URL.
|
|
47
48
|
* @return A `Promise` that fulfills with a `string` of the referrer URL of the installed app.
|
|
48
49
|
*
|
|
49
|
-
*
|
|
50
|
+
* @example
|
|
50
51
|
* ```ts
|
|
51
52
|
* await Application.getInstallReferrerAsync();
|
|
52
53
|
* // "utm_source=google-play&utm_medium=organic"
|
|
53
54
|
* ```
|
|
55
|
+
* @platform android
|
|
54
56
|
*/
|
|
55
57
|
export declare function getInstallReferrerAsync(): Promise<string>;
|
|
56
58
|
/**
|
|
57
|
-
*
|
|
59
|
+
* Gets the iOS "identifier for vendor" ([IDFV](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor))
|
|
58
60
|
* value, a string ID that uniquely identifies a device to the app’s vendor. This method may
|
|
59
61
|
* sometimes return `nil`, in which case wait and call the method again later. This might happen
|
|
60
62
|
* when the device has been restarted before the user has unlocked the device.
|
|
@@ -66,11 +68,12 @@ export declare function getInstallReferrerAsync(): Promise<string>;
|
|
|
66
68
|
* same vendor will return the same ID. See Apple's documentation for more information about the
|
|
67
69
|
* vendor ID's semantics.
|
|
68
70
|
*
|
|
69
|
-
*
|
|
71
|
+
* @example
|
|
70
72
|
* ```ts
|
|
71
73
|
* await Application.getIosIdForVendorAsync();
|
|
72
74
|
* // "68753A44-4D6F-1226-9C60-0050E4C00067"
|
|
73
75
|
* ```
|
|
76
|
+
* @platform ios
|
|
74
77
|
*/
|
|
75
78
|
export declare function getIosIdForVendorAsync(): Promise<string | null>;
|
|
76
79
|
export declare enum ApplicationReleaseType {
|
|
@@ -82,15 +85,17 @@ export declare enum ApplicationReleaseType {
|
|
|
82
85
|
APP_STORE = 5
|
|
83
86
|
}
|
|
84
87
|
/**
|
|
85
|
-
*
|
|
88
|
+
* Gets the iOS application release type.
|
|
86
89
|
* @return Returns a promise which fulfills with an [`ApplicationReleaseType`](#applicationreleasetype).
|
|
90
|
+
* @platform ios
|
|
87
91
|
*/
|
|
88
92
|
export declare function getIosApplicationReleaseTypeAsync(): Promise<ApplicationReleaseType>;
|
|
89
93
|
/**
|
|
90
|
-
*
|
|
94
|
+
* Gets the current [Apple Push Notification (APN)](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment?language=objc)
|
|
91
95
|
* service environment.
|
|
92
96
|
* @return Returns a promise fulfilled with the string, either `'development'` or `'production'`,
|
|
93
97
|
* based on the current APN environment.
|
|
98
|
+
* @platform ios
|
|
94
99
|
*/
|
|
95
100
|
export declare function getIosPushNotificationServiceEnvironmentAsync(): Promise<string>;
|
|
96
101
|
/**
|
|
@@ -104,7 +109,7 @@ export declare function getIosPushNotificationServiceEnvironmentAsync(): Promise
|
|
|
104
109
|
* @return Returns a `Promise` that fulfills with a `Date` object that specifies the time the app
|
|
105
110
|
* was installed on the device.
|
|
106
111
|
*
|
|
107
|
-
*
|
|
112
|
+
* @example
|
|
108
113
|
* ```ts
|
|
109
114
|
* await Application.getInstallationTimeAsync();
|
|
110
115
|
* // 2019-07-18T18:08:26.121Z
|
|
@@ -112,14 +117,15 @@ export declare function getIosPushNotificationServiceEnvironmentAsync(): Promise
|
|
|
112
117
|
*/
|
|
113
118
|
export declare function getInstallationTimeAsync(): Promise<Date>;
|
|
114
119
|
/**
|
|
115
|
-
*
|
|
120
|
+
* Gets the last time the app was updated from the Google Play Store.
|
|
116
121
|
* @return Returns a `Promise` that fulfills with a `Date` object that specifies the last time
|
|
117
122
|
* the app was updated via the Google Play Store).
|
|
118
123
|
*
|
|
119
|
-
*
|
|
124
|
+
* @example
|
|
120
125
|
* ```ts
|
|
121
126
|
* await Application.getLastUpdateTimeAsync();
|
|
122
127
|
* // 2019-07-18T21:20:16.887Z
|
|
123
128
|
* ```
|
|
129
|
+
* @platform android
|
|
124
130
|
*/
|
|
125
131
|
export declare function getLastUpdateTimeAsync(): Promise<Date>;
|
package/build/Application.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UnavailabilityError } from '
|
|
1
|
+
import { UnavailabilityError } from 'expo-modules-core';
|
|
2
2
|
import ExpoApplication from './ExpoApplication';
|
|
3
3
|
// @needsAudit
|
|
4
4
|
/**
|
|
@@ -6,7 +6,7 @@ import ExpoApplication from './ExpoApplication';
|
|
|
6
6
|
* This is the `Info.plist` value for `CFBundleShortVersionString` on iOS and the version name set
|
|
7
7
|
* by `version` in `app.json` on Android at the time the native app was built.
|
|
8
8
|
* On web, this value is `null`.
|
|
9
|
-
*
|
|
9
|
+
* @example `"2.11.0"`
|
|
10
10
|
*/
|
|
11
11
|
export const nativeApplicationVersion = ExpoApplication
|
|
12
12
|
? ExpoApplication.nativeApplicationVersion || null
|
|
@@ -18,7 +18,7 @@ export const nativeApplicationVersion = ExpoApplication
|
|
|
18
18
|
* `ios.buildNumber` value in `app.json` in a standalone app) and the version code set by
|
|
19
19
|
* `android.versionCode` in `app.json` on Android at the time the native app was built. On web, this
|
|
20
20
|
* value is `null`. The return type on Android and iOS is `string`.
|
|
21
|
-
*
|
|
21
|
+
* @example iOS: `"2.11.0"`, Android: `"114"`
|
|
22
22
|
*/
|
|
23
23
|
export const nativeBuildVersion = ExpoApplication
|
|
24
24
|
? ExpoApplication.nativeBuildVersion || null
|
|
@@ -28,7 +28,7 @@ export const nativeBuildVersion = ExpoApplication
|
|
|
28
28
|
* The human-readable name of the application that is displayed with the app's icon on the device's
|
|
29
29
|
* home screen or desktop. On Android and iOS, this value is a `string` unless the name could not be
|
|
30
30
|
* retrieved, in which case this value will be `null`. On web this value is `null`.
|
|
31
|
-
*
|
|
31
|
+
* @example `"Expo"`, `"Yelp"`, `"Instagram"`
|
|
32
32
|
*/
|
|
33
33
|
export const applicationName = ExpoApplication
|
|
34
34
|
? ExpoApplication.applicationName || null
|
|
@@ -37,14 +37,14 @@ export const applicationName = ExpoApplication
|
|
|
37
37
|
/**
|
|
38
38
|
* The ID of the application. On Android, this is the application ID. On iOS, this is the bundle ID.
|
|
39
39
|
* On web, this is `null`.
|
|
40
|
-
*
|
|
40
|
+
* @example `"com.cocoacasts.scribbles"`, `"com.apple.Pages"`
|
|
41
41
|
*/
|
|
42
42
|
export const applicationId = ExpoApplication
|
|
43
43
|
? ExpoApplication.applicationId || null
|
|
44
44
|
: null;
|
|
45
45
|
// @needsAudit
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* The value of [`Settings.Secure.ANDROID_ID`](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).
|
|
48
48
|
* This is a hexadecimal `string` unique to each combination of app-signing key, user, and device.
|
|
49
49
|
* The value may change if a factory reset is performed on the device or if an APK signing key changes.
|
|
50
50
|
* For more information about how the platform handles `ANDROID_ID` in Android 8.0 (API level 26)
|
|
@@ -53,20 +53,22 @@ export const applicationId = ExpoApplication
|
|
|
53
53
|
* > In versions of the platform lower than Android 8.0 (API level 26), this value remains constant
|
|
54
54
|
* > for the lifetime of the user's device. See the [ANDROID_ID](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID)
|
|
55
55
|
* > official docs for more information.
|
|
56
|
-
*
|
|
56
|
+
* @example `"dd96dec43fb81c97"`
|
|
57
|
+
* @platform android
|
|
57
58
|
*/
|
|
58
59
|
export const androidId = ExpoApplication ? ExpoApplication.androidId || null : null;
|
|
59
60
|
// @needsAudit
|
|
60
61
|
/**
|
|
61
|
-
*
|
|
62
|
+
* Gets the referrer URL of the installed app with the [`Install Referrer API`](https://developer.android.com/google/play/installreferrer)
|
|
62
63
|
* from the Google Play Store. In practice, the referrer URL may not be a complete, absolute URL.
|
|
63
64
|
* @return A `Promise` that fulfills with a `string` of the referrer URL of the installed app.
|
|
64
65
|
*
|
|
65
|
-
*
|
|
66
|
+
* @example
|
|
66
67
|
* ```ts
|
|
67
68
|
* await Application.getInstallReferrerAsync();
|
|
68
69
|
* // "utm_source=google-play&utm_medium=organic"
|
|
69
70
|
* ```
|
|
71
|
+
* @platform android
|
|
70
72
|
*/
|
|
71
73
|
export async function getInstallReferrerAsync() {
|
|
72
74
|
if (!ExpoApplication.getInstallReferrerAsync) {
|
|
@@ -76,7 +78,7 @@ export async function getInstallReferrerAsync() {
|
|
|
76
78
|
}
|
|
77
79
|
// @needsAudit
|
|
78
80
|
/**
|
|
79
|
-
*
|
|
81
|
+
* Gets the iOS "identifier for vendor" ([IDFV](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor))
|
|
80
82
|
* value, a string ID that uniquely identifies a device to the app’s vendor. This method may
|
|
81
83
|
* sometimes return `nil`, in which case wait and call the method again later. This might happen
|
|
82
84
|
* when the device has been restarted before the user has unlocked the device.
|
|
@@ -88,11 +90,12 @@ export async function getInstallReferrerAsync() {
|
|
|
88
90
|
* same vendor will return the same ID. See Apple's documentation for more information about the
|
|
89
91
|
* vendor ID's semantics.
|
|
90
92
|
*
|
|
91
|
-
*
|
|
93
|
+
* @example
|
|
92
94
|
* ```ts
|
|
93
95
|
* await Application.getIosIdForVendorAsync();
|
|
94
96
|
* // "68753A44-4D6F-1226-9C60-0050E4C00067"
|
|
95
97
|
* ```
|
|
98
|
+
* @platform ios
|
|
96
99
|
*/
|
|
97
100
|
export async function getIosIdForVendorAsync() {
|
|
98
101
|
if (!ExpoApplication.getIosIdForVendorAsync) {
|
|
@@ -112,8 +115,9 @@ export var ApplicationReleaseType;
|
|
|
112
115
|
})(ApplicationReleaseType || (ApplicationReleaseType = {}));
|
|
113
116
|
// @needsAudit
|
|
114
117
|
/**
|
|
115
|
-
*
|
|
118
|
+
* Gets the iOS application release type.
|
|
116
119
|
* @return Returns a promise which fulfills with an [`ApplicationReleaseType`](#applicationreleasetype).
|
|
120
|
+
* @platform ios
|
|
117
121
|
*/
|
|
118
122
|
export async function getIosApplicationReleaseTypeAsync() {
|
|
119
123
|
if (!ExpoApplication.getApplicationReleaseTypeAsync) {
|
|
@@ -123,10 +127,11 @@ export async function getIosApplicationReleaseTypeAsync() {
|
|
|
123
127
|
}
|
|
124
128
|
// @needsAudit
|
|
125
129
|
/**
|
|
126
|
-
*
|
|
130
|
+
* Gets the current [Apple Push Notification (APN)](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment?language=objc)
|
|
127
131
|
* service environment.
|
|
128
132
|
* @return Returns a promise fulfilled with the string, either `'development'` or `'production'`,
|
|
129
133
|
* based on the current APN environment.
|
|
134
|
+
* @platform ios
|
|
130
135
|
*/
|
|
131
136
|
export async function getIosPushNotificationServiceEnvironmentAsync() {
|
|
132
137
|
if (!ExpoApplication.getPushNotificationServiceEnvironmentAsync) {
|
|
@@ -146,7 +151,7 @@ export async function getIosPushNotificationServiceEnvironmentAsync() {
|
|
|
146
151
|
* @return Returns a `Promise` that fulfills with a `Date` object that specifies the time the app
|
|
147
152
|
* was installed on the device.
|
|
148
153
|
*
|
|
149
|
-
*
|
|
154
|
+
* @example
|
|
150
155
|
* ```ts
|
|
151
156
|
* await Application.getInstallationTimeAsync();
|
|
152
157
|
* // 2019-07-18T18:08:26.121Z
|
|
@@ -161,15 +166,16 @@ export async function getInstallationTimeAsync() {
|
|
|
161
166
|
}
|
|
162
167
|
// @needsAudit
|
|
163
168
|
/**
|
|
164
|
-
*
|
|
169
|
+
* Gets the last time the app was updated from the Google Play Store.
|
|
165
170
|
* @return Returns a `Promise` that fulfills with a `Date` object that specifies the last time
|
|
166
171
|
* the app was updated via the Google Play Store).
|
|
167
172
|
*
|
|
168
|
-
*
|
|
173
|
+
* @example
|
|
169
174
|
* ```ts
|
|
170
175
|
* await Application.getLastUpdateTimeAsync();
|
|
171
176
|
* // 2019-07-18T21:20:16.887Z
|
|
172
177
|
* ```
|
|
178
|
+
* @platform android
|
|
173
179
|
*/
|
|
174
180
|
export async function getLastUpdateTimeAsync() {
|
|
175
181
|
if (!ExpoApplication.getLastUpdateTimeAsync) {
|
package/build/Application.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Application.js","sourceRoot":"","sources":["../src/Application.ts"],"names":[],"mappings":"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","sourcesContent":["import { UnavailabilityError } from '@unimodules/core';\n\nimport ExpoApplication from './ExpoApplication';\n\n// @needsAudit\n/**\n * The human-readable version of the native application that may be displayed in the app store.\n * This is the `Info.plist` value for `CFBundleShortVersionString` on iOS and the version name set\n * by `version` in `app.json` on Android at the time the native app was built.\n * On web, this value is `null`.\n * - E.g., `\"2.11.0\"`\n */\nexport const nativeApplicationVersion: string | null = ExpoApplication\n ? ExpoApplication.nativeApplicationVersion || null\n : null;\n\n// @needsAudit\n/**\n * The internal build version of the native application that the app store may use to distinguish\n * between different binaries. This is the `Info.plist` value for `CFBundleVersion` on iOS (set with\n * `ios.buildNumber` value in `app.json` in a standalone app) and the version code set by\n * `android.versionCode` in `app.json` on Android at the time the native app was built. On web, this\n * value is `null`. The return type on Android and iOS is `string`.\n * - E.g., iOS: `\"2.11.0\"`, Android: `\"114\"`\n */\nexport const nativeBuildVersion: string | null = ExpoApplication\n ? ExpoApplication.nativeBuildVersion || null\n : null;\n\n// @needsAudit\n/**\n * The human-readable name of the application that is displayed with the app's icon on the device's\n * home screen or desktop. On Android and iOS, this value is a `string` unless the name could not be\n * retrieved, in which case this value will be `null`. On web this value is `null`.\n * - E.g., `\"Expo\"`, `\"Yelp\"`, `\"Instagram\"`\n */\nexport const applicationName: string | null = ExpoApplication\n ? ExpoApplication.applicationName || null\n : null;\n\n// @needsAudit\n/**\n * The ID of the application. On Android, this is the application ID. On iOS, this is the bundle ID.\n * On web, this is `null`.\n * - E.g., `\"com.cocoacasts.scribbles\"`, `\"com.apple.Pages\"`\n */\nexport const applicationId: string | null = ExpoApplication\n ? ExpoApplication.applicationId || null\n : null;\n\n// @needsAudit\n/**\n * **Android only.** The value of [`Settings.Secure.ANDROID_ID`](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).\n * This is a hexadecimal `string` unique to each combination of app-signing key, user, and device.\n * The value may change if a factory reset is performed on the device or if an APK signing key changes.\n * For more information about how the platform handles `ANDROID_ID` in Android 8.0 (API level 26)\n * and higher, see [Android 8.0 Behavior Changes](https://developer.android.com/about/versions/oreo/android-8.0-changes.html#privacy-all).\n * On iOS and web, this value is `null`.\n * > In versions of the platform lower than Android 8.0 (API level 26), this value remains constant\n * > for the lifetime of the user's device. See the [ANDROID_ID](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID)\n * > official docs for more information.\n * - E.g., `\"dd96dec43fb81c97\"`\n */\nexport const androidId: string | null = ExpoApplication ? ExpoApplication.androidId || null : null;\n\n// @needsAudit\n/**\n * **Android only.** Gets the referrer URL of the installed app with the [`Install Referrer API`](https://developer.android.com/google/play/installreferrer)\n * from the Google Play Store. In practice, the referrer URL may not be a complete, absolute URL.\n * @return A `Promise` that fulfills with a `string` of the referrer URL of the installed app.\n *\n * # Example\n * ```ts\n * await Application.getInstallReferrerAsync();\n * // \"utm_source=google-play&utm_medium=organic\"\n * ```\n */\nexport async function getInstallReferrerAsync(): Promise<string> {\n if (!ExpoApplication.getInstallReferrerAsync) {\n throw new UnavailabilityError('expo-application', 'getInstallReferrerAsync');\n }\n return await ExpoApplication.getInstallReferrerAsync();\n}\n\n// @needsAudit\n/**\n * **iOS only.** Gets the iOS \"identifier for vendor\" ([IDFV](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor))\n * value, a string ID that uniquely identifies a device to the app’s vendor. This method may\n * sometimes return `nil`, in which case wait and call the method again later. This might happen\n * when the device has been restarted before the user has unlocked the device.\n *\n * The OS will change the vendor identifier if all apps from the current app's vendor have been\n * uninstalled.\n *\n * @return A `Promise` that fulfills with a `string` specifying the app's vendor ID. Apps from the\n * same vendor will return the same ID. See Apple's documentation for more information about the\n * vendor ID's semantics.\n *\n * # Example\n * ```ts\n * await Application.getIosIdForVendorAsync();\n * // \"68753A44-4D6F-1226-9C60-0050E4C00067\"\n * ```\n */\nexport async function getIosIdForVendorAsync(): Promise<string | null> {\n if (!ExpoApplication.getIosIdForVendorAsync) {\n throw new UnavailabilityError('expo-application', 'getIosIdForVendorAsync');\n }\n return (await ExpoApplication.getIosIdForVendorAsync()) ?? null;\n}\n\n// @docsMissing\nexport enum ApplicationReleaseType {\n UNKNOWN = 0,\n SIMULATOR = 1,\n ENTERPRISE = 2,\n DEVELOPMENT = 3,\n AD_HOC = 4,\n APP_STORE = 5,\n}\n\n// @needsAudit\n/**\n * **iOS only.** Gets the iOS application release type.\n * @return Returns a promise which fulfills with an [`ApplicationReleaseType`](#applicationreleasetype).\n */\nexport async function getIosApplicationReleaseTypeAsync(): Promise<ApplicationReleaseType> {\n if (!ExpoApplication.getApplicationReleaseTypeAsync) {\n throw new UnavailabilityError('expo-application', 'getApplicationReleaseTypeAsync');\n }\n return await ExpoApplication.getApplicationReleaseTypeAsync();\n}\n\n// @needsAudit\n/**\n * **iOS only.** Gets the current [Apple Push Notification (APN)](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment?language=objc)\n * service environment.\n * @return Returns a promise fulfilled with the string, either `'development'` or `'production'`,\n * based on the current APN environment.\n */\nexport async function getIosPushNotificationServiceEnvironmentAsync(): Promise<string> {\n if (!ExpoApplication.getPushNotificationServiceEnvironmentAsync) {\n throw new UnavailabilityError('expo-application', 'getPushNotificationServiceEnvironmentAsync');\n }\n return await ExpoApplication.getPushNotificationServiceEnvironmentAsync();\n}\n\n// @needsAudit\n/**\n * Gets the time the app was installed onto the device, not counting subsequent updates. If the app\n * is uninstalled and reinstalled, this method returns the time the app was reinstalled.\n * - On iOS, this method uses the [`NSFileCreationDate`](https://developer.apple.com/documentation/foundation/nsfilecreationdate?language=objc)\n * of the app's document root directory.\n * - On Android, this method uses [`PackageInfo.firstInstallTime`](https://developer.android.com/reference/android/content/pm/PackageInfo.html#firstInstallTime).\n * - On web, this method returns `null`.\n *\n * @return Returns a `Promise` that fulfills with a `Date` object that specifies the time the app\n * was installed on the device.\n *\n * # Example\n * ```ts\n * await Application.getInstallationTimeAsync();\n * // 2019-07-18T18:08:26.121Z\n * ```\n */\nexport async function getInstallationTimeAsync(): Promise<Date> {\n if (!ExpoApplication.getInstallationTimeAsync) {\n throw new UnavailabilityError('expo-application', 'getInstallationTimeAsync');\n }\n const installationTime = await ExpoApplication.getInstallationTimeAsync();\n return new Date(installationTime);\n}\n\n// @needsAudit\n/**\n * **Android only.** Gets the last time the app was updated from the Google Play Store.\n * @return Returns a `Promise` that fulfills with a `Date` object that specifies the last time\n * the app was updated via the Google Play Store).\n *\n * # Example\n * ```ts\n * await Application.getLastUpdateTimeAsync();\n * // 2019-07-18T21:20:16.887Z\n * ```\n */\nexport async function getLastUpdateTimeAsync(): Promise<Date> {\n if (!ExpoApplication.getLastUpdateTimeAsync) {\n throw new UnavailabilityError('expo-application', 'getLastUpdateTimeAsync');\n }\n const lastUpdateTime = await ExpoApplication.getLastUpdateTimeAsync();\n return new Date(lastUpdateTime);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Application.js","sourceRoot":"","sources":["../src/Application.ts"],"names":[],"mappings":"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","sourcesContent":["import { UnavailabilityError } from 'expo-modules-core';\n\nimport ExpoApplication from './ExpoApplication';\n\n// @needsAudit\n/**\n * The human-readable version of the native application that may be displayed in the app store.\n * This is the `Info.plist` value for `CFBundleShortVersionString` on iOS and the version name set\n * by `version` in `app.json` on Android at the time the native app was built.\n * On web, this value is `null`.\n * @example `\"2.11.0\"`\n */\nexport const nativeApplicationVersion: string | null = ExpoApplication\n ? ExpoApplication.nativeApplicationVersion || null\n : null;\n\n// @needsAudit\n/**\n * The internal build version of the native application that the app store may use to distinguish\n * between different binaries. This is the `Info.plist` value for `CFBundleVersion` on iOS (set with\n * `ios.buildNumber` value in `app.json` in a standalone app) and the version code set by\n * `android.versionCode` in `app.json` on Android at the time the native app was built. On web, this\n * value is `null`. The return type on Android and iOS is `string`.\n * @example iOS: `\"2.11.0\"`, Android: `\"114\"`\n */\nexport const nativeBuildVersion: string | null = ExpoApplication\n ? ExpoApplication.nativeBuildVersion || null\n : null;\n\n// @needsAudit\n/**\n * The human-readable name of the application that is displayed with the app's icon on the device's\n * home screen or desktop. On Android and iOS, this value is a `string` unless the name could not be\n * retrieved, in which case this value will be `null`. On web this value is `null`.\n * @example `\"Expo\"`, `\"Yelp\"`, `\"Instagram\"`\n */\nexport const applicationName: string | null = ExpoApplication\n ? ExpoApplication.applicationName || null\n : null;\n\n// @needsAudit\n/**\n * The ID of the application. On Android, this is the application ID. On iOS, this is the bundle ID.\n * On web, this is `null`.\n * @example `\"com.cocoacasts.scribbles\"`, `\"com.apple.Pages\"`\n */\nexport const applicationId: string | null = ExpoApplication\n ? ExpoApplication.applicationId || null\n : null;\n\n// @needsAudit\n/**\n * The value of [`Settings.Secure.ANDROID_ID`](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).\n * This is a hexadecimal `string` unique to each combination of app-signing key, user, and device.\n * The value may change if a factory reset is performed on the device or if an APK signing key changes.\n * For more information about how the platform handles `ANDROID_ID` in Android 8.0 (API level 26)\n * and higher, see [Android 8.0 Behavior Changes](https://developer.android.com/about/versions/oreo/android-8.0-changes.html#privacy-all).\n * On iOS and web, this value is `null`.\n * > In versions of the platform lower than Android 8.0 (API level 26), this value remains constant\n * > for the lifetime of the user's device. See the [ANDROID_ID](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID)\n * > official docs for more information.\n * @example `\"dd96dec43fb81c97\"`\n * @platform android\n */\nexport const androidId: string | null = ExpoApplication ? ExpoApplication.androidId || null : null;\n\n// @needsAudit\n/**\n * Gets the referrer URL of the installed app with the [`Install Referrer API`](https://developer.android.com/google/play/installreferrer)\n * from the Google Play Store. In practice, the referrer URL may not be a complete, absolute URL.\n * @return A `Promise` that fulfills with a `string` of the referrer URL of the installed app.\n *\n * @example\n * ```ts\n * await Application.getInstallReferrerAsync();\n * // \"utm_source=google-play&utm_medium=organic\"\n * ```\n * @platform android\n */\nexport async function getInstallReferrerAsync(): Promise<string> {\n if (!ExpoApplication.getInstallReferrerAsync) {\n throw new UnavailabilityError('expo-application', 'getInstallReferrerAsync');\n }\n return await ExpoApplication.getInstallReferrerAsync();\n}\n\n// @needsAudit\n/**\n * Gets the iOS \"identifier for vendor\" ([IDFV](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor))\n * value, a string ID that uniquely identifies a device to the app’s vendor. This method may\n * sometimes return `nil`, in which case wait and call the method again later. This might happen\n * when the device has been restarted before the user has unlocked the device.\n *\n * The OS will change the vendor identifier if all apps from the current app's vendor have been\n * uninstalled.\n *\n * @return A `Promise` that fulfills with a `string` specifying the app's vendor ID. Apps from the\n * same vendor will return the same ID. See Apple's documentation for more information about the\n * vendor ID's semantics.\n *\n * @example\n * ```ts\n * await Application.getIosIdForVendorAsync();\n * // \"68753A44-4D6F-1226-9C60-0050E4C00067\"\n * ```\n * @platform ios\n */\nexport async function getIosIdForVendorAsync(): Promise<string | null> {\n if (!ExpoApplication.getIosIdForVendorAsync) {\n throw new UnavailabilityError('expo-application', 'getIosIdForVendorAsync');\n }\n return (await ExpoApplication.getIosIdForVendorAsync()) ?? null;\n}\n\n// @docsMissing\nexport enum ApplicationReleaseType {\n UNKNOWN = 0,\n SIMULATOR = 1,\n ENTERPRISE = 2,\n DEVELOPMENT = 3,\n AD_HOC = 4,\n APP_STORE = 5,\n}\n\n// @needsAudit\n/**\n * Gets the iOS application release type.\n * @return Returns a promise which fulfills with an [`ApplicationReleaseType`](#applicationreleasetype).\n * @platform ios\n */\nexport async function getIosApplicationReleaseTypeAsync(): Promise<ApplicationReleaseType> {\n if (!ExpoApplication.getApplicationReleaseTypeAsync) {\n throw new UnavailabilityError('expo-application', 'getApplicationReleaseTypeAsync');\n }\n return await ExpoApplication.getApplicationReleaseTypeAsync();\n}\n\n// @needsAudit\n/**\n * Gets the current [Apple Push Notification (APN)](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment?language=objc)\n * service environment.\n * @return Returns a promise fulfilled with the string, either `'development'` or `'production'`,\n * based on the current APN environment.\n * @platform ios\n */\nexport async function getIosPushNotificationServiceEnvironmentAsync(): Promise<string> {\n if (!ExpoApplication.getPushNotificationServiceEnvironmentAsync) {\n throw new UnavailabilityError('expo-application', 'getPushNotificationServiceEnvironmentAsync');\n }\n return await ExpoApplication.getPushNotificationServiceEnvironmentAsync();\n}\n\n// @needsAudit\n/**\n * Gets the time the app was installed onto the device, not counting subsequent updates. If the app\n * is uninstalled and reinstalled, this method returns the time the app was reinstalled.\n * - On iOS, this method uses the [`NSFileCreationDate`](https://developer.apple.com/documentation/foundation/nsfilecreationdate?language=objc)\n * of the app's document root directory.\n * - On Android, this method uses [`PackageInfo.firstInstallTime`](https://developer.android.com/reference/android/content/pm/PackageInfo.html#firstInstallTime).\n * - On web, this method returns `null`.\n *\n * @return Returns a `Promise` that fulfills with a `Date` object that specifies the time the app\n * was installed on the device.\n *\n * @example\n * ```ts\n * await Application.getInstallationTimeAsync();\n * // 2019-07-18T18:08:26.121Z\n * ```\n */\nexport async function getInstallationTimeAsync(): Promise<Date> {\n if (!ExpoApplication.getInstallationTimeAsync) {\n throw new UnavailabilityError('expo-application', 'getInstallationTimeAsync');\n }\n const installationTime = await ExpoApplication.getInstallationTimeAsync();\n return new Date(installationTime);\n}\n\n// @needsAudit\n/**\n * Gets the last time the app was updated from the Google Play Store.\n * @return Returns a `Promise` that fulfills with a `Date` object that specifies the last time\n * the app was updated via the Google Play Store).\n *\n * @example\n * ```ts\n * await Application.getLastUpdateTimeAsync();\n * // 2019-07-18T21:20:16.887Z\n * ```\n * @platform android\n */\nexport async function getLastUpdateTimeAsync(): Promise<Date> {\n if (!ExpoApplication.getLastUpdateTimeAsync) {\n throw new UnavailabilityError('expo-application', 'getLastUpdateTimeAsync');\n }\n const lastUpdateTime = await ExpoApplication.getLastUpdateTimeAsync();\n return new Date(lastUpdateTime);\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("
|
|
1
|
+
declare const _default: import("expo-modules-core").ProxyNativeModule;
|
|
2
2
|
export default _default;
|
package/build/ExpoApplication.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoApplication.js","sourceRoot":"","sources":["../src/ExpoApplication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"ExpoApplication.js","sourceRoot":"","sources":["../src/ExpoApplication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,eAAe,kBAAkB,CAAC,eAAe,CAAC","sourcesContent":["import { NativeModulesProxy } from 'expo-modules-core';\nexport default NativeModulesProxy.ExpoApplication;\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copyright 2019-present 650 Industries. All rights reserved.
|
|
2
2
|
|
|
3
|
-
#import <
|
|
3
|
+
#import <ExpoModulesCore/EXExportedModule.h>
|
|
4
4
|
#import <Foundation/Foundation.h>
|
|
5
5
|
|
|
6
|
-
@interface EXApplication :
|
|
6
|
+
@interface EXApplication : EXExportedModule
|
|
7
7
|
|
|
8
8
|
@end
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
-
#import <
|
|
2
|
+
#import <ExpoModulesCore/EXUtilities.h>
|
|
3
3
|
#import <EXApplication/EXApplication.h>
|
|
4
4
|
#import <UIKit/UIKit.h>
|
|
5
5
|
#import <EXApplication/EXProvisioningProfile.h>
|
|
6
6
|
|
|
7
7
|
@implementation EXApplication
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
EX_EXPORT_MODULE(ExpoApplication);
|
|
10
10
|
|
|
11
11
|
- (dispatch_queue_t)methodQueue
|
|
12
12
|
{
|
|
13
13
|
return dispatch_get_main_queue();
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
EX_EXPORT_METHOD_AS(getIosIdForVendorAsync, getIosIdForVendorAsyncWithResolver:(EXPromiseResolveBlock)resolve rejecter:(EXPromiseRejectBlock)reject)
|
|
17
17
|
{
|
|
18
18
|
resolve([[UIDevice currentDevice].identifierForVendor UUIDString]);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
EX_EXPORT_METHOD_AS(getInstallationTimeAsync, getInstallationTimeAsyncWithResolver:(EXPromiseResolveBlock)resolve rejecter:(EXPromiseRejectBlock)reject)
|
|
22
22
|
{
|
|
23
23
|
NSURL *urlToDocumentsFolder = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
|
|
24
24
|
NSError *error = nil;
|
|
@@ -32,13 +32,13 @@ UM_EXPORT_METHOD_AS(getInstallationTimeAsync, getInstallationTimeAsyncWithResolv
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
EX_EXPORT_METHOD_AS(getApplicationReleaseTypeAsync, getApplicationReleaseTypeAsyncWithResolver:(EXPromiseResolveBlock)resolve rejecter:(EXPromiseRejectBlock)reject)
|
|
36
36
|
{
|
|
37
37
|
EXProvisioningProfile *mainProvisioningProfile = [EXProvisioningProfile mainProvisioningProfile];
|
|
38
38
|
resolve(@([mainProvisioningProfile appReleaseType]));
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
EX_EXPORT_METHOD_AS(getPushNotificationServiceEnvironmentAsync, getPushNotificationServiceEnvironmentAsyncWithResolver:(EXPromiseResolveBlock)resolve rejecter:(EXPromiseRejectBlock)reject)
|
|
42
42
|
{
|
|
43
43
|
EXProvisioningProfile *mainProvisioningProfile = [EXProvisioningProfile mainProvisioningProfile];
|
|
44
44
|
resolve([mainProvisioningProfile notificationServiceEnvironment]);
|
|
@@ -10,10 +10,11 @@ Pod::Spec.new do |s|
|
|
|
10
10
|
s.license = package['license']
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.homepage = package['homepage']
|
|
13
|
-
s.platform = :ios, '
|
|
13
|
+
s.platform = :ios, '12.0'
|
|
14
14
|
s.source = { git: 'https://github.com/expo/expo.git' }
|
|
15
|
+
s.static_framework = true
|
|
15
16
|
|
|
16
|
-
s.dependency '
|
|
17
|
+
s.dependency 'ExpoModulesCore'
|
|
17
18
|
|
|
18
19
|
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')
|
|
19
20
|
s.source_files = "#{s.name}/**/*.h"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-application",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "A universal module that gets native application information such as its ID, app name, and build version at runtime",
|
|
5
5
|
"main": "build/Application.js",
|
|
6
6
|
"types": "build/Application.d.ts",
|
|
@@ -28,9 +28,13 @@
|
|
|
28
28
|
},
|
|
29
29
|
"author": "650 Industries, Inc.",
|
|
30
30
|
"license": "MIT",
|
|
31
|
-
"homepage": "https://docs.expo.
|
|
31
|
+
"homepage": "https://docs.expo.dev/versions/latest/sdk/application/",
|
|
32
|
+
"dependencies": {},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"expo-module-scripts": "^2.0.0"
|
|
34
35
|
},
|
|
35
|
-
"
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"expo": "*"
|
|
38
|
+
},
|
|
39
|
+
"gitHead": "ba24eba18bf4f4d4b0d54828992d81a2bb18246a"
|
|
36
40
|
}
|
package/src/Application.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UnavailabilityError } from '
|
|
1
|
+
import { UnavailabilityError } from 'expo-modules-core';
|
|
2
2
|
|
|
3
3
|
import ExpoApplication from './ExpoApplication';
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ import ExpoApplication from './ExpoApplication';
|
|
|
8
8
|
* This is the `Info.plist` value for `CFBundleShortVersionString` on iOS and the version name set
|
|
9
9
|
* by `version` in `app.json` on Android at the time the native app was built.
|
|
10
10
|
* On web, this value is `null`.
|
|
11
|
-
*
|
|
11
|
+
* @example `"2.11.0"`
|
|
12
12
|
*/
|
|
13
13
|
export const nativeApplicationVersion: string | null = ExpoApplication
|
|
14
14
|
? ExpoApplication.nativeApplicationVersion || null
|
|
@@ -21,7 +21,7 @@ export const nativeApplicationVersion: string | null = ExpoApplication
|
|
|
21
21
|
* `ios.buildNumber` value in `app.json` in a standalone app) and the version code set by
|
|
22
22
|
* `android.versionCode` in `app.json` on Android at the time the native app was built. On web, this
|
|
23
23
|
* value is `null`. The return type on Android and iOS is `string`.
|
|
24
|
-
*
|
|
24
|
+
* @example iOS: `"2.11.0"`, Android: `"114"`
|
|
25
25
|
*/
|
|
26
26
|
export const nativeBuildVersion: string | null = ExpoApplication
|
|
27
27
|
? ExpoApplication.nativeBuildVersion || null
|
|
@@ -32,7 +32,7 @@ export const nativeBuildVersion: string | null = ExpoApplication
|
|
|
32
32
|
* The human-readable name of the application that is displayed with the app's icon on the device's
|
|
33
33
|
* home screen or desktop. On Android and iOS, this value is a `string` unless the name could not be
|
|
34
34
|
* retrieved, in which case this value will be `null`. On web this value is `null`.
|
|
35
|
-
*
|
|
35
|
+
* @example `"Expo"`, `"Yelp"`, `"Instagram"`
|
|
36
36
|
*/
|
|
37
37
|
export const applicationName: string | null = ExpoApplication
|
|
38
38
|
? ExpoApplication.applicationName || null
|
|
@@ -42,7 +42,7 @@ export const applicationName: string | null = ExpoApplication
|
|
|
42
42
|
/**
|
|
43
43
|
* The ID of the application. On Android, this is the application ID. On iOS, this is the bundle ID.
|
|
44
44
|
* On web, this is `null`.
|
|
45
|
-
*
|
|
45
|
+
* @example `"com.cocoacasts.scribbles"`, `"com.apple.Pages"`
|
|
46
46
|
*/
|
|
47
47
|
export const applicationId: string | null = ExpoApplication
|
|
48
48
|
? ExpoApplication.applicationId || null
|
|
@@ -50,7 +50,7 @@ export const applicationId: string | null = ExpoApplication
|
|
|
50
50
|
|
|
51
51
|
// @needsAudit
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* The value of [`Settings.Secure.ANDROID_ID`](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).
|
|
54
54
|
* This is a hexadecimal `string` unique to each combination of app-signing key, user, and device.
|
|
55
55
|
* The value may change if a factory reset is performed on the device or if an APK signing key changes.
|
|
56
56
|
* For more information about how the platform handles `ANDROID_ID` in Android 8.0 (API level 26)
|
|
@@ -59,21 +59,23 @@ export const applicationId: string | null = ExpoApplication
|
|
|
59
59
|
* > In versions of the platform lower than Android 8.0 (API level 26), this value remains constant
|
|
60
60
|
* > for the lifetime of the user's device. See the [ANDROID_ID](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID)
|
|
61
61
|
* > official docs for more information.
|
|
62
|
-
*
|
|
62
|
+
* @example `"dd96dec43fb81c97"`
|
|
63
|
+
* @platform android
|
|
63
64
|
*/
|
|
64
65
|
export const androidId: string | null = ExpoApplication ? ExpoApplication.androidId || null : null;
|
|
65
66
|
|
|
66
67
|
// @needsAudit
|
|
67
68
|
/**
|
|
68
|
-
*
|
|
69
|
+
* Gets the referrer URL of the installed app with the [`Install Referrer API`](https://developer.android.com/google/play/installreferrer)
|
|
69
70
|
* from the Google Play Store. In practice, the referrer URL may not be a complete, absolute URL.
|
|
70
71
|
* @return A `Promise` that fulfills with a `string` of the referrer URL of the installed app.
|
|
71
72
|
*
|
|
72
|
-
*
|
|
73
|
+
* @example
|
|
73
74
|
* ```ts
|
|
74
75
|
* await Application.getInstallReferrerAsync();
|
|
75
76
|
* // "utm_source=google-play&utm_medium=organic"
|
|
76
77
|
* ```
|
|
78
|
+
* @platform android
|
|
77
79
|
*/
|
|
78
80
|
export async function getInstallReferrerAsync(): Promise<string> {
|
|
79
81
|
if (!ExpoApplication.getInstallReferrerAsync) {
|
|
@@ -84,7 +86,7 @@ export async function getInstallReferrerAsync(): Promise<string> {
|
|
|
84
86
|
|
|
85
87
|
// @needsAudit
|
|
86
88
|
/**
|
|
87
|
-
*
|
|
89
|
+
* Gets the iOS "identifier for vendor" ([IDFV](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor))
|
|
88
90
|
* value, a string ID that uniquely identifies a device to the app’s vendor. This method may
|
|
89
91
|
* sometimes return `nil`, in which case wait and call the method again later. This might happen
|
|
90
92
|
* when the device has been restarted before the user has unlocked the device.
|
|
@@ -96,11 +98,12 @@ export async function getInstallReferrerAsync(): Promise<string> {
|
|
|
96
98
|
* same vendor will return the same ID. See Apple's documentation for more information about the
|
|
97
99
|
* vendor ID's semantics.
|
|
98
100
|
*
|
|
99
|
-
*
|
|
101
|
+
* @example
|
|
100
102
|
* ```ts
|
|
101
103
|
* await Application.getIosIdForVendorAsync();
|
|
102
104
|
* // "68753A44-4D6F-1226-9C60-0050E4C00067"
|
|
103
105
|
* ```
|
|
106
|
+
* @platform ios
|
|
104
107
|
*/
|
|
105
108
|
export async function getIosIdForVendorAsync(): Promise<string | null> {
|
|
106
109
|
if (!ExpoApplication.getIosIdForVendorAsync) {
|
|
@@ -121,8 +124,9 @@ export enum ApplicationReleaseType {
|
|
|
121
124
|
|
|
122
125
|
// @needsAudit
|
|
123
126
|
/**
|
|
124
|
-
*
|
|
127
|
+
* Gets the iOS application release type.
|
|
125
128
|
* @return Returns a promise which fulfills with an [`ApplicationReleaseType`](#applicationreleasetype).
|
|
129
|
+
* @platform ios
|
|
126
130
|
*/
|
|
127
131
|
export async function getIosApplicationReleaseTypeAsync(): Promise<ApplicationReleaseType> {
|
|
128
132
|
if (!ExpoApplication.getApplicationReleaseTypeAsync) {
|
|
@@ -133,10 +137,11 @@ export async function getIosApplicationReleaseTypeAsync(): Promise<ApplicationRe
|
|
|
133
137
|
|
|
134
138
|
// @needsAudit
|
|
135
139
|
/**
|
|
136
|
-
*
|
|
140
|
+
* Gets the current [Apple Push Notification (APN)](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment?language=objc)
|
|
137
141
|
* service environment.
|
|
138
142
|
* @return Returns a promise fulfilled with the string, either `'development'` or `'production'`,
|
|
139
143
|
* based on the current APN environment.
|
|
144
|
+
* @platform ios
|
|
140
145
|
*/
|
|
141
146
|
export async function getIosPushNotificationServiceEnvironmentAsync(): Promise<string> {
|
|
142
147
|
if (!ExpoApplication.getPushNotificationServiceEnvironmentAsync) {
|
|
@@ -157,7 +162,7 @@ export async function getIosPushNotificationServiceEnvironmentAsync(): Promise<s
|
|
|
157
162
|
* @return Returns a `Promise` that fulfills with a `Date` object that specifies the time the app
|
|
158
163
|
* was installed on the device.
|
|
159
164
|
*
|
|
160
|
-
*
|
|
165
|
+
* @example
|
|
161
166
|
* ```ts
|
|
162
167
|
* await Application.getInstallationTimeAsync();
|
|
163
168
|
* // 2019-07-18T18:08:26.121Z
|
|
@@ -173,15 +178,16 @@ export async function getInstallationTimeAsync(): Promise<Date> {
|
|
|
173
178
|
|
|
174
179
|
// @needsAudit
|
|
175
180
|
/**
|
|
176
|
-
*
|
|
181
|
+
* Gets the last time the app was updated from the Google Play Store.
|
|
177
182
|
* @return Returns a `Promise` that fulfills with a `Date` object that specifies the last time
|
|
178
183
|
* the app was updated via the Google Play Store).
|
|
179
184
|
*
|
|
180
|
-
*
|
|
185
|
+
* @example
|
|
181
186
|
* ```ts
|
|
182
187
|
* await Application.getLastUpdateTimeAsync();
|
|
183
188
|
* // 2019-07-18T21:20:16.887Z
|
|
184
189
|
* ```
|
|
190
|
+
* @platform android
|
|
185
191
|
*/
|
|
186
192
|
export async function getLastUpdateTimeAsync(): Promise<Date> {
|
|
187
193
|
if (!ExpoApplication.getLastUpdateTimeAsync) {
|
package/src/ExpoApplication.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { NativeModulesProxy } from '
|
|
1
|
+
import { NativeModulesProxy } from 'expo-modules-core';
|
|
2
2
|
export default NativeModulesProxy.ExpoApplication;
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
package expo.modules.application;
|
|
2
|
-
|
|
3
|
-
import android.app.Activity;
|
|
4
|
-
import android.content.Context;
|
|
5
|
-
import android.content.pm.PackageInfo;
|
|
6
|
-
import android.content.pm.PackageManager;
|
|
7
|
-
import android.os.Build;
|
|
8
|
-
import android.os.RemoteException;
|
|
9
|
-
import android.provider.Settings;
|
|
10
|
-
import android.util.Log;
|
|
11
|
-
|
|
12
|
-
import com.android.installreferrer.api.InstallReferrerClient;
|
|
13
|
-
import com.android.installreferrer.api.InstallReferrerStateListener;
|
|
14
|
-
import com.android.installreferrer.api.ReferrerDetails;
|
|
15
|
-
|
|
16
|
-
import org.unimodules.core.ExportedModule;
|
|
17
|
-
import org.unimodules.core.ModuleRegistry;
|
|
18
|
-
import org.unimodules.core.Promise;
|
|
19
|
-
import org.unimodules.core.interfaces.ActivityProvider;
|
|
20
|
-
import org.unimodules.core.interfaces.ExpoMethod;
|
|
21
|
-
import org.unimodules.core.interfaces.RegistryLifecycleListener;
|
|
22
|
-
|
|
23
|
-
import java.util.HashMap;
|
|
24
|
-
import java.util.Map;
|
|
25
|
-
|
|
26
|
-
public class ApplicationModule extends ExportedModule implements RegistryLifecycleListener {
|
|
27
|
-
private static final String NAME = "ExpoApplication";
|
|
28
|
-
private static final String TAG = ApplicationModule.class.getSimpleName();
|
|
29
|
-
|
|
30
|
-
private ModuleRegistry mModuleRegistry;
|
|
31
|
-
private Context mContext;
|
|
32
|
-
private ActivityProvider mActivityProvider;
|
|
33
|
-
private Activity mActivity;
|
|
34
|
-
|
|
35
|
-
public ApplicationModule(Context context) {
|
|
36
|
-
super(context);
|
|
37
|
-
mContext = context;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@Override
|
|
41
|
-
public String getName() {
|
|
42
|
-
return NAME;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@Override
|
|
46
|
-
public void onCreate(ModuleRegistry moduleRegistry) {
|
|
47
|
-
mModuleRegistry = moduleRegistry;
|
|
48
|
-
mActivityProvider = moduleRegistry.getModule(ActivityProvider.class);
|
|
49
|
-
mActivity = mActivityProvider.getCurrentActivity();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@Override
|
|
53
|
-
public Map<String, Object> getConstants() {
|
|
54
|
-
HashMap<String, Object> constants = new HashMap<>();
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
String applicationName = mContext.getApplicationInfo().loadLabel(mContext.getPackageManager()).toString();
|
|
58
|
-
String packageName = mContext.getPackageName();
|
|
59
|
-
|
|
60
|
-
constants.put("applicationName", applicationName);
|
|
61
|
-
constants.put("applicationId", packageName);
|
|
62
|
-
|
|
63
|
-
PackageManager packageManager = mContext.getPackageManager();
|
|
64
|
-
try {
|
|
65
|
-
PackageInfo pInfo = packageManager.getPackageInfo(packageName, 0);
|
|
66
|
-
constants.put("nativeApplicationVersion", pInfo.versionName);
|
|
67
|
-
|
|
68
|
-
int versionCode = (int)getLongVersionCode(pInfo);
|
|
69
|
-
constants.put("nativeBuildVersion", Integer.toString(versionCode));
|
|
70
|
-
} catch (PackageManager.NameNotFoundException e) {
|
|
71
|
-
Log.e(TAG, "Exception: ", e);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
constants.put("androidId", Settings.Secure.getString(mContext.getContentResolver(), Settings.Secure.ANDROID_ID));
|
|
75
|
-
|
|
76
|
-
return constants;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
@ExpoMethod
|
|
80
|
-
public void getInstallationTimeAsync(Promise promise) {
|
|
81
|
-
PackageManager packageManager = mContext.getPackageManager();
|
|
82
|
-
String packageName = mContext.getPackageName();
|
|
83
|
-
try {
|
|
84
|
-
PackageInfo info = packageManager.getPackageInfo(packageName, 0);
|
|
85
|
-
promise.resolve((double)info.firstInstallTime);
|
|
86
|
-
} catch (PackageManager.NameNotFoundException e) {
|
|
87
|
-
Log.e(TAG, "Exception: ", e);
|
|
88
|
-
promise.reject("ERR_APPLICATION_PACKAGE_NAME_NOT_FOUND", "Unable to get install time of this application. Could not get package info or package name.", e);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
@ExpoMethod
|
|
93
|
-
public void getLastUpdateTimeAsync(Promise promise) {
|
|
94
|
-
PackageManager packageManager = mContext.getPackageManager();
|
|
95
|
-
String packageName = mContext.getPackageName();
|
|
96
|
-
try {
|
|
97
|
-
PackageInfo info = packageManager.getPackageInfo(packageName, 0);
|
|
98
|
-
promise.resolve((double)info.lastUpdateTime);
|
|
99
|
-
} catch (PackageManager.NameNotFoundException e) {
|
|
100
|
-
Log.e(TAG, "Exception: ", e);
|
|
101
|
-
promise.reject("ERR_APPLICATION_PACKAGE_NAME_NOT_FOUND", "Unable to get last update time of this application. Could not get package info or package name.", e);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
@ExpoMethod
|
|
107
|
-
public void getInstallReferrerAsync(final Promise promise) {
|
|
108
|
-
final StringBuilder installReferrer = new StringBuilder();
|
|
109
|
-
|
|
110
|
-
final InstallReferrerClient referrerClient;
|
|
111
|
-
referrerClient = InstallReferrerClient.newBuilder(mContext).build();
|
|
112
|
-
referrerClient.startConnection(new InstallReferrerStateListener() {
|
|
113
|
-
@Override
|
|
114
|
-
public void onInstallReferrerSetupFinished(int responseCode) {
|
|
115
|
-
switch (responseCode) {
|
|
116
|
-
case InstallReferrerClient.InstallReferrerResponse.OK:
|
|
117
|
-
// Connection established and response received
|
|
118
|
-
try {
|
|
119
|
-
ReferrerDetails response = referrerClient.getInstallReferrer();
|
|
120
|
-
installReferrer.append(response.getInstallReferrer());
|
|
121
|
-
} catch (RemoteException e) {
|
|
122
|
-
Log.e(TAG, "Exception: ", e);
|
|
123
|
-
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);
|
|
124
|
-
}
|
|
125
|
-
promise.resolve(installReferrer.toString());
|
|
126
|
-
break;
|
|
127
|
-
case InstallReferrerClient.InstallReferrerResponse.FEATURE_NOT_SUPPORTED:
|
|
128
|
-
// API not available in the current Play Store app
|
|
129
|
-
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.");
|
|
130
|
-
break;
|
|
131
|
-
case InstallReferrerClient.InstallReferrerResponse.SERVICE_UNAVAILABLE:
|
|
132
|
-
// Connection could not be established
|
|
133
|
-
promise.reject("ERR_APPLICATION_INSTALL_REFERRER_CONNECTION", "Could not establish a connection to Google Play");
|
|
134
|
-
break;
|
|
135
|
-
default:
|
|
136
|
-
promise.reject("ERR_APPLICATION_INSTALL_REFERRER", "General error retrieving the install referrer: response code " + responseCode);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
referrerClient.endConnection();
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
@Override
|
|
143
|
-
public void onInstallReferrerServiceDisconnected() {
|
|
144
|
-
promise.reject("ERR_APPLICATION_INSTALL_REFERRER_SERVICE_DISCONNECTED", "Connection to install referrer service was lost.");
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
private static long getLongVersionCode(PackageInfo info) {
|
|
150
|
-
if (Build.VERSION.SDK_INT >= 28) {
|
|
151
|
-
return info.getLongVersionCode();
|
|
152
|
-
}
|
|
153
|
-
return info.versionCode;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
package expo.modules.application;
|
|
2
|
-
|
|
3
|
-
import android.content.Context;
|
|
4
|
-
|
|
5
|
-
import java.util.Collections;
|
|
6
|
-
import java.util.List;
|
|
7
|
-
|
|
8
|
-
import org.unimodules.core.BasePackage;
|
|
9
|
-
import org.unimodules.core.ExportedModule;
|
|
10
|
-
import org.unimodules.core.ViewManager;
|
|
11
|
-
|
|
12
|
-
public class ApplicationPackage extends BasePackage {
|
|
13
|
-
@Override
|
|
14
|
-
public List<ExportedModule> createExportedModules(Context context) {
|
|
15
|
-
return Collections.singletonList((ExportedModule) new ApplicationModule(context));
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|