pulse-updates 1.0.4 → 1.0.5

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.
@@ -609,13 +609,19 @@ class PulseController private constructor() {
609
609
  private fun loadEmbeddedManifest() {
610
610
  val ctx = context ?: return
611
611
 
612
- try {
613
- val json = ctx.assets.open("embedded-manifest.json").bufferedReader().use { it.readText() }
614
- embeddedManifest = EmbeddedManifest.fromJson(json)
615
- pulseLog(TAG, "Loaded embedded manifest: ${embeddedManifest?.updateId}")
616
- } catch (e: Exception) {
617
- pulseLog(TAG, "No embedded manifest found")
612
+ // Try pulse/ subdirectory first, then root
613
+ val paths = listOf("pulse/embedded-manifest.json", "embedded-manifest.json")
614
+ for (path in paths) {
615
+ try {
616
+ val json = ctx.assets.open(path).bufferedReader().use { it.readText() }
617
+ embeddedManifest = EmbeddedManifest.fromJson(json)
618
+ pulseLog(TAG, "Loaded embedded manifest from $path: ${embeddedManifest?.updateId}")
619
+ return
620
+ } catch (e: Exception) {
621
+ // Try next path
622
+ }
618
623
  }
624
+ pulseLog(TAG, "No embedded manifest found")
619
625
  }
620
626
 
621
627
  private fun seedEmbeddedUpdateIfNeeded() {
@@ -323,13 +323,18 @@ class PulseAppLauncher(
323
323
  // MARK: - Embedded Manifest
324
324
 
325
325
  private fun loadEmbeddedManifest(): EmbeddedManifest? {
326
- return try {
327
- val json = context.assets.open("embedded-manifest.json").bufferedReader().use { it.readText() }
328
- EmbeddedManifest.fromJson(json)
329
- } catch (e: Exception) {
330
- pulseLogWarn(TAG, "No embedded manifest found: ${e.message}")
331
- null
326
+ // Try pulse/ subdirectory first, then root
327
+ val paths = listOf("pulse/embedded-manifest.json", "embedded-manifest.json")
328
+ for (path in paths) {
329
+ try {
330
+ val json = context.assets.open(path).bufferedReader().use { it.readText() }
331
+ return EmbeddedManifest.fromJson(json)
332
+ } catch (e: Exception) {
333
+ // Try next path
334
+ }
332
335
  }
336
+ pulseLogWarn(TAG, "No embedded manifest found")
337
+ return null
333
338
  }
334
339
 
335
340
  // MARK: - Crypto
@@ -561,7 +561,9 @@ public final class PulseController {
561
561
  }
562
562
 
563
563
  private func loadEmbeddedManifest() {
564
- guard let url = Bundle.main.url(forResource: "embedded-manifest", withExtension: "json"),
564
+ // Try pulse/ subdirectory first, then root
565
+ guard let url = Bundle.main.url(forResource: "embedded-manifest", withExtension: "json", subdirectory: "pulse")
566
+ ?? Bundle.main.url(forResource: "embedded-manifest", withExtension: "json"),
565
567
  let data = try? Data(contentsOf: url),
566
568
  let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any] else {
567
569
  pulseLog("No embedded manifest found")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pulse-updates",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "OTA updates for React Native - lightweight alternative to expo-updates",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",