expo-application 3.1.2 → 4.0.1
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 +33 -0
- package/README.md +1 -1
- package/android/build.gradle +30 -14
- 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 +112 -0
- package/build/Application.js +125 -1
- 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 +129 -1
- 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
|
@@ -8,6 +8,39 @@
|
|
|
8
8
|
|
|
9
9
|
### 🐛 Bug fixes
|
|
10
10
|
|
|
11
|
+
### 💡 Others
|
|
12
|
+
|
|
13
|
+
## 4.0.1 — 2021-11-17
|
|
14
|
+
|
|
15
|
+
_This version does not introduce any user-facing changes._
|
|
16
|
+
|
|
17
|
+
## 4.0.0 — 2021-09-28
|
|
18
|
+
|
|
19
|
+
### 🛠 Breaking changes
|
|
20
|
+
|
|
21
|
+
- Dropped support for iOS 11.0 ([#14383](https://github.com/expo/expo/pull/14383) by [@cruzach](https://github.com/cruzach))
|
|
22
|
+
|
|
23
|
+
### 🐛 Bug fixes
|
|
24
|
+
|
|
25
|
+
- Fix building errors from use_frameworks! in Podfile. ([#14523](https://github.com/expo/expo/pull/14523) by [@kudo](https://github.com/kudo))
|
|
26
|
+
|
|
27
|
+
## 3.3.0 — 2021-09-08
|
|
28
|
+
|
|
29
|
+
### 💡 Others
|
|
30
|
+
|
|
31
|
+
- Rewrite android code to Kotlin ([#13792](https://github.com/expo/expo/pull/13792) by [@kkafar](https://github.com/kkafar))
|
|
32
|
+
- Add basic unit tests to Kotlin. ([#13792](https://github.com/expo/expo/pull/13792) by [@kkafar](https://github.com/kkafar))
|
|
33
|
+
|
|
34
|
+
## 3.2.0 — 2021-06-16
|
|
35
|
+
|
|
36
|
+
### 🐛 Bug fixes
|
|
37
|
+
|
|
38
|
+
- Enable kotlin in all modules. ([#12716](https://github.com/expo/expo/pull/12716) by [@wschurman](https://github.com/wschurman))
|
|
39
|
+
|
|
40
|
+
### 💡 Others
|
|
41
|
+
|
|
42
|
+
- 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))
|
|
43
|
+
|
|
11
44
|
## 3.1.2 — 2021-04-13
|
|
12
45
|
|
|
13
46
|
_This version does not introduce any user-facing changes._
|
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,12 +1,23 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
|
+
apply plugin: 'kotlin-android'
|
|
2
3
|
apply plugin: 'maven'
|
|
3
4
|
|
|
4
5
|
group = 'host.exp.exponent'
|
|
5
|
-
version = '
|
|
6
|
+
version = '4.0.1'
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
buildscript {
|
|
9
|
+
// Simple helper that allows the root project to override versions declared by this library.
|
|
10
|
+
ext.safeExtGet = { prop, fallback ->
|
|
11
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
repositories {
|
|
15
|
+
mavenCentral()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
dependencies {
|
|
19
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '1.4.21')}")
|
|
20
|
+
}
|
|
10
21
|
}
|
|
11
22
|
|
|
12
23
|
// Upload android library to maven with javadoc and android sources
|
|
@@ -37,26 +48,31 @@ uploadArchives {
|
|
|
37
48
|
android {
|
|
38
49
|
compileSdkVersion safeExtGet("compileSdkVersion", 30)
|
|
39
50
|
|
|
51
|
+
compileOptions {
|
|
52
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
53
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
54
|
+
}
|
|
55
|
+
|
|
40
56
|
defaultConfig {
|
|
41
57
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
42
58
|
targetSdkVersion safeExtGet("targetSdkVersion", 30)
|
|
43
59
|
versionCode 12
|
|
44
|
-
versionName '
|
|
60
|
+
versionName '4.0.1'
|
|
45
61
|
}
|
|
46
62
|
lintOptions {
|
|
47
63
|
abortOnError false
|
|
48
64
|
}
|
|
49
65
|
}
|
|
50
66
|
|
|
51
|
-
if (new File(rootProject.projectDir.parentFile, 'package.json').exists()) {
|
|
52
|
-
apply from: project(":unimodules-core").file("../unimodules-core.gradle")
|
|
53
|
-
} else {
|
|
54
|
-
throw new GradleException(
|
|
55
|
-
'\'unimodules-core.gradle\' was not found in the usual React Native dependency location. ' +
|
|
56
|
-
'This package can only be used in such projects. Are you sure you\'ve installed the dependencies properly?')
|
|
57
|
-
}
|
|
58
|
-
|
|
59
67
|
dependencies {
|
|
60
|
-
|
|
68
|
+
implementation project(':expo-modules-core')
|
|
69
|
+
|
|
61
70
|
implementation 'com.android.installreferrer:installreferrer:1.0'
|
|
71
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '1.4.21')}"
|
|
72
|
+
|
|
73
|
+
if (project.findProject(':unimodules-test-core')) {
|
|
74
|
+
testImplementation project(':unimodules-test-core')
|
|
75
|
+
}
|
|
76
|
+
testImplementation "org.robolectric:robolectric:4.5.1"
|
|
77
|
+
testImplementation 'junit:junit:4.12'
|
|
62
78
|
}
|
|
@@ -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
|
@@ -1,9 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The human-readable version of the native application that may be displayed in the app store.
|
|
3
|
+
* This is the `Info.plist` value for `CFBundleShortVersionString` on iOS and the version name set
|
|
4
|
+
* by `version` in `app.json` on Android at the time the native app was built.
|
|
5
|
+
* On web, this value is `null`.
|
|
6
|
+
* @example `"2.11.0"`
|
|
7
|
+
*/
|
|
1
8
|
export declare const nativeApplicationVersion: string | null;
|
|
9
|
+
/**
|
|
10
|
+
* The internal build version of the native application that the app store may use to distinguish
|
|
11
|
+
* between different binaries. This is the `Info.plist` value for `CFBundleVersion` on iOS (set with
|
|
12
|
+
* `ios.buildNumber` value in `app.json` in a standalone app) and the version code set by
|
|
13
|
+
* `android.versionCode` in `app.json` on Android at the time the native app was built. On web, this
|
|
14
|
+
* value is `null`. The return type on Android and iOS is `string`.
|
|
15
|
+
* @example iOS: `"2.11.0"`, Android: `"114"`
|
|
16
|
+
*/
|
|
2
17
|
export declare const nativeBuildVersion: string | null;
|
|
18
|
+
/**
|
|
19
|
+
* The human-readable name of the application that is displayed with the app's icon on the device's
|
|
20
|
+
* home screen or desktop. On Android and iOS, this value is a `string` unless the name could not be
|
|
21
|
+
* retrieved, in which case this value will be `null`. On web this value is `null`.
|
|
22
|
+
* @example `"Expo"`, `"Yelp"`, `"Instagram"`
|
|
23
|
+
*/
|
|
3
24
|
export declare const applicationName: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* The ID of the application. On Android, this is the application ID. On iOS, this is the bundle ID.
|
|
27
|
+
* On web, this is `null`.
|
|
28
|
+
* @example `"com.cocoacasts.scribbles"`, `"com.apple.Pages"`
|
|
29
|
+
*/
|
|
4
30
|
export declare const applicationId: string | null;
|
|
31
|
+
/**
|
|
32
|
+
* The value of [`Settings.Secure.ANDROID_ID`](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).
|
|
33
|
+
* This is a hexadecimal `string` unique to each combination of app-signing key, user, and device.
|
|
34
|
+
* The value may change if a factory reset is performed on the device or if an APK signing key changes.
|
|
35
|
+
* For more information about how the platform handles `ANDROID_ID` in Android 8.0 (API level 26)
|
|
36
|
+
* and higher, see [Android 8.0 Behavior Changes](https://developer.android.com/about/versions/oreo/android-8.0-changes.html#privacy-all).
|
|
37
|
+
* On iOS and web, this value is `null`.
|
|
38
|
+
* > In versions of the platform lower than Android 8.0 (API level 26), this value remains constant
|
|
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
|
+
* > official docs for more information.
|
|
41
|
+
* @example `"dd96dec43fb81c97"`
|
|
42
|
+
* @platform android
|
|
43
|
+
*/
|
|
5
44
|
export declare const androidId: string | null;
|
|
45
|
+
/**
|
|
46
|
+
* Gets the referrer URL of the installed app with the [`Install Referrer API`](https://developer.android.com/google/play/installreferrer)
|
|
47
|
+
* from the Google Play Store. In practice, the referrer URL may not be a complete, absolute URL.
|
|
48
|
+
* @return A `Promise` that fulfills with a `string` of the referrer URL of the installed app.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* await Application.getInstallReferrerAsync();
|
|
53
|
+
* // "utm_source=google-play&utm_medium=organic"
|
|
54
|
+
* ```
|
|
55
|
+
* @platform android
|
|
56
|
+
*/
|
|
6
57
|
export declare function getInstallReferrerAsync(): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Gets the iOS "identifier for vendor" ([IDFV](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor))
|
|
60
|
+
* value, a string ID that uniquely identifies a device to the app’s vendor. This method may
|
|
61
|
+
* sometimes return `nil`, in which case wait and call the method again later. This might happen
|
|
62
|
+
* when the device has been restarted before the user has unlocked the device.
|
|
63
|
+
*
|
|
64
|
+
* The OS will change the vendor identifier if all apps from the current app's vendor have been
|
|
65
|
+
* uninstalled.
|
|
66
|
+
*
|
|
67
|
+
* @return A `Promise` that fulfills with a `string` specifying the app's vendor ID. Apps from the
|
|
68
|
+
* same vendor will return the same ID. See Apple's documentation for more information about the
|
|
69
|
+
* vendor ID's semantics.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* await Application.getIosIdForVendorAsync();
|
|
74
|
+
* // "68753A44-4D6F-1226-9C60-0050E4C00067"
|
|
75
|
+
* ```
|
|
76
|
+
* @platform ios
|
|
77
|
+
*/
|
|
7
78
|
export declare function getIosIdForVendorAsync(): Promise<string | null>;
|
|
8
79
|
export declare enum ApplicationReleaseType {
|
|
9
80
|
UNKNOWN = 0,
|
|
@@ -13,7 +84,48 @@ export declare enum ApplicationReleaseType {
|
|
|
13
84
|
AD_HOC = 4,
|
|
14
85
|
APP_STORE = 5
|
|
15
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Gets the iOS application release type.
|
|
89
|
+
* @return Returns a promise which fulfills with an [`ApplicationReleaseType`](#applicationreleasetype).
|
|
90
|
+
* @platform ios
|
|
91
|
+
*/
|
|
16
92
|
export declare function getIosApplicationReleaseTypeAsync(): Promise<ApplicationReleaseType>;
|
|
93
|
+
/**
|
|
94
|
+
* Gets the current [Apple Push Notification (APN)](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment?language=objc)
|
|
95
|
+
* service environment.
|
|
96
|
+
* @return Returns a promise fulfilled with the string, either `'development'` or `'production'`,
|
|
97
|
+
* based on the current APN environment.
|
|
98
|
+
* @platform ios
|
|
99
|
+
*/
|
|
17
100
|
export declare function getIosPushNotificationServiceEnvironmentAsync(): Promise<string>;
|
|
101
|
+
/**
|
|
102
|
+
* Gets the time the app was installed onto the device, not counting subsequent updates. If the app
|
|
103
|
+
* is uninstalled and reinstalled, this method returns the time the app was reinstalled.
|
|
104
|
+
* - On iOS, this method uses the [`NSFileCreationDate`](https://developer.apple.com/documentation/foundation/nsfilecreationdate?language=objc)
|
|
105
|
+
* of the app's document root directory.
|
|
106
|
+
* - On Android, this method uses [`PackageInfo.firstInstallTime`](https://developer.android.com/reference/android/content/pm/PackageInfo.html#firstInstallTime).
|
|
107
|
+
* - On web, this method returns `null`.
|
|
108
|
+
*
|
|
109
|
+
* @return Returns a `Promise` that fulfills with a `Date` object that specifies the time the app
|
|
110
|
+
* was installed on the device.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```ts
|
|
114
|
+
* await Application.getInstallationTimeAsync();
|
|
115
|
+
* // 2019-07-18T18:08:26.121Z
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
18
118
|
export declare function getInstallationTimeAsync(): Promise<Date>;
|
|
119
|
+
/**
|
|
120
|
+
* Gets the last time the app was updated from the Google Play Store.
|
|
121
|
+
* @return Returns a `Promise` that fulfills with a `Date` object that specifies the last time
|
|
122
|
+
* the app was updated via the Google Play Store).
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* await Application.getLastUpdateTimeAsync();
|
|
127
|
+
* // 2019-07-18T21:20:16.887Z
|
|
128
|
+
* ```
|
|
129
|
+
* @platform android
|
|
130
|
+
*/
|
|
19
131
|
export declare function getLastUpdateTimeAsync(): Promise<Date>;
|
package/build/Application.js
CHANGED
|
@@ -1,30 +1,109 @@
|
|
|
1
|
-
import { UnavailabilityError } from '
|
|
1
|
+
import { UnavailabilityError } from 'expo-modules-core';
|
|
2
2
|
import ExpoApplication from './ExpoApplication';
|
|
3
|
+
// @needsAudit
|
|
4
|
+
/**
|
|
5
|
+
* The human-readable version of the native application that may be displayed in the app store.
|
|
6
|
+
* This is the `Info.plist` value for `CFBundleShortVersionString` on iOS and the version name set
|
|
7
|
+
* by `version` in `app.json` on Android at the time the native app was built.
|
|
8
|
+
* On web, this value is `null`.
|
|
9
|
+
* @example `"2.11.0"`
|
|
10
|
+
*/
|
|
3
11
|
export const nativeApplicationVersion = ExpoApplication
|
|
4
12
|
? ExpoApplication.nativeApplicationVersion || null
|
|
5
13
|
: null;
|
|
14
|
+
// @needsAudit
|
|
15
|
+
/**
|
|
16
|
+
* The internal build version of the native application that the app store may use to distinguish
|
|
17
|
+
* between different binaries. This is the `Info.plist` value for `CFBundleVersion` on iOS (set with
|
|
18
|
+
* `ios.buildNumber` value in `app.json` in a standalone app) and the version code set by
|
|
19
|
+
* `android.versionCode` in `app.json` on Android at the time the native app was built. On web, this
|
|
20
|
+
* value is `null`. The return type on Android and iOS is `string`.
|
|
21
|
+
* @example iOS: `"2.11.0"`, Android: `"114"`
|
|
22
|
+
*/
|
|
6
23
|
export const nativeBuildVersion = ExpoApplication
|
|
7
24
|
? ExpoApplication.nativeBuildVersion || null
|
|
8
25
|
: null;
|
|
26
|
+
// @needsAudit
|
|
27
|
+
/**
|
|
28
|
+
* The human-readable name of the application that is displayed with the app's icon on the device's
|
|
29
|
+
* home screen or desktop. On Android and iOS, this value is a `string` unless the name could not be
|
|
30
|
+
* retrieved, in which case this value will be `null`. On web this value is `null`.
|
|
31
|
+
* @example `"Expo"`, `"Yelp"`, `"Instagram"`
|
|
32
|
+
*/
|
|
9
33
|
export const applicationName = ExpoApplication
|
|
10
34
|
? ExpoApplication.applicationName || null
|
|
11
35
|
: null;
|
|
36
|
+
// @needsAudit
|
|
37
|
+
/**
|
|
38
|
+
* The ID of the application. On Android, this is the application ID. On iOS, this is the bundle ID.
|
|
39
|
+
* On web, this is `null`.
|
|
40
|
+
* @example `"com.cocoacasts.scribbles"`, `"com.apple.Pages"`
|
|
41
|
+
*/
|
|
12
42
|
export const applicationId = ExpoApplication
|
|
13
43
|
? ExpoApplication.applicationId || null
|
|
14
44
|
: null;
|
|
45
|
+
// @needsAudit
|
|
46
|
+
/**
|
|
47
|
+
* The value of [`Settings.Secure.ANDROID_ID`](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).
|
|
48
|
+
* This is a hexadecimal `string` unique to each combination of app-signing key, user, and device.
|
|
49
|
+
* The value may change if a factory reset is performed on the device or if an APK signing key changes.
|
|
50
|
+
* For more information about how the platform handles `ANDROID_ID` in Android 8.0 (API level 26)
|
|
51
|
+
* and higher, see [Android 8.0 Behavior Changes](https://developer.android.com/about/versions/oreo/android-8.0-changes.html#privacy-all).
|
|
52
|
+
* On iOS and web, this value is `null`.
|
|
53
|
+
* > In versions of the platform lower than Android 8.0 (API level 26), this value remains constant
|
|
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
|
+
* > official docs for more information.
|
|
56
|
+
* @example `"dd96dec43fb81c97"`
|
|
57
|
+
* @platform android
|
|
58
|
+
*/
|
|
15
59
|
export const androidId = ExpoApplication ? ExpoApplication.androidId || null : null;
|
|
60
|
+
// @needsAudit
|
|
61
|
+
/**
|
|
62
|
+
* Gets the referrer URL of the installed app with the [`Install Referrer API`](https://developer.android.com/google/play/installreferrer)
|
|
63
|
+
* from the Google Play Store. In practice, the referrer URL may not be a complete, absolute URL.
|
|
64
|
+
* @return A `Promise` that fulfills with a `string` of the referrer URL of the installed app.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* await Application.getInstallReferrerAsync();
|
|
69
|
+
* // "utm_source=google-play&utm_medium=organic"
|
|
70
|
+
* ```
|
|
71
|
+
* @platform android
|
|
72
|
+
*/
|
|
16
73
|
export async function getInstallReferrerAsync() {
|
|
17
74
|
if (!ExpoApplication.getInstallReferrerAsync) {
|
|
18
75
|
throw new UnavailabilityError('expo-application', 'getInstallReferrerAsync');
|
|
19
76
|
}
|
|
20
77
|
return await ExpoApplication.getInstallReferrerAsync();
|
|
21
78
|
}
|
|
79
|
+
// @needsAudit
|
|
80
|
+
/**
|
|
81
|
+
* Gets the iOS "identifier for vendor" ([IDFV](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor))
|
|
82
|
+
* value, a string ID that uniquely identifies a device to the app’s vendor. This method may
|
|
83
|
+
* sometimes return `nil`, in which case wait and call the method again later. This might happen
|
|
84
|
+
* when the device has been restarted before the user has unlocked the device.
|
|
85
|
+
*
|
|
86
|
+
* The OS will change the vendor identifier if all apps from the current app's vendor have been
|
|
87
|
+
* uninstalled.
|
|
88
|
+
*
|
|
89
|
+
* @return A `Promise` that fulfills with a `string` specifying the app's vendor ID. Apps from the
|
|
90
|
+
* same vendor will return the same ID. See Apple's documentation for more information about the
|
|
91
|
+
* vendor ID's semantics.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* await Application.getIosIdForVendorAsync();
|
|
96
|
+
* // "68753A44-4D6F-1226-9C60-0050E4C00067"
|
|
97
|
+
* ```
|
|
98
|
+
* @platform ios
|
|
99
|
+
*/
|
|
22
100
|
export async function getIosIdForVendorAsync() {
|
|
23
101
|
if (!ExpoApplication.getIosIdForVendorAsync) {
|
|
24
102
|
throw new UnavailabilityError('expo-application', 'getIosIdForVendorAsync');
|
|
25
103
|
}
|
|
26
104
|
return (await ExpoApplication.getIosIdForVendorAsync()) ?? null;
|
|
27
105
|
}
|
|
106
|
+
// @docsMissing
|
|
28
107
|
export var ApplicationReleaseType;
|
|
29
108
|
(function (ApplicationReleaseType) {
|
|
30
109
|
ApplicationReleaseType[ApplicationReleaseType["UNKNOWN"] = 0] = "UNKNOWN";
|
|
@@ -34,18 +113,50 @@ export var ApplicationReleaseType;
|
|
|
34
113
|
ApplicationReleaseType[ApplicationReleaseType["AD_HOC"] = 4] = "AD_HOC";
|
|
35
114
|
ApplicationReleaseType[ApplicationReleaseType["APP_STORE"] = 5] = "APP_STORE";
|
|
36
115
|
})(ApplicationReleaseType || (ApplicationReleaseType = {}));
|
|
116
|
+
// @needsAudit
|
|
117
|
+
/**
|
|
118
|
+
* Gets the iOS application release type.
|
|
119
|
+
* @return Returns a promise which fulfills with an [`ApplicationReleaseType`](#applicationreleasetype).
|
|
120
|
+
* @platform ios
|
|
121
|
+
*/
|
|
37
122
|
export async function getIosApplicationReleaseTypeAsync() {
|
|
38
123
|
if (!ExpoApplication.getApplicationReleaseTypeAsync) {
|
|
39
124
|
throw new UnavailabilityError('expo-application', 'getApplicationReleaseTypeAsync');
|
|
40
125
|
}
|
|
41
126
|
return await ExpoApplication.getApplicationReleaseTypeAsync();
|
|
42
127
|
}
|
|
128
|
+
// @needsAudit
|
|
129
|
+
/**
|
|
130
|
+
* Gets the current [Apple Push Notification (APN)](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment?language=objc)
|
|
131
|
+
* service environment.
|
|
132
|
+
* @return Returns a promise fulfilled with the string, either `'development'` or `'production'`,
|
|
133
|
+
* based on the current APN environment.
|
|
134
|
+
* @platform ios
|
|
135
|
+
*/
|
|
43
136
|
export async function getIosPushNotificationServiceEnvironmentAsync() {
|
|
44
137
|
if (!ExpoApplication.getPushNotificationServiceEnvironmentAsync) {
|
|
45
138
|
throw new UnavailabilityError('expo-application', 'getPushNotificationServiceEnvironmentAsync');
|
|
46
139
|
}
|
|
47
140
|
return await ExpoApplication.getPushNotificationServiceEnvironmentAsync();
|
|
48
141
|
}
|
|
142
|
+
// @needsAudit
|
|
143
|
+
/**
|
|
144
|
+
* Gets the time the app was installed onto the device, not counting subsequent updates. If the app
|
|
145
|
+
* is uninstalled and reinstalled, this method returns the time the app was reinstalled.
|
|
146
|
+
* - On iOS, this method uses the [`NSFileCreationDate`](https://developer.apple.com/documentation/foundation/nsfilecreationdate?language=objc)
|
|
147
|
+
* of the app's document root directory.
|
|
148
|
+
* - On Android, this method uses [`PackageInfo.firstInstallTime`](https://developer.android.com/reference/android/content/pm/PackageInfo.html#firstInstallTime).
|
|
149
|
+
* - On web, this method returns `null`.
|
|
150
|
+
*
|
|
151
|
+
* @return Returns a `Promise` that fulfills with a `Date` object that specifies the time the app
|
|
152
|
+
* was installed on the device.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```ts
|
|
156
|
+
* await Application.getInstallationTimeAsync();
|
|
157
|
+
* // 2019-07-18T18:08:26.121Z
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
49
160
|
export async function getInstallationTimeAsync() {
|
|
50
161
|
if (!ExpoApplication.getInstallationTimeAsync) {
|
|
51
162
|
throw new UnavailabilityError('expo-application', 'getInstallationTimeAsync');
|
|
@@ -53,6 +164,19 @@ export async function getInstallationTimeAsync() {
|
|
|
53
164
|
const installationTime = await ExpoApplication.getInstallationTimeAsync();
|
|
54
165
|
return new Date(installationTime);
|
|
55
166
|
}
|
|
167
|
+
// @needsAudit
|
|
168
|
+
/**
|
|
169
|
+
* Gets the last time the app was updated from the Google Play Store.
|
|
170
|
+
* @return Returns a `Promise` that fulfills with a `Date` object that specifies the last time
|
|
171
|
+
* the app was updated via the Google Play Store).
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```ts
|
|
175
|
+
* await Application.getLastUpdateTimeAsync();
|
|
176
|
+
* // 2019-07-18T21:20:16.887Z
|
|
177
|
+
* ```
|
|
178
|
+
* @platform android
|
|
179
|
+
*/
|
|
56
180
|
export async function getLastUpdateTimeAsync() {
|
|
57
181
|
if (!ExpoApplication.getLastUpdateTimeAsync) {
|
|
58
182
|
throw new UnavailabilityError('expo-application', '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\nexport const nativeApplicationVersion: string | null = ExpoApplication\n ? ExpoApplication.nativeApplicationVersion || null\n : null;\nexport const nativeBuildVersion: string | null = ExpoApplication\n ? ExpoApplication.nativeBuildVersion || null\n : null;\nexport const applicationName: string | null = ExpoApplication\n ? ExpoApplication.applicationName || null\n : null;\nexport const applicationId: string | null = ExpoApplication\n ? ExpoApplication.applicationId || null\n : null;\nexport const androidId: string | null = ExpoApplication ? ExpoApplication.androidId || null : null;\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\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\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\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\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\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\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":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,cAAc;AACd;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAkB,eAAe;IACpE,CAAC,CAAC,eAAe,CAAC,wBAAwB,IAAI,IAAI;IAClD,CAAC,CAAC,IAAI,CAAC;AAET,cAAc;AACd;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAkB,eAAe;IAC9D,CAAC,CAAC,eAAe,CAAC,kBAAkB,IAAI,IAAI;IAC5C,CAAC,CAAC,IAAI,CAAC;AAET,cAAc;AACd;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAkB,eAAe;IAC3D,CAAC,CAAC,eAAe,CAAC,eAAe,IAAI,IAAI;IACzC,CAAC,CAAC,IAAI,CAAC;AAET,cAAc;AACd;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAkB,eAAe;IACzD,CAAC,CAAC,eAAe,CAAC,aAAa,IAAI,IAAI;IACvC,CAAC,CAAC,IAAI,CAAC;AAET,cAAc;AACd;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,SAAS,GAAkB,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAEnG,cAAc;AACd;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAC3C,IAAI,CAAC,eAAe,CAAC,uBAAuB,EAAE;QAC5C,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,EAAE,yBAAyB,CAAC,CAAC;KAC9E;IACD,OAAO,MAAM,eAAe,CAAC,uBAAuB,EAAE,CAAC;AACzD,CAAC;AAED,cAAc;AACd;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAC1C,IAAI,CAAC,eAAe,CAAC,sBAAsB,EAAE;QAC3C,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,EAAE,wBAAwB,CAAC,CAAC;KAC7E;IACD,OAAO,CAAC,MAAM,eAAe,CAAC,sBAAsB,EAAE,CAAC,IAAI,IAAI,CAAC;AAClE,CAAC;AAED,eAAe;AACf,MAAM,CAAN,IAAY,sBAOX;AAPD,WAAY,sBAAsB;IAChC,yEAAW,CAAA;IACX,6EAAa,CAAA;IACb,+EAAc,CAAA;IACd,iFAAe,CAAA;IACf,uEAAU,CAAA;IACV,6EAAa,CAAA;AACf,CAAC,EAPW,sBAAsB,KAAtB,sBAAsB,QAOjC;AAED,cAAc;AACd;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,iCAAiC;IACrD,IAAI,CAAC,eAAe,CAAC,8BAA8B,EAAE;QACnD,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,EAAE,gCAAgC,CAAC,CAAC;KACrF;IACD,OAAO,MAAM,eAAe,CAAC,8BAA8B,EAAE,CAAC;AAChE,CAAC;AAED,cAAc;AACd;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,6CAA6C;IACjE,IAAI,CAAC,eAAe,CAAC,0CAA0C,EAAE;QAC/D,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,EAAE,4CAA4C,CAAC,CAAC;KACjG;IACD,OAAO,MAAM,eAAe,CAAC,0CAA0C,EAAE,CAAC;AAC5E,CAAC;AAED,cAAc;AACd;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB;IAC5C,IAAI,CAAC,eAAe,CAAC,wBAAwB,EAAE;QAC7C,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,EAAE,0BAA0B,CAAC,CAAC;KAC/E;IACD,MAAM,gBAAgB,GAAG,MAAM,eAAe,CAAC,wBAAwB,EAAE,CAAC;IAC1E,OAAO,IAAI,IAAI,CAAC,gBAAgB,CAAC,CAAC;AACpC,CAAC;AAED,cAAc;AACd;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAC1C,IAAI,CAAC,eAAe,CAAC,sBAAsB,EAAE;QAC3C,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,EAAE,wBAAwB,CAAC,CAAC;KAC7E;IACD,MAAM,cAAc,GAAG,MAAM,eAAe,CAAC,sBAAsB,EAAE,CAAC;IACtE,OAAO,IAAI,IAAI,CAAC,cAAc,CAAC,CAAC;AAClC,CAAC","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.1",
|
|
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": "9faa58818454ba59dbff95077b9025a1c1cbd9fd"
|
|
36
40
|
}
|
package/src/Application.ts
CHANGED
|
@@ -1,21 +1,82 @@
|
|
|
1
|
-
import { UnavailabilityError } from '
|
|
1
|
+
import { UnavailabilityError } from 'expo-modules-core';
|
|
2
2
|
|
|
3
3
|
import ExpoApplication from './ExpoApplication';
|
|
4
4
|
|
|
5
|
+
// @needsAudit
|
|
6
|
+
/**
|
|
7
|
+
* The human-readable version of the native application that may be displayed in the app store.
|
|
8
|
+
* This is the `Info.plist` value for `CFBundleShortVersionString` on iOS and the version name set
|
|
9
|
+
* by `version` in `app.json` on Android at the time the native app was built.
|
|
10
|
+
* On web, this value is `null`.
|
|
11
|
+
* @example `"2.11.0"`
|
|
12
|
+
*/
|
|
5
13
|
export const nativeApplicationVersion: string | null = ExpoApplication
|
|
6
14
|
? ExpoApplication.nativeApplicationVersion || null
|
|
7
15
|
: null;
|
|
16
|
+
|
|
17
|
+
// @needsAudit
|
|
18
|
+
/**
|
|
19
|
+
* The internal build version of the native application that the app store may use to distinguish
|
|
20
|
+
* between different binaries. This is the `Info.plist` value for `CFBundleVersion` on iOS (set with
|
|
21
|
+
* `ios.buildNumber` value in `app.json` in a standalone app) and the version code set by
|
|
22
|
+
* `android.versionCode` in `app.json` on Android at the time the native app was built. On web, this
|
|
23
|
+
* value is `null`. The return type on Android and iOS is `string`.
|
|
24
|
+
* @example iOS: `"2.11.0"`, Android: `"114"`
|
|
25
|
+
*/
|
|
8
26
|
export const nativeBuildVersion: string | null = ExpoApplication
|
|
9
27
|
? ExpoApplication.nativeBuildVersion || null
|
|
10
28
|
: null;
|
|
29
|
+
|
|
30
|
+
// @needsAudit
|
|
31
|
+
/**
|
|
32
|
+
* The human-readable name of the application that is displayed with the app's icon on the device's
|
|
33
|
+
* home screen or desktop. On Android and iOS, this value is a `string` unless the name could not be
|
|
34
|
+
* retrieved, in which case this value will be `null`. On web this value is `null`.
|
|
35
|
+
* @example `"Expo"`, `"Yelp"`, `"Instagram"`
|
|
36
|
+
*/
|
|
11
37
|
export const applicationName: string | null = ExpoApplication
|
|
12
38
|
? ExpoApplication.applicationName || null
|
|
13
39
|
: null;
|
|
40
|
+
|
|
41
|
+
// @needsAudit
|
|
42
|
+
/**
|
|
43
|
+
* The ID of the application. On Android, this is the application ID. On iOS, this is the bundle ID.
|
|
44
|
+
* On web, this is `null`.
|
|
45
|
+
* @example `"com.cocoacasts.scribbles"`, `"com.apple.Pages"`
|
|
46
|
+
*/
|
|
14
47
|
export const applicationId: string | null = ExpoApplication
|
|
15
48
|
? ExpoApplication.applicationId || null
|
|
16
49
|
: null;
|
|
50
|
+
|
|
51
|
+
// @needsAudit
|
|
52
|
+
/**
|
|
53
|
+
* The value of [`Settings.Secure.ANDROID_ID`](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).
|
|
54
|
+
* This is a hexadecimal `string` unique to each combination of app-signing key, user, and device.
|
|
55
|
+
* The value may change if a factory reset is performed on the device or if an APK signing key changes.
|
|
56
|
+
* For more information about how the platform handles `ANDROID_ID` in Android 8.0 (API level 26)
|
|
57
|
+
* and higher, see [Android 8.0 Behavior Changes](https://developer.android.com/about/versions/oreo/android-8.0-changes.html#privacy-all).
|
|
58
|
+
* On iOS and web, this value is `null`.
|
|
59
|
+
* > In versions of the platform lower than Android 8.0 (API level 26), this value remains constant
|
|
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
|
+
* > official docs for more information.
|
|
62
|
+
* @example `"dd96dec43fb81c97"`
|
|
63
|
+
* @platform android
|
|
64
|
+
*/
|
|
17
65
|
export const androidId: string | null = ExpoApplication ? ExpoApplication.androidId || null : null;
|
|
18
66
|
|
|
67
|
+
// @needsAudit
|
|
68
|
+
/**
|
|
69
|
+
* Gets the referrer URL of the installed app with the [`Install Referrer API`](https://developer.android.com/google/play/installreferrer)
|
|
70
|
+
* from the Google Play Store. In practice, the referrer URL may not be a complete, absolute URL.
|
|
71
|
+
* @return A `Promise` that fulfills with a `string` of the referrer URL of the installed app.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* await Application.getInstallReferrerAsync();
|
|
76
|
+
* // "utm_source=google-play&utm_medium=organic"
|
|
77
|
+
* ```
|
|
78
|
+
* @platform android
|
|
79
|
+
*/
|
|
19
80
|
export async function getInstallReferrerAsync(): Promise<string> {
|
|
20
81
|
if (!ExpoApplication.getInstallReferrerAsync) {
|
|
21
82
|
throw new UnavailabilityError('expo-application', 'getInstallReferrerAsync');
|
|
@@ -23,6 +84,27 @@ export async function getInstallReferrerAsync(): Promise<string> {
|
|
|
23
84
|
return await ExpoApplication.getInstallReferrerAsync();
|
|
24
85
|
}
|
|
25
86
|
|
|
87
|
+
// @needsAudit
|
|
88
|
+
/**
|
|
89
|
+
* Gets the iOS "identifier for vendor" ([IDFV](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor))
|
|
90
|
+
* value, a string ID that uniquely identifies a device to the app’s vendor. This method may
|
|
91
|
+
* sometimes return `nil`, in which case wait and call the method again later. This might happen
|
|
92
|
+
* when the device has been restarted before the user has unlocked the device.
|
|
93
|
+
*
|
|
94
|
+
* The OS will change the vendor identifier if all apps from the current app's vendor have been
|
|
95
|
+
* uninstalled.
|
|
96
|
+
*
|
|
97
|
+
* @return A `Promise` that fulfills with a `string` specifying the app's vendor ID. Apps from the
|
|
98
|
+
* same vendor will return the same ID. See Apple's documentation for more information about the
|
|
99
|
+
* vendor ID's semantics.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* await Application.getIosIdForVendorAsync();
|
|
104
|
+
* // "68753A44-4D6F-1226-9C60-0050E4C00067"
|
|
105
|
+
* ```
|
|
106
|
+
* @platform ios
|
|
107
|
+
*/
|
|
26
108
|
export async function getIosIdForVendorAsync(): Promise<string | null> {
|
|
27
109
|
if (!ExpoApplication.getIosIdForVendorAsync) {
|
|
28
110
|
throw new UnavailabilityError('expo-application', 'getIosIdForVendorAsync');
|
|
@@ -30,6 +112,7 @@ export async function getIosIdForVendorAsync(): Promise<string | null> {
|
|
|
30
112
|
return (await ExpoApplication.getIosIdForVendorAsync()) ?? null;
|
|
31
113
|
}
|
|
32
114
|
|
|
115
|
+
// @docsMissing
|
|
33
116
|
export enum ApplicationReleaseType {
|
|
34
117
|
UNKNOWN = 0,
|
|
35
118
|
SIMULATOR = 1,
|
|
@@ -39,6 +122,12 @@ export enum ApplicationReleaseType {
|
|
|
39
122
|
APP_STORE = 5,
|
|
40
123
|
}
|
|
41
124
|
|
|
125
|
+
// @needsAudit
|
|
126
|
+
/**
|
|
127
|
+
* Gets the iOS application release type.
|
|
128
|
+
* @return Returns a promise which fulfills with an [`ApplicationReleaseType`](#applicationreleasetype).
|
|
129
|
+
* @platform ios
|
|
130
|
+
*/
|
|
42
131
|
export async function getIosApplicationReleaseTypeAsync(): Promise<ApplicationReleaseType> {
|
|
43
132
|
if (!ExpoApplication.getApplicationReleaseTypeAsync) {
|
|
44
133
|
throw new UnavailabilityError('expo-application', 'getApplicationReleaseTypeAsync');
|
|
@@ -46,6 +135,14 @@ export async function getIosApplicationReleaseTypeAsync(): Promise<ApplicationRe
|
|
|
46
135
|
return await ExpoApplication.getApplicationReleaseTypeAsync();
|
|
47
136
|
}
|
|
48
137
|
|
|
138
|
+
// @needsAudit
|
|
139
|
+
/**
|
|
140
|
+
* Gets the current [Apple Push Notification (APN)](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment?language=objc)
|
|
141
|
+
* service environment.
|
|
142
|
+
* @return Returns a promise fulfilled with the string, either `'development'` or `'production'`,
|
|
143
|
+
* based on the current APN environment.
|
|
144
|
+
* @platform ios
|
|
145
|
+
*/
|
|
49
146
|
export async function getIosPushNotificationServiceEnvironmentAsync(): Promise<string> {
|
|
50
147
|
if (!ExpoApplication.getPushNotificationServiceEnvironmentAsync) {
|
|
51
148
|
throw new UnavailabilityError('expo-application', 'getPushNotificationServiceEnvironmentAsync');
|
|
@@ -53,6 +150,24 @@ export async function getIosPushNotificationServiceEnvironmentAsync(): Promise<s
|
|
|
53
150
|
return await ExpoApplication.getPushNotificationServiceEnvironmentAsync();
|
|
54
151
|
}
|
|
55
152
|
|
|
153
|
+
// @needsAudit
|
|
154
|
+
/**
|
|
155
|
+
* Gets the time the app was installed onto the device, not counting subsequent updates. If the app
|
|
156
|
+
* is uninstalled and reinstalled, this method returns the time the app was reinstalled.
|
|
157
|
+
* - On iOS, this method uses the [`NSFileCreationDate`](https://developer.apple.com/documentation/foundation/nsfilecreationdate?language=objc)
|
|
158
|
+
* of the app's document root directory.
|
|
159
|
+
* - On Android, this method uses [`PackageInfo.firstInstallTime`](https://developer.android.com/reference/android/content/pm/PackageInfo.html#firstInstallTime).
|
|
160
|
+
* - On web, this method returns `null`.
|
|
161
|
+
*
|
|
162
|
+
* @return Returns a `Promise` that fulfills with a `Date` object that specifies the time the app
|
|
163
|
+
* was installed on the device.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```ts
|
|
167
|
+
* await Application.getInstallationTimeAsync();
|
|
168
|
+
* // 2019-07-18T18:08:26.121Z
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
56
171
|
export async function getInstallationTimeAsync(): Promise<Date> {
|
|
57
172
|
if (!ExpoApplication.getInstallationTimeAsync) {
|
|
58
173
|
throw new UnavailabilityError('expo-application', 'getInstallationTimeAsync');
|
|
@@ -61,6 +176,19 @@ export async function getInstallationTimeAsync(): Promise<Date> {
|
|
|
61
176
|
return new Date(installationTime);
|
|
62
177
|
}
|
|
63
178
|
|
|
179
|
+
// @needsAudit
|
|
180
|
+
/**
|
|
181
|
+
* Gets the last time the app was updated from the Google Play Store.
|
|
182
|
+
* @return Returns a `Promise` that fulfills with a `Date` object that specifies the last time
|
|
183
|
+
* the app was updated via the Google Play Store).
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```ts
|
|
187
|
+
* await Application.getLastUpdateTimeAsync();
|
|
188
|
+
* // 2019-07-18T21:20:16.887Z
|
|
189
|
+
* ```
|
|
190
|
+
* @platform android
|
|
191
|
+
*/
|
|
64
192
|
export async function getLastUpdateTimeAsync(): Promise<Date> {
|
|
65
193
|
if (!ExpoApplication.getLastUpdateTimeAsync) {
|
|
66
194
|
throw new UnavailabilityError('expo-application', '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
|
-
|