@mentra/engine 3.5.0-dev.1465 → 3.5.0-dev.1466
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/generated/releaseMetadata.js +5 -5
- package/build/generated/releaseMetadata.js.map +1 -1
- package/build/react/useMentraLiveOta.d.ts.map +1 -1
- package/build/react/useMentraLiveOta.js +15 -3
- package/build/react/useMentraLiveOta.js.map +1 -1
- package/build/services/HotspotOtaTransport.d.ts.map +1 -1
- package/build/services/HotspotOtaTransport.js +1 -0
- package/build/services/HotspotOtaTransport.js.map +1 -1
- package/build/services/asg/gallerySyncService.d.ts.map +1 -1
- package/build/services/asg/gallerySyncService.js +3 -0
- package/build/services/asg/gallerySyncService.js.map +1 -1
- package/build/services/asg/localNetworkTransport.d.ts +2 -0
- package/build/services/asg/localNetworkTransport.d.ts.map +1 -1
- package/build/services/asg/localNetworkTransport.js +1 -1
- package/build/services/asg/localNetworkTransport.js.map +1 -1
- package/build/stores/gallerySync.d.ts +2 -0
- package/build/stores/gallerySync.d.ts.map +1 -1
- package/build/stores/gallerySync.js.map +1 -1
- package/build/stores/glasses.d.ts +1 -0
- package/build/stores/glasses.d.ts.map +1 -1
- package/build/stores/glasses.js +13 -3
- package/build/stores/glasses.js.map +1 -1
- package/package.json +8 -8
- package/src/generated/releaseMetadata.ts +5 -5
- package/src/react/useMentraLiveOta.ts +12 -2
- package/src/services/HotspotOtaTransport.ts +1 -0
- package/src/services/asg/gallerySyncService.ts +3 -0
- package/src/services/asg/localNetworkTransport.ts +3 -0
- package/src/stores/gallerySync.ts +2 -0
- package/src/stores/glasses.ts +14 -2
|
@@ -19,6 +19,8 @@ export declare const localNetworkTransport: {
|
|
|
19
19
|
connect(caller: symbol, ssid: string, password: string, options?: {
|
|
20
20
|
assertCurrent?: () => void;
|
|
21
21
|
gateway?: string;
|
|
22
|
+
/** The hotspot's channel in MHz, when the glasses report it: a Mac then scans only that channel. */
|
|
23
|
+
frequency?: number;
|
|
22
24
|
purpose?: "outgoing-client" | "incoming-server";
|
|
23
25
|
/** iOS: the join has waited a few seconds for Local Network access, which may have been denied. */
|
|
24
26
|
onPermissionRequired?: (systemAnswer: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localNetworkTransport.d.ts","sourceRoot":"","sources":["../../../src/services/asg/localNetworkTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,6BAA6B,CAAA;AAMnD,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAA;AAC9D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,CAAA;AAU1D,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE;QAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAC,CAAA;CACvD,CAAA;AAmCD,uFAAuF;AACvF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,wBAAwB,CAoCjF;AAED,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,GAAG,OAAO,CAEzF;AAuBD,eAAO,MAAM,qBAAqB;oCACF,OAAO;oCACP,OAAO;oBAG3B,MAAM,QACR,MAAM,YACF,MAAM,YACN;QACR,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;QAC1B,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE,iBAAiB,GAAG,iBAAiB,CAAA;QAC/C,mGAAmG;QACnG,oBAAoB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAA;KACtD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AA4B,OAAO,CAAC,IAAI,CAAC;eAevD,MAAM,GAAG,GAAG,GAAG,OAAO,SAAS,WAAW,uBAAuB,OAAO,CAAC,QAAQ,CAAC;0BA8B7E,eAAe,GAAG,cAAc;wBA8DlC,MAAM,GAAG,IAAI;CASlC,CAAA"}
|
|
@@ -126,7 +126,7 @@ export const localNetworkTransport = {
|
|
|
126
126
|
options?.onPermissionRequired?.(systemAnswer);
|
|
127
127
|
});
|
|
128
128
|
try {
|
|
129
|
-
const address = await glassesHotspot.join(owner, ssid, password, options?.gateway, options?.purpose ?? "outgoing-client");
|
|
129
|
+
const address = await glassesHotspot.join(owner, ssid, password, options?.gateway, options?.purpose ?? "outgoing-client", options?.frequency);
|
|
130
130
|
assertCurrent();
|
|
131
131
|
return address;
|
|
132
132
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localNetworkTransport.js","sourceRoot":"","sources":["../../../src/services/asg/localNetworkTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,6BAA6B,CAAA;AACnD,OAAO,EAAC,eAAe,EAAuC,MAAM,qCAAqC,CAAA;AACzG,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAA;AAKrC,IAAI,oBAAoB,GAAG,CAAC,CAAA;AAC5B,IAAI,sBAAsB,GAAG,KAAK,CAAA;AAClC,IAAI,SAAS,GAAG,SAAS,CAAA;AACzB,MAAM,UAAU,GAAG,IAAI,GAAG,EAAkB,CAAA;AAC5C,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAAU,CAAA;AAC7C,wFAAwF;AACxF,IAAI,eAAe,GAA8C,IAAI,CAAA;AASrE,2FAA2F;AAC3F,kFAAkF;AAClF,+FAA+F;AAC/F,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IAClC,gDAAgD;IA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CAAA","sourcesContent":["import * as RNFS from \"@dr.pogodin/react-native-fs\"\nimport {otaLocalNetwork, type OtaLocalNetworkDownloadProgress} from \"@mentra/bluetooth-sdk/ota-transport\"\nimport {glassesHotspot} from \"@mentra/glasses-media\"\nimport {Buffer} from \"buffer\"\nimport {Platform} from \"react-native\"\n\ntype DownloadOptions = Parameters<typeof RNFS.downloadFile>[0]\ntype DownloadHandle = ReturnType<typeof RNFS.downloadFile>\n\nlet connectionGeneration = 0\nlet scopedConnectionActive = false\nlet nextJobId = 1_000_000\nconst nativeJobs = new Map<number, string>()\nconst cancelledNativeJobs = new Set<number>()\n// iOS joins through the shared native owner that also serves Mentra Call and the relay.\nlet iosHotspotOwner: {caller: symbol; nativeId: string} | null = null\n\nexport type LocalNetworkErrorDetails = {\n code?: string | number\n domain?: string\n message?: string\n underlying?: {code?: string | number; domain?: string}\n}\n\n// Existing native builds wrap these app-authored LocalMediaError causes in ERR_UNEXPECTED.\n// Expo keeps the cause in Error.message, but normal Error serialization omits it.\n// Recover only exact owned causes, never arbitrary NSError descriptions or network identities.\nconst legacyHotspotCauses = new Set([\n \"Previous hotspot session has not been released\",\n \"Previous hotspot session has not finished cleaning up\",\n \"Invalid hotspot access purpose\",\n \"The glasses reported an invalid hotspot gateway\",\n \"The glasses did not report their hotspot gateway\",\n \"The glasses hotspot is already in use\",\n \"Hotspot join timed out\",\n \"Hotspot join cancelled\",\n \"Location access is required to identify the glasses hotspot on Mac\",\n \"Mac hotspot Location authorization is unavailable\",\n \"Location access is required to verify the current Mac Wi-Fi network\",\n \"Mac Wi-Fi did not associate with the requested glasses hotspot\",\n \"Mac Wi-Fi framework is unavailable\",\n \"Mac Wi-Fi interface is unavailable\",\n \"Mac Wi-Fi interface does not support hotspot association\",\n \"Mac Wi-Fi interface has no identity\",\n \"Mac Wi-Fi interface disappeared during association\",\n \"The requested glasses hotspot was not found by Mac Wi-Fi\",\n \"Mac Wi-Fi has no verified glasses hotspot address\",\n \"Local connection to the glasses timed out\",\n])\n\nfunction legacyHotspotCause(message: string): string | undefined {\n if (message.length > 2048) return undefined\n const cause = message.split(\"\\n→ Caused by: \").at(-1)!\n if (legacyHotspotCauses.has(cause)) return cause\n return /^Mac Wi-Fi (scan|association) failed \\([A-Za-z0-9_.-]{1,128}, -?\\d{1,12}\\)$/.test(cause) ? cause : undefined\n}\n\n/** Keep native connection facts ahead of large stacks and private NSError userInfo. */\nexport function localNetworkErrorDetails(error: unknown): LocalNetworkErrorDetails {\n const facts = (value: unknown): {code?: string | number; domain?: string} => {\n if (!value || typeof value !== \"object\") return {}\n const {code, domain} = value as {code?: unknown; domain?: unknown}\n return {\n ...(typeof code === \"number\" && Number.isFinite(code)\n ? {code}\n : typeof code === \"string\" && /^[A-Za-z0-9_.-]{1,128}$/.test(code)\n ? {code}\n : {}),\n ...(typeof domain === \"string\" && /^[A-Za-z0-9_.-]{1,128}$/.test(domain) ? {domain} : {}),\n }\n }\n const details = facts(error)\n const message = error && typeof error === \"object\" && \"message\" in error && typeof error.message === \"string\"\n ? error.message\n : undefined\n const hotspotMessage =\n typeof details.code === \"string\" &&\n [\"ERR_HOTSPOT_JOIN\", \"ERR_HOTSPOT_CANCELLED\", \"ERR_HOTSPOT_NATIVE\", \"ERR_HOTSPOT_USER_DENIED\"].includes(\n details.code,\n ) &&\n message !== undefined\n ? message.replace(/[\\u0000-\\u001f\\u007f-\\u009f]/g, \"\").slice(0, 512)\n : details.code === \"ERR_UNEXPECTED\" && message !== undefined ? legacyHotspotCause(message) : undefined\n const userInfo = (error as {userInfo?: unknown} | null | undefined)?.userInfo\n const underlying = facts(\n userInfo && typeof userInfo === \"object\"\n ? (userInfo as {NSUnderlyingError?: unknown}).NSUnderlyingError\n : undefined,\n )\n return {\n ...details,\n ...(hotspotMessage ? {message: hotspotMessage} : {}),\n ...(Object.keys(underlying).length ? {underlying} : {}),\n }\n}\n\nexport function shouldUseScopedLocalNetwork(os: string, moduleAvailable: boolean): boolean {\n return os === \"android\" && moduleAvailable\n}\n\nfunction supportsScopedConnection(): boolean {\n return shouldUseScopedLocalNetwork(Platform.OS, otaLocalNetwork.isAvailable())\n}\n\nfunction normalizeHeaders(headers?: HeadersInit): Record<string, string> {\n if (!headers) return {}\n if (headers instanceof Headers) {\n const result: Record<string, string> = {}\n headers.forEach((value, key) => {\n result[key] = value\n })\n return result\n }\n if (Array.isArray(headers)) return Object.fromEntries(headers)\n return {...headers}\n}\n\nfunction requestId(prefix: string): string {\n return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2)}`\n}\n\nexport const localNetworkTransport = {\n supportsScopedConnection: (): boolean => supportsScopedConnection(),\n isScopedConnectionActive: (): boolean => scopedConnectionActive,\n\n async connect(\n caller: symbol,\n ssid: string,\n password: string,\n options?: {\n assertCurrent?: () => void\n gateway?: string\n purpose?: \"outgoing-client\" | \"incoming-server\"\n /** iOS: the join has waited a few seconds for Local Network access, which may have been denied. */\n onPermissionRequired?: (systemAnswer: string) => void\n },\n ): Promise<string | undefined> {\n const isIos = Platform.OS === \"ios\"\n if (isIos && iosHotspotOwner) throw new Error(\"Previous hotspot session has not been released\")\n const generation = ++connectionGeneration\n const assertCurrent = () => {\n if (generation !== connectionGeneration) throw new Error(\"Local network connection was superseded\")\n options?.assertCurrent?.()\n }\n assertCurrent()\n scopedConnectionActive = false\n nativeJobs.clear()\n if (isIos) {\n // The native join asks iOS again when its scan misses the hotspot and resolves only\n // with the phone's verified address on it.\n const owner = requestId(\"ios_hotspot\")\n iosHotspotOwner = {caller, nativeId: owner}\n const permission = glassesHotspot.onPermissionRequired((id, systemAnswer) => {\n if (id === owner) options?.onPermissionRequired?.(systemAnswer)\n })\n try {\n const address = await glassesHotspot.join(\n owner,\n ssid,\n password,\n options?.gateway,\n options?.purpose ?? \"outgoing-client\",\n )\n assertCurrent()\n return address\n } catch (error) {\n try {\n await glassesHotspot.leave(owner)\n } catch (cleanupError) {\n console.warn(\"[LocalNetworkTransport] hotspot cleanup failed\", localNetworkErrorDetails(cleanupError))\n throw error\n }\n if (iosHotspotOwner?.nativeId === owner) iosHotspotOwner = null\n throw error\n } finally {\n permission.remove()\n }\n }\n if (!supportsScopedConnection()) throw new Error(\"The glasses hotspot cannot be joined on this platform\")\n const result = await otaLocalNetwork.connect(ssid, password, options?.purpose === \"incoming-server\")\n scopedConnectionActive = true\n return result.localAddress\n },\n\n async disconnect(caller: symbol, waitForInternet = false): Promise<void> {\n if (iosHotspotOwner && iosHotspotOwner.caller !== caller) return\n connectionGeneration += 1\n if (iosHotspotOwner) {\n const owner = iosHotspotOwner.nativeId\n await glassesHotspot.leave(owner, waitForInternet)\n if (iosHotspotOwner?.nativeId === owner) iosHotspotOwner = null\n }\n if (supportsScopedConnection()) {\n await otaLocalNetwork.disconnect()\n }\n scopedConnectionActive = false\n nativeJobs.clear()\n },\n\n async fetch(url: string | URL | Request, init?: RequestInit, timeoutMs = 30_000): Promise<Response> {\n if (!scopedConnectionActive || !otaLocalNetwork.isAvailable() || typeof url !== \"string\") {\n return globalThis.fetch(url, init)\n }\n\n const nativeModule = otaLocalNetwork\n const id = requestId(\"request\")\n const signal = init?.signal\n const cancel = () => void nativeModule.cancel(id)\n if (signal?.aborted) throw new Error(\"Request aborted\")\n signal?.addEventListener(\"abort\", cancel, {once: true})\n try {\n const result = await nativeModule.request(\n id,\n url,\n init?.method || \"GET\",\n normalizeHeaders(init?.headers),\n typeof init?.body === \"string\" ? init.body : null,\n timeoutMs,\n )\n const bytes = Buffer.from(result.bodyBase64, \"base64\")\n return new Response(bytes as unknown as BodyInit, {\n status: result.status,\n headers: result.headers,\n })\n } finally {\n signal?.removeEventListener(\"abort\", cancel)\n }\n },\n\n downloadFile(options: DownloadOptions): DownloadHandle {\n if (!scopedConnectionActive || !otaLocalNetwork.isAvailable()) return RNFS.downloadFile(options)\n\n const jobId = nextJobId++\n const id = requestId(\"download\")\n let began = false\n nativeJobs.set(jobId, id)\n const subscription = otaLocalNetwork.onDownloadProgress((event: OtaLocalNetworkDownloadProgress) => {\n if (event.requestId !== id) return\n if (!began) {\n began = true\n options.begin?.({\n jobId,\n statusCode: event.statusCode || 200,\n contentLength: event.contentLength,\n headers: event.headers || {},\n })\n }\n options.progress?.({\n jobId,\n contentLength: event.contentLength,\n bytesWritten: event.bytesWritten,\n })\n })\n\n const promise = otaLocalNetwork\n .download(\n id,\n options.fromUrl,\n options.toFile,\n options.headers || {},\n options.connectionTimeout || 30_000,\n options.readTimeout || 30_000,\n )\n .then((result) => {\n if (!began) {\n options.begin?.({\n jobId,\n statusCode: result.statusCode,\n contentLength: result.bytesWritten,\n headers: result.headers,\n })\n }\n return {\n jobId,\n statusCode: result.statusCode,\n bytesWritten: result.bytesWritten,\n }\n })\n .catch((error) => {\n if (cancelledNativeJobs.has(jobId)) throw new Error(\"Sync cancelled\")\n throw error\n })\n .finally(() => {\n nativeJobs.delete(jobId)\n cancelledNativeJobs.delete(jobId)\n subscription.remove()\n })\n\n return {jobId, promise} as DownloadHandle\n },\n\n stopDownload(jobId: number): void {\n const nativeId = nativeJobs.get(jobId)\n if (nativeId && otaLocalNetwork.isAvailable()) {\n cancelledNativeJobs.add(jobId)\n void otaLocalNetwork.cancel(nativeId)\n return\n }\n RNFS.stopDownload(jobId)\n },\n}\n\notaLocalNetwork.onNetworkLost(() => {\n scopedConnectionActive = false\n nativeJobs.clear()\n})\n"]}
|
|
1
|
+
{"version":3,"file":"localNetworkTransport.js","sourceRoot":"","sources":["../../../src/services/asg/localNetworkTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,6BAA6B,CAAA;AACnD,OAAO,EAAC,eAAe,EAAuC,MAAM,qCAAqC,CAAA;AACzG,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAA;AAKrC,IAAI,oBAAoB,GAAG,CAAC,CAAA;AAC5B,IAAI,sBAAsB,GAAG,K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;YAC9C,mBAAmB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;YAC9B,KAAK,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;YACrC,OAAM;QACR,CAAC;QACD,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;IAC1B,CAAC;CACF,CAAA;AAED,eAAe,CAAC,aAAa,CAAC,GAAG,EAAE;IACjC,sBAAsB,GAAG,KAAK,CAAA;IAC9B,UAAU,CAAC,KAAK,EAAE,CAAA;AACpB,CAAC,CAAC,CAAA","sourcesContent":["import * as RNFS from \"@dr.pogodin/react-native-fs\"\nimport {otaLocalNetwork, type OtaLocalNetworkDownloadProgress} from \"@mentra/bluetooth-sdk/ota-transport\"\nimport {glassesHotspot} from \"@mentra/glasses-media\"\nimport {Buffer} from \"buffer\"\nimport {Platform} from \"react-native\"\n\ntype DownloadOptions = Parameters<typeof RNFS.downloadFile>[0]\ntype DownloadHandle = ReturnType<typeof RNFS.downloadFile>\n\nlet connectionGeneration = 0\nlet scopedConnectionActive = false\nlet nextJobId = 1_000_000\nconst nativeJobs = new Map<number, string>()\nconst cancelledNativeJobs = new Set<number>()\n// iOS joins through the shared native owner that also serves Mentra Call and the relay.\nlet iosHotspotOwner: {caller: symbol; nativeId: string} | null = null\n\nexport type LocalNetworkErrorDetails = {\n code?: string | number\n domain?: string\n message?: string\n underlying?: {code?: string | number; domain?: string}\n}\n\n// Existing native builds wrap these app-authored LocalMediaError causes in ERR_UNEXPECTED.\n// Expo keeps the cause in Error.message, but normal Error serialization omits it.\n// Recover only exact owned causes, never arbitrary NSError descriptions or network identities.\nconst legacyHotspotCauses = new Set([\n \"Previous hotspot session has not been released\",\n \"Previous hotspot session has not finished cleaning up\",\n \"Invalid hotspot access purpose\",\n \"The glasses reported an invalid hotspot gateway\",\n \"The glasses did not report their hotspot gateway\",\n \"The glasses hotspot is already in use\",\n \"Hotspot join timed out\",\n \"Hotspot join cancelled\",\n \"Location access is required to identify the glasses hotspot on Mac\",\n \"Mac hotspot Location authorization is unavailable\",\n \"Location access is required to verify the current Mac Wi-Fi network\",\n \"Mac Wi-Fi did not associate with the requested glasses hotspot\",\n \"Mac Wi-Fi framework is unavailable\",\n \"Mac Wi-Fi interface is unavailable\",\n \"Mac Wi-Fi interface does not support hotspot association\",\n \"Mac Wi-Fi interface has no identity\",\n \"Mac Wi-Fi interface disappeared during association\",\n \"The requested glasses hotspot was not found by Mac Wi-Fi\",\n \"Mac Wi-Fi has no verified glasses hotspot address\",\n \"Local connection to the glasses timed out\",\n])\n\nfunction legacyHotspotCause(message: string): string | undefined {\n if (message.length > 2048) return undefined\n const cause = message.split(\"\\n→ Caused by: \").at(-1)!\n if (legacyHotspotCauses.has(cause)) return cause\n return /^Mac Wi-Fi (scan|association) failed \\([A-Za-z0-9_.-]{1,128}, -?\\d{1,12}\\)$/.test(cause) ? cause : undefined\n}\n\n/** Keep native connection facts ahead of large stacks and private NSError userInfo. */\nexport function localNetworkErrorDetails(error: unknown): LocalNetworkErrorDetails {\n const facts = (value: unknown): {code?: string | number; domain?: string} => {\n if (!value || typeof value !== \"object\") return {}\n const {code, domain} = value as {code?: unknown; domain?: unknown}\n return {\n ...(typeof code === \"number\" && Number.isFinite(code)\n ? {code}\n : typeof code === \"string\" && /^[A-Za-z0-9_.-]{1,128}$/.test(code)\n ? {code}\n : {}),\n ...(typeof domain === \"string\" && /^[A-Za-z0-9_.-]{1,128}$/.test(domain) ? {domain} : {}),\n }\n }\n const details = facts(error)\n const message = error && typeof error === \"object\" && \"message\" in error && typeof error.message === \"string\"\n ? error.message\n : undefined\n const hotspotMessage =\n typeof details.code === \"string\" &&\n [\"ERR_HOTSPOT_JOIN\", \"ERR_HOTSPOT_CANCELLED\", \"ERR_HOTSPOT_NATIVE\", \"ERR_HOTSPOT_USER_DENIED\"].includes(\n details.code,\n ) &&\n message !== undefined\n ? message.replace(/[\\u0000-\\u001f\\u007f-\\u009f]/g, \"\").slice(0, 512)\n : details.code === \"ERR_UNEXPECTED\" && message !== undefined ? legacyHotspotCause(message) : undefined\n const userInfo = (error as {userInfo?: unknown} | null | undefined)?.userInfo\n const underlying = facts(\n userInfo && typeof userInfo === \"object\"\n ? (userInfo as {NSUnderlyingError?: unknown}).NSUnderlyingError\n : undefined,\n )\n return {\n ...details,\n ...(hotspotMessage ? {message: hotspotMessage} : {}),\n ...(Object.keys(underlying).length ? {underlying} : {}),\n }\n}\n\nexport function shouldUseScopedLocalNetwork(os: string, moduleAvailable: boolean): boolean {\n return os === \"android\" && moduleAvailable\n}\n\nfunction supportsScopedConnection(): boolean {\n return shouldUseScopedLocalNetwork(Platform.OS, otaLocalNetwork.isAvailable())\n}\n\nfunction normalizeHeaders(headers?: HeadersInit): Record<string, string> {\n if (!headers) return {}\n if (headers instanceof Headers) {\n const result: Record<string, string> = {}\n headers.forEach((value, key) => {\n result[key] = value\n })\n return result\n }\n if (Array.isArray(headers)) return Object.fromEntries(headers)\n return {...headers}\n}\n\nfunction requestId(prefix: string): string {\n return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2)}`\n}\n\nexport const localNetworkTransport = {\n supportsScopedConnection: (): boolean => supportsScopedConnection(),\n isScopedConnectionActive: (): boolean => scopedConnectionActive,\n\n async connect(\n caller: symbol,\n ssid: string,\n password: string,\n options?: {\n assertCurrent?: () => void\n gateway?: string\n /** The hotspot's channel in MHz, when the glasses report it: a Mac then scans only that channel. */\n frequency?: number\n purpose?: \"outgoing-client\" | \"incoming-server\"\n /** iOS: the join has waited a few seconds for Local Network access, which may have been denied. */\n onPermissionRequired?: (systemAnswer: string) => void\n },\n ): Promise<string | undefined> {\n const isIos = Platform.OS === \"ios\"\n if (isIos && iosHotspotOwner) throw new Error(\"Previous hotspot session has not been released\")\n const generation = ++connectionGeneration\n const assertCurrent = () => {\n if (generation !== connectionGeneration) throw new Error(\"Local network connection was superseded\")\n options?.assertCurrent?.()\n }\n assertCurrent()\n scopedConnectionActive = false\n nativeJobs.clear()\n if (isIos) {\n // The native join asks iOS again when its scan misses the hotspot and resolves only\n // with the phone's verified address on it.\n const owner = requestId(\"ios_hotspot\")\n iosHotspotOwner = {caller, nativeId: owner}\n const permission = glassesHotspot.onPermissionRequired((id, systemAnswer) => {\n if (id === owner) options?.onPermissionRequired?.(systemAnswer)\n })\n try {\n const address = await glassesHotspot.join(\n owner,\n ssid,\n password,\n options?.gateway,\n options?.purpose ?? \"outgoing-client\",\n options?.frequency,\n )\n assertCurrent()\n return address\n } catch (error) {\n try {\n await glassesHotspot.leave(owner)\n } catch (cleanupError) {\n console.warn(\"[LocalNetworkTransport] hotspot cleanup failed\", localNetworkErrorDetails(cleanupError))\n throw error\n }\n if (iosHotspotOwner?.nativeId === owner) iosHotspotOwner = null\n throw error\n } finally {\n permission.remove()\n }\n }\n if (!supportsScopedConnection()) throw new Error(\"The glasses hotspot cannot be joined on this platform\")\n const result = await otaLocalNetwork.connect(ssid, password, options?.purpose === \"incoming-server\")\n scopedConnectionActive = true\n return result.localAddress\n },\n\n async disconnect(caller: symbol, waitForInternet = false): Promise<void> {\n if (iosHotspotOwner && iosHotspotOwner.caller !== caller) return\n connectionGeneration += 1\n if (iosHotspotOwner) {\n const owner = iosHotspotOwner.nativeId\n await glassesHotspot.leave(owner, waitForInternet)\n if (iosHotspotOwner?.nativeId === owner) iosHotspotOwner = null\n }\n if (supportsScopedConnection()) {\n await otaLocalNetwork.disconnect()\n }\n scopedConnectionActive = false\n nativeJobs.clear()\n },\n\n async fetch(url: string | URL | Request, init?: RequestInit, timeoutMs = 30_000): Promise<Response> {\n if (!scopedConnectionActive || !otaLocalNetwork.isAvailable() || typeof url !== \"string\") {\n return globalThis.fetch(url, init)\n }\n\n const nativeModule = otaLocalNetwork\n const id = requestId(\"request\")\n const signal = init?.signal\n const cancel = () => void nativeModule.cancel(id)\n if (signal?.aborted) throw new Error(\"Request aborted\")\n signal?.addEventListener(\"abort\", cancel, {once: true})\n try {\n const result = await nativeModule.request(\n id,\n url,\n init?.method || \"GET\",\n normalizeHeaders(init?.headers),\n typeof init?.body === \"string\" ? init.body : null,\n timeoutMs,\n )\n const bytes = Buffer.from(result.bodyBase64, \"base64\")\n return new Response(bytes as unknown as BodyInit, {\n status: result.status,\n headers: result.headers,\n })\n } finally {\n signal?.removeEventListener(\"abort\", cancel)\n }\n },\n\n downloadFile(options: DownloadOptions): DownloadHandle {\n if (!scopedConnectionActive || !otaLocalNetwork.isAvailable()) return RNFS.downloadFile(options)\n\n const jobId = nextJobId++\n const id = requestId(\"download\")\n let began = false\n nativeJobs.set(jobId, id)\n const subscription = otaLocalNetwork.onDownloadProgress((event: OtaLocalNetworkDownloadProgress) => {\n if (event.requestId !== id) return\n if (!began) {\n began = true\n options.begin?.({\n jobId,\n statusCode: event.statusCode || 200,\n contentLength: event.contentLength,\n headers: event.headers || {},\n })\n }\n options.progress?.({\n jobId,\n contentLength: event.contentLength,\n bytesWritten: event.bytesWritten,\n })\n })\n\n const promise = otaLocalNetwork\n .download(\n id,\n options.fromUrl,\n options.toFile,\n options.headers || {},\n options.connectionTimeout || 30_000,\n options.readTimeout || 30_000,\n )\n .then((result) => {\n if (!began) {\n options.begin?.({\n jobId,\n statusCode: result.statusCode,\n contentLength: result.bytesWritten,\n headers: result.headers,\n })\n }\n return {\n jobId,\n statusCode: result.statusCode,\n bytesWritten: result.bytesWritten,\n }\n })\n .catch((error) => {\n if (cancelledNativeJobs.has(jobId)) throw new Error(\"Sync cancelled\")\n throw error\n })\n .finally(() => {\n nativeJobs.delete(jobId)\n cancelledNativeJobs.delete(jobId)\n subscription.remove()\n })\n\n return {jobId, promise} as DownloadHandle\n },\n\n stopDownload(jobId: number): void {\n const nativeId = nativeJobs.get(jobId)\n if (nativeId && otaLocalNetwork.isAvailable()) {\n cancelledNativeJobs.add(jobId)\n void otaLocalNetwork.cancel(nativeId)\n return\n }\n RNFS.stopDownload(jobId)\n },\n}\n\notaLocalNetwork.onNetworkLost(() => {\n scopedConnectionActive = false\n nativeJobs.clear()\n})\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gallerySync.d.ts","sourceRoot":"","sources":["../../src/stores/gallerySync.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,CAAA;IAEtB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAGD,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,oBAAoB,GACpB,iBAAiB,GACjB,WAAW,GACX,SAAS,GACT,UAAU,GACV,OAAO,GACP,WAAW,CAAA;AAEf,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,EAAE,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"gallerySync.d.ts","sourceRoot":"","sources":["../../src/stores/gallerySync.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,cAAc,CAAC,EAAE,M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KAAK,CAAC,SAAS,KAAK,WAAW;IAC/B,KAAK,CAAC,SAAS,KAAK,oBAAoB;IACxC,KAAK,CAAC,SAAS,KAAK,iBAAiB,CAAA;AAEvC,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,KAAuB,EAAE,EAAE,CAAC,CAAC;IACtE,KAAK,EAAE,KAAK,CAAC,yBAAyB;IACtC,MAAM,EAAE,KAAK,CAAC,iBAAiB;IAC/B,MAAM,EAAE,KAAK,CAAC,iBAAiB;IAC/B,KAAK,EAAE,KAAK,CAAC,iBAAiB;IAC9B,UAAU,EAAE,KAAK,CAAC,iBAAiB;CACpC,CAAC,CAAA","sourcesContent":["/**\n * Gallery Sync Store\n * Manages gallery sync state independently of UI lifecycle\n */\n\nimport {create} from \"zustand\"\nimport {subscribeWithSelector} from \"zustand/middleware\"\n\n// Relocated from the host @/types/asg so this store is self-contained inside\n// engine. The host barrel re-exports this (a shim), so its importers are unchanged.\nexport interface PhotoInfo {\n name: string\n url: string\n download: string\n size: number\n modified: string | number // Unix timestamp (milliseconds) - can be string or number from API\n mime_type?: string\n is_video?: boolean\n thumbnail_data?: string\n downloaded_at?: number\n // Video duration in milliseconds (from glasses sync response)\n duration?: number\n // New fields for filesystem storage\n filePath?: string\n thumbnailPath?: string\n // Glasses model that captured this media\n glassesModel?: string\n}\n\n// Sync state machine states\nexport type SyncState =\n | \"idle\"\n | \"requesting_hotspot\"\n | \"connecting_wifi\"\n | \"preparing\"\n | \"syncing\"\n | \"complete\"\n | \"error\"\n | \"cancelled\"\n\nexport interface HotspotInfo {\n ssid: string\n password: string\n ip: string\n}\n\nexport interface SyncQueue {\n files: PhotoInfo[]\n currentIndex: number\n startedAt: number\n hotspotInfo: HotspotInfo\n}\n\nexport interface GallerySyncInfo {\n // State machine\n syncState: SyncState\n syncStarting: boolean\n\n // Progress tracking\n currentFile: string | null\n currentFileProgress: number // 0-100\n completedFiles: number\n totalFiles: number\n failedFiles: string[]\n\n // Queue (persisted separately via localStorageService)\n queue: PhotoInfo[]\n queueIndex: number\n\n // Hotspot info\n hotspotInfo: HotspotInfo | null\n syncServiceOpenedHotspot: boolean\n\n // Gallery status from glasses\n glassesGalleryStatusKnown: boolean\n glassesPhotoCount: number\n glassesVideoCount: number\n glassesTotalCount: number\n glassesHasContent: boolean\n\n // Error tracking\n lastError: string | null\n}\n\nexport interface GallerySyncState extends GallerySyncInfo {\n // State transitions\n setSyncState: (state: SyncState) => void\n setSyncStarting: (starting: boolean) => void\n setRequestingHotspot: () => void\n setConnectingWifi: () => void\n setSyncing: (files: PhotoInfo[]) => void\n setSyncComplete: () => void\n setSyncError: (error: string) => void\n setSyncCancelled: () => void\n\n // Progress updates\n setCurrentFile: (fileName: string | null, progress: number) => void\n onFileProgress: (fileName: string, progress: number) => void\n onFileComplete: (fileName: string) => void\n onFileFailed: (fileName: string, error?: string) => void\n onFileProcessing: (fileName: string) => void\n onFileProcessed: (fileName: string) => void\n updateFileInQueue: (fileName: string, updatedFile: PhotoInfo) => void\n removeFilesFromQueue: (fileNames: string[]) => void\n\n // Processing queue tracking\n processingFiles: Set<string>\n processedFiles: number\n\n // Hotspot management\n setHotspotInfo: (info: HotspotInfo | null) => void\n setSyncServiceOpenedHotspot: (opened: boolean) => void\n\n // Gallery status from glasses\n setGlassesGalleryStatus: (photos: number, videos: number, total: number, hasContent: boolean) => void\n clearGlassesGalleryStatus: () => void\n\n // Queue management (for resume)\n setQueue: (files: PhotoInfo[], startIndex?: number) => void\n advanceQueue: () => void\n clearQueue: () => void\n\n // Full reset\n reset: () => void\n}\n\nconst initialState: GallerySyncInfo & {processingFiles: Set<string>; processedFiles: number} = {\n syncState: \"idle\",\n syncStarting: false,\n currentFile: null,\n currentFileProgress: 0,\n completedFiles: 0,\n totalFiles: 0,\n failedFiles: [],\n queue: [],\n queueIndex: 0,\n hotspotInfo: null,\n syncServiceOpenedHotspot: false,\n glassesGalleryStatusKnown: false,\n glassesPhotoCount: 0,\n glassesVideoCount: 0,\n glassesTotalCount: 0,\n glassesHasContent: false,\n lastError: null,\n processingFiles: new Set<string>(),\n processedFiles: 0,\n}\n\nexport const useGallerySyncStore = create<GallerySyncState>()(\n subscribeWithSelector((set, get) => ({\n ...initialState,\n\n // State transitions\n setSyncState: (syncState: SyncState) => set({syncState}),\n setSyncStarting: (syncStarting: boolean) => set({syncStarting}),\n\n setRequestingHotspot: () =>\n set({\n syncState: \"requesting_hotspot\",\n lastError: null,\n failedFiles: [],\n }),\n\n setConnectingWifi: () =>\n set({\n syncState: \"connecting_wifi\",\n }),\n\n setSyncing: (files: PhotoInfo[]) =>\n set({\n syncState: \"syncing\",\n // C4: Strip thumbnail_data (base64) from store to prevent OOM\n queue: files.map(({thumbnail_data: _thumbnailData, ...rest}) => rest),\n queueIndex: 0,\n totalFiles: files.length,\n completedFiles: 0,\n currentFile: files.length > 0 ? files[0].name : null,\n currentFileProgress: 0,\n failedFiles: [],\n lastError: null,\n processedFiles: 0,\n processingFiles: new Set<string>(),\n }),\n\n setSyncComplete: () =>\n set({\n syncState: \"complete\",\n currentFile: null,\n currentFileProgress: 0,\n // Keep queue intact so photos remain visible after sync\n // Don't clear: queue: [], queueIndex: 0\n }),\n\n setSyncError: (error: string) =>\n set({\n syncState: \"error\",\n lastError: error,\n currentFile: null,\n currentFileProgress: 0,\n }),\n\n setSyncCancelled: () =>\n set({\n syncState: \"cancelled\",\n currentFile: null,\n currentFileProgress: 0,\n queue: [],\n queueIndex: 0,\n }),\n\n // Progress updates\n setCurrentFile: (fileName: string | null, progress: number) =>\n set({\n currentFile: fileName,\n currentFileProgress: Math.max(0, Math.min(100, progress)),\n }),\n\n onFileProgress: (fileName: string, progress: number) => {\n const state = get()\n const clampedProgress = Math.max(0, Math.min(100, progress))\n // Throttle: skip update if same file and same percentage (prevents Zustand flood)\n if (clampedProgress === state.currentFileProgress && fileName === state.currentFile) {\n return\n }\n set({\n currentFile: fileName,\n currentFileProgress: clampedProgress,\n })\n },\n\n onFileComplete: (_fileName: string) => {\n const state = get()\n const newCompletedFiles = state.completedFiles + 1\n const newQueueIndex = state.queueIndex + 1\n const nextFile = state.queue[newQueueIndex]\n\n set({\n completedFiles: newCompletedFiles,\n queueIndex: newQueueIndex,\n currentFile: nextFile?.name || null,\n currentFileProgress: 0,\n })\n },\n\n onFileFailed: (fileName: string, _error?: string) => {\n const state = get()\n const newQueueIndex = state.queueIndex + 1\n const nextFile = state.queue[newQueueIndex]\n\n set({\n failedFiles: [...state.failedFiles, fileName],\n queueIndex: newQueueIndex,\n currentFile: nextFile?.name || null,\n currentFileProgress: 0,\n })\n },\n\n onFileProcessing: (fileName: string) => {\n const state = get()\n const newSet = new Set(state.processingFiles)\n newSet.add(fileName)\n set({processingFiles: newSet})\n },\n\n onFileProcessed: (fileName: string) => {\n const state = get()\n const newSet = new Set(state.processingFiles)\n newSet.delete(fileName)\n set({processingFiles: newSet, processedFiles: state.processedFiles + 1})\n },\n\n updateFileInQueue: (fileName: string, updatedFile: PhotoInfo) => {\n const state = get()\n const updatedQueue = state.queue.map((file) => (file.name === fileName ? updatedFile : file))\n set({queue: updatedQueue})\n },\n\n removeFilesFromQueue: (fileNames: string[]) => {\n if (fileNames.length === 0) return\n\n const filesToRemove = new Set(fileNames)\n const state = get()\n const failedFilesSet = new Set(state.failedFiles)\n const filesBeforeQueueIndex = state.queue\n .slice(0, state.queueIndex)\n .filter((file) => filesToRemove.has(file.name))\n const removedBeforeQueueIndex = filesBeforeQueueIndex.length\n const removedCompletedBeforeQueueIndex = filesBeforeQueueIndex.filter(\n (file) => !failedFilesSet.has(file.name),\n ).length\n const filteredQueue = state.queue.filter((file) => !filesToRemove.has(file.name))\n const removedCount = state.queue.length - filteredQueue.length\n\n if (removedCount === 0) return\n\n const nextQueueIndex = state.queueIndex - removedBeforeQueueIndex\n const currentFileRemoved = state.currentFile !== null && filesToRemove.has(state.currentFile)\n\n set({\n queue: filteredQueue,\n totalFiles: state.totalFiles - removedCount,\n completedFiles: Math.max(0, state.completedFiles - removedCompletedBeforeQueueIndex),\n queueIndex: nextQueueIndex,\n failedFiles: state.failedFiles.filter((fileName) => !filesToRemove.has(fileName)),\n processingFiles: new Set(Array.from(state.processingFiles).filter((fileName) => !filesToRemove.has(fileName))),\n currentFile: currentFileRemoved ? filteredQueue[nextQueueIndex]?.name || null : state.currentFile,\n })\n },\n\n // Hotspot management\n setHotspotInfo: (info: HotspotInfo | null) => set({hotspotInfo: info}),\n\n setSyncServiceOpenedHotspot: (opened: boolean) => set({syncServiceOpenedHotspot: opened}),\n\n // Gallery status from glasses\n setGlassesGalleryStatus: (photos: number, videos: number, total: number, hasContent: boolean) => {\n const state = get()\n // Reset to idle if sync is in a terminal state and new content is available\n // This allows syncing again after taking new photos\n const shouldResetToIdle =\n hasContent && (state.syncState === \"complete\" || state.syncState === \"error\" || state.syncState === \"cancelled\")\n\n set({\n glassesGalleryStatusKnown: true,\n glassesPhotoCount: photos,\n glassesVideoCount: videos,\n glassesTotalCount: total,\n glassesHasContent: hasContent,\n ...(shouldResetToIdle ? {syncState: \"idle\" as SyncState} : {}),\n })\n },\n\n clearGlassesGalleryStatus: () =>\n set({\n glassesGalleryStatusKnown: false,\n glassesPhotoCount: 0,\n glassesVideoCount: 0,\n glassesTotalCount: 0,\n glassesHasContent: false,\n }),\n\n // Queue management\n setQueue: (files: PhotoInfo[], startIndex: number = 0) =>\n set({\n // C4: Strip thumbnail_data (base64) from store to prevent OOM\n queue: files.map(({thumbnail_data: _thumbnailData, ...rest}) => rest),\n queueIndex: startIndex,\n totalFiles: files.length,\n completedFiles: startIndex,\n }),\n\n advanceQueue: () => {\n const state = get()\n set({queueIndex: state.queueIndex + 1})\n },\n\n clearQueue: () =>\n set({\n queue: [],\n queueIndex: 0,\n totalFiles: 0,\n completedFiles: 0,\n }),\n\n // Full reset\n reset: () => set({...initialState, processingFiles: new Set<string>()}),\n })),\n)\n\n// Selector helpers for common subscriptions\nexport const selectSyncProgress = (state: GallerySyncState) => ({\n syncState: state.syncState,\n currentFile: state.currentFile,\n currentFileProgress: state.currentFileProgress,\n completedFiles: state.completedFiles,\n totalFiles: state.totalFiles,\n failedFiles: state.failedFiles,\n processingFiles: state.processingFiles,\n})\n\nexport const selectIssyncing = (state: GallerySyncState) =>\n state.syncState === \"syncing\" ||\n state.syncState === \"preparing\" ||\n state.syncState === \"requesting_hotspot\" ||\n state.syncState === \"connecting_wifi\"\n\nexport const selectGlassesGalleryStatus = (state: GallerySyncState) => ({\n known: state.glassesGalleryStatusKnown,\n photos: state.glassesPhotoCount,\n videos: state.glassesVideoCount,\n total: state.glassesTotalCount,\n hasContent: state.glassesHasContent,\n})\n"]}
|
|
1
|
+
{"version":3,"file":"gallerySync.js","sourceRoot":"","sources":["../../src/stores/gallerySync.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAA;AA0HxD,MAAM,YAAY,GAA6E;IAC7F,SAAS,EAAE,MAAM;IACjB,YAAY,EAAE,KAAK;IACnB,WAAW,EAAE,IAAI;IACjB,mBAAmB,EAAE,CAAC;IACtB,cAAc,EAAE,CAAC;IACjB,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,EAAE;IACf,KAAK,EAAE,EAAE;IACT,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,IAAI;IACjB,wBAAwB,EAAE,KAAK;IAC/B,yBAAyB,EAAE,KAAK;IAChC,iBAAiB,EAAE,CAAC;IACpB,iBAAiB,EAAE,CAAC;IACpB,iBAAiB,EAAE,CAAC;IACpB,iBAAiB,EAAE,KAAK;IACxB,SAAS,EAAE,IAAI;IACf,eAAe,EAAE,IAAI,GAAG,EAAU;IAClC,cAAc,EAAE,CAAC;CAClB,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,EAAoB,CAC3D,qBAAqB,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACnC,GA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K,CAAC,iBAAiB;CACpC,CAAC,CAAA","sourcesContent":["/**\n * Gallery Sync Store\n * Manages gallery sync state independently of UI lifecycle\n */\n\nimport {create} from \"zustand\"\nimport {subscribeWithSelector} from \"zustand/middleware\"\n\n// Relocated from the host @/types/asg so this store is self-contained inside\n// engine. The host barrel re-exports this (a shim), so its importers are unchanged.\nexport interface PhotoInfo {\n name: string\n url: string\n download: string\n size: number\n modified: string | number // Unix timestamp (milliseconds) - can be string or number from API\n mime_type?: string\n is_video?: boolean\n thumbnail_data?: string\n downloaded_at?: number\n // Video duration in milliseconds (from glasses sync response)\n duration?: number\n // New fields for filesystem storage\n filePath?: string\n thumbnailPath?: string\n // Glasses model that captured this media\n glassesModel?: string\n}\n\n// Sync state machine states\nexport type SyncState =\n | \"idle\"\n | \"requesting_hotspot\"\n | \"connecting_wifi\"\n | \"preparing\"\n | \"syncing\"\n | \"complete\"\n | \"error\"\n | \"cancelled\"\n\nexport interface HotspotInfo {\n ssid: string\n password: string\n ip: string\n /** The AP's channel in MHz, when the glasses report it. */\n frequency?: number\n}\n\nexport interface SyncQueue {\n files: PhotoInfo[]\n currentIndex: number\n startedAt: number\n hotspotInfo: HotspotInfo\n}\n\nexport interface GallerySyncInfo {\n // State machine\n syncState: SyncState\n syncStarting: boolean\n\n // Progress tracking\n currentFile: string | null\n currentFileProgress: number // 0-100\n completedFiles: number\n totalFiles: number\n failedFiles: string[]\n\n // Queue (persisted separately via localStorageService)\n queue: PhotoInfo[]\n queueIndex: number\n\n // Hotspot info\n hotspotInfo: HotspotInfo | null\n syncServiceOpenedHotspot: boolean\n\n // Gallery status from glasses\n glassesGalleryStatusKnown: boolean\n glassesPhotoCount: number\n glassesVideoCount: number\n glassesTotalCount: number\n glassesHasContent: boolean\n\n // Error tracking\n lastError: string | null\n}\n\nexport interface GallerySyncState extends GallerySyncInfo {\n // State transitions\n setSyncState: (state: SyncState) => void\n setSyncStarting: (starting: boolean) => void\n setRequestingHotspot: () => void\n setConnectingWifi: () => void\n setSyncing: (files: PhotoInfo[]) => void\n setSyncComplete: () => void\n setSyncError: (error: string) => void\n setSyncCancelled: () => void\n\n // Progress updates\n setCurrentFile: (fileName: string | null, progress: number) => void\n onFileProgress: (fileName: string, progress: number) => void\n onFileComplete: (fileName: string) => void\n onFileFailed: (fileName: string, error?: string) => void\n onFileProcessing: (fileName: string) => void\n onFileProcessed: (fileName: string) => void\n updateFileInQueue: (fileName: string, updatedFile: PhotoInfo) => void\n removeFilesFromQueue: (fileNames: string[]) => void\n\n // Processing queue tracking\n processingFiles: Set<string>\n processedFiles: number\n\n // Hotspot management\n setHotspotInfo: (info: HotspotInfo | null) => void\n setSyncServiceOpenedHotspot: (opened: boolean) => void\n\n // Gallery status from glasses\n setGlassesGalleryStatus: (photos: number, videos: number, total: number, hasContent: boolean) => void\n clearGlassesGalleryStatus: () => void\n\n // Queue management (for resume)\n setQueue: (files: PhotoInfo[], startIndex?: number) => void\n advanceQueue: () => void\n clearQueue: () => void\n\n // Full reset\n reset: () => void\n}\n\nconst initialState: GallerySyncInfo & {processingFiles: Set<string>; processedFiles: number} = {\n syncState: \"idle\",\n syncStarting: false,\n currentFile: null,\n currentFileProgress: 0,\n completedFiles: 0,\n totalFiles: 0,\n failedFiles: [],\n queue: [],\n queueIndex: 0,\n hotspotInfo: null,\n syncServiceOpenedHotspot: false,\n glassesGalleryStatusKnown: false,\n glassesPhotoCount: 0,\n glassesVideoCount: 0,\n glassesTotalCount: 0,\n glassesHasContent: false,\n lastError: null,\n processingFiles: new Set<string>(),\n processedFiles: 0,\n}\n\nexport const useGallerySyncStore = create<GallerySyncState>()(\n subscribeWithSelector((set, get) => ({\n ...initialState,\n\n // State transitions\n setSyncState: (syncState: SyncState) => set({syncState}),\n setSyncStarting: (syncStarting: boolean) => set({syncStarting}),\n\n setRequestingHotspot: () =>\n set({\n syncState: \"requesting_hotspot\",\n lastError: null,\n failedFiles: [],\n }),\n\n setConnectingWifi: () =>\n set({\n syncState: \"connecting_wifi\",\n }),\n\n setSyncing: (files: PhotoInfo[]) =>\n set({\n syncState: \"syncing\",\n // C4: Strip thumbnail_data (base64) from store to prevent OOM\n queue: files.map(({thumbnail_data: _thumbnailData, ...rest}) => rest),\n queueIndex: 0,\n totalFiles: files.length,\n completedFiles: 0,\n currentFile: files.length > 0 ? files[0].name : null,\n currentFileProgress: 0,\n failedFiles: [],\n lastError: null,\n processedFiles: 0,\n processingFiles: new Set<string>(),\n }),\n\n setSyncComplete: () =>\n set({\n syncState: \"complete\",\n currentFile: null,\n currentFileProgress: 0,\n // Keep queue intact so photos remain visible after sync\n // Don't clear: queue: [], queueIndex: 0\n }),\n\n setSyncError: (error: string) =>\n set({\n syncState: \"error\",\n lastError: error,\n currentFile: null,\n currentFileProgress: 0,\n }),\n\n setSyncCancelled: () =>\n set({\n syncState: \"cancelled\",\n currentFile: null,\n currentFileProgress: 0,\n queue: [],\n queueIndex: 0,\n }),\n\n // Progress updates\n setCurrentFile: (fileName: string | null, progress: number) =>\n set({\n currentFile: fileName,\n currentFileProgress: Math.max(0, Math.min(100, progress)),\n }),\n\n onFileProgress: (fileName: string, progress: number) => {\n const state = get()\n const clampedProgress = Math.max(0, Math.min(100, progress))\n // Throttle: skip update if same file and same percentage (prevents Zustand flood)\n if (clampedProgress === state.currentFileProgress && fileName === state.currentFile) {\n return\n }\n set({\n currentFile: fileName,\n currentFileProgress: clampedProgress,\n })\n },\n\n onFileComplete: (_fileName: string) => {\n const state = get()\n const newCompletedFiles = state.completedFiles + 1\n const newQueueIndex = state.queueIndex + 1\n const nextFile = state.queue[newQueueIndex]\n\n set({\n completedFiles: newCompletedFiles,\n queueIndex: newQueueIndex,\n currentFile: nextFile?.name || null,\n currentFileProgress: 0,\n })\n },\n\n onFileFailed: (fileName: string, _error?: string) => {\n const state = get()\n const newQueueIndex = state.queueIndex + 1\n const nextFile = state.queue[newQueueIndex]\n\n set({\n failedFiles: [...state.failedFiles, fileName],\n queueIndex: newQueueIndex,\n currentFile: nextFile?.name || null,\n currentFileProgress: 0,\n })\n },\n\n onFileProcessing: (fileName: string) => {\n const state = get()\n const newSet = new Set(state.processingFiles)\n newSet.add(fileName)\n set({processingFiles: newSet})\n },\n\n onFileProcessed: (fileName: string) => {\n const state = get()\n const newSet = new Set(state.processingFiles)\n newSet.delete(fileName)\n set({processingFiles: newSet, processedFiles: state.processedFiles + 1})\n },\n\n updateFileInQueue: (fileName: string, updatedFile: PhotoInfo) => {\n const state = get()\n const updatedQueue = state.queue.map((file) => (file.name === fileName ? updatedFile : file))\n set({queue: updatedQueue})\n },\n\n removeFilesFromQueue: (fileNames: string[]) => {\n if (fileNames.length === 0) return\n\n const filesToRemove = new Set(fileNames)\n const state = get()\n const failedFilesSet = new Set(state.failedFiles)\n const filesBeforeQueueIndex = state.queue\n .slice(0, state.queueIndex)\n .filter((file) => filesToRemove.has(file.name))\n const removedBeforeQueueIndex = filesBeforeQueueIndex.length\n const removedCompletedBeforeQueueIndex = filesBeforeQueueIndex.filter(\n (file) => !failedFilesSet.has(file.name),\n ).length\n const filteredQueue = state.queue.filter((file) => !filesToRemove.has(file.name))\n const removedCount = state.queue.length - filteredQueue.length\n\n if (removedCount === 0) return\n\n const nextQueueIndex = state.queueIndex - removedBeforeQueueIndex\n const currentFileRemoved = state.currentFile !== null && filesToRemove.has(state.currentFile)\n\n set({\n queue: filteredQueue,\n totalFiles: state.totalFiles - removedCount,\n completedFiles: Math.max(0, state.completedFiles - removedCompletedBeforeQueueIndex),\n queueIndex: nextQueueIndex,\n failedFiles: state.failedFiles.filter((fileName) => !filesToRemove.has(fileName)),\n processingFiles: new Set(Array.from(state.processingFiles).filter((fileName) => !filesToRemove.has(fileName))),\n currentFile: currentFileRemoved ? filteredQueue[nextQueueIndex]?.name || null : state.currentFile,\n })\n },\n\n // Hotspot management\n setHotspotInfo: (info: HotspotInfo | null) => set({hotspotInfo: info}),\n\n setSyncServiceOpenedHotspot: (opened: boolean) => set({syncServiceOpenedHotspot: opened}),\n\n // Gallery status from glasses\n setGlassesGalleryStatus: (photos: number, videos: number, total: number, hasContent: boolean) => {\n const state = get()\n // Reset to idle if sync is in a terminal state and new content is available\n // This allows syncing again after taking new photos\n const shouldResetToIdle =\n hasContent && (state.syncState === \"complete\" || state.syncState === \"error\" || state.syncState === \"cancelled\")\n\n set({\n glassesGalleryStatusKnown: true,\n glassesPhotoCount: photos,\n glassesVideoCount: videos,\n glassesTotalCount: total,\n glassesHasContent: hasContent,\n ...(shouldResetToIdle ? {syncState: \"idle\" as SyncState} : {}),\n })\n },\n\n clearGlassesGalleryStatus: () =>\n set({\n glassesGalleryStatusKnown: false,\n glassesPhotoCount: 0,\n glassesVideoCount: 0,\n glassesTotalCount: 0,\n glassesHasContent: false,\n }),\n\n // Queue management\n setQueue: (files: PhotoInfo[], startIndex: number = 0) =>\n set({\n // C4: Strip thumbnail_data (base64) from store to prevent OOM\n queue: files.map(({thumbnail_data: _thumbnailData, ...rest}) => rest),\n queueIndex: startIndex,\n totalFiles: files.length,\n completedFiles: startIndex,\n }),\n\n advanceQueue: () => {\n const state = get()\n set({queueIndex: state.queueIndex + 1})\n },\n\n clearQueue: () =>\n set({\n queue: [],\n queueIndex: 0,\n totalFiles: 0,\n completedFiles: 0,\n }),\n\n // Full reset\n reset: () => set({...initialState, processingFiles: new Set<string>()}),\n })),\n)\n\n// Selector helpers for common subscriptions\nexport const selectSyncProgress = (state: GallerySyncState) => ({\n syncState: state.syncState,\n currentFile: state.currentFile,\n currentFileProgress: state.currentFileProgress,\n completedFiles: state.completedFiles,\n totalFiles: state.totalFiles,\n failedFiles: state.failedFiles,\n processingFiles: state.processingFiles,\n})\n\nexport const selectIssyncing = (state: GallerySyncState) =>\n state.syncState === \"syncing\" ||\n state.syncState === \"preparing\" ||\n state.syncState === \"requesting_hotspot\" ||\n state.syncState === \"connecting_wifi\"\n\nexport const selectGlassesGalleryStatus = (state: GallerySyncState) => ({\n known: state.glassesGalleryStatusKnown,\n photos: state.glassesPhotoCount,\n videos: state.glassesVideoCount,\n total: state.glassesTotalCount,\n hasContent: state.glassesHasContent,\n})\n"]}
|
|
@@ -51,6 +51,7 @@ type LegacyHotspotFields = {
|
|
|
51
51
|
hotspotPassword?: string;
|
|
52
52
|
hotspotGatewayIp?: string;
|
|
53
53
|
hotspotLocalIp?: string;
|
|
54
|
+
hotspotFrequency?: number;
|
|
54
55
|
};
|
|
55
56
|
type GlassesInfoUpdate = Partial<EngineGlassesStatus> & LegacyWifiFields & LegacyHotspotFields;
|
|
56
57
|
export declare const getGlasesInfoPartial: (state: EngineGlassesStatus) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glasses.d.ts","sourceRoot":"","sources":["../../src/stores/glasses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EAEvB,WAAW,EACX,SAAS,EACT,aAAa,EACb,mBAAmB,EAEpB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAC,kBAAkB,EAAE,sBAAsB,EAAE,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAMvG,OAAO,EAAC,kBAAkB,EAAE,sBAAsB,EAAE,cAAc,EAAC,CAAA;AAEnE,eAAO,MAAM,sBAAsB,GAAI,OAAO;IAAC,UAAU,EAAE,uBAAuB,CAAA;CAAC,YAC7C,CAAA;AAEtC,eAAO,MAAM,kBAAkB,GAAI,OAAO;IAAC,UAAU,EAAE,uBAAuB,CAAA;CAAC,YAAqC,CAAA;AAEpH;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC,CAAA;AAE/E;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,WAAW,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAA;AAE9E,KAAK,mBAAmB,GAAG,mBAAmB,GAAG;IAC/C,kBAAkB,EAAE,aAAa,GAAG,IAAI,CAAA;IACxC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAA;IAC/B,aAAa,EAAE,OA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AC,EAAE,MAAM,CAAA;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED,KAAK,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,GAAG,gBAAgB,GAAG,mBAAmB,CAAA;AA8B9F,eAAO,MAAM,oBAAoB,GAAI,OAAO,mBAAmB;;;;;;;;;;CAgB9D,CAAA;AAoED,eAAO,MAAM,eAAe;;;;;;;;EAmI3B,CAAA;AAED,wBAAgB,sBAAsB,IAAI,MAAM,CAE/C;AAED,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,MAAM,YAAY,EAC9D,KAAK,CAAC,EACN,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,OAAO,EAC9C,kBAAgB,KACf,OAAO,CAAC,OAAO,CAuBjB,CAAA"}
|
package/build/stores/glasses.js
CHANGED
|
@@ -22,7 +22,10 @@ function hotspotFromLegacyFields(info) {
|
|
|
22
22
|
const ssid = info.hotspotSsid?.trim();
|
|
23
23
|
const password = info.hotspotPassword?.trim();
|
|
24
24
|
const localIp = (info.hotspotGatewayIp ?? info.hotspotLocalIp)?.trim();
|
|
25
|
-
|
|
25
|
+
const frequency = info.hotspotFrequency;
|
|
26
|
+
return ssid && password && localIp
|
|
27
|
+
? { state: "enabled", ssid, password, localIp, ...(frequency ? { frequency } : {}) }
|
|
28
|
+
: null;
|
|
26
29
|
}
|
|
27
30
|
if (info.hotspotEnabled === false) {
|
|
28
31
|
return { state: "disabled" };
|
|
@@ -107,10 +110,17 @@ const initialState = {
|
|
|
107
110
|
export const useGlassesStore = create()(subscribeWithSelector((set) => ({
|
|
108
111
|
...initialState,
|
|
109
112
|
setGlassesInfo: (info) => set((state) => {
|
|
110
|
-
const { wifiConnected, wifiSsid, wifiLocalIp, hotspotEnabled, hotspotSsid, hotspotPassword, hotspotGatewayIp, hotspotLocalIp, wifi, hotspot, ...sdkInfo } = info;
|
|
113
|
+
const { wifiConnected, wifiSsid, wifiLocalIp, hotspotEnabled, hotspotSsid, hotspotPassword, hotspotGatewayIp, hotspotLocalIp, hotspotFrequency, wifi, hotspot, ...sdkInfo } = info;
|
|
111
114
|
const wifiUpdate = wifi ?? wifiFromLegacyFields({ wifiConnected, wifiSsid, wifiLocalIp });
|
|
112
115
|
const hotspotUpdate = hotspot ??
|
|
113
|
-
hotspotFromLegacyFields({
|
|
116
|
+
hotspotFromLegacyFields({
|
|
117
|
+
hotspotEnabled,
|
|
118
|
+
hotspotSsid,
|
|
119
|
+
hotspotPassword,
|
|
120
|
+
hotspotGatewayIp,
|
|
121
|
+
hotspotLocalIp,
|
|
122
|
+
hotspotFrequency,
|
|
123
|
+
});
|
|
114
124
|
const hasWifiInfoUpdate = Object.prototype.hasOwnProperty.call(info, "wifi") ||
|
|
115
125
|
Object.prototype.hasOwnProperty.call(info, "wifiConnected") ||
|
|
116
126
|
Object.prototype.hasOwnProperty.call(info, "wifiSsid") ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glasses.js","sourceRoot":"","sources":["../../src/stores/glasses.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,kBAAkB,EAAE,sBAAsB,EAAE,cAAc,EAAC,MAAM,8BAA8B,CAAA;AACvG,OAAO,EAAC,MAAM,EAAC,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAA;AAExD,uEAAuE;AACvE,kEAAkE;AAClE,OAAO,EAAC,kBAAkB,EAAE,sBAAsB,EAAE,cAAc,EAAC,CAAA;AAEnE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAA4C,EAAE,EAAE,CACrF,kBAAkB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;AAEtC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAA4C,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;AAwDpH,SAAS,oBAAoB,CAAC,IAAsB;IAClD,IAA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Info,\n PublicGlassesStatus,\n WifiStatus,\n} from \"@mentra/bluetooth-sdk\"\nimport {isGlassesConnected, isGlassesLinkLayerBusy, isGlassesReady} from \"../services/GlassesReadiness\"\nimport {create} from \"zustand\"\nimport {subscribeWithSelector} from \"zustand/middleware\"\n\n// Re-export the connection predicates (single source of truth lives in\n// GlassesReadiness) so importers of this store keep getting them.\nexport {isGlassesConnected, isGlassesLinkLayerBusy, isGlassesReady}\n\nexport const selectGlassesConnected = (state: {connection: GlassesConnectionStatus}) =>\n isGlassesConnected(state.connection)\n\nexport const selectGlassesReady = (state: {connection: GlassesConnectionStatus}) => isGlassesReady(state.connection)\n\n/**\n * The SDK-owned Mentra Live pairing state (`normal`, `pairing_mode`, `pairing_rejected`).\n * The engine mirrors it from `glasses_status` and `pairing_state_changed`; it never derives it.\n */\nexport type LivePairingState = NonNullable<PublicGlassesStatus[\"pairingState\"]>\n\n/**\n * The SDK-owned audio setup state (`idle`, `not_applicable`, `connecting`, `connected`,\n * `needs_user`). The engine mirrors it from `glasses_status` and `audio_setup_changed`.\n */\nexport type GlassesAudioSetup = NonNullable<PublicGlassesStatus[\"audioSetup\"]>\n\ntype EngineGlassesStatus = PublicGlassesStatus & {\n otaUpdateAvailable: OtaUpdateInfo | null\n otaProgress: OtaProgress | null\n otaInProgress: boolean\n otaVersionUrl: string\n}\n\nexport interface GlassesState extends EngineGlassesStatus {\n systemTimeMs: number\n wifiStatusKnown: boolean\n setGlassesInfo: (info: GlassesInfoUpdate) => void\n setBatteryInfo: (batteryLevel: number, charging: boolean, caseBatteryLevel: number, caseCharging: boolean) => void\n setWifiInfo: (connected: boolean, ssid: string) => void\n setHotspotInfo: (enabled: boolean, ssid: string, password: string, ip: string) => void\n // OTA methods\n otaStatus: OtaStatus | null\n setOtaStatus: (status: OtaStatus | null) => void\n setOtaUpdateAvailable: (info: OtaUpdateInfo | null) => void\n setOtaProgress: (progress: OtaProgress | null) => void\n setOtaInProgress: (inProgress: boolean) => void\n setMtkUpdatedThisSession: (updated: boolean) => void\n clearOtaState: () => void\n reset: () => void\n mtkUpdatedThisSession: boolean\n}\n\ntype LegacyWifiFields = {\n wifiConnected?: boolean\n wifiSsid?: string\n wifiLocalIp?: string\n}\n\ntype LegacyHotspotFields = {\n hotspotEnabled?: boolean\n hotspotSsid?: string\n hotspotPassword?: string\n hotspotGatewayIp?: string\n hotspotLocalIp?: string\n}\n\ntype GlassesInfoUpdate = Partial<EngineGlassesStatus> & LegacyWifiFields & LegacyHotspotFields\n\nfunction wifiFromLegacyFields(info: LegacyWifiFields): WifiStatus | null {\n if (info.wifiConnected === true) {\n const ssid = info.wifiSsid?.trim()\n const localIp = info.wifiLocalIp?.trim()\n return ssid ? {state: \"connected\", ssid, ...(localIp ? {localIp} : {})} : null\n }\n if (info.wifiConnected === false) {\n return {state: \"disconnected\"}\n }\n return null\n}\n\nfunction hotspotFromLegacyFields(info: LegacyHotspotFields): HotspotStatus | null {\n if (info.hotspotEnabled === true) {\n const ssid = info.hotspotSsid?.trim()\n const password = info.hotspotPassword?.trim()\n const localIp = (info.hotspotGatewayIp ?? info.hotspotLocalIp)?.trim()\n return ssid && password && localIp ? {state: \"enabled\", ssid, password, localIp} : null\n }\n if (info.hotspotEnabled === false) {\n return {state: \"disabled\"}\n }\n return null\n}\n\nexport const getGlasesInfoPartial = (state: EngineGlassesStatus) => {\n const wifi = state.wifi\n const connected = isGlassesConnected(state.connection)\n return {\n batteryLevel: state.batteryLevel,\n charging: state.charging,\n caseBatteryLevel: state.caseBatteryLevel,\n caseCharging: state.caseCharging,\n connected,\n wifiConnected: wifi.state === \"connected\",\n wifiSsid: wifi.state === \"connected\" ? wifi.ssid : \"\",\n deviceModel: state.deviceModel,\n // Cloud GlassesInfo uses modelName, map from deviceModel so the cloud\n // knows which device is connected when it receives connection state updates\n modelName: state.deviceModel || null,\n }\n}\n\ninterface GlassesStore extends EngineGlassesStatus {\n systemTimeMs: number\n mtkUpdatedThisSession: boolean\n wifiStatusKnown: boolean\n otaStatus: OtaStatus | null\n}\n\nconst initialState: GlassesStore = {\n // state:\n connection: {state: \"disconnected\"},\n g2MissingArm: null,\n micEnabled: false,\n bluetoothClassicConnected: false,\n bluetoothClassicProfilesConnected: false,\n bluetoothAudioRouted: false,\n signalStrength: -1,\n signalStrengthUpdatedAt: 0,\n voiceActivityDetectionEnabled: true,\n // device info\n deviceModel: \"\",\n androidVersion: \"\",\n firmwareVersion: \"\",\n bluetoothMacAddress: \"\",\n wifiMacAddress: \"\",\n leftMacAddress: \"\",\n rightMacAddress: \"\",\n buildNumber: \"\",\n pairingState: {state: \"normal\"},\n audioSetup: {state: \"idle\"},\n systemTimeMs: 0,\n otaVersionUrl: \"\",\n appVersion: \"\",\n packageName: \"\",\n bluetoothName: \"\",\n serialNumber: \"\",\n style: \"\",\n color: \"\",\n mtkFirmwareVersion: \"\",\n besFirmwareVersion: \"\",\n hotspotOtaVersion: 0,\n // wifi info\n wifi: {state: \"disconnected\"},\n wifiStatusKnown: false,\n // battery info\n batteryLevel: -1,\n charging: false,\n caseBatteryLevel: -1,\n caseCharging: false,\n caseOpen: false,\n caseRemoved: true,\n // hotspot info\n hotspot: {state: \"disabled\"},\n // OTA update info\n otaStatus: null,\n otaUpdateAvailable: null,\n otaProgress: null,\n otaInProgress: false,\n mtkUpdatedThisSession: false,\n // ring:\n controllerConnected: false,\n controllerFullyBooted: false,\n controllerMacAddress: \"\",\n controllerBatteryLevel: -1,\n controllerSignalStrength: -1,\n}\n\nexport const useGlassesStore = create<GlassesState>()(\n subscribeWithSelector((set) => ({\n ...initialState,\n\n setGlassesInfo: (info) =>\n set((state) => {\n const {\n wifiConnected,\n wifiSsid,\n wifiLocalIp,\n hotspotEnabled,\n hotspotSsid,\n hotspotPassword,\n hotspotGatewayIp,\n hotspotLocalIp,\n wifi,\n hotspot,\n ...sdkInfo\n } = info\n const wifiUpdate = wifi ?? wifiFromLegacyFields({wifiConnected, wifiSsid, wifiLocalIp})\n const hotspotUpdate =\n hotspot ??\n hotspotFromLegacyFields({hotspotEnabled, hotspotSsid, hotspotPassword, hotspotGatewayIp, hotspotLocalIp})\n const hasWifiInfoUpdate =\n Object.prototype.hasOwnProperty.call(info, \"wifi\") ||\n Object.prototype.hasOwnProperty.call(info, \"wifiConnected\") ||\n Object.prototype.hasOwnProperty.call(info, \"wifiSsid\") ||\n Object.prototype.hasOwnProperty.call(info, \"wifiLocalIp\")\n const next = {\n ...state,\n ...sdkInfo,\n ...(wifiUpdate ? {wifi: wifiUpdate} : {}),\n ...(hotspotUpdate ? {hotspot: hotspotUpdate} : {}),\n ...(hasWifiInfoUpdate ? {wifiStatusKnown: true} : {}),\n }\n if (!isGlassesConnected(next.connection)) {\n next.wifiStatusKnown = false\n next.hotspotOtaVersion = 0\n // packageName is deliberately NOT cleared here. It is only ever safe to clear together\n // with buildNumber, which the native session boundary does atomically (both arrive in\n // version_info_1). Clearing identity alone would leave a stale sideloaded buildNumber\n // paired with a blank package, and the OTA guard reads a blank package as stock — the\n // exact update loop this guard exists to prevent. Stale-together is fail-closed.\n }\n return next\n }),\n\n setBatteryInfo: (batteryLevel, charging, caseBatteryLevel, caseCharging) =>\n set({\n batteryLevel,\n charging,\n caseBatteryLevel,\n caseCharging,\n }),\n\n setWifiInfo: (connected, ssid) =>\n set(() => {\n const trimmedSsid = ssid.trim()\n if (connected && !trimmedSsid) {\n return {}\n }\n const wifi: WifiStatus = connected ? {state: \"connected\", ssid: trimmedSsid} : {state: \"disconnected\"}\n return {\n wifi,\n wifiStatusKnown: true,\n }\n }),\n\n setHotspotInfo: (enabled: boolean, ssid: string, password: string, ip: string) =>\n set(() => {\n const hotspot = hotspotFromLegacyFields({\n hotspotEnabled: enabled,\n hotspotSsid: ssid,\n hotspotPassword: password,\n hotspotGatewayIp: ip,\n })\n return hotspot ? {hotspot} : {}\n }),\n\n // OTA methods\n setOtaStatus: (status: OtaStatus | null) => set({otaStatus: status}),\n\n setOtaUpdateAvailable: (info: OtaUpdateInfo | null) => set({otaUpdateAvailable: info}),\n\n setOtaProgress: (progress: OtaProgress | null) =>\n set((state) => {\n const otaInProgress = progress !== null && progress.status !== \"FINISHED\" && progress.status !== \"FAILED\"\n console.log(\"🔍 GLASSES STORE: setOtaProgress called with:\", JSON.stringify(progress))\n console.log(\"🔍 GLASSES STORE: otaInProgress =\", otaInProgress)\n\n // Never allow progress to regress within the same stage+currentUpdate — except a new\n // work wave (STARTED) or the step after FINISHED (multi-hop APK: 27→31→36 re-downloads from 0).\n const prev = state.otaProgress\n const sameWave =\n progress &&\n prev &&\n progress.stage === prev.stage &&\n progress.currentUpdate === prev.currentUpdate &&\n progress.progress < prev.progress\n if (sameWave) {\n const nextIsNewWave = progress.status === \"STARTED\" || prev.status === \"FINISHED\"\n if (!nextIsNewWave) {\n return {otaProgress: {...progress, progress: prev.progress}, otaInProgress}\n }\n }\n\n return {otaProgress: progress, otaInProgress}\n }),\n\n setOtaInProgress: (inProgress: boolean) => set({otaInProgress: inProgress}),\n\n setMtkUpdatedThisSession: (updated: boolean) => set({mtkUpdatedThisSession: updated}),\n\n clearOtaState: () =>\n set({\n otaUpdateAvailable: null,\n otaProgress: null,\n otaInProgress: false,\n // Note: mtkUpdatedThisSession is NOT cleared here - it stays true until glasses disconnect/reboot\n }),\n\n reset: () => set(initialState),\n })),\n)\n\nexport function getGlassesSystemTimeMs(): number {\n return useGlassesStore.getState().systemTimeMs ?? 0\n}\n\nexport const waitForGlassesState = <K extends keyof GlassesState>(\n key: K,\n predicate: (value: GlassesState[K]) => boolean,\n timeoutMs = 1000,\n): Promise<boolean> => {\n return new Promise((resolve) => {\n const state = useGlassesStore.getState()\n if (predicate(state[key])) {\n resolve(true)\n return\n }\n\n const unsubscribe = useGlassesStore.subscribe(\n (s) => s[key],\n (value) => {\n if (predicate(value)) {\n unsubscribe()\n resolve(true)\n }\n },\n )\n\n setTimeout(() => {\n unsubscribe()\n resolve(predicate(useGlassesStore.getState()[key]))\n }, timeoutMs)\n })\n}\n"]}
|
|
1
|
+
{"version":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O,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAA;QACxC,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;YAC1B,OAAO,CAAC,IAAI,CAAC,CAAA;YACb,OAAM;QACR,CAAC;QAED,MAAM,WAAW,GAAG,eAAe,CAAC,SAAS,CAC3C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EACb,CAAC,KAAK,EAAE,EAAE;YACR,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;gBACrB,WAAW,EAAE,CAAA;gBACb,OAAO,CAAC,IAAI,CAAC,CAAA;YACf,CAAC;QACH,CAAC,CACF,CAAA;QAED,UAAU,CAAC,GAAG,EAAE;YACd,WAAW,EAAE,CAAA;YACb,OAAO,CAAC,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QACrD,CAAC,EAAE,SAAS,CAAC,CAAA;IACf,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import type {\n GlassesConnectionStatus,\n HotspotStatus,\n OtaProgress,\n OtaStatus,\n OtaUpdateInfo,\n PublicGlassesStatus,\n WifiStatus,\n} from \"@mentra/bluetooth-sdk\"\nimport {isGlassesConnected, isGlassesLinkLayerBusy, isGlassesReady} from \"../services/GlassesReadiness\"\nimport {create} from \"zustand\"\nimport {subscribeWithSelector} from \"zustand/middleware\"\n\n// Re-export the connection predicates (single source of truth lives in\n// GlassesReadiness) so importers of this store keep getting them.\nexport {isGlassesConnected, isGlassesLinkLayerBusy, isGlassesReady}\n\nexport const selectGlassesConnected = (state: {connection: GlassesConnectionStatus}) =>\n isGlassesConnected(state.connection)\n\nexport const selectGlassesReady = (state: {connection: GlassesConnectionStatus}) => isGlassesReady(state.connection)\n\n/**\n * The SDK-owned Mentra Live pairing state (`normal`, `pairing_mode`, `pairing_rejected`).\n * The engine mirrors it from `glasses_status` and `pairing_state_changed`; it never derives it.\n */\nexport type LivePairingState = NonNullable<PublicGlassesStatus[\"pairingState\"]>\n\n/**\n * The SDK-owned audio setup state (`idle`, `not_applicable`, `connecting`, `connected`,\n * `needs_user`). The engine mirrors it from `glasses_status` and `audio_setup_changed`.\n */\nexport type GlassesAudioSetup = NonNullable<PublicGlassesStatus[\"audioSetup\"]>\n\ntype EngineGlassesStatus = PublicGlassesStatus & {\n otaUpdateAvailable: OtaUpdateInfo | null\n otaProgress: OtaProgress | null\n otaInProgress: boolean\n otaVersionUrl: string\n}\n\nexport interface GlassesState extends EngineGlassesStatus {\n systemTimeMs: number\n wifiStatusKnown: boolean\n setGlassesInfo: (info: GlassesInfoUpdate) => void\n setBatteryInfo: (batteryLevel: number, charging: boolean, caseBatteryLevel: number, caseCharging: boolean) => void\n setWifiInfo: (connected: boolean, ssid: string) => void\n setHotspotInfo: (enabled: boolean, ssid: string, password: string, ip: string) => void\n // OTA methods\n otaStatus: OtaStatus | null\n setOtaStatus: (status: OtaStatus | null) => void\n setOtaUpdateAvailable: (info: OtaUpdateInfo | null) => void\n setOtaProgress: (progress: OtaProgress | null) => void\n setOtaInProgress: (inProgress: boolean) => void\n setMtkUpdatedThisSession: (updated: boolean) => void\n clearOtaState: () => void\n reset: () => void\n mtkUpdatedThisSession: boolean\n}\n\ntype LegacyWifiFields = {\n wifiConnected?: boolean\n wifiSsid?: string\n wifiLocalIp?: string\n}\n\ntype LegacyHotspotFields = {\n hotspotEnabled?: boolean\n hotspotSsid?: string\n hotspotPassword?: string\n hotspotGatewayIp?: string\n hotspotLocalIp?: string\n hotspotFrequency?: number\n}\n\ntype GlassesInfoUpdate = Partial<EngineGlassesStatus> & LegacyWifiFields & LegacyHotspotFields\n\nfunction wifiFromLegacyFields(info: LegacyWifiFields): WifiStatus | null {\n if (info.wifiConnected === true) {\n const ssid = info.wifiSsid?.trim()\n const localIp = info.wifiLocalIp?.trim()\n return ssid ? {state: \"connected\", ssid, ...(localIp ? {localIp} : {})} : null\n }\n if (info.wifiConnected === false) {\n return {state: \"disconnected\"}\n }\n return null\n}\n\nfunction hotspotFromLegacyFields(info: LegacyHotspotFields): HotspotStatus | null {\n if (info.hotspotEnabled === true) {\n const ssid = info.hotspotSsid?.trim()\n const password = info.hotspotPassword?.trim()\n const localIp = (info.hotspotGatewayIp ?? info.hotspotLocalIp)?.trim()\n const frequency = info.hotspotFrequency\n return ssid && password && localIp\n ? {state: \"enabled\", ssid, password, localIp, ...(frequency ? {frequency} : {})}\n : null\n }\n if (info.hotspotEnabled === false) {\n return {state: \"disabled\"}\n }\n return null\n}\n\nexport const getGlasesInfoPartial = (state: EngineGlassesStatus) => {\n const wifi = state.wifi\n const connected = isGlassesConnected(state.connection)\n return {\n batteryLevel: state.batteryLevel,\n charging: state.charging,\n caseBatteryLevel: state.caseBatteryLevel,\n caseCharging: state.caseCharging,\n connected,\n wifiConnected: wifi.state === \"connected\",\n wifiSsid: wifi.state === \"connected\" ? wifi.ssid : \"\",\n deviceModel: state.deviceModel,\n // Cloud GlassesInfo uses modelName, map from deviceModel so the cloud\n // knows which device is connected when it receives connection state updates\n modelName: state.deviceModel || null,\n }\n}\n\ninterface GlassesStore extends EngineGlassesStatus {\n systemTimeMs: number\n mtkUpdatedThisSession: boolean\n wifiStatusKnown: boolean\n otaStatus: OtaStatus | null\n}\n\nconst initialState: GlassesStore = {\n // state:\n connection: {state: \"disconnected\"},\n g2MissingArm: null,\n micEnabled: false,\n bluetoothClassicConnected: false,\n bluetoothClassicProfilesConnected: false,\n bluetoothAudioRouted: false,\n signalStrength: -1,\n signalStrengthUpdatedAt: 0,\n voiceActivityDetectionEnabled: true,\n // device info\n deviceModel: \"\",\n androidVersion: \"\",\n firmwareVersion: \"\",\n bluetoothMacAddress: \"\",\n wifiMacAddress: \"\",\n leftMacAddress: \"\",\n rightMacAddress: \"\",\n buildNumber: \"\",\n pairingState: {state: \"normal\"},\n audioSetup: {state: \"idle\"},\n systemTimeMs: 0,\n otaVersionUrl: \"\",\n appVersion: \"\",\n packageName: \"\",\n bluetoothName: \"\",\n serialNumber: \"\",\n style: \"\",\n color: \"\",\n mtkFirmwareVersion: \"\",\n besFirmwareVersion: \"\",\n hotspotOtaVersion: 0,\n // wifi info\n wifi: {state: \"disconnected\"},\n wifiStatusKnown: false,\n // battery info\n batteryLevel: -1,\n charging: false,\n caseBatteryLevel: -1,\n caseCharging: false,\n caseOpen: false,\n caseRemoved: true,\n // hotspot info\n hotspot: {state: \"disabled\"},\n // OTA update info\n otaStatus: null,\n otaUpdateAvailable: null,\n otaProgress: null,\n otaInProgress: false,\n mtkUpdatedThisSession: false,\n // ring:\n controllerConnected: false,\n controllerFullyBooted: false,\n controllerMacAddress: \"\",\n controllerBatteryLevel: -1,\n controllerSignalStrength: -1,\n}\n\nexport const useGlassesStore = create<GlassesState>()(\n subscribeWithSelector((set) => ({\n ...initialState,\n\n setGlassesInfo: (info) =>\n set((state) => {\n const {\n wifiConnected,\n wifiSsid,\n wifiLocalIp,\n hotspotEnabled,\n hotspotSsid,\n hotspotPassword,\n hotspotGatewayIp,\n hotspotLocalIp,\n hotspotFrequency,\n wifi,\n hotspot,\n ...sdkInfo\n } = info\n const wifiUpdate = wifi ?? wifiFromLegacyFields({wifiConnected, wifiSsid, wifiLocalIp})\n const hotspotUpdate =\n hotspot ??\n hotspotFromLegacyFields({\n hotspotEnabled,\n hotspotSsid,\n hotspotPassword,\n hotspotGatewayIp,\n hotspotLocalIp,\n hotspotFrequency,\n })\n const hasWifiInfoUpdate =\n Object.prototype.hasOwnProperty.call(info, \"wifi\") ||\n Object.prototype.hasOwnProperty.call(info, \"wifiConnected\") ||\n Object.prototype.hasOwnProperty.call(info, \"wifiSsid\") ||\n Object.prototype.hasOwnProperty.call(info, \"wifiLocalIp\")\n const next = {\n ...state,\n ...sdkInfo,\n ...(wifiUpdate ? {wifi: wifiUpdate} : {}),\n ...(hotspotUpdate ? {hotspot: hotspotUpdate} : {}),\n ...(hasWifiInfoUpdate ? {wifiStatusKnown: true} : {}),\n }\n if (!isGlassesConnected(next.connection)) {\n next.wifiStatusKnown = false\n next.hotspotOtaVersion = 0\n // packageName is deliberately NOT cleared here. It is only ever safe to clear together\n // with buildNumber, which the native session boundary does atomically (both arrive in\n // version_info_1). Clearing identity alone would leave a stale sideloaded buildNumber\n // paired with a blank package, and the OTA guard reads a blank package as stock — the\n // exact update loop this guard exists to prevent. Stale-together is fail-closed.\n }\n return next\n }),\n\n setBatteryInfo: (batteryLevel, charging, caseBatteryLevel, caseCharging) =>\n set({\n batteryLevel,\n charging,\n caseBatteryLevel,\n caseCharging,\n }),\n\n setWifiInfo: (connected, ssid) =>\n set(() => {\n const trimmedSsid = ssid.trim()\n if (connected && !trimmedSsid) {\n return {}\n }\n const wifi: WifiStatus = connected ? {state: \"connected\", ssid: trimmedSsid} : {state: \"disconnected\"}\n return {\n wifi,\n wifiStatusKnown: true,\n }\n }),\n\n setHotspotInfo: (enabled: boolean, ssid: string, password: string, ip: string) =>\n set(() => {\n const hotspot = hotspotFromLegacyFields({\n hotspotEnabled: enabled,\n hotspotSsid: ssid,\n hotspotPassword: password,\n hotspotGatewayIp: ip,\n })\n return hotspot ? {hotspot} : {}\n }),\n\n // OTA methods\n setOtaStatus: (status: OtaStatus | null) => set({otaStatus: status}),\n\n setOtaUpdateAvailable: (info: OtaUpdateInfo | null) => set({otaUpdateAvailable: info}),\n\n setOtaProgress: (progress: OtaProgress | null) =>\n set((state) => {\n const otaInProgress = progress !== null && progress.status !== \"FINISHED\" && progress.status !== \"FAILED\"\n console.log(\"🔍 GLASSES STORE: setOtaProgress called with:\", JSON.stringify(progress))\n console.log(\"🔍 GLASSES STORE: otaInProgress =\", otaInProgress)\n\n // Never allow progress to regress within the same stage+currentUpdate — except a new\n // work wave (STARTED) or the step after FINISHED (multi-hop APK: 27→31→36 re-downloads from 0).\n const prev = state.otaProgress\n const sameWave =\n progress &&\n prev &&\n progress.stage === prev.stage &&\n progress.currentUpdate === prev.currentUpdate &&\n progress.progress < prev.progress\n if (sameWave) {\n const nextIsNewWave = progress.status === \"STARTED\" || prev.status === \"FINISHED\"\n if (!nextIsNewWave) {\n return {otaProgress: {...progress, progress: prev.progress}, otaInProgress}\n }\n }\n\n return {otaProgress: progress, otaInProgress}\n }),\n\n setOtaInProgress: (inProgress: boolean) => set({otaInProgress: inProgress}),\n\n setMtkUpdatedThisSession: (updated: boolean) => set({mtkUpdatedThisSession: updated}),\n\n clearOtaState: () =>\n set({\n otaUpdateAvailable: null,\n otaProgress: null,\n otaInProgress: false,\n // Note: mtkUpdatedThisSession is NOT cleared here - it stays true until glasses disconnect/reboot\n }),\n\n reset: () => set(initialState),\n })),\n)\n\nexport function getGlassesSystemTimeMs(): number {\n return useGlassesStore.getState().systemTimeMs ?? 0\n}\n\nexport const waitForGlassesState = <K extends keyof GlassesState>(\n key: K,\n predicate: (value: GlassesState[K]) => boolean,\n timeoutMs = 1000,\n): Promise<boolean> => {\n return new Promise((resolve) => {\n const state = useGlassesStore.getState()\n if (predicate(state[key])) {\n resolve(true)\n return\n }\n\n const unsubscribe = useGlassesStore.subscribe(\n (s) => s[key],\n (value) => {\n if (predicate(value)) {\n unsubscribe()\n resolve(true)\n }\n },\n )\n\n setTimeout(() => {\n unsubscribe()\n resolve(predicate(useGlassesStore.getState()[key]))\n }, timeoutMs)\n })\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mentra/engine",
|
|
3
|
-
"version": "3.5.0-dev.
|
|
3
|
+
"version": "3.5.0-dev.1466",
|
|
4
4
|
"description": "Mentra Engine — miniapp registry, WebView bridge, and miniapp store",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -107,13 +107,13 @@
|
|
|
107
107
|
"registry": "https://registry.npmjs.org/"
|
|
108
108
|
},
|
|
109
109
|
"dependencies": {
|
|
110
|
-
"@mentra/acs-meeting": "3.5.0-dev.
|
|
111
|
-
"@mentra/glasses-media": "3.5.0-dev.
|
|
112
|
-
"@mentra/bluetooth-sdk": "3.5.0-dev.
|
|
113
|
-
"@mentra/cloud-client": "3.5.0-dev.
|
|
114
|
-
"@mentra/cloud-protocol": "3.5.0-dev.
|
|
115
|
-
"@mentra/crust": "3.5.0-dev.
|
|
116
|
-
"@mentra/miniapp": "3.5.0-dev.
|
|
110
|
+
"@mentra/acs-meeting": "3.5.0-dev.1466",
|
|
111
|
+
"@mentra/glasses-media": "3.5.0-dev.1466",
|
|
112
|
+
"@mentra/bluetooth-sdk": "3.5.0-dev.1466",
|
|
113
|
+
"@mentra/cloud-client": "3.5.0-dev.1466",
|
|
114
|
+
"@mentra/cloud-protocol": "3.5.0-dev.1466",
|
|
115
|
+
"@mentra/crust": "3.5.0-dev.1466",
|
|
116
|
+
"@mentra/miniapp": "3.5.0-dev.1466",
|
|
117
117
|
"buffer": "^6.0.3",
|
|
118
118
|
"events": "^3.3.0",
|
|
119
119
|
"jszip": "^3.10.1",
|
|
@@ -12,9 +12,9 @@ export interface EngineReleaseMetadata {
|
|
|
12
12
|
export const ENGINE_RELEASE_METADATA: Readonly<EngineReleaseMetadata> = Object.freeze({
|
|
13
13
|
"schemaVersion": 1,
|
|
14
14
|
"familyBaseVersion": "3.5.0",
|
|
15
|
-
"releaseIdentity": "3.5.0-dev.
|
|
16
|
-
"releaseSetId": "mentra-3.5.0-dev.
|
|
17
|
-
"sourceCommit": "
|
|
18
|
-
"otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.
|
|
19
|
-
"otaManifestSha256": "
|
|
15
|
+
"releaseIdentity": "3.5.0-dev.1466",
|
|
16
|
+
"releaseSetId": "mentra-3.5.0-dev.1466",
|
|
17
|
+
"sourceCommit": "a56ee0ee343ad2adcc0ca08228329427a24f65cc",
|
|
18
|
+
"otaManifestUrl": "https://artifactscdn.mentraglass.com/Mentra-Community/MentraOS/releases/mentra-builds-v3.5.0/mentra-live-ota-3.5.0-dev.1466.json",
|
|
19
|
+
"otaManifestSha256": "2db50d0e64095f2636baafc59eb44d1ef4e865ed651457efcb1260686be1fa7f"
|
|
20
20
|
})
|
|
@@ -426,12 +426,22 @@ export function useMentraLiveOta(options: UseMentraLiveOtaOptions = {}): MentraL
|
|
|
426
426
|
}
|
|
427
427
|
let result = await ota.checkForUpdates(checkOptions)
|
|
428
428
|
if (!isCurrentCheck()) return
|
|
429
|
-
|
|
429
|
+
// Leaving the glasses hotspot after an update can leave the phone or Mac offline for a
|
|
430
|
+
// while: on 2026-11-18 the Mac's network was gone for 35 minutes. Keep checking, showing
|
|
431
|
+
// the failure after the first retry, until the internet returns or the person retries.
|
|
432
|
+
for (let retries = 0; !result.hasCheckCompleted && result.checkFailureReason === "network"; retries++) {
|
|
433
|
+
if (!isOtaAutoChainActive()) break
|
|
434
|
+
if (retries === 1) {
|
|
435
|
+
setErrorKind("network")
|
|
436
|
+
setCheckState("error")
|
|
437
|
+
}
|
|
430
438
|
await new Promise((resolve) => setTimeout(resolve, AUTO_CHAIN_NETWORK_RETRY_DELAY_MS))
|
|
431
439
|
if (!isCurrentCheck()) return
|
|
432
440
|
result = await ota.checkForUpdates(checkOptions)
|
|
441
|
+
if (!isCurrentCheck()) return
|
|
442
|
+
// Back to checking once it answers: the paths below need not set a state of their own.
|
|
443
|
+
if (result.hasCheckCompleted) setCheckState("checking")
|
|
433
444
|
}
|
|
434
|
-
if (!isCurrentCheck()) return
|
|
435
445
|
selectedCheckResultRef.current = result
|
|
436
446
|
selectedCheckDeviceRef.current = deviceRevision
|
|
437
447
|
await new Promise((resolve) => setTimeout(resolve, Math.max(0, MIN_DISPLAY_TIME_MS - (Date.now() - startTime))))
|
|
@@ -176,6 +176,7 @@ class HotspotOtaTransport {
|
|
|
176
176
|
localNetworkTransport.connect(this.networkOwner, hotspot.ssid, hotspot.password, {
|
|
177
177
|
assertCurrent,
|
|
178
178
|
gateway: hotspot.localIp,
|
|
179
|
+
frequency: hotspot.frequency,
|
|
179
180
|
// The glasses download from our listener; OTA asks their server only who they are.
|
|
180
181
|
purpose: "incoming-server",
|
|
181
182
|
}),
|
|
@@ -670,6 +670,7 @@ class GallerySyncService {
|
|
|
670
670
|
ssid: glassesStore.hotspot.ssid,
|
|
671
671
|
password: glassesStore.hotspot.password,
|
|
672
672
|
ip: glassesStore.hotspot.localIp,
|
|
673
|
+
frequency: glassesStore.hotspot.frequency,
|
|
673
674
|
}
|
|
674
675
|
: null
|
|
675
676
|
|
|
@@ -945,6 +946,7 @@ class GallerySyncService {
|
|
|
945
946
|
ssid: currentGlassesStore.hotspot.ssid,
|
|
946
947
|
password: currentGlassesStore.hotspot.password,
|
|
947
948
|
ip: currentGlassesStore.hotspot.localIp,
|
|
949
|
+
frequency: currentGlassesStore.hotspot.frequency,
|
|
948
950
|
}
|
|
949
951
|
: null
|
|
950
952
|
|
|
@@ -1241,6 +1243,7 @@ class GallerySyncService {
|
|
|
1241
1243
|
const joinedAddress = await keepHotspotUpWhileJoining(
|
|
1242
1244
|
localNetworkTransport.connect(this.networkOwner, hotspotInfo.ssid, hotspotInfo.password, {
|
|
1243
1245
|
gateway: hotspotInfo.ip,
|
|
1246
|
+
frequency: hotspotInfo.frequency,
|
|
1244
1247
|
onPermissionRequired: (systemAnswer) => {
|
|
1245
1248
|
if (!signal?.aborted) {
|
|
1246
1249
|
emitGalleryNotice({code: "local_network_permission_required", data: {systemAnswer}})
|
|
@@ -130,6 +130,8 @@ export const localNetworkTransport = {
|
|
|
130
130
|
options?: {
|
|
131
131
|
assertCurrent?: () => void
|
|
132
132
|
gateway?: string
|
|
133
|
+
/** The hotspot's channel in MHz, when the glasses report it: a Mac then scans only that channel. */
|
|
134
|
+
frequency?: number
|
|
133
135
|
purpose?: "outgoing-client" | "incoming-server"
|
|
134
136
|
/** iOS: the join has waited a few seconds for Local Network access, which may have been denied. */
|
|
135
137
|
onPermissionRequired?: (systemAnswer: string) => void
|
|
@@ -160,6 +162,7 @@ export const localNetworkTransport = {
|
|
|
160
162
|
password,
|
|
161
163
|
options?.gateway,
|
|
162
164
|
options?.purpose ?? "outgoing-client",
|
|
165
|
+
options?.frequency,
|
|
163
166
|
)
|
|
164
167
|
assertCurrent()
|
|
165
168
|
return address
|
package/src/stores/glasses.ts
CHANGED
|
@@ -70,6 +70,7 @@ type LegacyHotspotFields = {
|
|
|
70
70
|
hotspotPassword?: string
|
|
71
71
|
hotspotGatewayIp?: string
|
|
72
72
|
hotspotLocalIp?: string
|
|
73
|
+
hotspotFrequency?: number
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
type GlassesInfoUpdate = Partial<EngineGlassesStatus> & LegacyWifiFields & LegacyHotspotFields
|
|
@@ -91,7 +92,10 @@ function hotspotFromLegacyFields(info: LegacyHotspotFields): HotspotStatus | nul
|
|
|
91
92
|
const ssid = info.hotspotSsid?.trim()
|
|
92
93
|
const password = info.hotspotPassword?.trim()
|
|
93
94
|
const localIp = (info.hotspotGatewayIp ?? info.hotspotLocalIp)?.trim()
|
|
94
|
-
|
|
95
|
+
const frequency = info.hotspotFrequency
|
|
96
|
+
return ssid && password && localIp
|
|
97
|
+
? {state: "enabled", ssid, password, localIp, ...(frequency ? {frequency} : {})}
|
|
98
|
+
: null
|
|
95
99
|
}
|
|
96
100
|
if (info.hotspotEnabled === false) {
|
|
97
101
|
return {state: "disabled"}
|
|
@@ -198,6 +202,7 @@ export const useGlassesStore = create<GlassesState>()(
|
|
|
198
202
|
hotspotPassword,
|
|
199
203
|
hotspotGatewayIp,
|
|
200
204
|
hotspotLocalIp,
|
|
205
|
+
hotspotFrequency,
|
|
201
206
|
wifi,
|
|
202
207
|
hotspot,
|
|
203
208
|
...sdkInfo
|
|
@@ -205,7 +210,14 @@ export const useGlassesStore = create<GlassesState>()(
|
|
|
205
210
|
const wifiUpdate = wifi ?? wifiFromLegacyFields({wifiConnected, wifiSsid, wifiLocalIp})
|
|
206
211
|
const hotspotUpdate =
|
|
207
212
|
hotspot ??
|
|
208
|
-
hotspotFromLegacyFields({
|
|
213
|
+
hotspotFromLegacyFields({
|
|
214
|
+
hotspotEnabled,
|
|
215
|
+
hotspotSsid,
|
|
216
|
+
hotspotPassword,
|
|
217
|
+
hotspotGatewayIp,
|
|
218
|
+
hotspotLocalIp,
|
|
219
|
+
hotspotFrequency,
|
|
220
|
+
})
|
|
209
221
|
const hasWifiInfoUpdate =
|
|
210
222
|
Object.prototype.hasOwnProperty.call(info, "wifi") ||
|
|
211
223
|
Object.prototype.hasOwnProperty.call(info, "wifiConnected") ||
|