@onekeyfe/react-native-background-thread 3.0.102 → 3.0.103

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.
@@ -59,7 +59,7 @@ class BackgroundThreadManager private constructor() {
59
59
  // OneKey patch: background uses the same local dev-vendor HBC as main,
60
60
  // then evaluates its own modulesOnly Metro delta in the isolated runtime.
61
61
  private data class DevVendorConfig(
62
- val commonAssetName: String,
62
+ val commonBundleLocation: String,
63
63
  val fingerprint: String,
64
64
  val backgroundHMREnabled: Boolean,
65
65
  val runtimeGeneration: Long = 0,
@@ -411,11 +411,20 @@ class BackgroundThreadManager private constructor() {
411
411
  return object : JSBundleLoader() {
412
412
  override fun loadScript(delegate: com.facebook.react.bridge.JSBundleLoaderDelegate): String {
413
413
  val totalStart = System.nanoTime()
414
- delegate.loadScriptFromAssets(
415
- appContext.assets,
416
- "assets://${config.commonAssetName}",
417
- false,
418
- )
414
+ val commonFile = File(config.commonBundleLocation)
415
+ if (commonFile.isFile) {
416
+ delegate.loadScriptFromFile(
417
+ commonFile.absolutePath,
418
+ "onekey-dev-vendor://common.hbc",
419
+ false,
420
+ )
421
+ } else {
422
+ delegate.loadScriptFromAssets(
423
+ appContext.assets,
424
+ "assets://${config.commonBundleLocation}",
425
+ false,
426
+ )
427
+ }
419
428
  val assertionFile = File(appContext.cacheDir, "onekey-dev-vendor-assert-background.js")
420
429
  val quotedEntryURL = org.json.JSONObject.quote(entryURL)
421
430
  assertionFile.writeText(
@@ -501,14 +510,14 @@ class BackgroundThreadManager private constructor() {
501
510
  fun ensureBackgroundRunnerWithDevVendor(
502
511
  context: Context,
503
512
  entryURL: String,
504
- commonAssetName: String,
513
+ commonBundleLocation: String,
505
514
  fingerprint: String,
506
515
  backgroundHMREnabled: Boolean,
507
516
  ): Boolean {
508
517
  return ensureBackgroundRunner(
509
518
  context,
510
519
  entryURL,
511
- DevVendorConfig(commonAssetName, fingerprint, backgroundHMREnabled),
520
+ DevVendorConfig(commonBundleLocation, fingerprint, backgroundHMREnabled),
512
521
  )
513
522
  }
514
523
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-background-thread",
3
- "version": "3.0.102",
3
+ "version": "3.0.103",
4
4
  "description": "react-native-background-thread",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",