Files
faceclaw/app/phone-ui/pairing-page.xml
T
James BabcockandClaude Fable 5 17182532f4 Address review findings for the proximity-pairing PR
Correctness:
- Pair-glasses flows no longer strand the app in the manual-disconnected
  state: the pre-scan disconnect is followed by resumeAutoReconnect(), and
  the config page's scan hand-off drops the live link too.
- The mixed-arms serial warning is reachable now: pairs() groups by the
  canonical serial key, and a lone left + lone right with different serials
  get the mismatch warning on both rows (it previously required two
  different serials inside one serial-keyed group, which cannot happen).
- A selected pair that degrades to one arm (prune while the page is open)
  is deselected, and Save never pads a missing arm from stored addresses.
- DiscoveryAggregator.ingest no longer lets a bonded re-emit or split
  advertisement overwrite the note/name/flag learned from a full
  advertisement, and reclassifies split reports using remembered fields so
  a nameless half doesn't drop the arm.
- estimateProximity ignores the advertised TX Power Level (radiated power,
  not measured-power-at-1m); the calibration table is the only reference.
- Saving a ring without a glasses pair updates the stored identity's ring
  name/address instead of leaving the previous ring on record.
- Ring detection requires the stock "EVEN R1" name prefix in both the TS
  classifier and the Java pre-filter; a bare "R1" substring matched
  unrelated devices, and ring rows are always selectable.
- One-shot scans keep every sample (buildAddressSet merges them through
  DiscoveryAggregator), and flash-flow address resolution takes left/right
  from one serial-joined complete pair instead of latest-per-role.

Lifecycle:
- The pairing scan and its refresh timer pause on app suspend and resume
  with the app, and the model's app-event hooks are detached when the page
  is left for good.

Cleanup:
- One MAC normalizer (even-advertisement.normalizeMacAddress, re-exported
  by device-addresses), used for the ring "Yours" comparison too.
- One serial-equality definition (serialKey/serialsMatch); the containment
  fallback in isPreviouslyPaired is gone.
- Shared formatErrorMessage replaces five per-view-model copies; shared
  hex-util replaces the duplicate TS hex codecs; one Java bytesToHex in
  FaceclawFirmwareUtil replaces three hand-rolled encoders.
- glassesRow/ringRow share a presentation-base helper; dead row address
  fields, the constant glassesSectionVisibility, the identical-branch
  status ternary, and zoneRank/ZONE_ORDER are removed.
- .gitignore now actually covers .test-build/ as tests/README claims.

UI:
- Dark-mode styles for the pairing page: readable instructions, dark-gray
  cards with consistent light text; light mode keeps its current look.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016ZqzwmRQ3HQxasBz5rYyZV
2026-08-23 15:28:59 -07:00

93 lines
6.2 KiB
XML

<Page xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo" navigatingFrom="navigatingFrom" actionBarHidden="{{ actionBarHidden }}">
<ActionBar title="Pair Glasses" />
<GridLayout rows="auto,auto,*,auto" class="p-16">
<StackLayout row="0">
<Label text="{{ headline }}" class="h1 text-center" textWrap="true" />
<Label text="{{ instructions }}" class="m-t-8 pairing-instructions" textWrap="true" />
</StackLayout>
<GridLayout row="1" columns="auto,*" class="m-t-12 pairing-status-row">
<ActivityIndicator col="0" busy="{{ scanning }}" visibility="{{ scanningVisibility }}" width="22" height="22" />
<Label col="1" text="{{ status }}" textWrap="true" class="pairing-status" />
</GridLayout>
<ScrollView row="2" class="m-t-12">
<StackLayout>
<Label text="Glasses" class="h2 pairing-section" />
<Label text="{{ emptyGlassesMessage }}" class="pairing-empty" textWrap="true" visibility="{{ emptyGlassesVisibility }}" />
<Repeater items="{{ glassesRows }}">
<Repeater.itemsLayout>
<StackLayout />
</Repeater.itemsLayout>
<Repeater.itemTemplate>
<GridLayout columns="84,*,auto" rows="auto" class="{{ rowClass }}" tap="{{ onRowTap }}">
<GridLayout col="0" rows="auto,auto" class="pairing-art">
<Image row="0" src="{{ imagePath }}" stretch="aspectFit" width="80" height="30" />
<GridLayout row="1" columns="auto,auto" horizontalAlignment="center" class="m-t-4" visibility="{{ swatchVisibility }}">
<Label col="0" text="" width="12" height="12" borderRadius="6" backgroundColor="{{ swatchHex }}" />
<Label col="1" text="{{ colorwayLabel }}" class="pairing-swatch-label m-l-4" />
</GridLayout>
</GridLayout>
<StackLayout col="1" class="m-l-8">
<GridLayout columns="auto,auto">
<Label col="0" text="{{ modelTitle }}" class="pairing-title" />
<Label col="1" text="{{ badge }}" class="pairing-badge m-l-6" visibility="{{ badgeVisibility }}" />
</GridLayout>
<Label text="{{ variantSummary }}" class="pairing-variant" visibility="{{ variantVisibility }}" />
<Label text="{{ proximityLine }}" class="{{ proximityClass }}" />
<Label text="{{ deviceName }}" class="pairing-serial" />
<Label text="{{ armsSummary }}" class="pairing-arms" textWrap="true" />
<Label text="{{ warning }}" class="pairing-warning" textWrap="true" visibility="{{ warningVisibility }}" />
</StackLayout>
<Label col="2" text="{{ chevron }}" class="pairing-chevron" verticalAlignment="center" />
</GridLayout>
</Repeater.itemTemplate>
</Repeater>
<Label text="Ring (optional)" class="h2 pairing-section m-t-16" />
<Label text="{{ emptyRingMessage }}" class="pairing-empty" textWrap="true" visibility="{{ emptyRingVisibility }}" />
<Repeater items="{{ ringRows }}">
<Repeater.itemsLayout>
<StackLayout />
</Repeater.itemsLayout>
<Repeater.itemTemplate>
<GridLayout columns="84,*,auto" rows="auto" class="{{ rowClass }}" tap="{{ onRowTap }}">
<Image col="0" src="{{ imagePath }}" stretch="aspectFit" width="56" height="30" class="pairing-art" />
<StackLayout col="1" class="m-l-8">
<GridLayout columns="auto,auto">
<Label col="0" text="{{ modelTitle }}" class="pairing-title" />
<Label col="1" text="{{ badge }}" class="pairing-badge m-l-6" visibility="{{ badgeVisibility }}" />
</GridLayout>
<Label text="{{ proximityLine }}" class="{{ proximityClass }}" />
<Label text="{{ deviceName }}" class="pairing-serial" />
<Label text="{{ armsSummary }}" class="pairing-arms" textWrap="true" />
<Label text="{{ warning }}" class="pairing-warning" textWrap="true" visibility="{{ warningVisibility }}" />
</StackLayout>
<Label col="2" text="{{ chevron }}" class="pairing-chevron" verticalAlignment="center" />
</GridLayout>
</Repeater.itemTemplate>
</Repeater>
<StackLayout class="pairing-selection m-t-16" visibility="{{ selectionVisibility }}">
<Label text="Selected" class="h2 pairing-section" />
<Label text="{{ selectionSummary }}" textWrap="true" />
</StackLayout>
<Label text="{{ diagnostics }}" class="pairing-diagnostics m-t-16" textWrap="true" visibility="{{ diagnosticsVisibility }}" />
</StackLayout>
</ScrollView>
<StackLayout row="3" class="m-t-12">
<GridLayout columns="*,*">
<Button col="0" text="{{ secondaryLabel }}" tap="{{ onSecondaryTap }}" />
<Button col="1" text="{{ primaryLabel }}" tap="{{ onPrimaryTap }}" class="-primary" isEnabled="{{ primaryEnabled }}" />
</GridLayout>
<GridLayout columns="*,*" class="m-t-4">
<Button col="0" text="{{ scanToggleLabel }}" tap="{{ onScanToggleTap }}" class="pairing-link" />
<Button col="1" text="Enter addresses manually" tap="{{ onManualTap }}" class="pairing-link" />
</GridLayout>
</StackLayout>
</GridLayout>
</Page>