forked from Blendman974/faceclaw
Clean up redundant messages on the Pair Glasses page
This commit is contained in:
1 parent
fa663804de
commit
bf66c5a53c
5 files changed
+5
-33
No files matched your search
+1
-14
@@ -27,7 +27,7 @@
|
||||
*
|
||||
* It is **not** a measurement. A hand over the temple, a pocket, or a body
|
||||
* between phone and glasses moves the estimate by metres. The wearer therefore
|
||||
* only ever sees a coarse zone (glyph + label), never a number in metres they
|
||||
* only ever sees a coarse zone (a signal-strength glyph), never a number in metres they
|
||||
* might over-trust; the metres value exists purely to rank and bucket.
|
||||
*
|
||||
* This module is pure (no NativeScript imports) so it can run under node tests.
|
||||
@@ -75,19 +75,6 @@ export function zoneFromMeters(meters: number): ProximityZone {
|
||||
return "distant";
|
||||
}
|
||||
|
||||
export function zoneLabel(zone: ProximityZone): string {
|
||||
switch (zone) {
|
||||
case "immediate":
|
||||
return "In your hand";
|
||||
case "near":
|
||||
return "Nearby";
|
||||
case "far":
|
||||
return "Across the room";
|
||||
case "distant":
|
||||
return "Far away";
|
||||
}
|
||||
}
|
||||
|
||||
/** A glyph for the zone; SF Symbols have no Android equivalent, so plain text. */
|
||||
export function zoneGlyph(zone: ProximityZone): string {
|
||||
switch (zone) {
|
||||
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
RING_CALIBRATION,
|
||||
sortedByProximity,
|
||||
zoneGlyph,
|
||||
zoneLabel,
|
||||
type ProximityEstimate,
|
||||
type ProximityZone,
|
||||
} from "./ble-proximity";
|
||||
@@ -329,7 +328,6 @@ export type PairingRowPresentation = {
|
||||
isPreviouslyPaired: boolean;
|
||||
/** "Yours" / "Closest" / "". */
|
||||
badge: string;
|
||||
proximitySummary: string;
|
||||
proximityGlyph: string;
|
||||
zone: ProximityZone | null;
|
||||
/** "Left + right arms found", "Only the left arm has been seen", …; "" when there is nothing worth a line (an unbonded ring). */
|
||||
@@ -355,12 +353,11 @@ function presentationBase(
|
||||
isNearest: boolean,
|
||||
isPaired: boolean,
|
||||
warnings: readonly string[],
|
||||
): Pick<PairingRowPresentation, "isNearest" | "isPreviouslyPaired" | "badge" | "proximitySummary" | "proximityGlyph" | "zone" | "warning"> {
|
||||
): Pick<PairingRowPresentation, "isNearest" | "isPreviouslyPaired" | "badge" | "proximityGlyph" | "zone" | "warning"> {
|
||||
return {
|
||||
isNearest,
|
||||
isPreviouslyPaired: isPaired,
|
||||
badge: isPaired ? "Yours" : isNearest ? "Closest" : "",
|
||||
proximitySummary: proximity ? zoneLabel(proximity.zone) : "Signal unknown",
|
||||
proximityGlyph: proximity ? zoneGlyph(proximity.zone) : "○○○○",
|
||||
zone: proximity?.zone ?? null,
|
||||
warning: warnings.join(" "),
|
||||
|
||||
Reference in new issue
Block a user