@mentra/engine 3.1.0-dev.33 → 3.1.0-dev.37
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/build/engine.d.ts +2 -0
- package/build/engine.d.ts.map +1 -1
- package/build/facades/pairing.d.ts +4 -0
- package/build/facades/pairing.d.ts.map +1 -1
- package/build/facades/pairing.js +81 -7
- package/build/facades/pairing.js.map +1 -1
- package/build/generated/releaseMetadata.js +5 -5
- package/build/generated/releaseMetadata.js.map +1 -1
- package/build/react/MentraLiveOtaFlow.d.ts.map +1 -1
- package/build/react/MentraLiveOtaFlow.js +17 -0
- package/build/react/MentraLiveOtaFlow.js.map +1 -1
- package/build/react/index.d.ts +1 -1
- package/build/react/index.d.ts.map +1 -1
- package/build/react/index.js.map +1 -1
- package/build/react/useMentraLiveOta.d.ts +8 -0
- package/build/react/useMentraLiveOta.d.ts.map +1 -1
- package/build/react/useMentraLiveOta.js +39 -7
- package/build/react/useMentraLiveOta.js.map +1 -1
- package/build/services/OtaAutoChain.d.ts +3 -1
- package/build/services/OtaAutoChain.d.ts.map +1 -1
- package/build/services/OtaAutoChain.js +3 -1
- package/build/services/OtaAutoChain.js.map +1 -1
- package/build/services/OtaUpdateCheckService.d.ts +3 -0
- package/build/services/OtaUpdateCheckService.d.ts.map +1 -1
- package/build/services/OtaUpdateCheckService.js +12 -0
- package/build/services/OtaUpdateCheckService.js.map +1 -1
- package/build/services/otaReleaseVersion.d.ts +10 -0
- package/build/services/otaReleaseVersion.d.ts.map +1 -0
- package/build/services/otaReleaseVersion.js +14 -0
- package/build/services/otaReleaseVersion.js.map +1 -0
- package/package.json +6 -6
- package/src/facades/pairing.ts +88 -12
- package/src/generated/releaseMetadata.ts +5 -5
- package/src/react/MentraLiveOtaFlow.tsx +23 -0
- package/src/react/index.ts +1 -0
- package/src/react/useMentraLiveOta.ts +55 -7
- package/src/services/OtaAutoChain.ts +4 -0
- package/src/services/OtaUpdateCheckService.ts +15 -0
- package/src/services/otaReleaseVersion.ts +22 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import BluetoothSdk, {type OtaUpdateInfo} from "@mentra/bluetooth-sdk"
|
|
2
|
+
import {ENGINE_RELEASE_METADATA} from "../generated/releaseMetadata"
|
|
2
3
|
import {getGlassesSystemTimeMs, isGlassesConnected, useGlassesStore, waitForGlassesState} from "../stores/glasses"
|
|
3
4
|
import {maybeFixGlassesClockFromVersionInfo} from "./glassesClockSync"
|
|
4
5
|
import {hasConfiguredModernOtaManifestPin, resolveOtaManifestUrl} from "./otaManifestUrl"
|
|
6
|
+
import {resolveOtaReleaseVersion} from "./otaReleaseVersion"
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Phone-side mirror of ASG's `DOWNGRADE_FLOOR_VERSION_CODE`. Set to the versionCode of the first
|
|
@@ -37,6 +39,7 @@ export interface BesFirmware {
|
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
export interface VersionJson {
|
|
42
|
+
releaseVersion?: string
|
|
40
43
|
apps?: {
|
|
41
44
|
[packageName: string]: VersionInfo
|
|
42
45
|
}
|
|
@@ -65,6 +68,8 @@ export interface OtaCheckResult {
|
|
|
65
68
|
* instead of racing it with a second fetch of the same URL.
|
|
66
69
|
*/
|
|
67
70
|
manifestBody: string | null
|
|
71
|
+
/** Coordinated release identity for the selected OTA pin. */
|
|
72
|
+
releaseVersion: string | null
|
|
68
73
|
/**
|
|
69
74
|
* Why the check failed, when it did. "network" is retryable (connection/server
|
|
70
75
|
* trouble); "pin_unavailable" is permanent for this app build (manifest 404/gone,
|
|
@@ -105,6 +110,7 @@ function emptyCheckResult(skippedReason?: OtaCheckSkippedReason): OtaCheckCurren
|
|
|
105
110
|
besVersion: null,
|
|
106
111
|
isApkDowngrade: false,
|
|
107
112
|
manifestBody: null,
|
|
113
|
+
releaseVersion: null,
|
|
108
114
|
updateInfo: null,
|
|
109
115
|
isRequired: true,
|
|
110
116
|
skippedReason,
|
|
@@ -297,6 +303,7 @@ export async function checkForOtaUpdate(
|
|
|
297
303
|
besVersion: null,
|
|
298
304
|
isApkDowngrade: false,
|
|
299
305
|
manifestBody: null,
|
|
306
|
+
releaseVersion: null,
|
|
300
307
|
checkFailureReason: fetched.failureReason ?? "network",
|
|
301
308
|
}
|
|
302
309
|
}
|
|
@@ -328,6 +335,7 @@ export async function checkForOtaUpdate(
|
|
|
328
335
|
besVersion: null,
|
|
329
336
|
isApkDowngrade: false,
|
|
330
337
|
manifestBody: null,
|
|
338
|
+
releaseVersion: null,
|
|
331
339
|
checkFailureReason: "pin_unavailable",
|
|
332
340
|
}
|
|
333
341
|
}
|
|
@@ -366,6 +374,12 @@ export async function checkForOtaUpdate(
|
|
|
366
374
|
besVersion: versionJson?.bes_firmware?.version || null,
|
|
367
375
|
isApkDowngrade: apkDirection === "downgrade",
|
|
368
376
|
manifestBody: versionJson ? JSON.stringify(versionJson) : null,
|
|
377
|
+
releaseVersion: resolveOtaReleaseVersion({
|
|
378
|
+
manifestReleaseVersion: versionJson.releaseVersion,
|
|
379
|
+
manifestUrl: otaVersionUrl,
|
|
380
|
+
packagedManifestUrl: ENGINE_RELEASE_METADATA.otaManifestUrl,
|
|
381
|
+
packagedReleaseIdentity: ENGINE_RELEASE_METADATA.releaseIdentity,
|
|
382
|
+
}),
|
|
369
383
|
}
|
|
370
384
|
} catch (error) {
|
|
371
385
|
console.error("Error checking for OTA update:", error)
|
|
@@ -378,6 +392,7 @@ export async function checkForOtaUpdate(
|
|
|
378
392
|
besVersion: null,
|
|
379
393
|
isApkDowngrade: false,
|
|
380
394
|
manifestBody: null,
|
|
395
|
+
releaseVersion: null,
|
|
381
396
|
checkFailureReason: "network",
|
|
382
397
|
}
|
|
383
398
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const COORDINATED_RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-(?:dev|beta)\.[1-9]\d*)?$/
|
|
2
|
+
|
|
3
|
+
type OtaReleaseVersionInput = {
|
|
4
|
+
manifestReleaseVersion?: string | null
|
|
5
|
+
manifestUrl: string
|
|
6
|
+
packagedManifestUrl?: string | null
|
|
7
|
+
packagedReleaseIdentity?: string | null
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function validReleaseVersion(version: string | null | undefined): string | null {
|
|
11
|
+
const trimmed = version?.trim()
|
|
12
|
+
return trimmed && COORDINATED_RELEASE_VERSION.test(trimmed) ? trimmed : null
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Resolve the label for the selected OTA pin, including stable promotion of exact beta OTA bytes. */
|
|
16
|
+
export function resolveOtaReleaseVersion(input: OtaReleaseVersionInput): string | null {
|
|
17
|
+
const packagedRelease = validReleaseVersion(input.packagedReleaseIdentity)
|
|
18
|
+
if (packagedRelease && input.packagedManifestUrl?.trim() === input.manifestUrl.trim()) {
|
|
19
|
+
return packagedRelease
|
|
20
|
+
}
|
|
21
|
+
return validReleaseVersion(input.manifestReleaseVersion)
|
|
22
|
+
}
|