expo-application 5.4.0 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/android/build.gradle +48 -29
- package/android/src/main/java/expo/modules/application/ApplicationModule.kt +100 -108
- package/build/Application.d.ts +5 -12
- package/build/Application.d.ts.map +1 -1
- package/build/Application.js +12 -15
- package/build/Application.js.map +1 -1
- package/build/Application.types.d.ts +12 -0
- package/build/Application.types.d.ts.map +1 -1
- package/build/Application.types.js +10 -0
- package/build/Application.types.js.map +1 -1
- package/build/ExpoApplication.d.ts +1 -1
- package/build/ExpoApplication.d.ts.map +1 -1
- package/build/ExpoApplication.js +2 -2
- package/build/ExpoApplication.js.map +1 -1
- package/expo-module.config.json +10 -0
- package/ios/ApplicationExceptions.swift +19 -0
- package/ios/ApplicationModule.swift +48 -0
- package/ios/ApplicationModuleProvisioningProfile.swift +75 -0
- package/ios/{EXApplication.podspec → ExpoApplication.podspec} +10 -3
- package/package.json +2 -2
- package/src/Application.ts +13 -18
- package/src/Application.types.ts +14 -0
- package/src/ExpoApplication.ts +3 -2
- package/android/src/main/java/expo/modules/application/ApplicationPackage.kt +0 -11
- package/ios/EXApplication/EXApplication.h +0 -8
- package/ios/EXApplication/EXApplication.m +0 -57
- package/ios/EXApplication/EXProvisioningProfile.h +0 -22
- package/ios/EXApplication/EXProvisioningProfile.m +0 -134
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,24 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 5.6.0 — 2023-10-17
|
|
14
|
+
|
|
15
|
+
### 🛠 Breaking changes
|
|
16
|
+
|
|
17
|
+
- Dropped support for Android SDK 21 and 22. ([#24201](https://github.com/expo/expo/pull/24201) by [@behenate](https://github.com/behenate))
|
|
18
|
+
- Removed `androidId` constant in favor of a method (`getAndroidId`) to comply with Huawei and Xiaomi's app store policies. ([#22585](https://github.com/expo/expo/pull/22585) by [@fobos531](https://github.com/fobos531))
|
|
19
|
+
|
|
20
|
+
### 🎉 New features
|
|
21
|
+
|
|
22
|
+
- Migrate iOS module to Expo modules API. ([#24871](https://github.com/expo/expo/pull/24871) by [@reichhartd](https://github.com/reichhartd))
|
|
23
|
+
- Android module is now written using the Sweet API. ([#22395](https://github.com/expo/expo/pull/22585) by [@fobos531](https://github.com/fobos531))
|
|
24
|
+
|
|
25
|
+
## 5.5.0 — 2023-09-15
|
|
26
|
+
|
|
27
|
+
### 🎉 New features
|
|
28
|
+
|
|
29
|
+
- Added support for Apple tvOS. ([#24329](https://github.com/expo/expo/pull/24329) by [@douglowder](https://github.com/douglowder))
|
|
30
|
+
|
|
13
31
|
## 5.4.0 — 2023-09-04
|
|
14
32
|
|
|
15
33
|
### 🎉 New features
|
package/android/build.gradle
CHANGED
|
@@ -3,15 +3,20 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven-publish'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '5.
|
|
6
|
+
version = '5.6.0'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
9
|
+
if (expoModulesCorePlugin.exists()) {
|
|
10
|
+
apply from: expoModulesCorePlugin
|
|
11
|
+
applyKotlinExpoModulesCorePlugin()
|
|
12
|
+
// Remove this check, but keep the contents after SDK49 support is dropped
|
|
13
|
+
if (safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
14
|
+
useExpoPublishing()
|
|
15
|
+
useCoreDependencies()
|
|
13
16
|
}
|
|
17
|
+
}
|
|
14
18
|
|
|
19
|
+
buildscript {
|
|
15
20
|
// Simple helper that allows the root project to override versions declared by this library.
|
|
16
21
|
ext.safeExtGet = { prop, fallback ->
|
|
17
22
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
@@ -35,23 +40,44 @@ buildscript {
|
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
44
|
+
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
45
|
+
afterEvaluate {
|
|
46
|
+
publishing {
|
|
47
|
+
publications {
|
|
48
|
+
release(MavenPublication) {
|
|
49
|
+
from components.release
|
|
50
|
+
}
|
|
43
51
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
52
|
+
repositories {
|
|
53
|
+
maven {
|
|
54
|
+
url = mavenLocal().url
|
|
55
|
+
}
|
|
48
56
|
}
|
|
49
57
|
}
|
|
50
58
|
}
|
|
51
59
|
}
|
|
52
60
|
|
|
53
61
|
android {
|
|
54
|
-
|
|
62
|
+
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
63
|
+
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
64
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 33)
|
|
65
|
+
|
|
66
|
+
defaultConfig {
|
|
67
|
+
minSdkVersion safeExtGet("minSdkVersion", 23)
|
|
68
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
publishing {
|
|
72
|
+
singleVariant("release") {
|
|
73
|
+
withSourcesJar()
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
lintOptions {
|
|
78
|
+
abortOnError false
|
|
79
|
+
}
|
|
80
|
+
}
|
|
55
81
|
|
|
56
82
|
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
57
83
|
if (agpVersion.tokenize('.')[0].toInteger() < 8) {
|
|
@@ -67,26 +93,19 @@ android {
|
|
|
67
93
|
|
|
68
94
|
namespace "expo.modules.application"
|
|
69
95
|
defaultConfig {
|
|
70
|
-
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
71
|
-
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
72
96
|
versionCode 12
|
|
73
|
-
versionName '5.
|
|
74
|
-
}
|
|
75
|
-
lintOptions {
|
|
76
|
-
abortOnError false
|
|
77
|
-
}
|
|
78
|
-
publishing {
|
|
79
|
-
singleVariant("release") {
|
|
80
|
-
withSourcesJar()
|
|
81
|
-
}
|
|
97
|
+
versionName '5.6.0'
|
|
82
98
|
}
|
|
83
99
|
}
|
|
84
100
|
|
|
85
101
|
dependencies {
|
|
86
|
-
|
|
102
|
+
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
103
|
+
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
104
|
+
implementation project(':expo-modules-core')
|
|
105
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
106
|
+
}
|
|
87
107
|
|
|
88
108
|
implementation 'com.android.installreferrer:installreferrer:1.0'
|
|
89
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
90
109
|
|
|
91
110
|
if (project.findProject(':expo-modules-test-core')) {
|
|
92
111
|
testImplementation project(':expo-modules-test-core')
|
|
@@ -1,133 +1,125 @@
|
|
|
1
1
|
package expo.modules.application
|
|
2
2
|
|
|
3
|
-
import android.app.Activity
|
|
4
3
|
import android.content.Context
|
|
5
4
|
import android.content.pm.PackageInfo
|
|
6
|
-
import android.content.pm.PackageManager
|
|
5
|
+
import android.content.pm.PackageManager
|
|
7
6
|
import android.os.Build
|
|
8
7
|
import android.os.RemoteException
|
|
9
8
|
import android.provider.Settings
|
|
10
|
-
import android.util.Log
|
|
11
|
-
|
|
12
9
|
import com.android.installreferrer.api.InstallReferrerClient
|
|
13
10
|
import com.android.installreferrer.api.InstallReferrerStateListener
|
|
14
|
-
|
|
15
|
-
import expo.modules.
|
|
16
|
-
import expo.modules.
|
|
17
|
-
import expo.modules.
|
|
18
|
-
import expo.modules.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
private
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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)
|
|
11
|
+
import expo.modules.kotlin.Promise
|
|
12
|
+
import expo.modules.kotlin.exception.CodedException
|
|
13
|
+
import expo.modules.kotlin.exception.Exceptions
|
|
14
|
+
import expo.modules.kotlin.modules.Module
|
|
15
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
16
|
+
|
|
17
|
+
class ApplicationPackageNameNotFoundException(cause: PackageManager.NameNotFoundException) :
|
|
18
|
+
CodedException(message = "Unable to get install time of this application. Could not get package info or package name.", cause = cause)
|
|
19
|
+
|
|
20
|
+
class ApplicationModule : Module() {
|
|
21
|
+
private val context: Context
|
|
22
|
+
get() = appContext.reactContext ?: throw Exceptions.ReactContextLost()
|
|
23
|
+
|
|
24
|
+
override fun definition() = ModuleDefinition {
|
|
25
|
+
Name("ExpoApplication")
|
|
26
|
+
|
|
27
|
+
Constants {
|
|
28
|
+
return@Constants mapOf(
|
|
29
|
+
"applicationName" to applicationName,
|
|
30
|
+
"applicationId" to packageName,
|
|
31
|
+
"nativeApplicationVersion" to versionName,
|
|
32
|
+
"nativeBuildVersion" to versionCode.toString(),
|
|
33
|
+
)
|
|
58
34
|
}
|
|
59
35
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
36
|
+
Property("androidId") {
|
|
37
|
+
Settings.Secure.getString(context.contentResolver, Settings.Secure.ANDROID_ID)
|
|
38
|
+
}
|
|
64
39
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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)
|
|
40
|
+
AsyncFunction("getInstallationTimeAsync") {
|
|
41
|
+
val packageManager = context.packageManager
|
|
42
|
+
val packageName = context.packageName
|
|
43
|
+
packageManager
|
|
44
|
+
.getPackageInfoCompat(packageName, 0)
|
|
45
|
+
.firstInstallTime
|
|
46
|
+
.toDouble()
|
|
75
47
|
}
|
|
76
|
-
}
|
|
77
48
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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)
|
|
49
|
+
AsyncFunction("getLastUpdateTimeAsync") {
|
|
50
|
+
val packageManager = context.packageManager
|
|
51
|
+
val packageName = context.packageName
|
|
52
|
+
packageManager
|
|
53
|
+
.getPackageInfoCompat(packageName, 0)
|
|
54
|
+
.lastUpdateTime
|
|
55
|
+
.toDouble()
|
|
88
56
|
}
|
|
89
|
-
}
|
|
90
57
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
58
|
+
AsyncFunction("getInstallReferrerAsync") { promise: Promise ->
|
|
59
|
+
val installReferrer = StringBuilder()
|
|
60
|
+
|
|
61
|
+
val referrerClient = InstallReferrerClient.newBuilder(context).build()
|
|
62
|
+
|
|
63
|
+
referrerClient.startConnection(object : InstallReferrerStateListener {
|
|
64
|
+
override fun onInstallReferrerSetupFinished(responseCode: Int) {
|
|
65
|
+
when (responseCode) {
|
|
66
|
+
InstallReferrerClient.InstallReferrerResponse.OK -> {
|
|
67
|
+
// Connection established and response received
|
|
68
|
+
try {
|
|
69
|
+
val response = referrerClient.installReferrer
|
|
70
|
+
installReferrer.append(response.installReferrer)
|
|
71
|
+
} catch (e: RemoteException) {
|
|
72
|
+
promise.reject("ERR_APPLICATION_INSTALL_REFERRER_REMOTE_EXCEPTION", "RemoteException getting install referrer information. This may happen if the process hosting the remote object is no longer available.", e)
|
|
73
|
+
return
|
|
74
|
+
}
|
|
75
|
+
promise.resolve(installReferrer.toString())
|
|
106
76
|
}
|
|
107
|
-
|
|
77
|
+
|
|
78
|
+
InstallReferrerClient.InstallReferrerResponse.FEATURE_NOT_SUPPORTED -> // API not available in the current Play Store app
|
|
79
|
+
promise.reject("ERR_APPLICATION_INSTALL_REFERRER_UNAVAILABLE", "The current Play Store app doesn't provide the installation referrer API, or the Play Store may not be installed.", null)
|
|
80
|
+
|
|
81
|
+
InstallReferrerClient.InstallReferrerResponse.SERVICE_UNAVAILABLE -> // Connection could not be established
|
|
82
|
+
promise.reject("ERR_APPLICATION_INSTALL_REFERRER", "General error retrieving the install referrer: response code $responseCode", null)
|
|
83
|
+
|
|
84
|
+
else -> promise.reject("ERR_APPLICATION_INSTALL_REFERRER", "General error retrieving the install referrer: response code $responseCode", null)
|
|
108
85
|
}
|
|
109
|
-
|
|
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")
|
|
86
|
+
referrerClient.endConnection()
|
|
114
87
|
}
|
|
115
|
-
referrerClient.endConnection()
|
|
116
|
-
}
|
|
117
88
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
89
|
+
override fun onInstallReferrerServiceDisconnected() {
|
|
90
|
+
promise.reject("ERR_APPLICATION_INSTALL_REFERRER_SERVICE_DISCONNECTED", "Connection to install referrer service was lost.", null)
|
|
91
|
+
}
|
|
92
|
+
})
|
|
93
|
+
}
|
|
122
94
|
}
|
|
123
95
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
96
|
+
private val applicationName
|
|
97
|
+
get() = context.applicationInfo.loadLabel(context.packageManager).toString()
|
|
98
|
+
private val packageName
|
|
99
|
+
get() = context.packageName
|
|
100
|
+
private val packageManager
|
|
101
|
+
get() = context.packageManager
|
|
102
|
+
private val versionName
|
|
103
|
+
get() = packageManager.getPackageInfoCompat(packageName, 0).versionName
|
|
104
|
+
private val versionCode
|
|
105
|
+
get() = getLongVersionCode(packageManager.getPackageInfoCompat(packageName, 0)).toInt()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
private fun PackageManager.getPackageInfoCompat(packageName: String, flags: Int = 0): PackageInfo =
|
|
109
|
+
try {
|
|
110
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
111
|
+
getPackageInfo(packageName, PackageManager.PackageInfoFlags.of(flags.toLong()))
|
|
112
|
+
} else {
|
|
113
|
+
@Suppress("DEPRECATION") getPackageInfo(packageName, flags)
|
|
131
114
|
}
|
|
115
|
+
} catch (e: PackageManager.NameNotFoundException) {
|
|
116
|
+
throw ApplicationPackageNameNotFoundException(e)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private fun getLongVersionCode(info: PackageInfo): Long {
|
|
120
|
+
return if (Build.VERSION.SDK_INT >= 28) {
|
|
121
|
+
info.longVersionCode
|
|
122
|
+
} else {
|
|
123
|
+
@Suppress("DEPRECATION") info.versionCode.toLong()
|
|
132
124
|
}
|
|
133
125
|
}
|
package/build/Application.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ApplicationReleaseType, PushNotificationServiceEnvironment } from './Application.types';
|
|
1
2
|
/**
|
|
2
3
|
* The human-readable version of the native application that may be displayed in the app store.
|
|
3
4
|
* This is the `Info.plist` value for `CFBundleShortVersionString` on iOS and the version name set
|
|
@@ -29,19 +30,19 @@ export declare const applicationName: string | null;
|
|
|
29
30
|
*/
|
|
30
31
|
export declare const applicationId: string | null;
|
|
31
32
|
/**
|
|
32
|
-
*
|
|
33
|
+
* Gets the value of [`Settings.Secure.ANDROID_ID`](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).
|
|
33
34
|
* This is a hexadecimal `string` unique to each combination of app-signing key, user, and device.
|
|
34
35
|
* The value may change if a factory reset is performed on the device or if an APK signing key changes.
|
|
35
36
|
* For more information about how the platform handles `ANDROID_ID` in Android 8.0 (API level 26)
|
|
36
37
|
* 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
|
|
38
|
+
* On iOS and web, this function is unavailable.
|
|
38
39
|
* > In versions of the platform lower than Android 8.0 (API level 26), this value remains constant
|
|
39
40
|
* > 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
41
|
* > official docs for more information.
|
|
41
42
|
* @example `"dd96dec43fb81c97"`
|
|
42
43
|
* @platform android
|
|
43
44
|
*/
|
|
44
|
-
export declare
|
|
45
|
+
export declare function getAndroidId(): string;
|
|
45
46
|
/**
|
|
46
47
|
* Gets the referrer URL of the installed app with the [`Install Referrer API`](https://developer.android.com/google/play/installreferrer)
|
|
47
48
|
* from the Google Play Store. In practice, the referrer URL may not be a complete, absolute URL.
|
|
@@ -76,21 +77,12 @@ export declare function getInstallReferrerAsync(): Promise<string>;
|
|
|
76
77
|
* @platform ios
|
|
77
78
|
*/
|
|
78
79
|
export declare function getIosIdForVendorAsync(): Promise<string | null>;
|
|
79
|
-
export declare enum ApplicationReleaseType {
|
|
80
|
-
UNKNOWN = 0,
|
|
81
|
-
SIMULATOR = 1,
|
|
82
|
-
ENTERPRISE = 2,
|
|
83
|
-
DEVELOPMENT = 3,
|
|
84
|
-
AD_HOC = 4,
|
|
85
|
-
APP_STORE = 5
|
|
86
|
-
}
|
|
87
80
|
/**
|
|
88
81
|
* Gets the iOS application release type.
|
|
89
82
|
* @return Returns a promise which fulfills with an [`ApplicationReleaseType`](#applicationreleasetype).
|
|
90
83
|
* @platform ios
|
|
91
84
|
*/
|
|
92
85
|
export declare function getIosApplicationReleaseTypeAsync(): Promise<ApplicationReleaseType>;
|
|
93
|
-
export type PushNotificationServiceEnvironment = 'development' | 'production' | null;
|
|
94
86
|
/**
|
|
95
87
|
* Gets the current [Apple Push Notification (APN)](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment?language=objc)
|
|
96
88
|
* service environment.
|
|
@@ -130,4 +122,5 @@ export declare function getInstallationTimeAsync(): Promise<Date>;
|
|
|
130
122
|
* @platform android
|
|
131
123
|
*/
|
|
132
124
|
export declare function getLastUpdateTimeAsync(): Promise<Date>;
|
|
125
|
+
export { ApplicationReleaseType, PushNotificationServiceEnvironment };
|
|
133
126
|
//# sourceMappingURL=Application.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../src/Application.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../src/Application.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAC;AAIjG;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,GAAG,IAExC,CAAC;AAGT;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,GAAG,IAElC,CAAC;AAGT;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,GAAG,IAE/B,CAAC;AAGT;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,GAAG,IAE7B,CAAC;AAGT;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAKrC;AAGD;;;;;;;;;;;GAWG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC,CAK/D;AAGD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAKrE;AAGD;;;;GAIG;AACH,wBAAsB,iCAAiC,IAAI,OAAO,CAAC,sBAAsB,CAAC,CAKzF;AAGD;;;;;;GAMG;AACH,wBAAsB,6CAA6C,IAAI,OAAO,CAAC,kCAAkC,CAAC,CAKjH;AAGD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC,CAM9D;AAGD;;;;;;;;;;;GAWG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC,CAM5D;AAED,OAAO,EAAE,sBAAsB,EAAE,kCAAkC,EAAE,CAAC"}
|
package/build/Application.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { UnavailabilityError } from 'expo-modules-core';
|
|
1
|
+
import { Platform, UnavailabilityError } from 'expo-modules-core';
|
|
2
|
+
import { ApplicationReleaseType } from './Application.types';
|
|
2
3
|
import ExpoApplication from './ExpoApplication';
|
|
3
4
|
// @needsAudit
|
|
4
5
|
/**
|
|
@@ -44,19 +45,24 @@ export const applicationId = ExpoApplication
|
|
|
44
45
|
: null;
|
|
45
46
|
// @needsAudit
|
|
46
47
|
/**
|
|
47
|
-
*
|
|
48
|
+
* Gets the value of [`Settings.Secure.ANDROID_ID`](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).
|
|
48
49
|
* This is a hexadecimal `string` unique to each combination of app-signing key, user, and device.
|
|
49
50
|
* The value may change if a factory reset is performed on the device or if an APK signing key changes.
|
|
50
51
|
* For more information about how the platform handles `ANDROID_ID` in Android 8.0 (API level 26)
|
|
51
52
|
* 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
|
|
53
|
+
* On iOS and web, this function is unavailable.
|
|
53
54
|
* > In versions of the platform lower than Android 8.0 (API level 26), this value remains constant
|
|
54
55
|
* > 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
56
|
* > official docs for more information.
|
|
56
57
|
* @example `"dd96dec43fb81c97"`
|
|
57
58
|
* @platform android
|
|
58
59
|
*/
|
|
59
|
-
export
|
|
60
|
+
export function getAndroidId() {
|
|
61
|
+
if (Platform.OS !== 'android') {
|
|
62
|
+
throw new UnavailabilityError('expo-application', 'androidId');
|
|
63
|
+
}
|
|
64
|
+
return ExpoApplication.androidId;
|
|
65
|
+
}
|
|
60
66
|
// @needsAudit
|
|
61
67
|
/**
|
|
62
68
|
* Gets the referrer URL of the installed app with the [`Install Referrer API`](https://developer.android.com/google/play/installreferrer)
|
|
@@ -101,18 +107,8 @@ export async function getIosIdForVendorAsync() {
|
|
|
101
107
|
if (!ExpoApplication.getIosIdForVendorAsync) {
|
|
102
108
|
throw new UnavailabilityError('expo-application', 'getIosIdForVendorAsync');
|
|
103
109
|
}
|
|
104
|
-
return
|
|
110
|
+
return await ExpoApplication.getIosIdForVendorAsync();
|
|
105
111
|
}
|
|
106
|
-
// @docsMissing
|
|
107
|
-
export var ApplicationReleaseType;
|
|
108
|
-
(function (ApplicationReleaseType) {
|
|
109
|
-
ApplicationReleaseType[ApplicationReleaseType["UNKNOWN"] = 0] = "UNKNOWN";
|
|
110
|
-
ApplicationReleaseType[ApplicationReleaseType["SIMULATOR"] = 1] = "SIMULATOR";
|
|
111
|
-
ApplicationReleaseType[ApplicationReleaseType["ENTERPRISE"] = 2] = "ENTERPRISE";
|
|
112
|
-
ApplicationReleaseType[ApplicationReleaseType["DEVELOPMENT"] = 3] = "DEVELOPMENT";
|
|
113
|
-
ApplicationReleaseType[ApplicationReleaseType["AD_HOC"] = 4] = "AD_HOC";
|
|
114
|
-
ApplicationReleaseType[ApplicationReleaseType["APP_STORE"] = 5] = "APP_STORE";
|
|
115
|
-
})(ApplicationReleaseType || (ApplicationReleaseType = {}));
|
|
116
112
|
// @needsAudit
|
|
117
113
|
/**
|
|
118
114
|
* Gets the iOS application release type.
|
|
@@ -184,4 +180,5 @@ export async function getLastUpdateTimeAsync() {
|
|
|
184
180
|
const lastUpdateTime = await ExpoApplication.getLastUpdateTimeAsync();
|
|
185
181
|
return new Date(lastUpdateTime);
|
|
186
182
|
}
|
|
183
|
+
export { ApplicationReleaseType };
|
|
187
184
|
//# sourceMappingURL=Application.js.map
|
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 '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// @docsMissing\nexport type PushNotificationServiceEnvironment = 'development' | 'production' | null;\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, or `null` on the simulator as it does not support registering with APNs.\n * @platform ios\n */\nexport async function getIosPushNotificationServiceEnvironmentAsync(): Promise<PushNotificationServiceEnvironment> {\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
|
+
{"version":3,"file":"Application.js","sourceRoot":"","sources":["../src/Application.ts"],"names":[],"mappings":"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","sourcesContent":["import { Platform, UnavailabilityError } from 'expo-modules-core';\n\nimport { ApplicationReleaseType, PushNotificationServiceEnvironment } from './Application.types';\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 * Gets 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 function is unavailable.\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 function getAndroidId(): string {\n if (Platform.OS !== 'android') {\n throw new UnavailabilityError('expo-application', 'androidId');\n }\n return ExpoApplication.androidId;\n}\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();\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, or `null` on the simulator as it does not support registering with APNs.\n * @platform ios\n */\nexport async function getIosPushNotificationServiceEnvironmentAsync(): Promise<PushNotificationServiceEnvironment> {\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\nexport { ApplicationReleaseType, PushNotificationServiceEnvironment };\n"]}
|
|
@@ -1 +1,13 @@
|
|
|
1
|
+
export declare enum ApplicationReleaseType {
|
|
2
|
+
UNKNOWN = 0,
|
|
3
|
+
SIMULATOR = 1,
|
|
4
|
+
ENTERPRISE = 2,
|
|
5
|
+
DEVELOPMENT = 3,
|
|
6
|
+
AD_HOC = 4,
|
|
7
|
+
APP_STORE = 5
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Maps to the [`aps-environment`](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment) key in the native target's registered entitlements.
|
|
11
|
+
*/
|
|
12
|
+
export type PushNotificationServiceEnvironment = 'development' | 'production' | null;
|
|
1
13
|
//# sourceMappingURL=Application.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Application.types.d.ts","sourceRoot":"","sources":["../src/Application.types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Application.types.d.ts","sourceRoot":"","sources":["../src/Application.types.ts"],"names":[],"mappings":"AACA,oBAAY,sBAAsB;IAChC,OAAO,IAAI;IACX,SAAS,IAAI;IACb,UAAU,IAAI;IACd,WAAW,IAAI;IACf,MAAM,IAAI;IACV,SAAS,IAAI;CACd;AAED;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAAG,aAAa,GAAG,YAAY,GAAG,IAAI,CAAC"}
|
|
@@ -1 +1,11 @@
|
|
|
1
|
+
// @docsMissing
|
|
2
|
+
export var ApplicationReleaseType;
|
|
3
|
+
(function (ApplicationReleaseType) {
|
|
4
|
+
ApplicationReleaseType[ApplicationReleaseType["UNKNOWN"] = 0] = "UNKNOWN";
|
|
5
|
+
ApplicationReleaseType[ApplicationReleaseType["SIMULATOR"] = 1] = "SIMULATOR";
|
|
6
|
+
ApplicationReleaseType[ApplicationReleaseType["ENTERPRISE"] = 2] = "ENTERPRISE";
|
|
7
|
+
ApplicationReleaseType[ApplicationReleaseType["DEVELOPMENT"] = 3] = "DEVELOPMENT";
|
|
8
|
+
ApplicationReleaseType[ApplicationReleaseType["AD_HOC"] = 4] = "AD_HOC";
|
|
9
|
+
ApplicationReleaseType[ApplicationReleaseType["APP_STORE"] = 5] = "APP_STORE";
|
|
10
|
+
})(ApplicationReleaseType || (ApplicationReleaseType = {}));
|
|
1
11
|
//# sourceMappingURL=Application.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Application.types.js","sourceRoot":"","sources":["../src/Application.types.ts"],"names":[],"mappings":"","sourcesContent":[""]}
|
|
1
|
+
{"version":3,"file":"Application.types.js","sourceRoot":"","sources":["../src/Application.types.ts"],"names":[],"mappings":"AAAA,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","sourcesContent":["// @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/**\n * Maps to the [`aps-environment`](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment) key in the native target's registered entitlements.\n */\nexport type PushNotificationServiceEnvironment = 'development' | 'production' | null;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoApplication.d.ts","sourceRoot":"","sources":["../src/ExpoApplication.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ExpoApplication.d.ts","sourceRoot":"","sources":["../src/ExpoApplication.ts"],"names":[],"mappings":";AAEA,wBAAsD"}
|
package/build/ExpoApplication.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default
|
|
1
|
+
import { requireNativeModule } from 'expo-modules-core';
|
|
2
|
+
export default requireNativeModule('ExpoApplication');
|
|
3
3
|
//# sourceMappingURL=ExpoApplication.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoApplication.js","sourceRoot":"","sources":["../src/ExpoApplication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ExpoApplication.js","sourceRoot":"","sources":["../src/ExpoApplication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,eAAe,mBAAmB,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\n\nexport default requireNativeModule('ExpoApplication');\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import ExpoModulesCore
|
|
2
|
+
|
|
3
|
+
internal class UrlDocumentDirectoryException: Exception {
|
|
4
|
+
override var reason: String {
|
|
5
|
+
"Unable to get url for document directory"
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
internal class InstallationTimeException: Exception {
|
|
10
|
+
override var reason: String {
|
|
11
|
+
"Unable to get installation time of this application"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
internal class DateCastException: Exception {
|
|
16
|
+
override var reason: String {
|
|
17
|
+
"Invalid date format"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
+
import ExpoModulesCore
|
|
3
|
+
|
|
4
|
+
public class ApplicationModule: Module {
|
|
5
|
+
public func definition() -> ModuleDefinition {
|
|
6
|
+
Name("ExpoApplication")
|
|
7
|
+
|
|
8
|
+
Constants {
|
|
9
|
+
let infoPlist = Bundle.main.infoDictionary
|
|
10
|
+
return [
|
|
11
|
+
"applicationName": infoPlist?["CFBundleDisplayName"],
|
|
12
|
+
"applicationId": infoPlist?["CFBundleIdentifier"],
|
|
13
|
+
"nativeApplicationVersion": infoPlist?["CFBundleShortVersionString"],
|
|
14
|
+
"nativeBuildVersion": infoPlist?["CFBundleVersion"]
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
AsyncFunction("getIosIdForVendorAsync") { () -> String? in
|
|
19
|
+
return UIDevice.current.identifierForVendor?.uuidString
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
AsyncFunction("getInstallationTimeAsync") { () -> Double in
|
|
23
|
+
guard let urlToDocumentsFolder = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).last else {
|
|
24
|
+
throw UrlDocumentDirectoryException()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
do {
|
|
28
|
+
let fileAttributes = try FileManager.default.attributesOfItem(atPath: urlToDocumentsFolder.path)
|
|
29
|
+
if let installDate = fileAttributes[FileAttributeKey.creationDate] as? Date {
|
|
30
|
+
return installDate.timeIntervalSince1970 * 1000
|
|
31
|
+
}
|
|
32
|
+
throw DateCastException()
|
|
33
|
+
} catch {
|
|
34
|
+
throw InstallationTimeException()
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
AsyncFunction("getApplicationReleaseTypeAsync") { () -> Int in
|
|
39
|
+
let mainProvisioningProfile = ApplicationModuleProvisioningProfile.mainProvisioningProfile
|
|
40
|
+
return mainProvisioningProfile.appReleaseType().rawValue
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
AsyncFunction("getPushNotificationServiceEnvironmentAsync") { () -> String? in
|
|
44
|
+
let mainProvisioningProfile = ApplicationModuleProvisioningProfile.mainProvisioningProfile
|
|
45
|
+
return mainProvisioningProfile.notificationServiceEnvironment()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Copyright 2015-present 650 Industries. All rights reserved.
|
|
2
|
+
import ExpoModulesCore
|
|
3
|
+
|
|
4
|
+
class ApplicationModuleProvisioningProfile {
|
|
5
|
+
private let plist = readProvisioningProfilePlist()
|
|
6
|
+
static let mainProvisioningProfile = ApplicationModuleProvisioningProfile()
|
|
7
|
+
|
|
8
|
+
func notificationServiceEnvironment() -> String? {
|
|
9
|
+
guard let plist = plist else {
|
|
10
|
+
return nil
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let entitlements = plist["Entitlements"] as? [String: Any]
|
|
14
|
+
return entitlements?["aps-environment"] as? String
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
func appReleaseType() -> AppReleaseType {
|
|
18
|
+
guard let provisioningPath = Bundle.main.path(forResource: "embedded", ofType: "mobileprovision") else {
|
|
19
|
+
#if targetEnvironment(simulator)
|
|
20
|
+
return .simulator
|
|
21
|
+
#else
|
|
22
|
+
return .appStore
|
|
23
|
+
#endif
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
guard let mobileProvision = plist else {
|
|
27
|
+
return .unknown
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if let provisionsAllDevices = mobileProvision["ProvisionsAllDevices"] as? Bool, provisionsAllDevices {
|
|
31
|
+
return .enterprise
|
|
32
|
+
}
|
|
33
|
+
if let provisionedDevices = mobileProvision["ProvisionedDevices"] as? [String], !provisionedDevices.isEmpty {
|
|
34
|
+
let entitlements = mobileProvision["Entitlements"] as? [String: Any]
|
|
35
|
+
if let getTaskAllow = entitlements?["get-task-allow"] as? Bool, getTaskAllow {
|
|
36
|
+
return .dev
|
|
37
|
+
}
|
|
38
|
+
return .adHoc
|
|
39
|
+
}
|
|
40
|
+
return .appStore
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private static func readProvisioningProfilePlist() -> [String: Any]? {
|
|
44
|
+
guard let profilePath = Bundle.main.path(forResource: "embedded", ofType: "mobileprovision") else {
|
|
45
|
+
return nil
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
do {
|
|
49
|
+
let profileString = try String(contentsOfFile: profilePath, encoding: .ascii)
|
|
50
|
+
guard let plistStart = profileString.range(of: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"),
|
|
51
|
+
let plistEnd = profileString.range(of: "</plist>") else {
|
|
52
|
+
return nil
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let plistString = String(profileString[plistStart.lowerBound..<plistEnd.upperBound])
|
|
56
|
+
if let plistData = plistString.data(using: .utf8) {
|
|
57
|
+
return try PropertyListSerialization.propertyList(from: plistData, options: [], format: nil) as? [String: Any]
|
|
58
|
+
}
|
|
59
|
+
log.error("Failed to convert plistString to UTF-8 encoded data object.")
|
|
60
|
+
return nil
|
|
61
|
+
} catch {
|
|
62
|
+
log.error("Error reading provisioning profile: \(error.localizedDescription)")
|
|
63
|
+
return nil
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
enum AppReleaseType: Int, Enumerable {
|
|
69
|
+
case unknown = 0
|
|
70
|
+
case simulator = 1
|
|
71
|
+
case enterprise = 2
|
|
72
|
+
case dev = 3
|
|
73
|
+
case adHoc = 4
|
|
74
|
+
case appStore = 5
|
|
75
|
+
}
|
|
@@ -3,23 +3,30 @@ require 'json'
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
|
|
4
4
|
|
|
5
5
|
Pod::Spec.new do |s|
|
|
6
|
-
s.name = '
|
|
6
|
+
s.name = 'ExpoApplication'
|
|
7
7
|
s.version = package['version']
|
|
8
8
|
s.summary = package['description']
|
|
9
9
|
s.description = package['description']
|
|
10
10
|
s.license = package['license']
|
|
11
11
|
s.author = package['author']
|
|
12
12
|
s.homepage = package['homepage']
|
|
13
|
-
s.
|
|
13
|
+
s.platforms = { :ios => '13.0', :tvos => '13.0'}
|
|
14
|
+
s.swift_version = '5.4'
|
|
14
15
|
s.source = { git: 'https://github.com/expo/expo.git' }
|
|
15
16
|
s.static_framework = true
|
|
16
17
|
|
|
17
18
|
s.dependency 'ExpoModulesCore'
|
|
18
19
|
|
|
20
|
+
# Swift/Objective-C compatibility
|
|
21
|
+
s.pod_target_xcconfig = {
|
|
22
|
+
'DEFINES_MODULE' => 'YES',
|
|
23
|
+
'SWIFT_COMPILATION_MODE' => 'wholemodule'
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
if !$ExpoUseSources&.include?(package['name']) && ENV['EXPO_USE_SOURCE'].to_i == 0 && File.exist?("#{s.name}.xcframework") && Gem::Version.new(Pod::VERSION) >= Gem::Version.new('1.10.0')
|
|
20
27
|
s.source_files = "#{s.name}/**/*.h"
|
|
21
28
|
s.vendored_frameworks = "#{s.name}.xcframework"
|
|
22
29
|
else
|
|
23
|
-
s.source_files = "
|
|
30
|
+
s.source_files = "**/*.{h,m,swift}"
|
|
24
31
|
end
|
|
25
32
|
end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-application",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
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",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"expo": "*"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "da25937e2a99661cbe5eb60ca1d8d6245fc96a50"
|
|
40
40
|
}
|
package/src/Application.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { UnavailabilityError } from 'expo-modules-core';
|
|
1
|
+
import { Platform, UnavailabilityError } from 'expo-modules-core';
|
|
2
2
|
|
|
3
|
+
import { ApplicationReleaseType, PushNotificationServiceEnvironment } from './Application.types';
|
|
3
4
|
import ExpoApplication from './ExpoApplication';
|
|
4
5
|
|
|
5
6
|
// @needsAudit
|
|
@@ -50,19 +51,24 @@ export const applicationId: string | null = ExpoApplication
|
|
|
50
51
|
|
|
51
52
|
// @needsAudit
|
|
52
53
|
/**
|
|
53
|
-
*
|
|
54
|
+
* Gets the value of [`Settings.Secure.ANDROID_ID`](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID).
|
|
54
55
|
* This is a hexadecimal `string` unique to each combination of app-signing key, user, and device.
|
|
55
56
|
* The value may change if a factory reset is performed on the device or if an APK signing key changes.
|
|
56
57
|
* For more information about how the platform handles `ANDROID_ID` in Android 8.0 (API level 26)
|
|
57
58
|
* 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
|
|
59
|
+
* On iOS and web, this function is unavailable.
|
|
59
60
|
* > In versions of the platform lower than Android 8.0 (API level 26), this value remains constant
|
|
60
61
|
* > for the lifetime of the user's device. See the [ANDROID_ID](https://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID)
|
|
61
62
|
* > official docs for more information.
|
|
62
63
|
* @example `"dd96dec43fb81c97"`
|
|
63
64
|
* @platform android
|
|
64
65
|
*/
|
|
65
|
-
export
|
|
66
|
+
export function getAndroidId(): string {
|
|
67
|
+
if (Platform.OS !== 'android') {
|
|
68
|
+
throw new UnavailabilityError('expo-application', 'androidId');
|
|
69
|
+
}
|
|
70
|
+
return ExpoApplication.androidId;
|
|
71
|
+
}
|
|
66
72
|
|
|
67
73
|
// @needsAudit
|
|
68
74
|
/**
|
|
@@ -109,17 +115,7 @@ export async function getIosIdForVendorAsync(): Promise<string | null> {
|
|
|
109
115
|
if (!ExpoApplication.getIosIdForVendorAsync) {
|
|
110
116
|
throw new UnavailabilityError('expo-application', 'getIosIdForVendorAsync');
|
|
111
117
|
}
|
|
112
|
-
return
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// @docsMissing
|
|
116
|
-
export enum ApplicationReleaseType {
|
|
117
|
-
UNKNOWN = 0,
|
|
118
|
-
SIMULATOR = 1,
|
|
119
|
-
ENTERPRISE = 2,
|
|
120
|
-
DEVELOPMENT = 3,
|
|
121
|
-
AD_HOC = 4,
|
|
122
|
-
APP_STORE = 5,
|
|
118
|
+
return await ExpoApplication.getIosIdForVendorAsync();
|
|
123
119
|
}
|
|
124
120
|
|
|
125
121
|
// @needsAudit
|
|
@@ -135,9 +131,6 @@ export async function getIosApplicationReleaseTypeAsync(): Promise<ApplicationRe
|
|
|
135
131
|
return await ExpoApplication.getApplicationReleaseTypeAsync();
|
|
136
132
|
}
|
|
137
133
|
|
|
138
|
-
// @docsMissing
|
|
139
|
-
export type PushNotificationServiceEnvironment = 'development' | 'production' | null;
|
|
140
|
-
|
|
141
134
|
// @needsAudit
|
|
142
135
|
/**
|
|
143
136
|
* Gets the current [Apple Push Notification (APN)](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment?language=objc)
|
|
@@ -199,3 +192,5 @@ export async function getLastUpdateTimeAsync(): Promise<Date> {
|
|
|
199
192
|
const lastUpdateTime = await ExpoApplication.getLastUpdateTimeAsync();
|
|
200
193
|
return new Date(lastUpdateTime);
|
|
201
194
|
}
|
|
195
|
+
|
|
196
|
+
export { ApplicationReleaseType, PushNotificationServiceEnvironment };
|
package/src/Application.types.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @docsMissing
|
|
2
|
+
export enum ApplicationReleaseType {
|
|
3
|
+
UNKNOWN = 0,
|
|
4
|
+
SIMULATOR = 1,
|
|
5
|
+
ENTERPRISE = 2,
|
|
6
|
+
DEVELOPMENT = 3,
|
|
7
|
+
AD_HOC = 4,
|
|
8
|
+
APP_STORE = 5,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Maps to the [`aps-environment`](https://developer.apple.com/documentation/bundleresources/entitlements/aps-environment) key in the native target's registered entitlements.
|
|
13
|
+
*/
|
|
14
|
+
export type PushNotificationServiceEnvironment = 'development' | 'production' | null;
|
package/src/ExpoApplication.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { requireNativeModule } from 'expo-modules-core';
|
|
2
|
+
|
|
3
|
+
export default requireNativeModule('ExpoApplication');
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
-
#import <ExpoModulesCore/EXUtilities.h>
|
|
3
|
-
#import <EXApplication/EXApplication.h>
|
|
4
|
-
#import <UIKit/UIKit.h>
|
|
5
|
-
#import <EXApplication/EXProvisioningProfile.h>
|
|
6
|
-
|
|
7
|
-
@implementation EXApplication
|
|
8
|
-
|
|
9
|
-
EX_EXPORT_MODULE(ExpoApplication);
|
|
10
|
-
|
|
11
|
-
- (dispatch_queue_t)methodQueue
|
|
12
|
-
{
|
|
13
|
-
return dispatch_get_main_queue();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
EX_EXPORT_METHOD_AS(getIosIdForVendorAsync, getIosIdForVendorAsyncWithResolver:(EXPromiseResolveBlock)resolve rejecter:(EXPromiseRejectBlock)reject)
|
|
17
|
-
{
|
|
18
|
-
resolve([[UIDevice currentDevice].identifierForVendor UUIDString]);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
EX_EXPORT_METHOD_AS(getInstallationTimeAsync, getInstallationTimeAsyncWithResolver:(EXPromiseResolveBlock)resolve rejecter:(EXPromiseRejectBlock)reject)
|
|
22
|
-
{
|
|
23
|
-
NSURL *urlToDocumentsFolder = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
|
|
24
|
-
NSError *error = nil;
|
|
25
|
-
NSDate *installDate = [[[NSFileManager defaultManager] attributesOfItemAtPath:urlToDocumentsFolder.path error:&error] objectForKey:NSFileCreationDate];
|
|
26
|
-
if (error) {
|
|
27
|
-
reject(@"ERR_APPLICATION", @"Unable to get installation time of this application.", error);
|
|
28
|
-
} else {
|
|
29
|
-
NSTimeInterval timeInMilliseconds = [installDate timeIntervalSince1970] * 1000;
|
|
30
|
-
NSNumber *timeNumber = @(timeInMilliseconds);
|
|
31
|
-
resolve(timeNumber);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
EX_EXPORT_METHOD_AS(getApplicationReleaseTypeAsync, getApplicationReleaseTypeAsyncWithResolver:(EXPromiseResolveBlock)resolve rejecter:(EXPromiseRejectBlock)reject)
|
|
36
|
-
{
|
|
37
|
-
EXProvisioningProfile *mainProvisioningProfile = [EXProvisioningProfile mainProvisioningProfile];
|
|
38
|
-
resolve(@([mainProvisioningProfile appReleaseType]));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
EX_EXPORT_METHOD_AS(getPushNotificationServiceEnvironmentAsync, getPushNotificationServiceEnvironmentAsyncWithResolver:(EXPromiseResolveBlock)resolve rejecter:(EXPromiseRejectBlock)reject)
|
|
42
|
-
{
|
|
43
|
-
EXProvisioningProfile *mainProvisioningProfile = [EXProvisioningProfile mainProvisioningProfile];
|
|
44
|
-
resolve(EXNullIfNil([mainProvisioningProfile notificationServiceEnvironment]));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
- (NSDictionary *)constantsToExport
|
|
48
|
-
{
|
|
49
|
-
return @{
|
|
50
|
-
@"applicationName": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"] ?: [NSNull null],
|
|
51
|
-
@"applicationId": [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"] ?: [NSNull null],
|
|
52
|
-
@"nativeApplicationVersion": [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] ?: [NSNull null],
|
|
53
|
-
@"nativeBuildVersion": [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]?: [NSNull null],
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
@end
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Copyright 2015-present 650 Industries. All rights reserved.
|
|
2
|
-
|
|
3
|
-
#import <Foundation/Foundation.h>
|
|
4
|
-
|
|
5
|
-
// Keep in sync with ApplicationReleaseType in JS
|
|
6
|
-
typedef NS_ENUM(NSInteger, EXAppReleaseType) {
|
|
7
|
-
EXAppReleaseTypeUnknown,
|
|
8
|
-
EXAppReleaseSimulator,
|
|
9
|
-
EXAppReleaseEnterprise,
|
|
10
|
-
EXAppReleaseDev,
|
|
11
|
-
EXAppReleaseAdHoc,
|
|
12
|
-
EXAppReleaseAppStore
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
@interface EXProvisioningProfile : NSObject
|
|
16
|
-
|
|
17
|
-
+ (nonnull instancetype)mainProvisioningProfile;
|
|
18
|
-
|
|
19
|
-
- (EXAppReleaseType)appReleaseType;
|
|
20
|
-
- (nullable NSString *)notificationServiceEnvironment;
|
|
21
|
-
|
|
22
|
-
@end
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
// Copyright 2015-present 650 Industries. All rights reserved.
|
|
2
|
-
|
|
3
|
-
#import <EXApplication/EXProvisioningProfile.h>
|
|
4
|
-
|
|
5
|
-
@implementation EXProvisioningProfile {
|
|
6
|
-
NSDictionary *_plist;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
+ (nonnull instancetype)mainProvisioningProfile
|
|
10
|
-
{
|
|
11
|
-
static EXProvisioningProfile *profile;
|
|
12
|
-
static dispatch_once_t onceToken;
|
|
13
|
-
dispatch_once(&onceToken, ^{
|
|
14
|
-
NSDictionary *plist = [self _readProvisioningProfilePlist];
|
|
15
|
-
profile = [[self alloc] initWithPlist:plist];
|
|
16
|
-
});
|
|
17
|
-
return profile;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
- (instancetype)initWithPlist:(NSDictionary *)plist
|
|
21
|
-
{
|
|
22
|
-
if (self = [super init]) {
|
|
23
|
-
_plist = plist;
|
|
24
|
-
}
|
|
25
|
-
return self;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
- (nullable NSString *)notificationServiceEnvironment
|
|
29
|
-
{
|
|
30
|
-
if (!_plist) {
|
|
31
|
-
return nil;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
NSDictionary *entitlements = _plist[@"Entitlements"];
|
|
35
|
-
NSString *apsEnvironment = entitlements[@"aps-environment"];
|
|
36
|
-
return apsEnvironment;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
- (EXAppReleaseType)appReleaseType {
|
|
40
|
-
NSString *provisioningPath = [[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"];
|
|
41
|
-
if (!provisioningPath) {
|
|
42
|
-
// provisioning profile does not exist
|
|
43
|
-
#if TARGET_IPHONE_SIMULATOR
|
|
44
|
-
return EXAppReleaseSimulator;
|
|
45
|
-
#else
|
|
46
|
-
return EXAppReleaseAppStore;
|
|
47
|
-
#endif
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
NSDictionary *mobileProvision = _plist;
|
|
51
|
-
if (!mobileProvision) {
|
|
52
|
-
// failure to read other than it simply not existing
|
|
53
|
-
return EXAppReleaseTypeUnknown;
|
|
54
|
-
} else if ([[mobileProvision objectForKey:@"ProvisionsAllDevices"] boolValue]) {
|
|
55
|
-
// enterprise distribution contains ProvisionsAllDevices - true
|
|
56
|
-
return EXAppReleaseEnterprise;
|
|
57
|
-
} else if ([mobileProvision objectForKey:@"ProvisionedDevices"] && [[mobileProvision objectForKey:@"ProvisionedDevices"] count] > 0) {
|
|
58
|
-
// development contains UDIDs and get-task-allow is true
|
|
59
|
-
// ad hoc contains UDIDs and get-task-allow is false
|
|
60
|
-
NSDictionary *entitlements = [mobileProvision objectForKey:@"Entitlements"];
|
|
61
|
-
if ([[entitlements objectForKey:@"get-task-allow"] boolValue]) {
|
|
62
|
-
return EXAppReleaseDev;
|
|
63
|
-
} else {
|
|
64
|
-
return EXAppReleaseAdHoc;
|
|
65
|
-
}
|
|
66
|
-
} else {
|
|
67
|
-
// app store contains no UDIDs (if the file exists at all?)
|
|
68
|
-
return EXAppReleaseAppStore;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** embedded.mobileprovision plist format:
|
|
73
|
-
|
|
74
|
-
AppIDName, // string — TextDetective
|
|
75
|
-
ApplicationIdentifierPrefix[], // [ string - 66PK3K3KEV ]
|
|
76
|
-
CreationData, // date — 2013-01-17T14:18:05Z
|
|
77
|
-
DeveloperCertificates[], // [ data ]
|
|
78
|
-
Entitlements {
|
|
79
|
-
application-identifier // string - 66PK3K3KEV.com.blindsight.textdetective
|
|
80
|
-
get-task-allow // true or false
|
|
81
|
-
keychain-access-groups[] // [ string - 66PK3K3KEV.* ]
|
|
82
|
-
},
|
|
83
|
-
ExpirationDate, // date — 2014-01-17T14:18:05Z
|
|
84
|
-
Name, // string — Barrierefreikommunizieren (name assigned to the provisioning profile used)
|
|
85
|
-
ProvisionedDevices[], // [ string.... ]
|
|
86
|
-
TeamIdentifier[], // [string — HHBT96X2EX ]
|
|
87
|
-
TeamName, // string — The Blindsight Corporation
|
|
88
|
-
TimeToLive, // integer - 365
|
|
89
|
-
UUID, // string — 79F37E8E-CC8D-4819-8C13-A678479211CE
|
|
90
|
-
Version, // integer — 1
|
|
91
|
-
ProvisionsAllDevices // true or false ***NB: not sure if this is where this is
|
|
92
|
-
|
|
93
|
-
*/
|
|
94
|
-
+ (NSDictionary *)_readProvisioningProfilePlist
|
|
95
|
-
{
|
|
96
|
-
NSString *profilePath = [[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"];
|
|
97
|
-
if (!profilePath) {
|
|
98
|
-
return nil;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
NSError *error;
|
|
102
|
-
NSString *profileString = [NSString stringWithContentsOfFile:profilePath encoding:NSASCIIStringEncoding error:&error];
|
|
103
|
-
if (!profileString) {
|
|
104
|
-
NSLog(@"Error reading provisioning profile: %@", error.localizedDescription);
|
|
105
|
-
return nil;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
NSScanner *scanner = [NSScanner scannerWithString:profileString];
|
|
109
|
-
BOOL readPrelude = [scanner scanUpToString:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" intoString:nil];
|
|
110
|
-
if (!readPrelude) {
|
|
111
|
-
return nil;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
NSString *plistString;
|
|
115
|
-
BOOL readPlist = [scanner scanUpToString:@"</plist>" intoString:&plistString];
|
|
116
|
-
if (!readPlist) {
|
|
117
|
-
return nil;
|
|
118
|
-
}
|
|
119
|
-
plistString = [plistString stringByAppendingString:@"</plist>"];
|
|
120
|
-
|
|
121
|
-
NSData *plistData = [plistString dataUsingEncoding:NSUTF8StringEncoding];
|
|
122
|
-
NSDictionary *plistDictionary = [NSPropertyListSerialization propertyListWithData:plistData
|
|
123
|
-
options:NSPropertyListImmutable
|
|
124
|
-
format:NULL
|
|
125
|
-
error:&error];
|
|
126
|
-
if (!plistDictionary) {
|
|
127
|
-
NSLog(@"Error unserializing provisioning profile plist: %@", error.localizedDescription);
|
|
128
|
-
return nil;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return plistDictionary;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
@end
|