@onekeyfe/react-native-bundle-update 1.1.43 → 1.1.45

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.
@@ -278,10 +278,17 @@ object BundleUpdateStoreAndroid {
278
278
  val nextRetryAt = taskObj.optLong("nextRetryAt", 0)
279
279
  if (nextRetryAt > 0 && nextRetryAt > now) return
280
280
 
281
- // 3. Verify scheduledEnv matches current state
281
+ // 3. Verify scheduledEnv matches current state (including buildNumber)
282
282
  val currentAppVersion = getAppVersion(context) ?: return
283
283
  if (taskObj.optString("scheduledEnvAppVersion") != currentAppVersion) return
284
284
 
285
+ val prevBuildNumber = getNativeBuildNumber(context)
286
+ val currentBuildNumber = getBuildNumber(context)
287
+ if (prevBuildNumber.isNotEmpty() && currentBuildNumber.isNotEmpty() && prevBuildNumber != currentBuildNumber) {
288
+ OneKeyLog.info("BundleUpdate", "processPreLaunchPendingTask: buildNumber changed from $prevBuildNumber to $currentBuildNumber, skipping stale task")
289
+ return
290
+ }
291
+
285
292
  val currentBV = getCurrentBundleVersion(context)
286
293
  val currentBundleVersionStr = if (currentBV != null) {
287
294
  val idx = currentBV.lastIndexOf("-")
@@ -296,7 +303,8 @@ object BundleUpdateStoreAndroid {
296
303
  val appVersion = payload.optString("appVersion")
297
304
  val bundleVersion = payload.optString("bundleVersion")
298
305
  val signature = payload.optString("signature")
299
- if (appVersion.isEmpty() || bundleVersion.isEmpty()) return
306
+ if (appVersion.isEmpty() || bundleVersion.isEmpty() || signature.isEmpty()) return
307
+ if (!isSafeVersionString(appVersion) || !isSafeVersionString(bundleVersion)) return
300
308
 
301
309
  // 5. Verify bundle directory and entry file exist
302
310
  val folderName = "$appVersion-$bundleVersion"
@@ -236,10 +236,17 @@ public class BundleUpdateStore: NSObject {
236
236
  if nextRetryAtNum.int64Value > now { return }
237
237
  }
238
238
 
239
- // 3. Verify scheduledEnv matches current state
239
+ // 3. Verify scheduledEnv matches current state (including buildNumber)
240
240
  let currentAppVersion = getCurrentNativeVersion()
241
241
  guard taskDict["scheduledEnvAppVersion"] as? String == currentAppVersion else { return }
242
242
 
243
+ let prevBuildNumber = getNativeBuildNumber() ?? ""
244
+ let currentBuildNumber = getCurrentNativeBuildNumber()
245
+ if !prevBuildNumber.isEmpty && !currentBuildNumber.isEmpty && prevBuildNumber != currentBuildNumber {
246
+ OneKeyLog.info("BundleUpdate", "processPreLaunchPendingTask: buildNumber changed from \(prevBuildNumber) to \(currentBuildNumber), skipping stale task")
247
+ return
248
+ }
249
+
243
250
  let currentBundleVersionStr: String
244
251
  if let cbv = currentBundleVersion(),
245
252
  let dashRange = cbv.range(of: "-", options: .backwards) {
@@ -254,7 +261,8 @@ public class BundleUpdateStore: NSObject {
254
261
  let appVersion = payload["appVersion"] as? String,
255
262
  let bundleVersion = payload["bundleVersion"] as? String,
256
263
  let signature = payload["signature"] as? String,
257
- !appVersion.isEmpty, !bundleVersion.isEmpty
264
+ !appVersion.isEmpty, !bundleVersion.isEmpty, !signature.isEmpty,
265
+ appVersion.isSafeVersionString, bundleVersion.isSafeVersionString
258
266
  else { return }
259
267
 
260
268
  // 5. Verify bundle directory and entry file exist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-bundle-update",
3
- "version": "1.1.43",
3
+ "version": "1.1.45",
4
4
  "description": "react-native-bundle-update",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",