@glassly/engine 0.4.0-dev.1029 → 0.4.0-dev.1031

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.
@@ -190,9 +190,16 @@ function resolveEndpoints(): {core: string; runtime: string} {
190
190
  }
191
191
  }
192
192
 
193
+ // Via init(), never construct(): init() holds the disable-cloud gate, and a
194
+ // client built past it opens the runtime socket and retries it forever.
195
+ function requireClient(): CloudClient {
196
+ if (!client) cloudClientService.init()
197
+ if (!client) throw new Error("Glassly cloud is disabled")
198
+ return client
199
+ }
200
+
193
201
  function getCoreClient(): CloudCore {
194
- if (!client) construct()
195
- const core = client?.core
202
+ const core = requireClient().core
196
203
  if (!core) throw new Error("cloud client core not configured")
197
204
  return core
198
205
  }
@@ -207,9 +214,7 @@ function syncCoreAccessTokenToBluetooth(): Promise<string> {
207
214
  }
208
215
 
209
216
  async function syncCoreAccessTokenToBluetoothInternal(): Promise<string> {
210
- if (!client) construct()
211
- const c = client
212
- if (!c) throw new Error("cloud client not initialized")
217
+ const c = requireClient()
213
218
 
214
219
  const token = await c.auth.getCoreToken()
215
220
  if (c !== client) {
@@ -83,6 +83,8 @@ function armDebounce(generation: number): void {
83
83
 
84
84
  async function sendCurrentSnapshot(force: boolean, generation = syncGeneration): Promise<void> {
85
85
  if (!unsubscribe || generation !== syncGeneration) return
86
+ // Every send would fail into the retry backoff with no client to send through.
87
+ if (cloudClientService.isCloudDisabled()) return
86
88
  if (sendingGeneration === generation) {
87
89
  const fingerprint = snapshotFingerprint(buildSnapshot())
88
90
  if (fingerprint !== lastSentFingerprint) queuedFingerprint = fingerprint
@@ -762,12 +762,14 @@ export const SETTINGS: Record<string, Setting> = {
762
762
  saveOnServer: true,
763
763
  persist: true,
764
764
  },
765
+ // Session-only: Position settings holds it on for stock G1, and a persisted
766
+ // true (app killed on that screen) blanks every glasses' display at boot.
765
767
  screen_disabled: {
766
768
  key: "screen_disabled",
767
769
  defaultValue: () => false,
768
770
  writable: true,
769
771
  saveOnServer: false,
770
- persist: true,
772
+ persist: false,
771
773
  },
772
774
  // glasses settings:
773
775
  contextual_dashboard: {