expo-updates 0.21.1 → 0.23.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 +64 -0
- package/android/build.gradle +50 -30
- package/android/src/main/java/expo/modules/updates/DisabledUpdatesController.kt +125 -0
- package/android/src/main/java/expo/modules/updates/EnabledUpdatesController.kt +777 -0
- package/android/src/main/java/expo/modules/updates/IUpdatesController.kt +122 -0
- package/android/src/main/java/expo/modules/updates/UpdatesConfiguration.kt +58 -21
- package/android/src/main/java/expo/modules/updates/UpdatesController.kt +49 -591
- package/android/src/main/java/expo/modules/updates/UpdatesDevLauncherController.kt +181 -85
- package/android/src/main/java/expo/modules/updates/UpdatesModule.kt +181 -494
- package/android/src/main/java/expo/modules/updates/UpdatesPackage.kt +0 -11
- package/android/src/main/java/expo/modules/updates/UpdatesUtils.kt +26 -41
- package/android/src/main/java/expo/modules/updates/db/BuildData.kt +5 -2
- package/android/src/main/java/expo/modules/updates/db/dao/UpdateDao.kt +2 -2
- package/android/src/main/java/expo/modules/updates/launcher/DatabaseLauncher.kt +25 -7
- package/android/src/main/java/expo/modules/updates/launcher/NoDatabaseLauncher.kt +5 -30
- package/android/src/main/java/expo/modules/updates/loader/EmbeddedLoader.kt +2 -31
- package/android/src/main/java/expo/modules/updates/loader/FileDownloader.kt +3 -3
- package/android/src/main/java/expo/modules/updates/loader/Loader.kt +4 -13
- package/android/src/main/java/expo/modules/updates/loader/LoaderTask.kt +1 -15
- package/android/src/main/java/expo/modules/updates/loader/RemoteLoader.kt +4 -13
- package/android/src/main/java/expo/modules/updates/manifest/BareUpdateManifest.kt +3 -4
- package/android/src/main/java/expo/modules/updates/manifest/EmbeddedManifest.kt +2 -2
- package/android/src/main/java/expo/modules/updates/manifest/LegacyUpdateManifest.kt +2 -2
- package/android/src/main/java/expo/modules/updates/manifest/ManifestFactory.kt +5 -9
- package/android/src/main/java/expo/modules/updates/manifest/ManifestMetadata.kt +3 -3
- package/android/src/main/java/expo/modules/updates/manifest/NewUpdateManifest.kt +2 -2
- package/android/src/main/java/expo/modules/updates/statemachine/UpdatesStateMachine.kt +2 -0
- package/build/Updates.js +1 -1
- package/build/Updates.js.map +1 -1
- package/build/Updates.types.d.ts +4 -2
- package/build/Updates.types.d.ts.map +1 -1
- package/build/Updates.types.js +4 -2
- package/build/Updates.types.js.map +1 -1
- package/build/UpdatesEmitter.d.ts +3 -1
- package/build/UpdatesEmitter.d.ts.map +1 -1
- package/build/UpdatesEmitter.js +3 -1
- package/build/UpdatesEmitter.js.map +1 -1
- package/build/UpdatesHooks.d.ts +3 -1
- package/build/UpdatesHooks.d.ts.map +1 -1
- package/build/UpdatesHooks.js +3 -1
- package/build/UpdatesHooks.js.map +1 -1
- package/build-cli/cli.js +2 -2
- package/build-cli/configureCodeSigning.js +1 -1
- package/build-cli/generateCodeSigning.js +1 -1
- package/cli/cli.ts +3 -2
- package/cli/configureCodeSigning.ts +1 -1
- package/cli/generateCodeSigning.ts +1 -1
- package/e2e/README.md +1 -1
- package/e2e/fixtures/E2ETestModule.swift +0 -2
- package/e2e/fixtures/UpdatesE2ETestModule.kt +27 -27
- package/e2e/fixtures/project_files/.detoxrc.json +4 -2
- package/e2e/fixtures/project_files/eas.json +1 -0
- package/e2e/setup/{create-eas-project-tv.js → create-eas-project-tv.ts} +6 -3
- package/e2e/setup/{create-eas-project.js → create-eas-project.ts} +6 -3
- package/e2e/setup/{create-updates-test.js → create-updates-test.ts} +7 -4
- package/e2e/setup/{project.js → project.ts} +101 -61
- package/expo-module.config.json +3 -0
- package/ios/EXUpdates/AppController.swift +149 -646
- package/ios/EXUpdates/AppLauncher/AppLauncher.swift +1 -1
- package/ios/EXUpdates/AppLauncher/AppLauncherNoDatabase.swift +7 -25
- package/ios/EXUpdates/AppLauncher/AppLauncherWithDatabase.swift +18 -29
- package/ios/EXUpdates/AppLoader/AppLoader.swift +17 -9
- package/ios/EXUpdates/AppLoader/AppLoaderTask.swift +3 -35
- package/ios/EXUpdates/AppLoader/EmbeddedAppLoader.swift +6 -31
- package/ios/EXUpdates/AppLoader/FileDownloader.swift +3 -3
- package/ios/EXUpdates/AppLoader/RemoteAppLoader.swift +1 -2
- package/ios/EXUpdates/AppLoader/UpdateResponse.swift +0 -5
- package/ios/EXUpdates/Database/UpdatesBuildData.swift +2 -8
- package/ios/EXUpdates/Database/UpdatesDatabase.swift +0 -9
- package/ios/EXUpdates/Database/UpdatesReaper.swift +1 -1
- package/ios/EXUpdates/DevLauncherAppController.swift +318 -0
- package/ios/EXUpdates/DisabledAppController.swift +117 -0
- package/ios/EXUpdates/EnabledAppController.swift +788 -0
- package/ios/EXUpdates/ErrorRecovery.swift +15 -21
- package/ios/EXUpdates/Exceptions.swift +16 -6
- package/ios/EXUpdates/Logging/UpdatesLogReader.swift +7 -5
- package/ios/EXUpdates/ReactDelegateHandler/ExpoUpdatesAppDelegateSubscriber.swift +1 -1
- package/ios/EXUpdates/ReactDelegateHandler/ExpoUpdatesReactDelegateHandler.swift +3 -2
- package/ios/EXUpdates/Update/BareUpdate.swift +3 -3
- package/ios/EXUpdates/Update/LegacyUpdate.swift +2 -2
- package/ios/EXUpdates/Update/NewUpdate.swift +1 -1
- package/ios/EXUpdates/Update/Update.swift +6 -14
- package/ios/EXUpdates/UpdatesConfig.swift +66 -33
- package/ios/EXUpdates/UpdatesModule.swift +74 -125
- package/ios/EXUpdates/UpdatesStateMachine.swift +2 -6
- package/ios/EXUpdates/UpdatesUtils.swift +17 -329
- package/ios/EXUpdates.podspec +1 -1
- package/ios/Tests/AppLauncherWithDatabaseSpec.swift +23 -47
- package/ios/Tests/DatabaseIntegrityCheckSpec.swift +4 -2
- package/ios/Tests/ErrorRecoverySpec.swift +72 -27
- package/ios/Tests/FileDownloaderManifestParsingSpec.swift +32 -16
- package/ios/Tests/FileDownloaderSpec.swift +12 -10
- package/ios/Tests/LegacyUpdateSpec.swift +28 -9
- package/ios/Tests/NewUpdateSpec.swift +3 -2
- package/ios/Tests/ReaperSelectionPolicyDevelopmentClientSpec.swift +20 -10
- package/ios/Tests/ReaperSelectionPolicyFilterAwareSpec.swift +8 -4
- package/ios/Tests/SelectionPolicyFilterAwareSpec.swift +2 -1
- package/ios/Tests/UpdateSpec.swift +2 -15
- package/ios/Tests/UpdatesBuildDataSpec.swift +17 -13
- package/ios/Tests/UpdatesConfigSpec.swift +24 -14
- package/ios/Tests/UpdatesDatabaseSpec.swift +3 -2
- package/ios/Tests/UpdatesStateMachineSpec.swift +12 -6
- package/package.json +8 -8
- package/src/Updates.ts +1 -1
- package/src/Updates.types.ts +4 -2
- package/src/UpdatesEmitter.ts +3 -1
- package/src/UpdatesHooks.ts +3 -1
- package/tsconfig.cli.json +2 -5
- package/android/src/main/java/expo/modules/updates/UpdatesInterface.kt +0 -39
- package/android/src/main/java/expo/modules/updates/UpdatesService.kt +0 -76
- package/e2e/fixtures/project_files/detox.config.js +0 -77
- package/ios/EXUpdates/DevLauncherController.swift +0 -243
- package/ios/EXUpdates/EXUpdatesService.h +0 -40
- package/ios/EXUpdates/EXUpdatesService.m +0 -117
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,69 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.23.0 — 2023-11-14
|
|
14
|
+
|
|
15
|
+
### 🛠 Breaking changes
|
|
16
|
+
|
|
17
|
+
- Bumped iOS deployment target to 13.4. ([#25063](https://github.com/expo/expo/pull/25063) by [@gabrieldonadel](https://github.com/gabrieldonadel))
|
|
18
|
+
- Split updates controllers depending on configuration, changing native public API. ([#25085](https://github.com/expo/expo/pull/25085), [#25192](https://github.com/expo/expo/pull/25192) by [@wschurman](https://github.com/wschurman))
|
|
19
|
+
- On `Android` bump `compileSdkVersion` and `targetSdkVersion` to `34`. ([#24708](https://github.com/expo/expo/pull/24708) by [@alanjhughes](https://github.com/alanjhughes))
|
|
20
|
+
|
|
21
|
+
### 🎉 New features
|
|
22
|
+
|
|
23
|
+
- [iOS] Make asset exclusion work. ([#25216](https://github.com/expo/expo/pull/25216) by [@douglowder](https://github.com/douglowder))
|
|
24
|
+
- [Android] Asset exclusion on Android part 1. ([#25277](https://github.com/expo/expo/pull/25277) by [@douglowder](https://github.com/douglowder))
|
|
25
|
+
|
|
26
|
+
### 🐛 Bug fixes
|
|
27
|
+
|
|
28
|
+
- [iOS] Fix the E2E tests. ([#24865](https://github.com/expo/expo/pull/24865) by [@douglowder](https://github.com/douglowder))
|
|
29
|
+
- [Android] Simplify UpdatesUtils.parseDateString, fix UpdatesLoggingTest. ([#24951](https://github.com/expo/expo/pull/24951) by [@douglowder](https://github.com/douglowder))
|
|
30
|
+
- [iOS] Fix expo-localization tvOS compile, add CI. ([#25082](https://github.com/expo/expo/pull/25082) by [@douglowder](https://github.com/douglowder))
|
|
31
|
+
- Fix instrumentation tests. ([#25367](https://github.com/expo/expo/pull/25367) by [@wschurman](https://github.com/wschurman))
|
|
32
|
+
|
|
33
|
+
### 💡 Others
|
|
34
|
+
|
|
35
|
+
- Android: Stub expo-updates in Expo Go and remove service pattern. ([#24890](https://github.com/expo/expo/pull/24890) by [@wschurman](https://github.com/wschurman))
|
|
36
|
+
- iOS: Refactor responsibility of app controller. ([#24934](https://github.com/expo/expo/pull/24934), [#24949](https://github.com/expo/expo/pull/24949) by [@wschurman](https://github.com/wschurman))
|
|
37
|
+
- Android: Refactor responsibility of app controller. ([#24954](https://github.com/expo/expo/pull/24954), [#24975](https://github.com/expo/expo/pull/24975), [#25043](https://github.com/expo/expo/pull/25043) by [@wschurman](https://github.com/wschurman))
|
|
38
|
+
- Android: Backport ExpoGoUpdatesModule to SDK 49. ([#24974](https://github.com/expo/expo/pull/24974) by [@wschurman](https://github.com/wschurman))
|
|
39
|
+
- Remove unused `storedUpdateIdsWithConfiguration` method. ([#25194](https://github.com/expo/expo/pull/25194) by [@wschurman](https://github.com/wschurman))
|
|
40
|
+
- Remove ability for embedded manifests to be legacy manifests. ([#25195](https://github.com/expo/expo/pull/25195) by [@wschurman](https://github.com/wschurman))
|
|
41
|
+
- Convert e2e setup scripts to typescript. ([#25271](https://github.com/expo/expo/pull/25271) by [@wschurman](https://github.com/wschurman))
|
|
42
|
+
|
|
43
|
+
### ⚠️ Notices
|
|
44
|
+
|
|
45
|
+
- Deprecated `useUpdateEvents()` and `addListener()` in favor of the new `useUpdates()` API. ([#25345](https://github.com/expo/expo/pull/25345) by [@douglowder](https://github.com/douglowder))
|
|
46
|
+
|
|
47
|
+
## 0.18.17 — 2023-10-25
|
|
48
|
+
|
|
49
|
+
### 🐛 Bug fixes
|
|
50
|
+
|
|
51
|
+
- [Android] Simplify UpdatesUtils.parseDateString, fix UpdatesLoggingTest. ([#24951](https://github.com/expo/expo/pull/24951) by [@douglowder](https://github.com/douglowder))
|
|
52
|
+
|
|
53
|
+
## 0.22.0 — 2023-10-17
|
|
54
|
+
|
|
55
|
+
### 🐛 Bug fixes
|
|
56
|
+
|
|
57
|
+
- Add missing export in checkForUpdateAsync result. (by [@douglowder](https://github.com/douglowder)) ([#24503](https://github.com/expo/expo/pull/24503) by [@douglowder](https://github.com/douglowder))
|
|
58
|
+
- [Android] embedded loader should load images at all scales. ([#24549](https://github.com/expo/expo/pull/24549) by [@douglowder](https://github.com/douglowder))
|
|
59
|
+
|
|
60
|
+
### 💡 Others
|
|
61
|
+
|
|
62
|
+
- Transpile for Node 18 (LTS). ([#24471](https://github.com/expo/expo/pull/24471) by [@EvanBacon](https://github.com/EvanBacon))
|
|
63
|
+
- iOS: Stub expo-updates in Expo Go and remove service pattern. ([#24860](https://github.com/expo/expo/pull/24860) by [@wschurman](https://github.com/wschurman))
|
|
64
|
+
|
|
65
|
+
## 0.18.16 — 2023-10-05
|
|
66
|
+
|
|
67
|
+
### 🐛 Bug fixes
|
|
68
|
+
|
|
69
|
+
- Add missing export in checkForUpdateAsync result. (by [@douglowder](https://github.com/douglowder)) ([#24503](https://github.com/expo/expo/pull/24503) by [@douglowder](https://github.com/douglowder))
|
|
70
|
+
- [Android] embedded loader should load images at all scales. ([#24549](https://github.com/expo/expo/pull/24549) by [@douglowder](https://github.com/douglowder))
|
|
71
|
+
|
|
72
|
+
## 0.18.14 — 2023-09-27
|
|
73
|
+
|
|
74
|
+
_This version does not introduce any user-facing changes._
|
|
75
|
+
|
|
13
76
|
## 0.21.1 — 2023-09-18
|
|
14
77
|
|
|
15
78
|
_This version does not introduce any user-facing changes._
|
|
@@ -46,6 +109,7 @@ _This version does not introduce any user-facing changes._
|
|
|
46
109
|
|
|
47
110
|
- Change source of truth for constants types. ([#24049](https://github.com/expo/expo/pull/24049) by [@wschurman](https://github.com/wschurman))
|
|
48
111
|
- Remove classic manifest types and classic updates. ([#24053](https://github.com/expo/expo/pull/24053), [#24066](https://github.com/expo/expo/pull/24066) by [@wschurman](https://github.com/wschurman))
|
|
112
|
+
- Dropped support for Android SDK 21 and 22. ([#24201](https://github.com/expo/expo/pull/24201) by [@behenate](https://github.com/behenate))
|
|
49
113
|
|
|
50
114
|
### 🎉 New features
|
|
51
115
|
|
package/android/build.gradle
CHANGED
|
@@ -4,7 +4,18 @@ apply plugin: 'kotlin-kapt'
|
|
|
4
4
|
apply plugin: 'maven-publish'
|
|
5
5
|
|
|
6
6
|
group = 'host.exp.exponent'
|
|
7
|
-
version = '0.
|
|
7
|
+
version = '0.23.0'
|
|
8
|
+
|
|
9
|
+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
10
|
+
if (expoModulesCorePlugin.exists()) {
|
|
11
|
+
apply from: expoModulesCorePlugin
|
|
12
|
+
applyKotlinExpoModulesCorePlugin()
|
|
13
|
+
// Remove this check, but keep the contents after SDK49 support is dropped
|
|
14
|
+
if (safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
15
|
+
useExpoPublishing()
|
|
16
|
+
useCoreDependencies()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
8
19
|
|
|
9
20
|
// Utility method to derive boolean values from the environment or from Java properties,
|
|
10
21
|
// and return them as strings to be used in BuildConfig fields
|
|
@@ -34,12 +45,6 @@ def exUpdatesNativeDebug = getBoolStringFromPropOrEnv("EX_UPDATES_NATIVE_DEBUG",
|
|
|
34
45
|
def exUpdatesAndroidDelayLoadApp = getBoolStringFromPropOrEnv("EX_UPDATES_ANDROID_DELAY_LOAD_APP", true)
|
|
35
46
|
|
|
36
47
|
buildscript {
|
|
37
|
-
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
38
|
-
if (expoModulesCorePlugin.exists()) {
|
|
39
|
-
apply from: expoModulesCorePlugin
|
|
40
|
-
applyKotlinExpoModulesCorePlugin()
|
|
41
|
-
}
|
|
42
|
-
|
|
43
48
|
// Simple helper that allows the root project to override versions declared by this library.
|
|
44
49
|
ext.safeExtGet = { prop, fallback ->
|
|
45
50
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
@@ -63,23 +68,44 @@ buildscript {
|
|
|
63
68
|
}
|
|
64
69
|
}
|
|
65
70
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
72
|
+
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
73
|
+
afterEvaluate {
|
|
74
|
+
publishing {
|
|
75
|
+
publications {
|
|
76
|
+
release(MavenPublication) {
|
|
77
|
+
from components.release
|
|
78
|
+
}
|
|
71
79
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
80
|
+
repositories {
|
|
81
|
+
maven {
|
|
82
|
+
url = mavenLocal().url
|
|
83
|
+
}
|
|
76
84
|
}
|
|
77
85
|
}
|
|
78
86
|
}
|
|
79
87
|
}
|
|
80
88
|
|
|
81
89
|
android {
|
|
82
|
-
|
|
90
|
+
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
91
|
+
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
92
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
|
93
|
+
|
|
94
|
+
defaultConfig {
|
|
95
|
+
minSdkVersion safeExtGet("minSdkVersion", 23)
|
|
96
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 34)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
publishing {
|
|
100
|
+
singleVariant("release") {
|
|
101
|
+
withSourcesJar()
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
lintOptions {
|
|
106
|
+
abortOnError false
|
|
107
|
+
}
|
|
108
|
+
}
|
|
83
109
|
|
|
84
110
|
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
85
111
|
if (agpVersion.tokenize('.')[0].toInteger() < 8) {
|
|
@@ -95,10 +121,8 @@ android {
|
|
|
95
121
|
|
|
96
122
|
namespace "expo.modules.updates"
|
|
97
123
|
defaultConfig {
|
|
98
|
-
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
99
|
-
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
100
124
|
versionCode 31
|
|
101
|
-
versionName '0.
|
|
125
|
+
versionName '0.23.0'
|
|
102
126
|
consumerProguardFiles("proguard-rules.pro")
|
|
103
127
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
104
128
|
|
|
@@ -113,9 +137,6 @@ android {
|
|
|
113
137
|
}
|
|
114
138
|
} */
|
|
115
139
|
}
|
|
116
|
-
lintOptions {
|
|
117
|
-
abortOnError false
|
|
118
|
-
}
|
|
119
140
|
testOptions {
|
|
120
141
|
unitTests.includeAndroidResources = true
|
|
121
142
|
}
|
|
@@ -124,15 +145,15 @@ android {
|
|
|
124
145
|
androidTest.assets.srcDirs += files("$projectDir/src/androidTest/schemas".toString())
|
|
125
146
|
androidTest.assets.srcDirs += files("$projectDir/src/androidTest/certificates".toString())
|
|
126
147
|
}
|
|
127
|
-
publishing {
|
|
128
|
-
singleVariant("release") {
|
|
129
|
-
withSourcesJar()
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
148
|
}
|
|
133
149
|
|
|
134
150
|
dependencies {
|
|
135
|
-
|
|
151
|
+
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
152
|
+
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
153
|
+
implementation project(':expo-modules-core')
|
|
154
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
155
|
+
}
|
|
156
|
+
|
|
136
157
|
implementation project(':expo-structured-headers')
|
|
137
158
|
implementation project(':expo-updates-interface')
|
|
138
159
|
implementation project(':expo-manifests')
|
|
@@ -168,7 +189,6 @@ dependencies {
|
|
|
168
189
|
androidTestImplementation "androidx.room:room-testing:$room_version"
|
|
169
190
|
androidTestImplementation "org.jetbrains.kotlin:kotlin-test-junit:${getKotlinVersion()}"
|
|
170
191
|
|
|
171
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
172
192
|
implementation "org.jetbrains.kotlin:kotlin-reflect:${getKotlinVersion()}"
|
|
173
193
|
}
|
|
174
194
|
repositories {
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
package expo.modules.updates
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.os.Bundle
|
|
5
|
+
import android.util.Log
|
|
6
|
+
import com.facebook.react.ReactInstanceManager
|
|
7
|
+
import expo.modules.kotlin.exception.CodedException
|
|
8
|
+
import expo.modules.updates.UpdatesConfiguration.Companion.UPDATES_CONFIGURATION_RELEASE_CHANNEL_DEFAULT_VALUE
|
|
9
|
+
import expo.modules.updates.launcher.Launcher
|
|
10
|
+
import expo.modules.updates.launcher.NoDatabaseLauncher
|
|
11
|
+
import expo.modules.updates.statemachine.UpdatesStateContext
|
|
12
|
+
import java.io.File
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Updates controller for applications that either disable updates explicitly or have an error
|
|
16
|
+
* during initialization. Errors that may occur include but are not limited to:
|
|
17
|
+
* - Disk access errors
|
|
18
|
+
* - Internal database initialization errors
|
|
19
|
+
* - Configuration errors (missing required configuration)
|
|
20
|
+
*/
|
|
21
|
+
class DisabledUpdatesController(private val fatalException: Exception?, private val isMissingRuntimeVersion: Boolean) : IUpdatesController {
|
|
22
|
+
private var isStarted = false
|
|
23
|
+
private var launcher: Launcher? = null
|
|
24
|
+
private var isLoaderTaskFinished = false
|
|
25
|
+
override var updatesDirectory: File? = null
|
|
26
|
+
|
|
27
|
+
override var isEmergencyLaunch = false
|
|
28
|
+
private set
|
|
29
|
+
|
|
30
|
+
@get:Synchronized
|
|
31
|
+
override val launchAssetFile: String?
|
|
32
|
+
get() {
|
|
33
|
+
while (!isLoaderTaskFinished) {
|
|
34
|
+
try {
|
|
35
|
+
(this as java.lang.Object).wait()
|
|
36
|
+
} catch (e: InterruptedException) {
|
|
37
|
+
Log.e(TAG, "Interrupted while waiting for launch asset file", e)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return launcher?.launchAssetFile
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
override val bundleAssetName: String?
|
|
44
|
+
get() = launcher?.bundleAssetName
|
|
45
|
+
|
|
46
|
+
override fun onDidCreateReactInstanceManager(reactInstanceManager: ReactInstanceManager) {}
|
|
47
|
+
|
|
48
|
+
@Synchronized
|
|
49
|
+
override fun start(context: Context) {
|
|
50
|
+
if (isStarted) {
|
|
51
|
+
return
|
|
52
|
+
}
|
|
53
|
+
isStarted = true
|
|
54
|
+
|
|
55
|
+
launcher = NoDatabaseLauncher(context, fatalException)
|
|
56
|
+
isEmergencyLaunch = fatalException != null
|
|
57
|
+
notifyController()
|
|
58
|
+
return
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
class UpdatesDisabledException(message: String) : CodedException(message)
|
|
62
|
+
|
|
63
|
+
override fun getConstantsForModule(context: Context): IUpdatesController.UpdatesModuleConstants {
|
|
64
|
+
return IUpdatesController.UpdatesModuleConstants(
|
|
65
|
+
launchedUpdate = launcher?.launchedUpdate,
|
|
66
|
+
embeddedUpdate = null,
|
|
67
|
+
isEmergencyLaunch = isEmergencyLaunch,
|
|
68
|
+
isEnabled = false,
|
|
69
|
+
releaseChannel = UPDATES_CONFIGURATION_RELEASE_CHANNEL_DEFAULT_VALUE,
|
|
70
|
+
isUsingEmbeddedAssets = launcher?.isUsingEmbeddedAssets ?: false,
|
|
71
|
+
runtimeVersion = null,
|
|
72
|
+
checkOnLaunch = UpdatesConfiguration.CheckAutomaticallyConfiguration.NEVER,
|
|
73
|
+
requestHeaders = mapOf(),
|
|
74
|
+
localAssetFiles = launcher?.localAssetFiles,
|
|
75
|
+
isMissingRuntimeVersion = isMissingRuntimeVersion,
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
override fun relaunchReactApplicationForModule(context: Context, callback: IUpdatesController.ModuleCallback<Unit>) {
|
|
80
|
+
callback.onFailure(UpdatesDisabledException("You cannot reload when expo-updates is not enabled."))
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
override fun getNativeStateMachineContext(callback: IUpdatesController.ModuleCallback<UpdatesStateContext>) {
|
|
84
|
+
callback.onFailure(UpdatesDisabledException("You cannot check for updates when expo-updates is not enabled."))
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
override fun checkForUpdate(
|
|
88
|
+
context: Context,
|
|
89
|
+
callback: IUpdatesController.ModuleCallback<IUpdatesController.CheckForUpdateResult>
|
|
90
|
+
) {
|
|
91
|
+
callback.onFailure(UpdatesDisabledException("You cannot check for updates when expo-updates is not enabled."))
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
override fun fetchUpdate(
|
|
95
|
+
context: Context,
|
|
96
|
+
callback: IUpdatesController.ModuleCallback<IUpdatesController.FetchUpdateResult>
|
|
97
|
+
) {
|
|
98
|
+
callback.onFailure(UpdatesDisabledException("You cannot fetch update when expo-updates is not enabled."))
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
override fun getExtraParams(callback: IUpdatesController.ModuleCallback<Bundle>) {
|
|
102
|
+
callback.onFailure(UpdatesDisabledException("You cannot use extra params when expo-updates is not enabled."))
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
override fun setExtraParam(
|
|
106
|
+
key: String,
|
|
107
|
+
value: String?,
|
|
108
|
+
callback: IUpdatesController.ModuleCallback<Unit>
|
|
109
|
+
) {
|
|
110
|
+
callback.onFailure(UpdatesDisabledException("You cannot use extra params when expo-updates is not enabled."))
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@Synchronized
|
|
114
|
+
private fun notifyController() {
|
|
115
|
+
if (launcher == null) {
|
|
116
|
+
throw AssertionError("UpdatesController.notifyController was called with a null launcher, which is an error. This method should only be called when an update is ready to launch.")
|
|
117
|
+
}
|
|
118
|
+
isLoaderTaskFinished = true
|
|
119
|
+
(this as java.lang.Object).notify()
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
companion object {
|
|
123
|
+
private val TAG = DisabledUpdatesController::class.java.simpleName
|
|
124
|
+
}
|
|
125
|
+
}
|