Files
coucou/NotchBuddy/Sources/Phone/QuestionCard.swift
LouisandClaude Opus 5.5 66df17b01e iPhone: Liquid Glass, tabs, zoom, gestures, icons, Spotlight, Focus, services with actions, intro (#251)
* iPhone: Liquid Glass, tabs, zoom transitions, gestures, icons, Spotlight, Focus

- Tabs (Agents, Services, History, Search) with the agent that needs you
  above them, like Music's mini player (iOS 26).
- Liquid Glass cards and buttons on iOS 26, the dark material before; the
  island at the top grows Allow / Deny when a command waits (glass morphing).
- The Mochi tile zooms into the session; the agent's color moves softly
  behind it (MeshGradient); the header shrinks as the list scrolls.
- Symbols that move with the state; Apple Pay's drawn checkmark on Allow.
- Swipe right to allow (Face ID), left to deny; long press for a peek at
  the last turn.
- Search through every turn; finished turns in Spotlight (local index,
  can be turned off).
- Dark and tinted app icons, and Mochi in five other colors to pick.
- A Coucou Focus filter: only approvals and questions during a Focus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qkcwzfTWvbmbc2y9dur6p

* Approval panel the iOS way, a softer session glow, Live Activity alerts

- The island grows a glass panel under it when a command waits: who asks,
  the command, a quiet Deny and a bright Allow (Face ID). Same buttons in
  the session's approval card; no more red and green blocks.
- The session's glow is softer, and white or grey agents (VS Code,
  Cursor) glow in deep blue instead of a grey haze.
- "Waiting for your OK" and questions now update the Live Activity with an
  alert, so the Dynamic Island opens and the Lock Screen lights up; the
  iPhone allows frequent Live Activity updates so they aren't held back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qkcwzfTWvbmbc2y9dur6p

* Live Activity: log every change of phase and its push, retry again after a success

The update retries were capped for the whole activity: after ten waits for
a token, a later "waiting for your OK" could stay on the Mac. The count
now starts again after each update that goes out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qkcwzfTWvbmbc2y9dur6p

* Floating glass composer, no tabs in a session, Live Activity started again when it didn't come up

- The instruction field is one glass capsule with the language and the
  mic inside and a round send button next to it, like Messages on iOS 26;
  shortcuts are glass pills; no bar behind, the list fades out under it.
- A session takes the whole screen: the tab bar and the mini player hide.
- When iOS didn't bring the Live Activity up (no update token) and an
  agent then waits for your OK or asks a question, the Mac starts it again
  with that state, once per request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qkcwzfTWvbmbc2y9dur6p

* Live Activity: spend fewer starts

iOS allows only so many push-to-start activities an hour; every lock
started one and every unlock ended it, so after many locks the iPhone
stopped bringing it up. Now a working agent leaves for the iPhone once the
Mac has stayed locked for 20 s (right away when it waits for you), and an
unlock ends the activity only after 30 s, so locking again reuses it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qkcwzfTWvbmbc2y9dur6p

* Session screen: field fixed at the bottom, no tabs, keyboard away on scroll or tap

The tab bar shrank and grew while scrolling (minimize on scroll) and the
mini player sat between it and the field, so the field moved up and down.
The mini player and the minimizing are gone, the tabs hide inside a
session, and scrolling or tapping the conversation puts the keyboard away.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qkcwzfTWvbmbc2y9dur6p

* Keyboard: only a tap on the conversation puts it away, not a tap on the field

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qkcwzfTWvbmbc2y9dur6p

* Services up close on the iPhone, with actions run by the Mac

When a service's screen opens, the iPhone asks the Mac (ServiceAction
record); the Mac reads the service's API with the key in its Keychain and
writes a ServiceDetail record, encrypted: figures, lists and the actions
it offers on each item.

- Vercel: deployments and projects; redeploy, promote to production, cancel a build.
- GitHub: your pull requests (squash and merge), reviews asked of you
  (approve), CI on your latest repos (re-run failed jobs).
- Stripe: balance, payments, payouts, subscriptions and MRR (read only).
- Resend: latest emails and how they went, domains (read only).
- Cal.com: upcoming bookings; cancel one.
- n8n: workflows (turn on / off) and runs (retry a failed one).
- Notion: pages and databases edited lately (read only).

Actions need Face ID on the iPhone; the Mac runs one only if it offered
it on that item in the last detail it sent, asked in the last 5 minutes.
Nothing that moves money or sends an email can be asked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qkcwzfTWvbmbc2y9dur6p

* Services: fixes from an API and logic review

- Vercel: "Promote to production" rebuilds the preview for production
  (POST /v13/deployments with target production), as the Vercel CLI does;
  /v10/promote only promotes production builds.
- Stripe: pending paired with available by currency; MRR per currency,
  metered and tiered prices left out, decimal prices read, labelled as an
  estimate; every page of subscriptions (up to 1 000); full zero-decimal
  currency list; partly refunded and uncaptured charges shown as such;
  a list that can't be read says why instead of showing zeros.
- Resend: suppressed emails count as not delivered; domain badges without
  underscores; a sending-only key gets a clear message.
- Cal.com is read only: cancelling emails the guest and can refund or
  charge them.
- n8n: every page of workflows; archived ones not offered "Turn on"; a
  clear message when the instance is too old to retry a run.
- The Mac takes a request only if it could delete it from iCloud, tells
  the iPhone when an action isn't offered any more, is woken by the
  CloudKit push (one check a minute in case one is missed) instead of
  every 10 s, downloads only the request fields, and deletes its details
  when the iPhone sync is turned off.
- The iPhone waits for the result of this action (not an older one) and
  plays the success haptic only when it worked; leaving a service screen
  stops its checks; "Asking your Mac…" says so when the Mac doesn't answer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qkcwzfTWvbmbc2y9dur6p

* Services: Cal.com bookings found again, a cleaner service screen

- The Mac's Cal.com poller asked the v2 API with start / end, which aren't
  its parameters, so it found no booking: it now uses afterStart /
  beforeEnd (the notch and the iPhone's summary show the call again).
- Service screen: the figures in one strip; one line per item (title,
  badge, subtitle and date), a tap opens it on the web, its actions in a
  "…" menu or a long press (with Open and Copy link); the reason card
  only when something needs a look.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qkcwzfTWvbmbc2y9dur6p

* iPhone: Mochi moves at the screen's rate (up to 120 Hz)

Mochi was drawn at 30 frames a second (20 in lists) on screens that run
at 60 or 120 Hz, which made him stutter. He now follows the screen's rate,
the app may use ProMotion's 120 Hz like the Mac's notch, list rows are
capped at 60, and the agent's glow moves at 30 instead of 10.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qkcwzfTWvbmbc2y9dur6p

* iPhone: an opening with Mochi alone, who then flies to his tile

While the app loads, Mochi sits alone in the middle of a black screen,
looks left and right, then up with big round eyes, small eyes, a bar, a
blink, and back at you (at least 2.4 s, up to 4 s while iCloud answers).
Then he flies to the VS Code session's tile (or the island at the top)
as the black fades, and the real one takes over there. The first launch
opens on the setup guide instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qkcwzfTWvbmbc2y9dur6p

* iPhone intro: fluid eyes driven by the engine, no blink

Mochi's opening now moves through smooth curves (gaze, tilt, eye size and
height) instead of swapping eye shapes, and never closes his eyes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qkcwzfTWvbmbc2y9dur6p

* iPhone intro: a lively Mochi that hides the first sync

Mochi now pops in and plays a little show driven by springs: quick
glances and slow drifts, eyes that pop round, shrink or squint, a body
that leans, hops and squashes along. The intro ends once the first
iCloud fetch is over (between 2.4 s and 6 s), which now starts without
waiting for the notification prompt, so the home screen behind is
already in sync when he flies to his tile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qkcwzfTWvbmbc2y9dur6p

* README and site: Coucou on iPhone, App Store install

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qkcwzfTWvbmbc2y9dur6p

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-06 02:02:20 +02:00

120 lines
4.8 KiB
Swift

import SwiftUI
/// A question Claude asks (AskUserQuestion), with its choices: pick, then
/// Send. The Mac answers Claude with exactly these choices.
struct QuestionCard: View {
let link: PhoneLink
let session: SessionItem
let payload: QuestionPayload
@State private var picks: [Set<String>] = []
@State private var sending = false
@State private var sent = false
@State private var error: String?
private var ready: Bool {
picks.count == payload.items.count && !picks.contains { $0.isEmpty }
}
var body: some View {
VStack(alignment: .leading, spacing: 14) {
Text("Question").font(.subheadline.weight(.semibold)).foregroundStyle(.cyan)
ForEach(Array(payload.items.enumerated()), id: \.offset) { index, item in
VStack(alignment: .leading, spacing: 8) {
if !item.header.isEmpty {
Text(item.header.uppercased())
.font(.caption2.weight(.bold))
.foregroundStyle(.secondary)
}
Text(item.question).font(.callout.weight(.semibold))
if item.multiSelect {
Text("Pick one or more").font(.caption).foregroundStyle(.secondary)
}
ForEach(item.options, id: \.label) { option in
optionRow(option, item: item, index: index)
}
}
}
if sent {
Label("Answer sent to your Mac", systemImage: "checkmark.circle.fill")
.font(.callout.weight(.semibold))
.foregroundStyle(.green)
} else {
Button {
Task { await send() }
} label: {
Label("Send answer", systemImage: "paperplane.fill").frame(maxWidth: .infinity)
}
.buttonStyle(.borderedProminent)
.tint(.cyan)
.controlSize(.large)
.disabled(!ready || sending)
Text("Claude waits about 2 minutes, then asks in the terminal.")
.font(.caption).foregroundStyle(.secondary)
}
if let error {
Text(error).font(.caption).foregroundStyle(.red)
}
}
.padding(16)
.glassCard(tint: .cyan)
.overlay(RoundedRectangle(cornerRadius: 22).strokeBorder(Color.cyan.opacity(0.7), lineWidth: 1.5))
.onAppear { reset() }
.onChange(of: payload) { reset() }
}
private func optionRow(_ option: QuestionPayload.Option, item: QuestionPayload.Item, index: Int) -> some View {
let selected = picks.indices.contains(index) && picks[index].contains(option.label)
return Button {
guard picks.indices.contains(index), !sent else { return }
if item.multiSelect {
if selected { picks[index].remove(option.label) } else { picks[index].insert(option.label) }
} else {
picks[index] = [option.label]
}
Haptics.impact()
} label: {
HStack(alignment: .top, spacing: 10) {
Image(systemName: item.multiSelect
? (selected ? "checkmark.square.fill" : "square")
: (selected ? "largecircle.fill.circle" : "circle"))
.foregroundStyle(selected ? Color.cyan : Color.secondary)
VStack(alignment: .leading, spacing: 2) {
Text(option.label).font(.callout).foregroundStyle(.primary)
if !option.description.isEmpty {
Text(option.description).font(.caption).foregroundStyle(.secondary)
}
}
Spacer(minLength: 0)
}
.padding(12)
.background(selected ? Color.cyan.opacity(0.16) : Color(white: 0.16), in: RoundedRectangle(cornerRadius: 12))
.contentShape(Rectangle())
}
.buttonStyle(.plain)
}
private func reset() {
picks = Array(repeating: [], count: payload.items.count)
sent = false
error = nil
}
private func send() async {
sending = true
defer { sending = false }
error = nil
// Keep the order of the choices, as Claude listed them.
let selections = payload.items.enumerated().map { index, item in
item.options.map(\.label).filter { picks[index].contains($0) }
}
if await link.answer(fingerprint: session.questionFingerprint, pillId: session.id, selections: selections) {
sent = true
Haptics.success()
} else {
error = link.lastPong ?? "Couldn't reach iCloud."
Haptics.error()
}
}
}