@glassly/engine 0.4.0-dev.1084 → 0.4.0-dev.1085

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.
@@ -14,6 +14,7 @@ import {AppState, Linking} from "react-native"
14
14
  import {logBuffer} from "../utils/devLogging"
15
15
  import {collectDisplayDiagnostics} from "./DisplayDiagnostics"
16
16
  import Share from "react-native-share"
17
+ import {uses24HourClock} from "react-native-localize"
17
18
  import * as Battery from "expo-battery"
18
19
  import * as Clipboard from "expo-clipboard"
19
20
  import {File, Paths} from "expo-file-system"
@@ -5813,28 +5814,33 @@ class LocalMiniappRuntime {
5813
5814
  }
5814
5815
  }
5815
5816
 
5816
- /** Host user preferences miniapps follow by default (Settings > Appearance). */
5817
+ /** Host user preferences miniapps follow by default: the metric toggle and the phone's own clock format. */
5817
5818
  private currentPreferences(): MiniappPreferences {
5818
5819
  const settings = useSettingsStore.getState()
5819
5820
  return {
5820
5821
  unitSystem: settings.getSetting(SETTINGS.metric_system.key) === true ? "metric" : "imperial",
5821
- twelveHourTime: settings.getSetting(SETTINGS.twelve_hour_time.key) === true,
5822
+ twelveHourTime: !uses24HourClock(),
5822
5823
  }
5823
5824
  }
5824
5825
 
5825
5826
  private ensurePreferencesWired(): void {
5826
5827
  if (this.preferencesWired) return
5827
5828
  this.preferencesWired = true
5828
- useSettingsStore.subscribe(
5829
- (s) =>
5830
- `${s.getSetting(SETTINGS.metric_system.key) === true}:${s.getSetting(SETTINGS.twelve_hour_time.key) === true}`,
5831
- () => {
5832
- const preferences = this.currentPreferences()
5833
- for (const packageName of this.handshookApps) {
5834
- this.sendToMiniapp(packageName, {type: MiniappResponseType.PREFERENCES_UPDATE, preferences})
5835
- }
5836
- },
5837
- )
5829
+ let sent = JSON.stringify(this.currentPreferences())
5830
+ const pushIfChanged = () => {
5831
+ const preferences = this.currentPreferences()
5832
+ const key = JSON.stringify(preferences)
5833
+ if (key === sent) return
5834
+ sent = key
5835
+ for (const packageName of this.handshookApps) {
5836
+ this.sendToMiniapp(packageName, {type: MiniappResponseType.PREFERENCES_UPDATE, preferences})
5837
+ }
5838
+ }
5839
+ useSettingsStore.subscribe((s) => s.getSetting(SETTINGS.metric_system.key) === true, pushIfChanged)
5840
+ // The clock format is an OS setting, so it can only have changed while the app was in the background.
5841
+ AppState.addEventListener("change", (state) => {
5842
+ if (state === "active") pushIfChanged()
5843
+ })
5838
5844
  }
5839
5845
 
5840
5846
  private currentCloudStatus(): MiniappCloudStatus {
@@ -23,7 +23,6 @@ export type SettingsBridgeAccess = "read" | "write"
23
23
  export const SETTINGS_BRIDGE_KEYS: Readonly<Record<string, SettingsBridgeAccess>> = {
24
24
  // The dashboard's master switch is a phone-side debug knob.
25
25
  custom_dashboard_enabled: "read",
26
- contextual_dashboard: "write",
27
26
  head_up_angle: "write",
28
27
  // Where the glasses draw; each model's steps are its display.positionRange.
29
28
  dashboard_depth: "write",
@@ -33,7 +32,6 @@ export const SETTINGS_BRIDGE_KEYS: Readonly<Record<string, SettingsBridgeAccess>
33
32
  auto_brightness: "write",
34
33
  // Per paired model: the store resolves the indexed key.
35
34
  preferred_mic: "write",
36
- twelve_hour_time: "write",
37
35
  menu_apps: "write",
38
36
  notifications_enabled: "write",
39
37
  notifications_popups: "write",
@@ -708,13 +708,6 @@ export const SETTINGS: Record<string, Setting> = {
708
708
  saveOnServer: true,
709
709
  persist: true,
710
710
  },
711
- twelve_hour_time: {
712
- key: "twelve_hour_time",
713
- defaultValue: () => true,
714
- writable: true,
715
- saveOnServer: true,
716
- persist: true,
717
- },
718
711
  enforce_local_transcription: {
719
712
  key: "enforce_local_transcription",
720
713
  defaultValue: () => false,
@@ -764,14 +757,6 @@ export const SETTINGS: Record<string, Setting> = {
764
757
  saveOnServer: false,
765
758
  persist: false,
766
759
  },
767
- // glasses settings:
768
- contextual_dashboard: {
769
- key: "contextual_dashboard",
770
- defaultValue: () => false,
771
- writable: true,
772
- saveOnServer: true,
773
- persist: true,
774
- },
775
760
  // Debug escape hatch: G2 scene rendering through the Glassly CFW
776
761
  // direct-framebuffer path (rasterized mode-3 frames into the carrier).
777
762
  // ON by default — the working production path on CFW glasses; OFF falls
@@ -1268,8 +1253,7 @@ export const BLUETOOTH_SETTING_KEYS: string[] = [
1268
1253
  SETTINGS.screen_disabled.key,
1269
1254
  SETTINGS.auth_email.key,
1270
1255
  SETTINGS.core_token.key,
1271
- // glasses settings (contextual_dashboard is phone-side policy now — native
1272
- // no longer reads it):
1256
+ // glasses settings:
1273
1257
  SETTINGS.head_up_angle.key,
1274
1258
  SETTINGS.brightness.key,
1275
1259
  SETTINGS.auto_brightness.key,
@@ -1283,7 +1267,6 @@ export const BLUETOOTH_SETTING_KEYS: string[] = [
1283
1267
  SETTINGS.perf_logs.key,
1284
1268
  SETTINGS.ring_via_glasses.key,
1285
1269
  SETTINGS.display_max_fps.key,
1286
- SETTINGS.twelve_hour_time.key,
1287
1270
  SETTINGS.metric_system.key,
1288
1271
  // button:
1289
1272
  SETTINGS.button_photo_size.key,