mirror of
https://git.undefined-dev.fr/Blendman974/faceclaw.git
synced 2026-11-19 21:03:09 +00:00
Apple Watch: Sound-effects and vibrate settings, build scripts
This commit is contained in:
1 parent
2696f3b76c
commit
6df52021c8
13 files changed
+117
-29
No files matched your search
@@ -37,6 +37,8 @@ import {
|
|||||||
watchCrownClockwiseNextSetting,
|
watchCrownClockwiseNextSetting,
|
||||||
watchMirrorAssistantSetting,
|
watchMirrorAssistantSetting,
|
||||||
watchRemoteEnabledSetting,
|
watchRemoteEnabledSetting,
|
||||||
|
watchSoundEffectsSetting,
|
||||||
|
watchVibrateOnInputSetting,
|
||||||
} from "../ui/dashboard-settings";
|
} from "../ui/dashboard-settings";
|
||||||
import { shell, type AssistantActivityEvent } from "../ui/shell/shell";
|
import { shell, type AssistantActivityEvent } from "../ui/shell/shell";
|
||||||
import { voiceActivity } from "../ui/shell/voice-activity";
|
import { voiceActivity } from "../ui/shell/voice-activity";
|
||||||
@@ -308,6 +310,8 @@ export class WearRemote {
|
|||||||
apps: this.listApps(),
|
apps: this.listApps(),
|
||||||
remoteEnabled: watchRemoteEnabledSetting.get(),
|
remoteEnabled: watchRemoteEnabledSetting.get(),
|
||||||
crownClockwiseNext: watchCrownClockwiseNextSetting.get(),
|
crownClockwiseNext: watchCrownClockwiseNextSetting.get(),
|
||||||
|
vibrateOnInput: watchVibrateOnInputSetting.get(),
|
||||||
|
soundEffects: watchSoundEffectsSetting.get(),
|
||||||
canUnlock: watchCanUnlockSetting.get(),
|
canUnlock: watchCanUnlockSetting.get(),
|
||||||
mirrorAssistant: watchMirrorAssistantSetting.get(),
|
mirrorAssistant: watchMirrorAssistantSetting.get(),
|
||||||
assistantAvailable: shell.isAssistantAvailable(),
|
assistantAvailable: shell.isAssistantAvailable(),
|
||||||
|
|||||||
@@ -699,6 +699,7 @@ export const watchCanUnlockSetting = new ConfigSettingBoolean({
|
|||||||
"Let the watch unlock the glasses' lock screen (which otherwise waits for the phone to be unlocked). Your watch is on your wrist; turn this off if you would rather it stay a phone-only unlock.",
|
"Let the watch unlock the glasses' lock screen (which otherwise waits for the phone to be unlocked). Your watch is on your wrist; turn this off if you would rather it stay a phone-only unlock.",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Wear OS only: the Apple Watch's crown doesn't reach the app, so iOS doesn't offer this.
|
||||||
export const watchCrownClockwiseNextSetting = new ConfigSettingBoolean({
|
export const watchCrownClockwiseNextSetting = new ConfigSettingBoolean({
|
||||||
id: "watch-crown-clockwise-next",
|
id: "watch-crown-clockwise-next",
|
||||||
label: "Clockwise crown = next",
|
label: "Clockwise crown = next",
|
||||||
@@ -708,6 +709,26 @@ export const watchCrownClockwiseNextSetting = new ConfigSettingBoolean({
|
|||||||
"Choose which crown direction moves to the next item. Off: clockwise moves to the previous item. On: clockwise moves to the next item.",
|
"Choose which crown direction moves to the next item. Off: clockwise moves to the previous item. On: clockwise moves to the next item.",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Apple Watch only: Wear OS has no sounds, and keeps its vibration setting on the watch.
|
||||||
|
// The watch reads these from the mirrored state (apple-watch/Faceclaw/WatchPrefs.swift).
|
||||||
|
export const watchVibrateOnInputSetting = new ConfigSettingBoolean({
|
||||||
|
id: "watch-vibrate-on-input",
|
||||||
|
label: "Vibrate on input",
|
||||||
|
storageKey: "watch.vibrateOnInput",
|
||||||
|
defaultValue: true,
|
||||||
|
description:
|
||||||
|
"Adds a slight vibration with each watch input",
|
||||||
|
});
|
||||||
|
|
||||||
|
export const watchSoundEffectsSetting = new ConfigSettingBoolean({
|
||||||
|
id: "watch-sound-effects",
|
||||||
|
label: "Sound effects",
|
||||||
|
storageKey: "watch.soundEffects",
|
||||||
|
defaultValue: false,
|
||||||
|
description:
|
||||||
|
"On: each input gets its own watchOS feedback, a sound with a vibration (watchOS can't play one alone, so this vibrates even with Vibrate on input off). Off: a light tap for every input. Only Silent Mode on the watch guarantees no sound.",
|
||||||
|
});
|
||||||
|
|
||||||
export const watchMirrorAssistantSetting = new ConfigSettingBoolean({
|
export const watchMirrorAssistantSetting = new ConfigSettingBoolean({
|
||||||
id: "watch-mirror-assistant",
|
id: "watch-mirror-assistant",
|
||||||
label: "Mirror assistant to watch",
|
label: "Mirror assistant to watch",
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ import {
|
|||||||
watchCrownClockwiseNextSetting,
|
watchCrownClockwiseNextSetting,
|
||||||
watchMirrorAssistantSetting,
|
watchMirrorAssistantSetting,
|
||||||
watchRemoteEnabledSetting,
|
watchRemoteEnabledSetting,
|
||||||
|
watchSoundEffectsSetting,
|
||||||
|
watchVibrateOnInputSetting,
|
||||||
} from "../dashboard-settings";
|
} from "../dashboard-settings";
|
||||||
import { wearBridge } from "../../native/wear-bridge";
|
import { wearBridge } from "../../native/wear-bridge";
|
||||||
import { openSettingsSubMenu, SettingsPanelLayer, type SettingsSection } from "./settings-panel";
|
import { openSettingsSubMenu, SettingsPanelLayer, type SettingsSection } from "./settings-panel";
|
||||||
@@ -213,7 +215,12 @@ function settingsSections(): SettingsSection[] {
|
|||||||
// whether a watch running the companion app is currently reachable.
|
// whether a watch running the companion app is currently reachable.
|
||||||
items: [
|
items: [
|
||||||
toggleSettingMenuItem(watchRemoteEnabledSetting),
|
toggleSettingMenuItem(watchRemoteEnabledSetting),
|
||||||
toggleSettingMenuItem(watchCrownClockwiseNextSetting),
|
...(global.isIOS ? [
|
||||||
|
toggleSettingMenuItem(watchVibrateOnInputSetting),
|
||||||
|
toggleSettingMenuItem(watchSoundEffectsSetting),
|
||||||
|
] : [
|
||||||
|
toggleSettingMenuItem(watchCrownClockwiseNextSetting),
|
||||||
|
]),
|
||||||
toggleSettingMenuItem(watchCanUnlockSetting),
|
toggleSettingMenuItem(watchCanUnlockSetting),
|
||||||
toggleSettingMenuItem(watchMirrorAssistantSetting),
|
toggleSettingMenuItem(watchMirrorAssistantSetting),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ struct FaceclawWatchApp: App {
|
|||||||
|
|
||||||
init() {
|
init() {
|
||||||
link = PhoneLink()
|
link = PhoneLink()
|
||||||
prefs = WatchPrefs()
|
prefs = WatchPrefs(link: link)
|
||||||
// Here rather than in a view: a background launch never builds one.
|
// Here rather than in a view: a background launch never builds one.
|
||||||
link.start()
|
link.start()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,8 +171,8 @@ final class PadController {
|
|||||||
let steps = Int(crownRemainder.rounded(.towardZero))
|
let steps = Int(crownRemainder.rounded(.towardZero))
|
||||||
guard steps != 0 else { return }
|
guard steps != 0 else { return }
|
||||||
crownRemainder -= Double(steps)
|
crownRemainder -= Double(steps)
|
||||||
let clockwiseNext = link.state?.crownClockwiseNext == true
|
// Clockwise moves to the previous item.
|
||||||
let gesture: RingGesture = (steps > 0) == clockwiseNext ? .scrollDown : .scrollUp
|
let gesture: RingGesture = steps > 0 ? .scrollUp : .scrollDown
|
||||||
guard gestureAllowed(gesture) else { return }
|
guard gestureAllowed(gesture) else { return }
|
||||||
// Capped low: a fast twirl otherwise outruns the display. The crown's
|
// Capped low: a fast twirl otherwise outruns the display. The crown's
|
||||||
// own detent haptics are the feedback, so there's no buzz here.
|
// own detent haptics are the feedback, so there's no buzz here.
|
||||||
|
|||||||
@@ -115,8 +115,9 @@ struct PhoneState: Equatable {
|
|||||||
var windows: [WindowEntry] = []
|
var windows: [WindowEntry] = []
|
||||||
var apps: [AppEntry] = []
|
var apps: [AppEntry] = []
|
||||||
var remoteEnabled = true
|
var remoteEnabled = true
|
||||||
/** False by default: clockwise moves to the previous item. */
|
/** Settings > Watch on the glasses; WatchPrefs and Haptics say what they do. */
|
||||||
var crownClockwiseNext = false
|
var vibrateOnInput = true
|
||||||
|
var soundEffects = false
|
||||||
var canUnlock = true
|
var canUnlock = true
|
||||||
var mirrorAssistant = true
|
var mirrorAssistant = true
|
||||||
var assistantAvailable = false
|
var assistantAvailable = false
|
||||||
@@ -155,7 +156,8 @@ struct PhoneState: Equatable {
|
|||||||
}
|
}
|
||||||
state.apps = (o["apps"] as? [[String: Any]] ?? []).map(appEntry)
|
state.apps = (o["apps"] as? [[String: Any]] ?? []).map(appEntry)
|
||||||
state.remoteEnabled = o["remoteEnabled"] as? Bool ?? true
|
state.remoteEnabled = o["remoteEnabled"] as? Bool ?? true
|
||||||
state.crownClockwiseNext = o["crownClockwiseNext"] as? Bool ?? false
|
state.vibrateOnInput = o["vibrateOnInput"] as? Bool ?? true
|
||||||
|
state.soundEffects = o["soundEffects"] as? Bool ?? false
|
||||||
state.canUnlock = o["canUnlock"] as? Bool ?? true
|
state.canUnlock = o["canUnlock"] as? Bool ?? true
|
||||||
state.mirrorAssistant = o["mirrorAssistant"] as? Bool ?? true
|
state.mirrorAssistant = o["mirrorAssistant"] as? Bool ?? true
|
||||||
state.assistantAvailable = o["assistantAvailable"] as? Bool ?? false
|
state.assistantAvailable = o["assistantAvailable"] as? Bool ?? false
|
||||||
|
|||||||
@@ -340,20 +340,23 @@ struct StatusScreen: View {
|
|||||||
|
|
||||||
// MARK: - Settings
|
// MARK: - Settings
|
||||||
|
|
||||||
/** Watch-local preferences: feel of the pad and crown. */
|
/** Watch-local preferences: feel of the crown. */
|
||||||
struct SettingsScreen: View {
|
struct SettingsScreen: View {
|
||||||
@Environment(WatchPrefs.self) private var prefs
|
@Environment(WatchPrefs.self) private var prefs
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@Bindable var prefs = prefs
|
|
||||||
ScrollView {
|
ScrollView {
|
||||||
VStack(spacing: 4) {
|
VStack(spacing: 4) {
|
||||||
Toggle("Vibrate on input", isOn: $prefs.haptics)
|
|
||||||
Button {
|
Button {
|
||||||
prefs.crownSensitivity = prefs.crownSensitivity.next
|
prefs.crownSensitivity = prefs.crownSensitivity.next
|
||||||
} label: {
|
} label: {
|
||||||
RowLabel(title: "Crown sensitivity", detail: prefs.crownSensitivity.rawValue)
|
RowLabel(title: "Crown sensitivity", detail: prefs.crownSensitivity.rawValue)
|
||||||
}
|
}
|
||||||
|
Text("Vibration and sound effects are in Settings > Watch on the glasses.")
|
||||||
|
.font(.caption2)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
.multilineTextAlignment(.center)
|
||||||
|
.padding(.top, 6)
|
||||||
Text("To keep the remote open between glances, set Settings > General > Return to Clock > Faceclaw on the watch.")
|
Text("To keep the remote open between glances, set Settings > General > Return to Clock > Faceclaw on the watch.")
|
||||||
.font(.caption2)
|
.font(.caption2)
|
||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
|
|||||||
@@ -22,33 +22,44 @@ enum CrownSensitivity: String, CaseIterable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Watch-local preferences (nothing here is synced to the phone). */
|
/**
|
||||||
|
Crown sensitivity is the watch's own. Vibration and sound follow Settings > Watch on
|
||||||
|
the glasses, through the mirrored state, which the application context keeps for
|
||||||
|
when the phone is out of reach.
|
||||||
|
*/
|
||||||
@MainActor
|
@MainActor
|
||||||
@Observable
|
@Observable
|
||||||
final class WatchPrefs {
|
final class WatchPrefs {
|
||||||
/** Buzz on every gesture sent, and tick on crown detents. */
|
/** Confirm each gesture sent, and tick on crown detents. */
|
||||||
var haptics: Bool {
|
var haptics: Bool { link.state?.vibrateOnInput ?? true }
|
||||||
didSet { store.set(haptics, forKey: Keys.haptics) }
|
|
||||||
}
|
/** Give each gesture its own cue, sound included; see Haptics. */
|
||||||
|
var soundEffects: Bool { link.state?.soundEffects ?? false }
|
||||||
|
|
||||||
var crownSensitivity: CrownSensitivity {
|
var crownSensitivity: CrownSensitivity {
|
||||||
didSet { store.set(crownSensitivity.rawValue, forKey: Keys.crown) }
|
didSet { store.set(crownSensitivity.rawValue, forKey: Keys.crown) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ObservationIgnored private let link: PhoneLink
|
||||||
@ObservationIgnored private let store = UserDefaults.standard
|
@ObservationIgnored private let store = UserDefaults.standard
|
||||||
|
|
||||||
private enum Keys {
|
private enum Keys {
|
||||||
static let haptics = "haptics"
|
|
||||||
static let crown = "crownSensitivity"
|
static let crown = "crownSensitivity"
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init(link: PhoneLink) {
|
||||||
haptics = store.object(forKey: Keys.haptics) as? Bool ?? true
|
self.link = link
|
||||||
crownSensitivity = store.string(forKey: Keys.crown).flatMap(CrownSensitivity.init(rawValue:)) ?? .normal
|
crownSensitivity = store.string(forKey: Keys.crown).flatMap(CrownSensitivity.init(rawValue:)) ?? .normal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The wrist's confirmation of what was sent. */
|
/**
|
||||||
|
The wrist's confirmation of what was sent. watchOS has no call that plays only a
|
||||||
|
vibration or only a sound: every WKHapticType is both, and only the watch's own Silent
|
||||||
|
Mode mutes the sound. So sound effects on means the full set of cues, which vibrate
|
||||||
|
whatever the vibrate setting says, and off means `.click` for everything. Whether
|
||||||
|
`.click` is truly silent is unconfirmed; see notes/apple-watch-followups.md.
|
||||||
|
*/
|
||||||
@MainActor
|
@MainActor
|
||||||
struct Haptics {
|
struct Haptics {
|
||||||
let prefs: WatchPrefs
|
let prefs: WatchPrefs
|
||||||
@@ -62,10 +73,28 @@ struct Haptics {
|
|||||||
/** A reply finished arriving. */
|
/** A reply finished arriving. */
|
||||||
func done() { play(.success) }
|
func done() { play(.success) }
|
||||||
|
|
||||||
/** The phone refused or did not answer; always plays. */
|
/** The phone refused or did not answer; always plays, and never feels like a sent gesture. */
|
||||||
func error() { WKInterfaceDevice.current().play(.failure) }
|
func error() {
|
||||||
|
let device = WKInterfaceDevice.current()
|
||||||
private func play(_ type: WKHapticType) {
|
if prefs.soundEffects {
|
||||||
if prefs.haptics { WKInterfaceDevice.current().play(type) }
|
device.play(.failure)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
device.play(.click)
|
||||||
|
Task {
|
||||||
|
try? await Task.sleep(nanoseconds: Self.errorTapGapNanos)
|
||||||
|
device.play(.click)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func play(_ cue: WKHapticType) {
|
||||||
|
if prefs.soundEffects {
|
||||||
|
WKInterfaceDevice.current().play(cue)
|
||||||
|
} else if prefs.haptics {
|
||||||
|
WKInterfaceDevice.current().play(.click)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Apple's documentation asks for at least 100 ms between haptics. */
|
||||||
|
private static let errorTapGapNanos: UInt64 = 150_000_000
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,7 @@ standalone app: without Faceclaw on the iPhone it only tells you to install it.
|
|||||||
| press and hold | the system menu: Focus app switcher, Voice input, Close window (held until you lift your finger; games that use a long press as a move get it instead) |
|
| press and hold | the system menu: Focus app switcher, Voice input, Close window (held until you lift your finger; games that use a long press as a move get it instead) |
|
||||||
| tap, then press and hold | the app's context menu |
|
| tap, then press and hold | the app's context menu |
|
||||||
| swipe ↑ ↓ ← → | **spatial navigation**: the launcher moves one app by a row or a column, the settings panel moves between its columns and down its lists, the sidebar moves up and down, Music skips tracks. Right goes *into* things and left comes back *out*. Anywhere without a spatial meaning, up/down scroll, right selects and left goes back. One step per swipe. |
|
| swipe ↑ ↓ ← → | **spatial navigation**: the launcher moves one app by a row or a column, the settings panel moves between its columns and down its lists, the sidebar moves up and down, Music skips tracks. Right goes *into* things and left comes back *out*. Anywhere without a spatial meaning, up/down scroll, right selects and left goes back. One step per swipe. |
|
||||||
| turn the crown | previous / next. Clockwise is previous by default; reverse it in the on-glasses Settings > Watch section. Sensitivity is in the watch's own settings. |
|
| turn the crown | previous / next; clockwise is previous. Don't count on it: on a real watch the crown has triggered watchOS's own actions instead of reaching the app. Sensitivity is in the watch's own settings. |
|
||||||
| the Double Tap hand gesture (Series 9, Ultra 2, SE 3 and later, watchOS 11) | select |
|
| the Double Tap hand gesture (Series 9, Ultra 2, SE 3 and later, watchOS 11) | select |
|
||||||
|
|
||||||
Swipe up from the bottom edge to reveal the buttons, and down from them to hide them:
|
Swipe up from the bottom edge to reveal the buttons, and down from them to hide them:
|
||||||
@@ -32,7 +32,8 @@ Swipe up from the bottom edge to reveal the buttons, and down from them to hide
|
|||||||
- **Status** — connection, display on/off, lock/unlock, whether Faceclaw is
|
- **Status** — connection, display on/off, lock/unlock, whether Faceclaw is
|
||||||
answering on the iPhone, and the watch's settings.
|
answering on the iPhone, and the watch's settings.
|
||||||
|
|
||||||
Phone-side switches live in Faceclaw's Settings > Watch. While the glasses display
|
Phone-side switches live in Faceclaw's Settings > Watch, including vibration and
|
||||||
|
sound effects. While the glasses display
|
||||||
is off, a double-tap wakes it and a tap or hold shows the Glanceboard; other gestures
|
is off, a double-tap wakes it and a tap or hold shows the Glanceboard; other gestures
|
||||||
do nothing. The watch buzzes differently when the phone refuses or doesn't answer a
|
do nothing. The watch buzzes differently when the phone refuses or doesn't answer a
|
||||||
gesture, and the pill at the bottom says why.
|
gesture, and the pill at the bottom says why.
|
||||||
@@ -46,6 +47,10 @@ These come from what watchOS allows apps to do:
|
|||||||
|
|
||||||
- **No two-finger gestures.** SwiftUI on watchOS only reports one finger.
|
- **No two-finger gestures.** SwiftUI on watchOS only reports one finger.
|
||||||
- **No side buttons.** The crown press and side button belong to the system.
|
- **No side buttons.** The crown press and side button belong to the system.
|
||||||
|
- **Vibration and sound come as a pair.** watchOS has no call that plays only one, and
|
||||||
|
only the watch's own Silent Mode mutes the sound. With sound effects off, every input
|
||||||
|
gets a light tap rather than its own cue; with them on, inputs vibrate even if
|
||||||
|
Vibrate on input is off.
|
||||||
- **The display can't be kept on.** To keep the remote open between glances, set
|
- **The display can't be kept on.** To keep the remote open between glances, set
|
||||||
Settings > General > Return to Clock > Faceclaw on the watch to a longer time.
|
Settings > General > Return to Clock > Faceclaw on the watch to a longer time.
|
||||||
- **The tap that wakes the display does nothing.** The system consumes it, and an
|
- **The tap that wakes the display does nothing.** The system consumes it, and an
|
||||||
@@ -69,6 +74,7 @@ The watch app is its own Xcode project, so it can be opened and previewed alone:
|
|||||||
./build_apple_watch.sh # simulator build, no signing
|
./build_apple_watch.sh # simulator build, no signing
|
||||||
./build_apple_watch.sh --device # signed build for a real watch
|
./build_apple_watch.sh --device # signed build for a real watch
|
||||||
./build_apple_watch.sh --install # as --device, then installs on the paired watch
|
./build_apple_watch.sh --install # as --device, then installs on the paired watch
|
||||||
|
npm run install:apple-watch # the same as --install
|
||||||
```
|
```
|
||||||
|
|
||||||
**It only works with a phone app that embeds it.** The system links the two apps
|
**It only works with a phone app that embeds it.** The system links the two apps
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
"run:ios": "scripts/ios.sh run ios",
|
"run:ios": "scripts/ios.sh run ios",
|
||||||
"prepare:ios": "scripts/ios.sh prepare ios",
|
"prepare:ios": "scripts/ios.sh prepare ios",
|
||||||
"doctor:ios": "scripts/ios.sh doctor ios",
|
"doctor:ios": "scripts/ios.sh doctor ios",
|
||||||
|
"install:apple-watch": "./build_apple_watch.sh --install",
|
||||||
"build": "./build.sh",
|
"build": "./build.sh",
|
||||||
"lint": "./lint.sh",
|
"lint": "./lint.sh",
|
||||||
"run": "./build_and_run.sh",
|
"run": "./build_and_run.sh",
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ function loadRemote({ phase = 'disconnected', preview = false, now = 1_800_000_0
|
|||||||
'../ui/dashboard-settings': {
|
'../ui/dashboard-settings': {
|
||||||
onAnySettingChanged() {}, watchCanUnlockSetting: setting(true), watchCrownClockwiseNextSetting: setting(false),
|
onAnySettingChanged() {}, watchCanUnlockSetting: setting(true), watchCrownClockwiseNextSetting: setting(false),
|
||||||
watchMirrorAssistantSetting: setting(true), watchRemoteEnabledSetting: setting(true),
|
watchMirrorAssistantSetting: setting(true), watchRemoteEnabledSetting: setting(true),
|
||||||
|
watchVibrateOnInputSetting: setting(true), watchSoundEffectsSetting: setting(false),
|
||||||
},
|
},
|
||||||
'../ui/shell/shell': { shell },
|
'../ui/shell/shell': { shell },
|
||||||
'../ui/shell/voice-activity': { voiceActivity: { subscribe() {}, isActive: () => false } },
|
'../ui/shell/voice-activity': { voiceActivity: { subscribe() {}, isActive: () => false } },
|
||||||
@@ -207,6 +208,12 @@ test('a watch that does not know its battery shows no level, not an empty one',
|
|||||||
assert.equal(levels.watch, null);
|
assert.equal(levels.watch, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('the mirrored state carries the Apple Watch feedback settings', () => {
|
||||||
|
const state = loadRemote({ preview: true }).remote.buildState();
|
||||||
|
assert.equal(state.vibrateOnInput, true);
|
||||||
|
assert.equal(state.soundEffects, false);
|
||||||
|
});
|
||||||
|
|
||||||
test('the mirrored state says when gestures are landing on the preview', () => {
|
test('the mirrored state says when gestures are landing on the preview', () => {
|
||||||
const state = loadRemote({ preview: true }).remote.buildState();
|
const state = loadRemote({ preview: true }).remote.buildState();
|
||||||
assert.equal(state.preview, true);
|
assert.equal(state.preview, true);
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ do {
|
|||||||
"screenOn":true,"locked":false,"worn":null,"listening":false,"battery":78,"charging":false,"silentMode":false,
|
"screenOn":true,"locked":false,"worn":null,"listening":false,"battery":78,"charging":false,"silentMode":false,
|
||||||
"caseBattery":64,"caseCharging":null,"foreground":{"appId":"music","title":"Music"},
|
"caseBattery":64,"caseCharging":null,"foreground":{"appId":"music","title":"Music"},
|
||||||
"windows":[{"windowId":"w1","title":"Music","appId":"music","focused":true,"closeable":false,"acceptsText":true}],
|
"windows":[{"windowId":"w1","title":"Music","appId":"music","focused":true,"closeable":false,"acceptsText":true}],
|
||||||
"apps":[{"appId":"timer","title":"Timer"}],"remoteEnabled":true,"crownClockwiseNext":true,"canUnlock":false,
|
"apps":[{"appId":"timer","title":"Timer"}],"remoteEnabled":true,"vibrateOnInput":false,"soundEffects":true,"canUnlock":false,
|
||||||
"mirrorAssistant":true,"assistantAvailable":true}
|
"mirrorAssistant":true,"assistantAvailable":true}
|
||||||
"""
|
"""
|
||||||
let state = PhoneState.parse(json, updatedAt: 42)
|
let state = PhoneState.parse(json, updatedAt: 42)
|
||||||
@@ -134,7 +134,7 @@ do {
|
|||||||
check(state?.foreground == AppEntry(appId: "music", title: "Music"), "foreground")
|
check(state?.foreground == AppEntry(appId: "music", title: "Music"), "foreground")
|
||||||
check(state?.windows.first?.acceptsText == true && state?.windows.first?.closeable == false, "window flags")
|
check(state?.windows.first?.acceptsText == true && state?.windows.first?.closeable == false, "window flags")
|
||||||
check(state?.apps.map(\.appId) == ["timer"], "apps")
|
check(state?.apps.map(\.appId) == ["timer"], "apps")
|
||||||
check(state?.crownClockwiseNext == true && state?.canUnlock == false, "settings")
|
check(state?.vibrateOnInput == false && state?.soundEffects == true && state?.canUnlock == false, "settings")
|
||||||
check(state?.updatedAt == 42, "updatedAt")
|
check(state?.updatedAt == 42, "updatedAt")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,6 +143,7 @@ do {
|
|||||||
let state = PhoneState.parse("{\"battery\":140,\"unknownField\":[1,2]}", updatedAt: 0)
|
let state = PhoneState.parse("{\"battery\":140,\"unknownField\":[1,2]}", updatedAt: 0)
|
||||||
check(state?.battery == nil, "out-of-range percentage is unknown")
|
check(state?.battery == nil, "out-of-range percentage is unknown")
|
||||||
check(state?.remoteEnabled == true && state?.canUnlock == true, "permissive defaults")
|
check(state?.remoteEnabled == true && state?.canUnlock == true, "permissive defaults")
|
||||||
|
check(state?.vibrateOnInput == true && state?.soundEffects == false, "feedback defaults")
|
||||||
check(state?.phase == "disconnected" && state?.takesInput == false, "disconnected default")
|
check(state?.phase == "disconnected" && state?.takesInput == false, "disconnected default")
|
||||||
check(PhoneState.parse("not json", updatedAt: 0) == nil, "garbage is rejected")
|
check(PhoneState.parse("not json", updatedAt: 0) == nil, "garbage is rejected")
|
||||||
check(PhoneState.parse("[1]", updatedAt: 0) == nil, "a non-object is rejected")
|
check(PhoneState.parse("[1]", updatedAt: 0) == nil, "a non-object is rejected")
|
||||||
|
|||||||
+8
-1
@@ -68,6 +68,7 @@ dashboard state, re-sent whenever it changes (and at least every 30 s):
|
|||||||
"windows": [{"windowId": "…", "title": "…", "appId": "…", "focused": true, "closeable": true, "acceptsText": false}],
|
"windows": [{"windowId": "…", "title": "…", "appId": "…", "focused": true, "closeable": true, "acceptsText": false}],
|
||||||
"apps": [{"appId": "timer", "title": "Timer"}],
|
"apps": [{"appId": "timer", "title": "Timer"}],
|
||||||
"remoteEnabled": true, "crownClockwiseNext": false,
|
"remoteEnabled": true, "crownClockwiseNext": false,
|
||||||
|
"vibrateOnInput": true, "soundEffects": false,
|
||||||
"canUnlock": true, "mirrorAssistant": true,
|
"canUnlock": true, "mirrorAssistant": true,
|
||||||
"assistantAvailable": true
|
"assistantAvailable": true
|
||||||
}
|
}
|
||||||
@@ -86,7 +87,13 @@ The watch shows the case level under the charging line.
|
|||||||
`protocol` is reserved for incompatible revisions of this format (nothing
|
`protocol` is reserved for incompatible revisions of this format (nothing
|
||||||
checks it yet). `crownClockwiseNext` mirrors the
|
checks it yet). `crownClockwiseNext` mirrors the
|
||||||
on-glasses Settings > Watch toggle; when false (the default), clockwise crown
|
on-glasses Settings > Watch toggle; when false (the default), clockwise crown
|
||||||
rotation sends previous/up, and when true it sends next/down.
|
rotation sends previous/up, and when true it sends next/down. Only Wear OS reads
|
||||||
|
it, and the toggle only appears on Android; on Apple Watch, clockwise is always
|
||||||
|
previous/up.
|
||||||
|
|
||||||
|
`vibrateOnInput` and `soundEffects` mirror the Settings > Watch toggles that appear
|
||||||
|
on iOS, and only the Apple Watch app reads them. Wear OS keeps its vibration setting
|
||||||
|
on the watch and has no sounds.
|
||||||
|
|
||||||
`apps` is the launcher grid plus installed EvenHub packages, i.e. exactly what
|
`apps` is the launcher grid plus installed EvenHub packages, i.e. exactly what
|
||||||
the assistant's `apps.launch` tool accepts.
|
the assistant's `apps.launch` tool accepts.
|
||||||
|
|||||||
Reference in new issue
Block a user