expo-updates 0.24.11 → 0.24.13

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 CHANGED
@@ -10,6 +10,18 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.24.13 — 2024-05-25
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Android: Fix hard crash due to missing asset edge row. ([#28264](https://github.com/expo/expo/pull/28264) by [@douglowder](https://github.com/douglowder))
18
+
19
+ ## 0.24.12 — 2024-03-13
20
+
21
+ ### 💡 Others
22
+
23
+ - [iOS] Moved expo-dev-client + expo-updates interop setup out from `application:willFinishLaunchingWithOptions:`. ([#27477](https://github.com/expo/expo/pull/27477) by [@kudo](https://github.com/kudo))
24
+
13
25
  ## 0.24.11 — 2024-02-16
14
26
 
15
27
  _This version does not introduce any user-facing changes._
@@ -4,7 +4,7 @@ apply plugin: 'kotlin-kapt'
4
4
  apply plugin: 'maven-publish'
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '0.24.11'
7
+ version = '0.24.13'
8
8
 
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
10
10
  if (expoModulesCorePlugin.exists()) {
@@ -122,7 +122,7 @@ android {
122
122
  namespace "expo.modules.updates"
123
123
  defaultConfig {
124
124
  versionCode 31
125
- versionName '0.24.11'
125
+ versionName '0.24.13'
126
126
  consumerProguardFiles("proguard-rules.pro")
127
127
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
128
128
 
@@ -37,6 +37,14 @@ abstract class AssetDao {
37
37
  )
38
38
  abstract fun _unmarkUsedAssetsFromDeletion()
39
39
 
40
+ @Query(
41
+ "UPDATE assets SET marked_for_deletion = 0 WHERE id IN (" +
42
+ " SELECT launch_asset_id" +
43
+ " FROM updates" +
44
+ " WHERE updates.keep);"
45
+ )
46
+ abstract fun _unmarkUsedLaunchAssetsFromDeletion()
47
+
40
48
  @Query(
41
49
  "UPDATE assets SET marked_for_deletion = 0 WHERE relative_path IN (" +
42
50
  " SELECT relative_path" +
@@ -145,6 +153,7 @@ abstract class AssetDao {
145
153
  // this is safe since this is a transaction and will be rolled back upon failure
146
154
  _markAllAssetsForDeletion()
147
155
  _unmarkUsedAssetsFromDeletion()
156
+ _unmarkUsedLaunchAssetsFromDeletion()
148
157
  // check for duplicate rows representing a single file on disk
149
158
  _unmarkDuplicateUsedAssetsFromDeletion()
150
159
  val deletedAssets = _loadAssetsMarkedForDeletion()
@@ -25,8 +25,8 @@ abstract class UpdateDao {
25
25
  @Query("SELECT * FROM updates WHERE id = :id;")
26
26
  abstract fun _loadUpdatesWithId(id: UUID): List<UpdateEntity>
27
27
 
28
- @Query("SELECT assets.* FROM assets INNER JOIN updates ON updates.launch_asset_id = assets.id WHERE updates.id = :id;")
29
- abstract fun _loadLaunchAsset(id: UUID): AssetEntity
28
+ @Query("SELECT assets.* FROM assets INNER JOIN updates ON updates.launch_asset_id = assets.id WHERE updates.id = :updateId;")
29
+ abstract fun _loadLaunchAssetForUpdate(updateId: UUID): AssetEntity?
30
30
 
31
31
  @Query("UPDATE updates SET keep = 1 WHERE id = :id;")
32
32
  abstract fun _keepUpdate(id: UUID)
@@ -64,10 +64,10 @@ abstract class UpdateDao {
64
64
  return if (updateEntities.isNotEmpty()) updateEntities[0] else null
65
65
  }
66
66
 
67
- fun loadLaunchAsset(id: UUID): AssetEntity {
68
- val assetEntity = _loadLaunchAsset(id)
69
- assetEntity.isLaunchAsset = true
70
- return assetEntity
67
+ fun loadLaunchAssetForUpdate(updateId: UUID): AssetEntity? {
68
+ return _loadLaunchAssetForUpdate(updateId)?.apply {
69
+ isLaunchAsset = true
70
+ }
71
71
  }
72
72
 
73
73
  @Insert
@@ -59,4 +59,6 @@ class UpdateEntity(
59
59
 
60
60
  @ColumnInfo(name = "failed_launch_count", defaultValue = "0")
61
61
  var failedLaunchCount = 0
62
+
63
+ fun debugInfo(): String = JSONObject(mapOf("id" to id.toString(), "status" to status.name)).toString()
62
64
  }
@@ -71,7 +71,7 @@ class DatabaseLauncher(
71
71
 
72
72
  launchedUpdate = getLaunchableUpdate(database, context)
73
73
  if (launchedUpdate == null) {
74
- this.callback!!.onFailure(Exception("No launchable update was found. If this is a bare workflow app, make sure you have configured expo-updates correctly in android/app/build.gradle."))
74
+ this.callback!!.onFailure(Exception("No launchable update was found. If this is a generic app, ensure expo-updates is configured correctly."))
75
75
  return
76
76
  }
77
77
 
@@ -83,9 +83,14 @@ class DatabaseLauncher(
83
83
 
84
84
  // verify that we have all assets on disk
85
85
  // according to the database, we should, but something could have gone wrong on disk
86
- val launchAsset = database.updateDao().loadLaunchAsset(launchedUpdate!!.id)
86
+ val launchAsset = database.updateDao().loadLaunchAssetForUpdate(launchedUpdate!!.id)
87
+ if (launchAsset == null) {
88
+ this.callback!!.onFailure(Exception("Launch asset not found for update; this should never happen. Debug info: ${launchedUpdate!!.debugInfo()}"))
89
+ return
90
+ }
91
+
87
92
  if (launchAsset.relativePath == null) {
88
- throw AssertionError("Launch Asset relativePath should not be null")
93
+ this.callback!!.onFailure(Exception("Launch asset relative path should not be null. Debug info: ${launchedUpdate!!.debugInfo()}"))
89
94
  }
90
95
 
91
96
  val launchAssetFile = ensureAssetExists(launchAsset, database, context)
@@ -113,7 +118,7 @@ class DatabaseLauncher(
113
118
 
114
119
  if (assetsToDownload == 0) {
115
120
  if (this.launchAssetFile == null) {
116
- this.callback!!.onFailure(Exception("mLaunchAssetFile was immediately null; this should never happen"))
121
+ this.callback!!.onFailure(Exception("Launch asset file was null with no assets to download reported; this should never happen. Debug info: ${launchedUpdate!!.debugInfo()}"))
117
122
  } else {
118
123
  this.callback!!.onSuccess()
119
124
  }
@@ -1,6 +1,7 @@
1
1
  package expo.modules.updates.selectionpolicy
2
2
 
3
3
  import expo.modules.updates.db.entity.UpdateEntity
4
+ import expo.modules.updates.db.enums.UpdateStatus
4
5
  import org.json.JSONObject
5
6
 
6
7
  /**
@@ -50,6 +51,8 @@ class ReaperSelectionPolicyFilterAware : ReaperSelectionPolicy {
50
51
  } else if (nextNewestUpdate != null) {
51
52
  updatesToDelete.remove(nextNewestUpdate)
52
53
  }
53
- return updatesToDelete
54
+
55
+ // don't delete embedded update
56
+ return updatesToDelete.filter { it.status != UpdateStatus.EMBEDDED }
54
57
  }
55
58
  }
@@ -2,7 +2,6 @@
2
2
  "platforms": ["apple", "android"],
3
3
  "apple": {
4
4
  "modules": ["UpdatesModule"],
5
- "appDelegateSubscribers": ["ExpoUpdatesAppDelegateSubscriber"],
6
5
  "reactDelegateHandlers": ["ExpoUpdatesReactDelegateHandler"]
7
6
  },
8
7
  "android": {
@@ -1,6 +1,7 @@
1
1
  // Copyright 2018-present 650 Industries. All rights reserved.
2
2
 
3
3
  import ExpoModulesCore
4
+ import EXUpdatesInterface
4
5
 
5
6
  /**
6
7
  * Manages and controls the auto-setup behavior of expo-updates in applicable environments.
@@ -44,6 +45,13 @@ public final class ExpoUpdatesReactDelegateHandler: ExpoReactDelegateHandler, Ap
44
45
  }()
45
46
 
46
47
  public override func createBridge(reactDelegate: ExpoReactDelegate, bridgeDelegate: RCTBridgeDelegate, launchOptions: [AnyHashable: Any]?) -> RCTBridge? {
48
+ if EXAppDefines.APP_DEBUG && !UpdatesUtils.isNativeDebuggingEnabled() {
49
+ // In development builds with expo-dev-client, completes the auto-setup for development
50
+ // builds with the expo-updates integration by passing a reference to DevLauncherController
51
+ // over to the registry, which expo-dev-client can access.
52
+ UpdatesControllerRegistry.sharedInstance.controller = AppController.initializeAsDevLauncherWithoutStarting()
53
+ return nil
54
+ }
47
55
  if !shouldEnableAutoSetup {
48
56
  return nil
49
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-updates",
3
- "version": "0.24.11",
3
+ "version": "0.24.13",
4
4
  "description": "Fetches and manages remotely-hosted assets and updates to your app's JS bundle.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@expo/code-signing-certificates": "0.0.5",
43
43
  "@expo/config": "~8.5.0",
44
- "@expo/config-plugins": "~7.8.0",
44
+ "@expo/config-plugins": "~7.9.0",
45
45
  "arg": "4.1.0",
46
46
  "chalk": "^4.1.2",
47
47
  "expo-eas-client": "~0.11.0",
@@ -65,5 +65,5 @@
65
65
  "peerDependencies": {
66
66
  "expo": "*"
67
67
  },
68
- "gitHead": "6ceeb37fe2ccd9b290f9d717d9792c68487118b1"
68
+ "gitHead": "58a91cebca537b685603ca67bc51b6617b3dca80"
69
69
  }
@@ -1,18 +0,0 @@
1
- // Copyright 2022-present 650 Industries. All rights reserved.
2
-
3
- import ExpoModulesCore
4
- import EXUpdatesInterface
5
-
6
- /**
7
- * Used only in development builds with expo-dev-client; completes the auto-setup for development
8
- * builds with the expo-updates integration by passing a reference to DevLauncherController
9
- * over to the registry, which expo-dev-client can access.
10
- */
11
- public final class ExpoUpdatesAppDelegateSubscriber: ExpoAppDelegateSubscriber {
12
- public func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
13
- if EXAppDefines.APP_DEBUG && !UpdatesUtils.isNativeDebuggingEnabled() {
14
- UpdatesControllerRegistry.sharedInstance.controller = AppController.initializeAsDevLauncherWithoutStarting()
15
- }
16
- return true
17
- }
18
- }