Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

fix(ios): present sheets as native iPhone sheets

leepokai7d0af1c18cbd
diff --git a/AGENTS.md b/AGENTS.md
index bd01d7df..53f5126b 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -40,7 +40,7 @@ Use four-space indentation for Swift and Rust. Follow Swift 6 strict concurrency
Name Swift files after their main `UpperCamelCase` type; use `snake_case.rs` and `kebab-case.ts`. Follow role suffixes such as `View`, `Row`, and `Store`. See `docs/architecture/file-structure.md` and `CLAUDE.md` for architectural conventions.
-- UI controls default to the shared custom components. Explicit exception: iOS BotListView and ThreadView use native navigation/toolbar items and automatic back navigation for system Liquid Glass, as specified in `docs/design/ui-conventions.md`. The macOS menu bar also uses native `MenuBarExtra(.menu)`, menus, pickers and toggles. Keep system authentication and widget containers native. Outside these exceptions, avoid: no `Menu`/`Picker`, `.switch` toggles, `Form`/`List` styling, `confirmationDialog`/`alert`, `ProgressView`, `.sheet`/`.popover`/`.fullScreenCover`, `.toolbar`/navigation bars, `TabView`, `ContentUnavailableView`. Use `kit/Sources/CodyncUI/Controls.swift` + `Chrome.swift` (`.codyncSheet`, `ModalHeader`, `ScreenHeader`, `TabBar`, `.codyncMenu`, `.codyncDialog`, `ToggleStyle.codync`). Every tap that shows/hides something animates (`Motion`). Anything with a background fill gets no border line.
+- UI controls default to the shared custom components. Explicit exception: iOS BotListView and ThreadView use native navigation/toolbar items and automatic back navigation for system Liquid Glass, as specified in `docs/design/ui-conventions.md`. The macOS menu bar also uses native `MenuBarExtra(.menu)`, menus, pickers and toggles. Keep system authentication and widget containers native. On iOS `.codyncSheet` presents the system sheet (grabber, swipe down). Outside these exceptions, avoid: no `Menu`/`Picker`, `.switch` toggles, `Form`/`List` styling, `confirmationDialog`/`alert`, `ProgressView`, `.sheet`/`.popover`/`.fullScreenCover`, `.toolbar`/navigation bars, `TabView`, `ContentUnavailableView`. Use `kit/Sources/CodyncUI/Controls.swift` + `Chrome.swift` (`.codyncSheet`, `ModalHeader`, `ScreenHeader`, `TabBar`, `.codyncMenu`, `.codyncDialog`, `ToggleStyle.codync`). Every tap that shows/hides something animates (`Motion`). Anything with a background fill gets no border line.
## Cross-platform UI changes
diff --git a/CLAUDE.md b/CLAUDE.md
index 5c581ede..6cf3bb04 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -17,7 +17,7 @@ Bot-based remote for coding agents: persistent named bots on your computer, mess
- Clients: iOS app, native Mac window (menu bar app), native Linux app (`apps/linux/`, GTK 4 + libadwaita in Rust), terminal UI (`codync-host tui`, `host/src/tui/`, ratatui; layout and state vocabulary modeled on herdr). All talk to the host API; no web UI.
- Shared Swift (`kit/`): `CodyncKit` (models, client, theme, avatars) + `CodyncUI` (`BotStore` + chat screens) used by iOS and macOS. Platform specifics go through `BotStore` hooks or `Platform.swift`.
- UI principle: buttons an icon can express are icon-only (with tooltip / accessibility label); text only where an icon would be ambiguous (approval choices).
-- UI controls default to the shared custom components. Explicit exception: iOS BotListView and ThreadView use native navigation/toolbar items and automatic back navigation for system Liquid Glass, as specified in `docs/design/ui-conventions.md`. **iOS menus are always the system ones**: tap menus through `DropdownMenu`/`ChoicePicker` (native `Menu`), long-press through `.contextActions` (native `contextMenu`). Never hand-build a dropdown on iOS and never call `.codyncMenu` there (it is macOS-only and a compile error on iOS): the custom overlay lands in the wrong place (sheets, scroll views, the composer's + menu). The macOS menu bar also uses native `MenuBarExtra(.menu)`, menus, pickers and toggles. Keep system authentication and widget containers native. Outside these exceptions, avoid: no `Menu`/`Picker`, `.switch` toggles, `Form`/`List` styling, `confirmationDialog`/`alert`, `ProgressView`, `.sheet`/`.popover`/`.fullScreenCover`, `.toolbar`/navigation bars, `TabView`, `ContentUnavailableView`. Use `kit/Sources/CodyncUI/Controls.swift` + `Chrome.swift` (`.codyncSheet`, `ModalHeader`, `ScreenHeader`, `TabBar`, `.codyncMenu`, `.codyncDialog`, `ToggleStyle.codync`). Every tap that shows/hides something animates (`Motion`). Anything with a background fill gets no border line.
+- UI controls default to the shared custom components. Explicit exception: iOS BotListView and ThreadView use native navigation/toolbar items and automatic back navigation for system Liquid Glass, as specified in `docs/design/ui-conventions.md`. **iOS menus are always the system ones**: tap menus through `DropdownMenu`/`ChoicePicker` (native `Menu`), long-press through `.contextActions` (native `contextMenu`). Never hand-build a dropdown on iOS and never call `.codyncMenu` there (it is macOS-only and a compile error on iOS): the custom overlay lands in the wrong place (sheets, scroll views, the composer's + menu). The macOS menu bar also uses native `MenuBarExtra(.menu)`, menus, pickers and toggles. Keep system authentication and widget containers native. On iOS `.codyncSheet` presents the system sheet (grabber, swipe down). Outside these exceptions, avoid: no `Menu`/`Picker`, `.switch` toggles, `Form`/`List` styling, `confirmationDialog`/`alert`, `ProgressView`, `.sheet`/`.popover`/`.fullScreenCover`, `.toolbar`/navigation bars, `TabView`, `ContentUnavailableView`. Use `kit/Sources/CodyncUI/Controls.swift` + `Chrome.swift` (`.codyncSheet`, `ModalHeader`, `ScreenHeader`, `TabBar`, `.codyncMenu`, `.codyncDialog`, `ToggleStyle.codync`). Every tap that shows/hides something animates (`Motion`). Anything with a background fill gets no border line.
- `host/` — **codync-host** (Rust, macOS + Linux). Detects installed harnesses (`agent/backends.rs`: login-shell PATH + known dirs) and the ACP registry (`agent/registry.rs`, cached in `~/.codync/registry.json`, binaries under `~/.codync/agents`). Drives agents over **ACP** (JSON-RPC on stdio, hand-rolled in `agent/acp.rs`, updates kept as `serde_json::Value` so new adapter variants never break parsing). One actor per bot (`agent/bot.rs`) owns the agent process + session and maps `session/update` onto transcript entries.
- **Chat ≠ session**: a bot is one endless transcript (SQLite `entries`, ordered by `seq`); the ACP session underneath is resumed with `session/load` or replaced by *New session*.
- **Group chats and threads** are host features every client drives through the same methods (`send` with `threadId`, `thread`, `createBot {kind: group}`); clients never route, parse mentions or count replies themselves. A group is a roster row whose members answer in their own sessions (Grok Bot's room turns); a thread on a bot's message is a forked session: [docs/features/groups-and-threads.md](docs/features/groups-and-threads.md).
diff --git a/apps/ios/WhatsNew.md b/apps/ios/WhatsNew.md
index 4aeecacd..196044aa 100644
--- a/apps/ios/WhatsNew.md
+++ b/apps/ios/WhatsNew.md
@@ -13,6 +13,7 @@ a version without one gets a generic "Bug fixes and improvements" line. Delete o
- 多台電腦時,點電腦標題可以收合它的 bot;長按標題可以把整台電腦連同 bot 一起拖曳排序。
- 語音通話可以改用 OpenAI 或 Gemini 的即時語音:在通話的齒輪裡填入你自己的 API key 並挑選模型,就能直接插話、問 bot 現在在做什麼;key 加密存在你的電腦上,Mac 版也能語音通話。
- 設定畫面換上更乾淨的分組版面,每個選項都附上簡短說明;bot 設定也一起換上新版面。
+- 彈出的面板改用 iPhone 原生樣式,關閉時不再先往上跳一下。
### en-US
@@ -20,3 +21,4 @@ a version without one gets a generic "Bug fixes and improvements" line. Delete o
- With several computers, tap a computer's heading to fold its bots away, or long-press it to drag the whole computer up or down.
- Voice calls can use OpenAI or Gemini realtime voice: add your own API key and pick a model in the call's settings to talk over replies and ask what the bot is doing. The key is stored encrypted on your computer, and the Mac app can make voice calls too.
- Settings get a cleaner grouped layout, with a short note under each option, and bot settings follow it.
+- Sheets now use the native iPhone style and no longer jump up before closing.
diff --git a/docs/design/ui-conventions.md b/docs/design/ui-conventions.md
index 78eb27b7..db24d6a3 100644
--- a/docs/design/ui-conventions.md
+++ b/docs/design/ui-conventions.md
@@ -48,7 +48,7 @@ Other custom screens use `Chrome.swift` and `Controls.swift`:
| Need | Component |
|---|---|
-| Modal or full-window overlay | `.codyncSheet`, `.codyncOverlay` |
+| Modal or full-window overlay | `.codyncSheet` (system sheet on iPhone, centered card on Mac), `.codyncOverlay` |
| Header outside the native bot navigation flow | `ModalHeader`, `ScreenHeader` |
| Icon action | `IconButton` |
| Tab selection | `TabBar` |
diff --git a/kit/Sources/CodyncUI/Chrome.swift b/kit/Sources/CodyncUI/Chrome.swift
index 943e53e9..d8ee7c8d 100644
--- a/kit/Sources/CodyncUI/Chrome.swift
+++ b/kit/Sources/CodyncUI/Chrome.swift
@@ -203,22 +203,17 @@ private struct CodyncItemSheet<Item: Identifiable, Sheet: View>: ViewModifier {
}
#if os(iOS)
+/// The system sheet: its own slide, grabber and swipe down, nothing hand-built.
private struct CodyncSheet<Sheet: View>: ViewModifier {
@Binding var isPresented: Bool
let sheet: () -> Sheet
- /// Outlives `isPresented` by the slide-out, so closing from outside the sheet
- /// (clearing the binding) animates like the grabber and `dismissModal` do.
- @State private var covered = false
func body(content: Content) -> some View {
- content
- .fullScreenCover(isPresented: $covered) {
- BottomSheet(isPresented: $isPresented, removed: { covered = false }, content: sheet)
- .presentationBackground(.clear)
- }
- .onChange(of: isPresented, initial: true) { if isPresented { covered = true } }
- // Our own slide replaces the system one.
- .transaction(value: covered) { $0.disablesAnimations = true }
+ content.sheet(isPresented: $isPresented) {
+ sheet()
+ .environment(\.dismissModal, DismissModalAction { isPresented = false })
+ .presentationDragIndicator(.visible)
+ }
}
}
@@ -261,121 +256,6 @@ private struct FadeLayer<Layer: View>: View {
}
}
-/// Where the iPhone sheet sits. Only the offset and dim read it, so a drag frame
-/// doesn't re-render the sheet's content.
-@MainActor @Observable
-private final class SheetMotion {
- var shown = false
- var drag: CGFloat = 0
- var height: CGFloat = 1000
-
- /// 1 fully up, 0 off screen: the dim follows the finger.
- var progress: CGFloat { shown ? max(0, 1 - drag / max(height, 1)) : 0 }
-}
-
-private struct SheetOffset: ViewModifier {
- let motion: SheetMotion
-
- func body(content: Content) -> some View {
- content.offset(y: motion.shown ? motion.drag : motion.height)
- }
-}
-
-private struct SheetDim: View {
- let motion: SheetMotion
-
- var body: some View {
- Color.black.opacity(0.4 * motion.progress)
- }
-}
-
-/// The iPhone modal: slides up over a dim, drags down (from the grabber) to close.
-/// Closing slides it out first and only then clears the binding, so the screen
-/// underneath re-renders once, after the animation, not in its first frame.
-private struct BottomSheet<Content: View>: View {
- @Binding var isPresented: Bool
- let removed: () -> Void
- @ViewBuilder let content: () -> Content
- @State private var motion = SheetMotion()
- @State private var closing = false
- @Environment(\.accessibilityReduceMotion) private var reduceMotion
-
- var body: some View {
- ZStack(alignment: .bottom) {
- SheetDim(motion: motion)
- .ignoresSafeArea()
- .onTapGesture { close() }
- .accessibilityHidden(true)
- VStack(spacing: 0) {
- Capsule().fill(Palette.tertiary.opacity(0.6)).frame(width: 36, height: 5)
- .frame(maxWidth: .infinity, minHeight: 22)
- .contentShape(Rectangle())
- .gesture(dragToClose)
- .accessibilityHidden(true)
- content()
- .environment(\.dismissModal, DismissModalAction { close() })
- .frame(maxWidth: .infinity, maxHeight: .infinity)
- }
- .background(Palette.background)
- .clipShape(UnevenRoundedRectangle(topLeadingRadius: 28, topTrailingRadius: 28, style: .continuous))
- .padding(.top, 10)
- .ignoresSafeArea(.container, edges: .bottom)
- // Its own height (plus the home indicator) takes it fully off screen; the keyboard going away doesn't move the target.
- .onGeometryChange(for: CGFloat.self) { $0.size.height + $0.safeAreaInsets.bottom + 10 } action: { motion.height = $0 }
- .modifier(SheetOffset(motion: motion))
- }
- .onAppear(perform: slideIn)
- // Closed from outside (the binding cleared): slide out the same way.
- .onChange(of: isPresented) { if isPresented { slideIn() } else { close() } }
- .accessibilityAction(.escape) { close() }
- }
-
- private var dragToClose: some Gesture {
- // Global space: the grabber moves with the sheet, so local translation would feed back and jitter.
- DragGesture(coordinateSpace: .global)
- .onChanged { motion.drag = max(0, $0.translation.height) }
- .onEnded { value in
- let velocity = value.velocity.height
- if value.translation.height > 120 || value.predictedEndTranslation.height > 320 {
- close(velocity: velocity)
- } else {
- withAnimation(spring(from: motion.drag, to: 0, velocity: velocity)) { motion.drag = 0 }
- }
- }
- }
-
- private func slideIn() {
- closing = false
- withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { motion.shown = true }
- }
-
- /// Slides out (carrying the finger's speed), then clears the binding and removes the cover.
- private func close(velocity: CGFloat = 0) {
- guard !closing else { return }
- closing = true
- UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
- let animation = reduceMotion ? nil : spring(from: motion.drag, to: motion.height, velocity: velocity)
- withAnimation(animation) {
- motion.shown = false
- } completion: {
- guard closing else { return }
- var t = Transaction()
- t.disablesAnimations = true
- withTransaction(t) {
- if isPresented { isPresented = false }
- removed()
- }
- }
- }
-
- /// `Motion.layout`, starting at the finger's speed so a flick doesn't stall on release.
- private func spring(from: CGFloat, to: CGFloat, velocity: CGFloat) -> Animation {
- let distance = to - from
- guard abs(distance) > 1 else { return Motion.layout }
- return .interpolatingSpring(Spring(duration: 0.3, bounce: 0), initialVelocity: velocity / distance)
- }
-}
-
/// Keeps the edge swipe back working on screens whose navigation bar we replaced.
public struct SwipeBackEnabler: UIViewControllerRepresentable {
public init() {}