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
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
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
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
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
|
-
|
|
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")
|