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.

refactor(ios): drop the Mac layer from the iPhone package

leepokaie7f2be18474c
diff --git a/apps/ios/Kit/Sources/CodyncKit/Client/CloudClient.swift b/apps/ios/Kit/Sources/CodyncKit/Client/CloudClient.swift
index 83b884ce..9c218470 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Client/CloudClient.swift
+++ b/apps/ios/Kit/Sources/CodyncKit/Client/CloudClient.swift
@@ -77,10 +77,6 @@ public struct CloudClient: Sendable {
return res.computers
}
- public func renameComputer(_ id: ComputerID, name: String) async throws {
- try await send("PATCH", "v1/computers/\(id)", body: ["name": name])
- }
-
/// Removes the computer from the account; every device's access to it through the account ends.
public func removeComputer(_ id: ComputerID) async throws {
try await send("DELETE", "v1/computers/\(id)")
@@ -141,14 +137,6 @@ public struct CloudClient: Sendable {
// MARK: claims (§4.2 A)
- public func createClaim() async throws -> ClaimChallenge { try await request("POST", "v1/claims", body: [String: String]()) }
-
- public func completeClaim(_ claimId: String, signed: ClaimSignature) async throws -> CloudComputer {
- struct Res: Decodable { var computer: CloudComputer }
- let res: Res = try await request("POST", "v1/claims/\(claimId)/complete", body: signed)
- return res.computer
- }
-
// MARK: plumbing
private struct NoBody: Encodable {}
diff --git a/apps/ios/Kit/Sources/CodyncKit/Design/AppFont.swift b/apps/ios/Kit/Sources/CodyncKit/Design/AppFont.swift
deleted file mode 100644
index 3910a300..00000000
--- a/apps/ios/Kit/Sources/CodyncKit/Design/AppFont.swift
+++ /dev/null
@@ -1,126 +0,0 @@
-import SwiftUI
-
-/// Keeps each font's hierarchy and styling while applying the Mac text preference.
-public struct AppFont: Sendable {
- private var original: Font
- private var pointSize: CGFloat
- private var fontWeight: Font.Weight
- private var design: Font.Design
- private var automaticBoldWeight: Font.Weight = .bold
- private var hasMonospacedDigits = false
-
- private init(_ original: Font, size: CGFloat, weight: Font.Weight = .regular, design: Font.Design = .default) {
- self.original = original
- pointSize = size
- fontWeight = weight
- self.design = design
- }
-
- public static var largeTitle: Self { semantic(.largeTitle) }
- public static var title: Self { semantic(.title) }
- public static var title2: Self { semantic(.title2) }
- public static var title3: Self { semantic(.title3) }
- public static var headline: Self { semantic(.headline) }
- public static var subheadline: Self { semantic(.subheadline) }
- public static var body: Self { semantic(.body) }
- public static var callout: Self { semantic(.callout) }
- public static var footnote: Self { semantic(.footnote) }
- public static var caption: Self { semantic(.caption) }
- public static var caption2: Self { semantic(.caption2) }
-
- /// Codync's existing compact desktop fonts; phones retain their semantic fonts.
- public static var compactBody: Self {
- body
- }
-
- public static var compactSecondary: Self {
- subheadline
- }
-
- public static func system(size: CGFloat, weight: Font.Weight? = nil, design: Font.Design? = nil) -> Self {
- Self(.system(size: size, weight: weight, design: design), size: size, weight: weight ?? .regular, design: design ?? .default)
- }
-
- public static func system(_ style: Font.TextStyle, design: Font.Design? = nil) -> Self {
- var font = semantic(style)
- font.original = .system(style, design: design)
- font.design = design ?? .default
- return font
- }
-
- public func weight(_ weight: Font.Weight) -> Self {
- var font = self
- font.original = original.weight(weight)
- font.fontWeight = weight
- return font
- }
-
- public func bold() -> Self {
- var font = self
- font.original = original.bold()
- font.fontWeight = automaticBoldWeight
- return font
- }
-
- public func monospaced() -> Self {
- var font = self
- font.original = original.monospaced()
- font.design = .monospaced
- return font
- }
-
- public func monospacedDigit() -> Self {
- var font = self
- font.original = original.monospacedDigit()
- font.hasMonospacedDigits = true
- return font
- }
-
- func scaled(by scale: CGFloat) -> Font {
- return original
- }
-
- /// macOS 14–15 lack Font.scaled(by:); recreate the native font with its traits.
- func fallbackScaled(by scale: CGFloat) -> Font {
- let font = Font.system(size: pointSize * scale, weight: fontWeight, design: design)
- return hasMonospacedDigits ? font.monospacedDigit() : font
- }
-
- private static func semantic(_ style: Font.TextStyle) -> Self {
- let size: CGFloat = 0 // Only used by the Mac fallback.
- var font = Self(.system(style), size: size, weight: style == .headline ? .bold : .regular)
- // Native .bold() uses semibold for small semantic text and bold for
- // titles/headlines. An explicit .weight(.bold) remains explicit bold.
- switch style {
- case .largeTitle, .title, .title2, .title3, .headline: font.automaticBoldWeight = .bold
- default: font.automaticBoldWeight = .semibold
- }
- return font
- }
-}
-
-private struct AppFontScaleKey: EnvironmentKey {
- static let defaultValue: CGFloat = 1
-}
-
-public extension EnvironmentValues {
- var appFontScale: CGFloat {
- get { self[AppFontScaleKey.self] }
- set { self[AppFontScaleKey.self] = newValue }
- }
-}
-
-private struct AppFontModifier: ViewModifier {
- let font: AppFont
- @Environment(\.appFontScale) private var scale
-
- func body(content: Content) -> some View {
- content.font(font.scaled(by: scale))
- }
-}
-
-public extension View {
- func appFont(_ font: AppFont) -> some View {
- modifier(AppFontModifier(font: font))
- }
-}
diff --git a/apps/ios/Kit/Sources/CodyncKit/Design/CharacterAvatar.swift b/apps/ios/Kit/Sources/CodyncKit/Design/CharacterAvatar.swift
index adf40f39..373a7664 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Design/CharacterAvatar.swift
+++ b/apps/ios/Kit/Sources/CodyncKit/Design/CharacterAvatar.swift
@@ -193,7 +193,7 @@ public struct GroupAvatar: View {
switch members.count {
case 0:
Image(systemName: "person.2")
- .appFont(.system(size: size * 0.4))
+ .font(.system(size: size * 0.4))
.foregroundStyle(.secondary)
case 1:
CharacterAvatar(bot: members[0], size: size, animated: animated)
@@ -212,7 +212,7 @@ public struct GroupAvatar: View {
place(members[3], size * 0.5, .bottomTrailing)
} else {
Text("+\(members.count - 3)")
- .appFont(.system(size: size * 0.24, weight: .bold, design: .rounded))
+ .font(.system(size: size * 0.24, weight: .bold, design: .rounded))
.foregroundStyle(.secondary)
.frame(width: size * 0.5, height: size * 0.5)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomTrailing)
@@ -249,7 +249,7 @@ public struct AvatarWithStatus: View {
.overlay(alignment: .bottomTrailing) {
if bot.needsInput {
Image(systemName: "exclamationmark")
- .appFont(.system(size: size * 0.2, weight: .black))
+ .font(.system(size: size * 0.2, weight: .black))
.foregroundStyle(.white)
.frame(width: size * 0.36, height: size * 0.36)
.background(Palette.warning, in: Circle())
diff --git a/apps/ios/Kit/Sources/CodyncKit/Design/Motion.swift b/apps/ios/Kit/Sources/CodyncKit/Design/Motion.swift
index 07d02b1e..93550f3d 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Design/Motion.swift
+++ b/apps/ios/Kit/Sources/CodyncKit/Design/Motion.swift
@@ -12,7 +12,6 @@ public enum Motion {
public static let press = Animation.timingCurve(0.25, 0.1, 0.25, 1, duration: 0.05)
/// Icon and glyph swaps, the sidebar rail morph: `.2s cubic-bezier(.22,1,.36,1)`.
public static let morph = Animation.timingCurve(0.22, 1, 0.36, 1, duration: 0.2)
- public static let morphCurve = UnitCurve.bezier(startControlPoint: UnitPoint(x: 0.22, y: 1), endControlPoint: UnitPoint(x: 0.36, y: 1))
/// Size and layout changes (panels growing, cards resizing): the critically damped
/// `.3s` spring Grok writes as a `linear()` curve.
public static let layout = Animation.spring(duration: 0.3, bounce: 0)
diff --git a/apps/ios/Kit/Sources/CodyncKit/Design/UsageBar.swift b/apps/ios/Kit/Sources/CodyncKit/Design/UsageBar.swift
index d42e11f8..f8573e65 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Design/UsageBar.swift
+++ b/apps/ios/Kit/Sources/CodyncKit/Design/UsageBar.swift
@@ -15,44 +15,14 @@ public extension SharedStore {
}
}
-/// One place for "how full is this limit" colors, shared by the apps, the menu bar and widgets.
+/// "How full is this limit" colors, shared by the app and its widgets.
public extension Palette {
- /// Fill for bars: ink, amber from 70%, red from 90%.
- static func usageFill(_ percent: Double) -> Color {
- percent >= 90 ? danger : percent >= 70 ? warning : accentFill
- }
-
- /// Tint for gauges and progress views .
+ /// Tint for gauges and progress views.
static func usageTint(_ percent: Double) -> Color {
percent >= 90 ? danger : percent >= 70 ? warning : accent
}
}
-public struct UsageBar: View {
- let percent: Double
- let height: CGFloat
- let tint: Color?
-
- /// `tint` is the provider's color below 70%; amber and red still take over above.
- public init(percent: Double, height: CGFloat = 6, tint: Color? = nil) {
- self.percent = percent
- self.height = height
- self.tint = tint
- }
-
- public var body: some View {
- GeometryReader { geo in
- ZStack(alignment: .leading) {
- Capsule().fill(Palette.bubbleAgent)
- Capsule()
- .fill(percent < 70 ? tint ?? Palette.usageFill(percent) : Palette.usageFill(percent))
- .frame(width: geo.size.width * min(1, max(0.02, percent / 100)))
- }
- }
- .frame(height: height)
- }
-}
-
public extension UsageProvider {
/// Claude keeps its orange; everyone else is ink, like the rest of the app.
var tint: Color { id == "claude" ? Color(hex: 0xD97757) : Palette.accent }
@@ -75,11 +45,6 @@ public extension UsageWindow {
return label
}
- /// Window length, when the label says it: "5h", "7d".
- var span: String? {
- label == "5-hour" ? "5h" : label.hasPrefix("Weekly") ? "7d" : nil
- }
-
/// "resets 3h 20m" / "resets Sep 26 at 12pm", compact for widgets and cards.
func resetsShort(now: Date = .now) -> String? {
if let d = resetDate { return d > now ? "resets \(RelativeTime.until(d, now: now))" : nil }
@@ -111,7 +76,7 @@ public struct ProviderMascot: View {
.overlay(alignment: .topTrailing) {
if full {
Image(systemName: "exclamationmark.circle.fill")
- .appFont(.system(size: size * 0.34, weight: .bold))
+ .font(.system(size: size * 0.34, weight: .bold))
.symbolRenderingMode(.palette)
.foregroundStyle(.white, Palette.danger)
.offset(x: size * 0.12, y: -size * 0.12)
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/AgentModelPicker.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/AgentModelPicker.swift
index 4cbef2a5..9a6deb4b 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/AgentModelPicker.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/AgentModelPicker.swift
@@ -56,7 +56,7 @@ struct AgentModelPicker: View {
.plainTextInput()
.multilineTextAlignment(.trailing)
.textFieldStyle(.plain)
- .frame(minWidth: 0, maxWidth: InterfaceMetrics.value(mac: 160, mobile: 180))
+ .frame(minWidth: 0, maxWidth: 180)
.outlinedPill()
} else {
ChoicePicker(selection: value, options: options, fitsAvailableWidth: true)
@@ -66,16 +66,16 @@ struct AgentModelPicker: View {
if backend != "custom", !loading {
if let failure {
Text(failure)
- .appFont(.caption)
+ .font(.caption)
.foregroundStyle(Palette.warning)
} else if catalog?.models.isEmpty == true {
Text("This agent doesn't advertise a model list. Leave Default or enter a model ID.")
- .appFont(.caption)
+ .font(.caption)
.foregroundStyle(Palette.secondary)
}
}
Text("Changing the model starts a new agent session. Chat history is kept.")
- .appFont(.caption)
+ .font(.caption)
.foregroundStyle(Palette.secondary)
}
.onChange(of: backend) { _, _ in selection = nil }
@@ -97,7 +97,7 @@ struct AgentModelPicker: View {
.transition(.opacity)
}
}
- .frame(width: InterfaceMetrics.value(mac: 28, mobile: 36), height: InterfaceMetrics.value(mac: 28, mobile: 36))
+ .frame(width: 36, height: 36)
.animation(Motion.reduced(Motion.fade, reduceMotion), value: loading)
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift
index 73394349..600998f1 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/BotEditorView.swift
@@ -68,41 +68,6 @@ public struct BotEditorView: View {
}
}
-/// The desktop inspector next to a conversation: the same form, saved as you edit.
-public struct BotSettingsPanel: View {
- let botId: String
- @Environment(BotStore.self) private var model
- @State private var draft: BotDraft?
- @State private var error: String?
-
- public init(botId: String) { self.botId = botId }
-
- public var body: some View {
- Group {
- if let binding = Binding($draft) {
- BotSettingsForm(draft: binding, error: error)
- } else {
- Color.clear
- }
- }
- .task(id: botId) {
- draft = model.bots[botId].map(BotDraft.init)
- }
- .task(id: draft) {
- // Autosave a moment after the last change.
- guard let draft, let bot = model.bots[botId], draft != BotDraft(bot), draft.isValid else { return }
- try? await Task.sleep(for: .milliseconds(600))
- guard !Task.isCancelled else { return }
- do {
- _ = try await model.save(draft.normalized)
- error = nil
- } catch {
- self.error = error.localizedDescription
- }
- }
- }
-}
-
/// Bot settings: a big avatar (Grok Bot's), then sections in the Settings style (`CardSection`).
struct BotSettingsForm: View {
@Binding var draft: BotDraft
@@ -112,13 +77,11 @@ struct BotSettingsForm: View {
@Environment(BotStore.self) private var model
@Environment(\.accessibilityReduceMotion) private var reduceMotion
@State private var pickingFolder = false
- @State private var pickingAvatar = false
- @State private var avatarFrame: CGRect = .zero
var body: some View {
ScrollView {
- VStack(alignment: .leading, spacing: InterfaceMetrics.value(mac: 24, mobile: 30)) {
- VStack(spacing: InterfaceMetrics.value(mac: 12, mobile: 16)) {
+ VStack(alignment: .leading, spacing: 30) {
+ VStack(spacing: 16) {
CharacterAvatar(shape: draft.avatarShape, color: draft.avatarColor, size: 96)
.padding(18)
.background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 24, style: .continuous))
@@ -152,7 +115,7 @@ struct BotSettingsForm: View {
}
if computer != nil, model.connection != .online {
Text("Connect this computer to create the bot, or choose another computer.")
- .appFont(.caption).foregroundStyle(Palette.warning)
+ .font(.caption).foregroundStyle(Palette.warning)
}
}
VStack(alignment: .leading, spacing: 8) {
@@ -161,12 +124,12 @@ struct BotSettingsForm: View {
options: (model.hello?.backends ?? []).map { ($0.id, $0.available ? $0.name : "\($0.name) (not installed)") } + [("custom", "Custom command")])
}
if let b = model.hello?.backends.first(where: { $0.id == draft.backend }), !b.available {
- Text(b.installHint).appFont(.caption).foregroundStyle(Palette.warning)
+ Text(b.installHint).font(.caption).foregroundStyle(Palette.warning)
.frame(maxWidth: .infinity, alignment: .leading)
}
if draft.backend == "custom" {
TextField("ACP command, e.g. my-agent --acp", text: Binding(get: { draft.command ?? "" }, set: { draft.command = $0.isEmpty ? nil : $0 }))
- .appFont(.callout.monospaced())
+ .font(.callout.monospaced())
.plainTextInput()
.fieldBox()
}
@@ -187,7 +150,7 @@ struct BotSettingsForm: View {
} label: {
HStack(spacing: 6) {
Text(draft.cwd.isEmpty ? "Personal" : (draft.cwd as NSString).lastPathComponent).lineLimit(1)
- Image(systemName: "chevron.down").appFont(.caption2.weight(.semibold)).foregroundStyle(Palette.secondary)
+ Image(systemName: "chevron.down").font(.caption2.weight(.semibold)).foregroundStyle(Palette.secondary)
}
.foregroundStyle(Palette.text)
.outlinedPill()
@@ -229,12 +192,12 @@ struct BotSettingsForm: View {
}
if let error {
- Text(error).appFont(.footnote).foregroundStyle(Palette.danger)
+ Text(error).font(.footnote).foregroundStyle(Palette.danger)
}
}
- .padding(InterfaceMetrics.value(mac: 14, mobile: 20))
+ .padding(20)
}
- .appFont(AppFont.compactBody)
+ .font(.body)
.scrollDismissesKeyboard(.interactively)
.background(Palette.background)
.task { await model.refreshPlugins() }
@@ -264,7 +227,7 @@ struct Field<Content: View>: View {
VStack(alignment: .leading, spacing: 3) {
Text(label).foregroundStyle(Palette.text)
if let detail {
- Text(detail).appFont(.caption).foregroundStyle(Palette.secondary).lineSpacing(2)
+ Text(detail).font(.caption).foregroundStyle(Palette.secondary).lineSpacing(2)
.fixedSize(horizontal: false, vertical: true)
}
}
@@ -290,7 +253,7 @@ struct SwitchRow: View {
VStack(alignment: .leading, spacing: 3) {
Text(title).foregroundStyle(Palette.text)
if let detail {
- Text(detail).appFont(.caption).foregroundStyle(Palette.secondary).lineSpacing(2)
+ Text(detail).font(.caption).foregroundStyle(Palette.secondary).lineSpacing(2)
.fixedSize(horizontal: false, vertical: true)
}
}
@@ -328,8 +291,8 @@ extension View {
/// A rounded input box.
func fieldBox() -> some View {
textFieldStyle(.plain)
- .padding(.horizontal, InterfaceMetrics.value(mac: 10, mobile: 14))
- .padding(.vertical, InterfaceMetrics.value(mac: 8, mobile: 11))
+ .padding(.horizontal, 14)
+ .padding(.vertical, 11)
.background(Palette.background, in: RoundedRectangle(cornerRadius: 12, style: .continuous))
}
}
@@ -358,15 +321,6 @@ public extension BotStore {
draft.connectors = installedConnectors.map(\.id)
}
}
-
- /// Creates an unnamed bot with sensible defaults and opens it (desktop compose flow).
- func createDefaultBot() async throws -> Bot {
- var draft = BotDraft()
- fillDefaults(&draft)
- let bot = try await save(draft)
- selection = bot.id
- return bot
- }
}
struct AvatarPicker: View {
@@ -428,7 +382,7 @@ struct FolderPicker: View {
HStack(spacing: 0) {
if stack.count > 1 {
BackButton { go(forward: false) { stack.removeLast() } }
- .padding(.leading, InterfaceMetrics.value(mac: 10, mobile: 12))
+ .padding(.leading, 12)
.transition(.opacity)
}
ModalHeader(current.map { ($0 as NSString).lastPathComponent } ?? "Folders")
@@ -468,7 +422,7 @@ private struct FolderLevel: View {
var body: some View {
ScrollView {
- LazyVStack(alignment: .leading, spacing: InterfaceMetrics.value(mac: 14, mobile: 22)) {
+ LazyVStack(alignment: .leading, spacing: 22) {
SearchField(text: $filter)
if let listing {
CardSection(footer: listing.path) {
@@ -476,7 +430,7 @@ private struct FolderLevel: View {
onPick(listing.path)
} label: {
Label("Use “\((listing.path as NSString).lastPathComponent)”", systemImage: "checkmark.circle.fill")
- .appFont(.headline)
+ .font(.headline)
.foregroundStyle(Palette.accent)
.frame(maxWidth: .infinity, alignment: .leading)
.contentShape(Rectangle())
@@ -497,7 +451,7 @@ private struct FolderLevel: View {
Text(dir.name).foregroundStyle(Palette.text).lineLimit(1)
Spacer(minLength: 8)
Image(systemName: "chevron.right")
- .appFont(.caption2.weight(.semibold))
+ .font(.caption2.weight(.semibold))
.foregroundStyle(Palette.tertiary)
}
.contentShape(Rectangle())
@@ -512,8 +466,8 @@ private struct FolderLevel: View {
Spinner(size: 20).frame(maxWidth: .infinity)
}
}
- .appFont(AppFont.compactBody)
- .padding(InterfaceMetrics.value(mac: 14, mobile: 20))
+ .font(.body)
+ .padding(20)
}
.scrollDismissesKeyboard(.interactively)
.background(Palette.background)
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/BotRow.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/BotRow.swift
index 31c4c81d..5530d9df 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/BotRow.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/BotRow.swift
@@ -3,40 +3,35 @@ import SwiftUI
public struct BotRow: View {
let bot: Bot
- let compact: Bool
@Environment(BotStore.self) private var model
- public init(bot: Bot, compact: Bool = false) {
- self.bot = bot
- self.compact = compact
- }
+ public init(bot: Bot) { self.bot = bot }
- // A Mac sidebar row is denser than a phone row (Grok Bot's desktop sidebar).
private let avatar: CGFloat = 46
private let rowPadding: CGFloat = 10
private let lineSpacing: CGFloat = 4
public var body: some View {
- HStack(spacing: compact ? 0 : InterfaceMetrics.value(mac: 8, mobile: 12)) {
+ HStack(spacing: 12) {
AvatarWithStatus(bot: bot, members: model.members(of: bot), size: avatar)
VStack(alignment: .leading, spacing: lineSpacing) {
HStack(alignment: .firstTextBaseline) {
if bot.pinned {
- Image(systemName: "pin.fill").appFont(.caption2).foregroundStyle(Palette.tertiary)
+ Image(systemName: "pin.fill").font(.caption2).foregroundStyle(Palette.tertiary)
}
Text(bot.name)
- .appFont(AppFont.compactBody.weight(.semibold))
+ .font(.body.weight(.semibold))
.foregroundStyle(Palette.text)
.lineLimit(1)
if model.screen?.agentBot == bot.id {
Image(systemName: "cursorarrow.motionlines")
- .appFont(.caption)
+ .font(.caption)
.foregroundStyle(Palette.accent)
.accessibilityLabel("Using the computer")
}
Spacer(minLength: 8)
Text(RelativeTime.day(Date(milliseconds: bot.lastAt)))
- .appFont(AppFont.compactSecondary)
+ .font(.subheadline)
.foregroundStyle(bot.unread > 0 ? Palette.text : Palette.tertiary)
}
HStack(alignment: .firstTextBaseline, spacing: 6) {
@@ -44,7 +39,7 @@ public struct BotRow: View {
Spacer(minLength: 4)
if bot.unread > 0 {
Text("\(bot.unread)")
- .appFont(.caption2.bold())
+ .font(.caption2.bold())
.foregroundStyle(Palette.onAccent)
.padding(.horizontal, 6)
.frame(minWidth: 18, minHeight: 18)
@@ -52,12 +47,8 @@ public struct BotRow: View {
}
}
}
- .frame(width: compact ? 0 : nil, alignment: .leading)
- .opacity(compact ? 0 : 1)
- .clipped()
- .accessibilityHidden(compact)
}
- .frame(maxWidth: .infinity, alignment: compact ? .center : .leading)
+ .frame(maxWidth: .infinity, alignment: .leading)
.padding(.vertical, rowPadding)
.contentShape(Rectangle())
.accessibilityElement(children: .combine)
@@ -71,7 +62,7 @@ public struct BotRow: View {
} icon: {
ThinkingOrb(state: .listening, size: 16, color: Palette.warning)
}
- .appFont(AppFont.compactSecondary)
+ .font(.subheadline)
.foregroundStyle(Palette.warning)
.lineLimit(1)
} else if bot.isWorking {
@@ -80,16 +71,16 @@ public struct BotRow: View {
Text(bot.activity.isEmpty ? "Working…" : bot.activity)
.lineLimit(1)
}
- .appFont(AppFont.compactSecondary)
+ .font(.subheadline)
.foregroundStyle(Palette.secondary)
} else if bot.status == "error" {
Text(bot.lastMessage ?? "Something went wrong")
- .appFont(AppFont.compactSecondary)
+ .font(.subheadline)
.foregroundStyle(Palette.danger)
.lineLimit(1)
} else {
Text(bot.lastMessage ?? "\(model.backendName(bot.backend)) · \(bot.folderName)")
- .appFont(AppFont.compactSecondary)
+ .font(.subheadline)
.foregroundStyle(Palette.secondary)
.lineLimit(1)
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/BotTemplateView.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/BotTemplateView.swift
index 95cdad3d..d1679c6a 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/BotTemplateView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/BotTemplateView.swift
@@ -23,13 +23,13 @@ struct BotTemplateView: View {
VStack(spacing: 0) {
ModalHeader("Create template")
VStack(alignment: .leading, spacing: 20) {
- Text(template.name).appFont(.subheadline).foregroundStyle(Palette.secondary)
+ Text(template.name).font(.subheadline).foregroundStyle(Palette.secondary)
Text("Copy this bot’s settings to reuse as a template. Conversation history and conversation ID are excluded.")
- .appFont(.callout)
+ .font(.callout)
.foregroundStyle(Palette.secondary)
ScrollView {
Text(encoded ?? "Unable to create this template.")
- .appFont(.system(size: 12, design: .monospaced))
+ .font(.system(size: 12, design: .monospaced))
.textSelection(.enabled)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(16)
@@ -37,14 +37,14 @@ struct BotTemplateView: View {
.background(Palette.surface, in: RoundedRectangle(cornerRadius: 12))
HStack {
Text("Includes workspace preferences and agent configuration.")
- .appFont(.caption).foregroundStyle(Palette.secondary)
+ .font(.caption).foregroundStyle(Palette.secondary)
Spacer()
Button {
Pasteboard.copy(encoded)
withAnimation(Motion.reduced(Motion.morph, reduceMotion)) { copied = true }
} label: {
Label(copied ? "Copied" : "Copy template", systemImage: copied ? "checkmark" : "square.on.square")
- .appFont(.system(size: 13, weight: .semibold))
+ .font(.system(size: 13, weight: .semibold))
.padding(.horizontal, 14).padding(.vertical, 9)
.foregroundStyle(Palette.onAccent)
.background(Palette.accentFill, in: RoundedRectangle(cornerRadius: 9))
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/ComputerFilterHeader.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/ComputerFilterHeader.swift
index d4ea1f11..cde7a0de 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/ComputerFilterHeader.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/ComputerFilterHeader.swift
@@ -56,9 +56,9 @@ public struct ComputerFilterHeader: View {
} else {
Text(summary).lineLimit(1).contentTransition(.opacity)
}
- Image(systemName: "chevron.down").appFont(.system(size: 8, weight: .semibold))
+ Image(systemName: "chevron.down").font(.system(size: 8, weight: .semibold))
}
- .appFont(.system(size: 12, weight: .medium))
+ .font(.system(size: 12, weight: .medium))
.foregroundStyle(Palette.secondary)
.help(summary)
.padding(.vertical, 6)
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/Dialogs.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/Dialogs.swift
index 7c60126b..db041a80 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/Dialogs.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/Dialogs.swift
@@ -8,12 +8,6 @@ public extension View {
modifier(DeleteBotConfirmation(bot: bot, onDeleted: onDeleted))
}
- /// Shows `BotStore.lastError` in a dialog.
- func storeErrorAlert(_ model: BotStore) -> some View {
- codyncDialog("Something went wrong",
- isPresented: Binding(get: { model.lastError != nil }, set: { if !$0 { model.lastError = nil } }),
- message: model.lastError, cancel: "OK") { [] }
- }
}
private struct DeleteBotConfirmation: ViewModifier {
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/GroupEditorView.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/GroupEditorView.swift
index af0d07e5..d1f048b7 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/GroupEditorView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/GroupEditorView.swift
@@ -43,7 +43,7 @@ public struct GroupEditorView: View {
}
}
ScrollView {
- VStack(alignment: .leading, spacing: InterfaceMetrics.value(mac: 12, mobile: 18)) {
+ VStack(alignment: .leading, spacing: 18) {
GroupAvatar(members: picked, size: 72)
.frame(maxWidth: .infinity)
.animation(Motion.layout, value: members)
@@ -68,7 +68,7 @@ public struct GroupEditorView: View {
}
.animation(Motion.layout, value: members)
Text("Everyone answers in turn unless you @mention someone. Each bot works in its own folder with its own tools.")
- .appFont(.caption)
+ .font(.caption)
.foregroundStyle(Palette.tertiary)
}
Field("Name") {
@@ -80,7 +80,7 @@ public struct GroupEditorView: View {
.fieldBox()
}
if let error {
- Text(error).appFont(.footnote).foregroundStyle(Palette.danger).transition(.opacity)
+ Text(error).font(.footnote).foregroundStyle(Palette.danger).transition(.opacity)
}
if let group = groupId.flatMap({ model.bots[$0] }) {
Button("Delete group chat", role: .destructive) { confirmDelete = group }
@@ -88,7 +88,7 @@ public struct GroupEditorView: View {
.padding(.top, 8)
}
}
- .padding(InterfaceMetrics.value(mac: 16, mobile: 20))
+ .padding(20)
}
.scrollDismissesKeyboard(.interactively)
}
@@ -112,14 +112,14 @@ public struct GroupEditorView: View {
private func candidateRow(_ bot: Bot) -> some View {
Button { toggle(bot.id) } label: {
HStack(spacing: 12) {
- CharacterAvatar(bot: bot, size: InterfaceMetrics.value(mac: 26, mobile: 34), animated: false)
+ CharacterAvatar(bot: bot, size: 34, animated: false)
VStack(alignment: .leading, spacing: 1) {
Text(bot.name).foregroundStyle(Palette.text).lineLimit(1)
- Text(bot.folderName).appFont(.caption).foregroundStyle(Palette.tertiary).lineLimit(1)
+ Text(bot.folderName).font(.caption).foregroundStyle(Palette.tertiary).lineLimit(1)
}
Spacer()
Image(systemName: "plus.circle")
- .appFont(.system(size: 20))
+ .font(.system(size: 20))
.foregroundStyle(Palette.tertiary)
}
.padding(.horizontal, 12)
@@ -164,14 +164,14 @@ struct BotChip: View {
HStack(spacing: 6) {
CharacterAvatar(bot: bot, size: 20, animated: false)
Text(bot.name)
- .appFont(.body)
+ .font(.body)
.foregroundStyle(Palette.text)
.lineLimit(1)
.frame(maxWidth: 220, alignment: .leading)
.fixedSize(horizontal: true, vertical: false)
Button(action: remove) {
Image(systemName: "xmark")
- .appFont(.system(size: 10, weight: .semibold))
+ .font(.system(size: 10, weight: .semibold))
.foregroundStyle(Palette.secondary)
.frame(width: 18, height: 18)
.contentShape(Rectangle())
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/MemoryView.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/MemoryView.swift
index e3a12942..12e74bd2 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/MemoryView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Bots/MemoryView.swift
@@ -52,7 +52,7 @@ struct MemoryCard: View {
ForEach(facts) { fact in
HStack(alignment: .firstTextBaseline, spacing: 10) {
Image(systemName: fact.kind == "profile" ? "person" : "clock")
- .appFont(.caption)
+ .font(.caption)
.foregroundStyle(Palette.tertiary)
.help(fact.kind == "profile" ? "About you" : "History")
Text(fact.content)
@@ -61,7 +61,7 @@ struct MemoryCard: View {
Button("Forget", systemImage: "xmark") { forget(fact) }
.labelStyle(.iconOnly)
.buttonStyle(.plain)
- .appFont(.caption)
+ .font(.caption)
.foregroundStyle(Palette.tertiary)
.help("Forget")
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Bots/NewChatView.swift b/apps/ios/Kit/Sources/CodyncUI/Bots/NewChatView.swift
deleted file mode 100644
index 829e48c1..00000000
--- a/apps/ios/Kit/Sources/CodyncUI/Bots/NewChatView.swift
+++ /dev/null
@@ -1,268 +0,0 @@
-import CodyncKit
-import SwiftUI
-
-/// Desktop "new message" page (Grok Bot's compose): a To: field that searches your
-/// bots or creates a new one, with ⌘1…⌘9 shortcuts, and the message box underneath.
-/// Picked bots become chips in the To: field; one opens its chat, several start a
-/// group chat with them (or open the one they already share). Whatever you typed is sent.
-/// `group` is "New group chat": the same page, but it only gathers bots and needs two.
-public struct NewChatView: View {
- let group: Bool
- let close: () -> Void
- @Environment(BotStore.self) private var model
- @State private var query = ""
- @State private var draft = ""
- @State private var recipients: [String] = []
- @State private var creating = false
- @FocusState private var toFocused: Bool
-
- public init(group: Bool = false, close: @escaping () -> Void) {
- self.group = group
- self.close = close
- }
-
- /// Bots not picked yet; a group can only be opened on its own, so groups go once someone's picked.
- private var matches: [Bot] {
- let q = query.trimmingCharacters(in: .whitespaces)
- return model.roster.filter {
- !recipients.contains($0.id) && !($0.isGroup && (group || !recipients.isEmpty))
- && (q.isEmpty || $0.name.localizedCaseInsensitiveContains(q))
- }
- }
-
- private var picked: [Bot] { recipients.compactMap { model.bots[$0] } }
-
- public var body: some View {
- VStack(spacing: 0) {
- HStack(spacing: 8) {
- Text("To:").foregroundStyle(Palette.secondary)
- ScrollViewReader { proxy in
- ScrollView(.horizontal, showsIndicators: false) {
- HStack(spacing: 6) {
- ForEach(picked) { bot in
- BotChip(bot: bot) { remove(bot.id) }
- .transition(.scale(scale: 0.85).combined(with: .opacity))
- }
- TextField(toPrompt, text: $query)
- .textFieldStyle(.plain)
- .focused($toFocused)
- .frame(minWidth: 200)
- .onSubmit(submitTo)
- .onKeyPress(.delete) {
- // Backspace in an empty field takes the last chip back out.
- guard query.isEmpty, let last = recipients.last else { return .ignored }
- remove(last)
- return .handled
- }
- .id("field")
- }
- .animation(Motion.layout, value: recipients)
- }
- .onChange(of: recipients) { _, _ in withAnimation(Motion.layout) { proxy.scrollTo("field", anchor: .trailing) } }
- }
- IconButton("Close", systemImage: "xmark", action: close)
- .keyboardShortcut(.cancelAction)
- }
- .appFont(.title3)
- .padding(.horizontal, 22)
- .padding(.vertical, 12)
- Rectangle().fill(Palette.border).frame(height: 0.5)
-
- ScrollView {
- VStack(spacing: 2) {
- PickRow(shortcut: 1, action: create) {
- Image(systemName: creating ? "hourglass" : "plus")
- .appFont(.system(size: 13, weight: .medium))
- .frame(width: 26, height: 26)
- .background(Palette.bubbleAgent, in: Circle())
- } label: {
- Text(query.isEmpty ? "Create new Bot" : "Create “\(query)”")
- }
- ForEach(Array(matches.enumerated()), id: \.element.id) { i, bot in
- PickRow(shortcut: i + 2 <= 9 ? i + 2 : nil, action: { choose(bot) }) {
- if bot.isGroup {
- GroupAvatar(members: model.members(of: bot), size: 26, animated: false)
- } else {
- CharacterAvatar(bot: bot, size: 26, animated: false)
- }
- } label: {
- Text(bot.name)
- }
- }
- }
- .padding(8)
- }
- .frame(maxHeight: 460)
- .fixedSize(horizontal: false, vertical: true)
- .background(Palette.surface, in: RoundedRectangle(cornerRadius: 18, style: .continuous))
- .shadow(color: .black.opacity(0.08), radius: 16, y: 6)
- .frame(maxWidth: 620, alignment: .leading)
- .frame(maxWidth: .infinity, alignment: .leading)
- .padding(.horizontal, 22)
- .padding(.top, 10)
- .animation(Motion.layout, value: matches.map(\.id))
-
- Spacer(minLength: 0)
-
- HStack(alignment: .bottom, spacing: 8) {
- TextField(placeholder, text: $draft, axis: .vertical)
- .lineLimit(1...6)
- .textFieldStyle(.plain)
- .padding(.vertical, 11)
- .sendOnReturn(start)
- }
- .padding(.leading, 18)
- .padding(.trailing, 6)
- .padding(.vertical, 6)
- .composerSurface(in: RoundedRectangle(cornerRadius: 24, style: .continuous))
- .padding(16)
- }
- .background(Palette.background)
- .task {
- await Task.yield()
- toFocused = true
- }
- }
-
- private var toPrompt: String {
- if group { return recipients.count < 2 ? "Add bots to the group" : "Add another bot" }
- return recipients.isEmpty ? "Search or create bots" : "Add another bot"
- }
-
- private var placeholder: String {
- switch picked.count {
- case _ where group: picked.count < 2 ? "Pick at least two bots" : "Message the group"
- case 0: "Message Bot"
- case 1: "Message \(picked[0].name)"
- default: "Message \(picked.map(\.name).joined(separator: ", "))"
- }
- }
-
- /// A bot becomes a chip; a group (with nobody picked) opens right away.
- private func choose(_ bot: Bot) {
- if bot.isGroup {
- open(bot.id)
- return
- }
- withAnimation(Motion.layout) { recipients.append(bot.id) }
- query = ""
- toFocused = true
- }
-
- private func remove(_ id: String) {
- withAnimation(Motion.layout) { recipients.removeAll { $0 == id } }
- }
-
- /// Return in To: picks the top match, or with the field empty, starts the chat.
- private func submitTo() {
- if !query.trimmingCharacters(in: .whitespaces).isEmpty {
- if let first = matches.first { choose(first) } else { create() }
- } else {
- start()
- }
- }
-
- /// One bot: its chat. Several: their group chat.
- private func start() {
- switch recipients.count {
- case 0: return
- case 1:
- guard !group else { return }
- open(recipients[0])
- default:
- let names = picked.map(\.name).joined(separator: ", ")
- Task {
- do {
- let group = try await model.createGroup(name: names, members: recipients)
- open(group.id)
- } catch {
- model.lastError = error.localizedDescription
- }
- }
- }
- }
-
- private func open(_ id: String) {
- let text = draft.trimmingCharacters(in: .whitespacesAndNewlines)
- model.selection = id
- if !text.isEmpty { model.send(text, to: id) }
- close()
- }
-
- private func create() {
- guard !creating else { return }
- creating = true
- Task {
- do {
- var bot = try await model.createDefaultBot()
- let name = query.trimmingCharacters(in: .whitespaces)
- if !name.isEmpty {
- var d = BotDraft(bot)
- d.name = name
- bot = try await model.save(d)
- }
- if recipients.isEmpty && !group {
- open(bot.id)
- } else {
- // `createDefaultBot` selected it; stay here and add it to the others.
- model.selection = nil
- choose(bot)
- }
- } catch {
- model.lastError = error.localizedDescription
- }
- creating = false
- }
- }
-}
-
-private struct PickRow<Icon: View, Label: View>: View {
- let shortcut: Int?
- let action: () -> Void
- @ViewBuilder let icon: Icon
- @ViewBuilder let label: Label
- @State private var hovering = false
-
- var body: some View {
- if let shortcut {
- row.keyboardShortcut(KeyEquivalent(Character("\(shortcut)")), modifiers: .command)
- } else {
- row
- }
- }
-
- private var row: some View {
- Button(action: action) {
- HStack(spacing: 12) {
- icon
- label.foregroundStyle(Palette.text).lineLimit(1)
- Spacer()
- if let shortcut {
- HStack(spacing: 3) {
- KeyCap("⌘")
- KeyCap("\(shortcut)")
- }
- }
- }
- .padding(.horizontal, 12)
- .padding(.vertical, 8)
- .background(hovering ? Palette.bubbleAgent : .clear, in: RoundedRectangle(cornerRadius: 12, style: .continuous))
- .contentShape(Rectangle())
- }
- .buttonStyle(PressScale())
- .onHover { h in withAnimation(Motion.hover) { hovering = h } }
- }
-}
-
-private struct KeyCap: View {
- let text: String
- init(_ text: String) { self.text = text }
-
- var body: some View {
- Text(text)
- .appFont(.caption.monospaced())
- .foregroundStyle(Palette.secondary)
- .frame(minWidth: 18, minHeight: 18)
- .background(Palette.background, in: RoundedRectangle(cornerRadius: 4))
- }
-}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Call/CallView.swift b/apps/ios/Kit/Sources/CodyncUI/Call/CallView.swift
index 1402a631..4d03f0f6 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Call/CallView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Call/CallView.swift
@@ -125,7 +125,7 @@ struct CallView: View {
.multilineTextAlignment(.center)
.padding(.horizontal, 12)
.padding(.vertical, 8)
- .composerSurface(in: Capsule())
+ .glass(in: Capsule())
.transition(.opacity)
}
@@ -139,7 +139,7 @@ struct CallView: View {
// Audio leaves the phone: say where.
if let provider = session?.provider {
Text(provider.name)
- .appFont(.caption2.weight(.semibold))
+ .font(.caption2.weight(.semibold))
.foregroundStyle(Palette.secondary)
.accessibilityLabel("Voice by \(provider.name)")
}
@@ -157,9 +157,9 @@ struct CallView: View {
.accessibilityLabel("End call")
.help("End call")
}
- .padding(.leading, InterfaceMetrics.value(mac: 18, mobile: 14))
- .padding(.trailing, InterfaceMetrics.value(mac: 10, mobile: 7))
- .padding(.vertical, InterfaceMetrics.value(mac: 10, mobile: 7))
+ .padding(.leading, 14)
+ .padding(.trailing, 7)
+ .padding(.vertical, 7)
.glass(in: Capsule())
.shadow(color: .black.opacity(0.08), radius: 16, y: 6)
}
@@ -192,12 +192,12 @@ struct CallView: View {
.help(label)
}
- // The phone's bar spans the screen; the Mac's is a compact panel (Grok's desktop call bar).
- private static let buttonSize = InterfaceMetrics.value(mac: 40, mobile: 46)
- private static let iconSize = InterfaceMetrics.value(mac: 16, mobile: 17)
- private static let dotsHeight = InterfaceMetrics.value(mac: 16, mobile: 20)
- private static let dotsWidth = InterfaceMetrics.value(mac: 120, mobile: 0)
- private static let dotsMaxWidth: CGFloat = InterfaceMetrics.value(mac: 120, mobile: .infinity)
+ // The bar spans the screen.
+ private static let buttonSize: CGFloat = 46
+ private static let iconSize: CGFloat = 17
+ private static let dotsHeight: CGFloat = 20
+ private static let dotsWidth: CGFloat = 0
+ private static let dotsMaxWidth: CGFloat = .infinity
private static let buttonFill = Palette.background
private static let buttonInk = Palette.text
diff --git a/apps/ios/Kit/Sources/CodyncUI/Call/VoiceChatSettingsView.swift b/apps/ios/Kit/Sources/CodyncUI/Call/VoiceChatSettingsView.swift
index b5fa7efd..6c987d6e 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Call/VoiceChatSettingsView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Call/VoiceChatSettingsView.swift
@@ -6,17 +6,15 @@ import SwiftUI
/// user's own key kept by the computer), the mode, models and voice. Opened from a call's gear and
/// from the computer's row in settings; the computer is the `BotStore` in the environment.
public struct VoiceChatSettingsView: View {
- /// False inside the Mac's Settings window, which titles the page itself.
- var showsHeader: Bool
@AppStorage(VoiceSettings.engineKey) private var engine = "device"
@AppStorage(OnDeviceEngine.rateKey) private var rate = Double(AVSpeechUtteranceDefaultSpeechRate)
@Environment(\.accessibilityReduceMotion) private var reduceMotion
- public init(showsHeader: Bool = true) { self.showsHeader = showsHeader }
+ public init() {}
public var body: some View {
VStack(spacing: 0) {
- if showsHeader { ModalHeader("Voice chat") }
+ ModalHeader("Voice chat")
CardForm {
CardSection("Voice", footer: engineFooter) {
ValueRow("Engine") {
@@ -117,7 +115,7 @@ private struct ProviderVoiceSettings: View {
}
if let result {
Label(result.text, systemImage: result.ok ? "checkmark.circle.fill" : "exclamationmark.circle.fill")
- .appFont(.footnote)
+ .font(.footnote)
.foregroundStyle(result.ok ? Palette.secondary : Palette.danger)
.transition(.opacity)
}
@@ -158,7 +156,7 @@ private struct ProviderVoiceSettings: View {
.accessibilityHidden(true)
VStack(alignment: .leading, spacing: 1) {
Text("Key saved").foregroundStyle(Palette.text).lineLimit(1)
- Text("Stays on \(store.hostName)").appFont(.caption).foregroundStyle(Palette.tertiary).lineLimit(1)
+ Text("Stays on \(store.hostName)").font(.caption).foregroundStyle(Palette.tertiary).lineLimit(1)
}
Spacer(minLength: 8)
if busy {
@@ -185,7 +183,7 @@ private struct ProviderVoiceSettings: View {
VStack(alignment: .leading, spacing: 2) {
Text("No \(provider.name) key on \(store.hostName)").foregroundStyle(Palette.text)
Text("Add it in Codync on that computer: Computers & devices, then Voice chat.")
- .appFont(.caption)
+ .font(.caption)
.foregroundStyle(Palette.secondary)
.fixedSize(horizontal: false, vertical: true)
}
@@ -194,7 +192,7 @@ private struct ProviderVoiceSettings: View {
/// Paste a key; the computer checks it with the provider before keeping it.
private var keyEntry: some View {
- VStack(alignment: .leading, spacing: InterfaceMetrics.value(mac: 10, mobile: 12)) {
+ VStack(alignment: .leading, spacing: 12) {
HStack(spacing: 8) {
SecureField("API key", text: $key, prompt: Text(provider.keyPrompt))
.plainTextInput()
@@ -209,12 +207,12 @@ private struct ProviderVoiceSettings: View {
}
}
HStack {
- WebLink("Get a key from \(provider.name)", url: provider.keyPage).appFont(.footnote)
+ WebLink("Get a key from \(provider.name)", url: provider.keyPage).font(.footnote)
Spacer()
if replacing {
Button("Cancel") { replacing = false; key = ""; result = nil }
.buttonStyle(.plain)
- .appFont(.footnote)
+ .font(.footnote)
.foregroundStyle(Palette.secondary)
}
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Chrome.swift b/apps/ios/Kit/Sources/CodyncUI/Chrome.swift
index f2cbb17a..e7467150 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Chrome.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Chrome.swift
@@ -37,7 +37,7 @@ public struct IconButtonStyle: ButtonStyle {
public init(selected: Bool = false, size: CGFloat? = nil) {
self.selected = selected
- self.size = size ?? InterfaceMetrics.value(mac: 28, mobile: 36)
+ self.size = size ?? 36
}
public func makeBody(configuration: Configuration) -> some View {
@@ -53,7 +53,7 @@ public struct IconButtonStyle: ButtonStyle {
var body: some View {
configuration.label
- .appFont(.system(size: size / 2, weight: .medium))
+ .font(.system(size: size / 2, weight: .medium))
.foregroundStyle(selected ? Palette.onAccent : hovering ? Palette.text : Palette.secondary)
.frame(width: size, height: size)
.background(
@@ -87,7 +87,7 @@ public struct ModalHeader<Trailing: View>: View {
public var body: some View {
HStack(spacing: 8) {
Text(title)
- .appFont(AppFont.compactBody.weight(.semibold))
+ .font(.body.weight(.semibold))
.foregroundStyle(Palette.text)
.lineLimit(1)
Spacer(minLength: 8)
@@ -95,9 +95,9 @@ public struct ModalHeader<Trailing: View>: View {
IconButton("Close", systemImage: "xmark") { dismiss() }
.keyboardShortcut(.cancelAction)
}
- .padding(.leading, InterfaceMetrics.value(mac: 16, mobile: 20))
- .padding(.trailing, InterfaceMetrics.value(mac: 10, mobile: 12))
- .frame(height: InterfaceMetrics.value(mac: 48, mobile: 56))
+ .padding(.leading, 20)
+ .padding(.trailing, 12)
+ .frame(height: 56)
}
}
@@ -126,8 +126,8 @@ public struct ScreenHeader<Leading: View, Title: View, Trailing: View>: View {
trailing
}
}
- .padding(.horizontal, InterfaceMetrics.value(mac: 12, mobile: 12))
- .frame(height: InterfaceMetrics.value(mac: 44, mobile: 52))
+ .padding(.horizontal, 12)
+ .frame(height: 52)
.background(Palette.background)
}
}
@@ -159,7 +159,7 @@ public extension EnvironmentValues {
}
public extension View {
- /// Presents a Codync modal: a centered card on the Mac, a bottom sheet on iPhone.
+ /// Presents a Codync modal as the system bottom sheet.
/// Content titles itself with `ModalHeader` and closes with `\.dismissModal`.
func codyncSheet<Sheet: View>(isPresented: Binding<Bool>, @ViewBuilder content: @escaping () -> Sheet) -> some View {
modifier(CodyncSheet(isPresented: isPresented, sheet: content))
@@ -175,11 +175,6 @@ public extension View {
modifier(CodyncOverlay(isPresented: isPresented, layer: content))
}
- /// Mac: the window root that hosts every `.codyncSheet` below it, so modals cover the
- /// whole window rather than the column that opened them.
- @ViewBuilder func modalHost() -> some View {
- self
- }
}
/// Keeps the last item on screen while the sheet slides away after the item is cleared.
@@ -298,8 +293,8 @@ public struct TabBar<ID: Hashable>: View {
withAnimation(Motion.reduced(Motion.morph, reduceMotion)) { selection = tab.id }
} label: {
VStack(spacing: 3) {
- Image(systemName: tab.icon).appFont(.system(size: 18, weight: .medium))
- Text(tab.title).appFont(.caption2.weight(.medium))
+ Image(systemName: tab.icon).font(.system(size: 18, weight: .medium))
+ Text(tab.title).font(.caption2.weight(.medium))
}
.foregroundStyle(on ? Palette.text : Palette.secondary)
.frame(width: 76, height: 50)
diff --git a/apps/ios/Kit/Sources/CodyncUI/ComputerBadge.swift b/apps/ios/Kit/Sources/CodyncUI/ComputerBadge.swift
index 3e3d20c6..e73b68b8 100644
--- a/apps/ios/Kit/Sources/CodyncUI/ComputerBadge.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/ComputerBadge.swift
@@ -23,7 +23,7 @@ public struct ComputerBadge: View {
switch computer?.device {
// SF Symbols has no penguin.
case "linux": Image("computer-linux", bundle: .module).resizable().scaledToFit().frame(width: size * 0.55)
- case let device: Image(systemName: Self.symbol(device)).appFont(.system(size: size * 0.5, weight: .medium))
+ case let device: Image(systemName: Self.symbol(device)).font(.system(size: size * 0.5, weight: .medium))
}
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Controls.swift b/apps/ios/Kit/Sources/CodyncUI/Controls.swift
index 0645726f..76981f41 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Controls.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Controls.swift
@@ -5,10 +5,9 @@ import UIKit
// Codync's own controls. Never use the stock ones (Picker, .switch toggles,
// Form/List styling, confirmationDialog/alert, ProgressView, DisclosureGroup,
// .bordered buttons, swipeActions): build from these instead.
-// Menus are the one exception on iOS: `DropdownMenu`/`ChoicePicker` open the system
-// `Menu` and `.contextActions` the system `contextMenu`. A hand-built overlay anchored
-// by global frame lands in the wrong place there (sheets, scroll views, the composer),
-// so `.codyncMenu` is macOS-only.
+// Menus are the one exception: `DropdownMenu`/`ChoicePicker` open the system `Menu` and
+// `.contextActions` the system `contextMenu`. A hand-built overlay anchored by global
+// frame lands in the wrong place (sheets, scroll views, the composer).
// Anything with a background fill gets no border line.
// MARK: - Switch
@@ -82,10 +81,10 @@ private struct StyledButton: View {
var body: some View {
configuration.label
- .appFont(AppFont.compactBody.weight(.medium))
+ .font(.body.weight(.medium))
.foregroundStyle(foreground)
- .padding(.horizontal, InterfaceMetrics.value(mac: 12, mobile: 18))
- .padding(.vertical, InterfaceMetrics.value(mac: 6, mobile: 11))
+ .padding(.horizontal, 18)
+ .padding(.vertical, 11)
.background(fill, in: Capsule())
.opacity(isEnabled ? (configuration.isPressed ? 0.85 : 1) : 0.4)
.scaleEffect(configuration.isPressed ? Motion.pressScale : 1)
@@ -160,171 +159,8 @@ public struct ReactionPick {
}
}
-private struct MenuAvailableSizeKey: EnvironmentKey {
- static let defaultValue = CGSize(width: 320, height: 420)
-}
-
-private extension EnvironmentValues {
- var menuAvailableSize: CGSize {
- get { self[MenuAvailableSizeKey.self] }
- set { self[MenuAvailableSizeKey.self] = newValue }
- }
-}
-
-/// The floating panel of menu rows (used by every menu, popover or overlay).
-public struct MenuPanel: View {
- let items: [MenuItem]
- var reactions: ReactionPick?
- let dismiss: () -> Void
- @Environment(\.menuAvailableSize) private var availableSize
- @State private var contentHeight: CGFloat?
- @State private var positionedSelection = false
-
- public init(items: [MenuItem], reactions: ReactionPick? = nil, dismiss: @escaping () -> Void) {
- self.items = items
- self.reactions = reactions
- self.dismiss = dismiss
- }
-
- public var body: some View {
- ScrollViewReader { proxy in
- ScrollView(.vertical) {
- VStack(alignment: .leading, spacing: 2) {
- if let reactions {
- ReactionStrip(pick: reactions, dismiss: dismiss)
- .padding(.bottom, 4)
- }
- ForEach(items) { item in
- if item.divider {
- Rectangle().fill(Palette.text.opacity(0.1)).frame(height: 0.5)
- .padding(.horizontal, 10).padding(.vertical, 4)
- }
- MenuRow(item: item) {
- dismiss()
- item.action()
- }
- .id(item.id)
- }
- }
- .padding(6)
- .fixedSize(horizontal: false, vertical: true)
- .onGeometryChange(for: CGFloat.self) { $0.size.height } action: { contentHeight = $0 }
- }
- .scrollBounceBehavior(.basedOnSize)
- .frame(width: min(320, availableSize.width),
- height: min(contentHeight ?? estimatedHeight, availableSize.height))
- .clipShape(RoundedRectangle(cornerRadius: 14, style: .continuous))
- .onChange(of: contentHeight) { _, height in
- guard height != nil, !positionedSelection,
- let selected = items.first(where: { $0.selected == true }) else { return }
- positionedSelection = true
- proxy.scrollTo(selected.id, anchor: .center)
- }
- }
- }
-
- private var estimatedHeight: CGFloat {
- CGFloat(items.count) * InterfaceMetrics.value(mac: 32, mobile: 46) + 12
- + (reactions == nil ? 0 : InterfaceMetrics.value(mac: 32, mobile: 46))
- }
-
-}
-
-/// Quick-reaction buttons; a chosen one is highlighted and tapping it takes it back.
-struct ReactionStrip: View {
- let pick: ReactionPick
- var dismiss: () -> Void = {}
-
- var body: some View {
- HStack(spacing: 0) {
- ForEach(pick.emoji, id: \.self) { emoji in
- let chosen = pick.chosen.contains(emoji)
- Button {
- dismiss()
- pick.toggle(emoji)
- } label: {
- Text(emoji).appFont(.system(size: InterfaceMetrics.value(mac: 14, mobile: 24)))
- }
- .buttonStyle(ReactionButtonStyle(chosen: chosen))
- .help(chosen ? "Remove \(emoji)" : "React \(emoji)")
- .accessibilityLabel(chosen ? "Remove reaction \(emoji)" : "React \(emoji)")
- }
- }
- }
-}
-
-/// One emoji in a reaction row: grows a little under the pointer, tinted once chosen.
-private struct ReactionButtonStyle: ButtonStyle {
- let chosen: Bool
-
- func makeBody(configuration: Configuration) -> some View {
- ReactionButton(configuration: configuration, chosen: chosen)
- }
-
- private struct ReactionButton: View {
- let configuration: Configuration
- let chosen: Bool
- @State private var hovering = false
-
- var body: some View {
- let size = InterfaceMetrics.value(mac: 26, mobile: 40)
- configuration.label
- .scaleEffect(configuration.isPressed ? 0.85 : hovering ? 1.15 : 1)
- .frame(width: size, height: size)
- .background(
- Palette.text.opacity(chosen ? 0.12 : hovering ? 0.06 : 0),
- in: RoundedRectangle(cornerRadius: size * 0.28, style: .continuous)
- )
- .contentShape(Rectangle())
- .animation(Motion.press, value: configuration.isPressed)
- .animation(Motion.hover, value: hovering)
- .onHover { hovering = $0 }
- }
- }
-}
-
-private struct MenuRow: View {
- let item: MenuItem
- let action: () -> Void
- @State private var hovering = false
-
- var body: some View {
- Button(action: action) {
- HStack(spacing: 10) {
- if let icon = item.icon {
- Image(systemName: icon).frame(width: 18)
- }
- // Wraps rather than truncates: a cut-off choice can't be read.
- Text(item.title).fixedSize(horizontal: false, vertical: true)
- Spacer(minLength: 16)
- if let selected = item.selected {
- Image(systemName: "checkmark").appFont(.caption.weight(.semibold)).opacity(selected ? 1 : 0)
- }
- }
- .appFont(AppFont.compactBody)
- .foregroundStyle(item.destructive ? Palette.danger : Palette.text)
- .padding(.horizontal, 10)
- .padding(.vertical, InterfaceMetrics.value(mac: 6, mobile: 11))
- .background(hovering ? Palette.text.opacity(0.07) : .clear, in: RoundedRectangle(cornerRadius: 8, style: .continuous))
- .contentShape(Rectangle())
- }
- .buttonStyle(.plain)
- .onHover { h in withAnimation(Motion.hover) { hovering = h } }
- .help(item.title)
- .accessibilityAddTraits(item.selected == true ? .isSelected : [])
- }
-}
-
public extension View {
- /// Mac only: shows a Codync menu under (or above) this view while `isPresented` is true.
- /// iOS menus are the system ones (`DropdownMenu`, `.contextActions`).
- @available(iOS, unavailable, message: "iOS menus are the system Menu: use DropdownMenu")
- func codyncMenu(isPresented: Binding<Bool>, items: @escaping () -> [MenuItem]) -> some View {
- modifier(AnchoredMenu(isPresented: isPresented, point: nil, items: items))
- }
-
- /// Right-click (Mac) opens a Codync menu; long-press (iPhone) the system context menu.
- /// `reactions` puts a quick-reaction row on top.
+ /// Long-press opens the system context menu; `reactions` puts a quick-reaction row on top.
func contextActions(reactions: ReactionPick? = nil, _ items: @escaping () -> [MenuItem]) -> some View {
modifier(ContextActions(items: items, reactions: reactions))
}
@@ -367,64 +203,10 @@ private struct ContextActions: ViewModifier {
}
}
-/// Presents `MenuPanel` next to the view (or at `point` inside it, for right-clicks).
-private struct AnchoredMenu: ViewModifier {
- @Binding var isPresented: Bool
- let point: CGPoint?
- let items: () -> [MenuItem]
- var reactions: ReactionPick?
- @State private var frame: CGRect = .zero
-
- func body(content: Content) -> some View {
- content
- .onGeometryChange(for: CGRect.self) { $0.frame(in: .global) } action: { frame = $0 }
- .codyncOverlay(isPresented: $isPresented) { close in
- let anchor = point.map { CGRect(x: frame.minX + $0.x, y: frame.minY + $0.y, width: 0, height: 0) } ?? frame
- AnchoredPanel(anchor: anchor, close: close) {
- MenuPanel(items: items(), reactions: reactions, dismiss: close)
- }
- }
- }
-}
-
-/// Places a floating panel beside `anchor` (global coordinates), flipping to stay on screen;
-/// a tap anywhere else closes it.
-struct AnchoredPanel<Panel: View>: View {
- let anchor: CGRect
- let close: () -> Void
- @ViewBuilder let panel: () -> Panel
-
- var body: some View {
- GeometryReader { geo in
- let space = geo.frame(in: .global)
- let a = anchor.offsetBy(dx: -space.minX, dy: -space.minY)
- let roomBelow = max(0, space.height - a.maxY - 14)
- let roomAbove = max(0, a.minY - 14)
- let below = roomBelow >= roomAbove
- let leading = a.midX < space.width * 0.6
- let horizontalInset = max(8, space.width - min(320, space.width - 16) - 8)
- ZStack(alignment: Alignment(horizontal: leading ? .leading : .trailing, vertical: below ? .top : .bottom)) {
- Color.clear.contentShape(Rectangle()).onTapGesture(perform: close)
- panel()
- .environment(\.menuAvailableSize, CGSize(
- width: max(1, space.width - 16),
- height: max(1, min(420, below ? roomBelow : roomAbove))
- ))
- .background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 14, style: .continuous))
- .shadow(color: .black.opacity(0.25), radius: 20, y: 8)
- .offset(x: leading ? min(max(8, a.minX), horizontalInset) : -min(max(8, space.width - a.maxX), horizontalInset),
- y: below ? a.maxY + 6 : -(space.height - a.minY + 6))
- }
- }
- .ignoresSafeArea()
- }
-}
-
-/// A button that opens a Codync menu.
+/// A button that opens the system menu.
public struct DropdownMenu<Label: View>: View {
let items: () -> [MenuItem]
let label: Label
- @State private var open = false
public init(items: @escaping () -> [MenuItem], @ViewBuilder label: () -> Label) {
self.items = items
@@ -444,7 +226,7 @@ public struct DropdownMenu<Label: View>: View {
}
}
-/// Picks one value: shows the current choice in a pill with a chevron, opens a Codync menu.
+/// Picks one value: shows the current choice in a pill with a chevron, opens the system menu.
public struct ChoicePicker<ID: Hashable>: View {
@Binding var selection: ID
let options: [(id: ID, label: String)]
@@ -464,9 +246,9 @@ public struct ChoicePicker<ID: Hashable>: View {
} label: {
HStack(spacing: 6) {
Text(options.first { $0.id == selection }?.label ?? "Choose").lineLimit(1)
- Image(systemName: "chevron.down").appFont(.caption2.weight(.semibold)).foregroundStyle(Palette.secondary)
+ Image(systemName: "chevron.down").font(.caption2.weight(.semibold)).foregroundStyle(Palette.secondary)
}
- .appFont(AppFont.compactBody)
+ .font(.body)
.foregroundStyle(Palette.text)
.pill(fill: fill)
.overlay {
@@ -498,11 +280,11 @@ public struct SegmentedChoice<ID: Hashable>: View {
withAnimation(Motion.reduced(Motion.morph, reduceMotion)) { selection = option.id }
} label: {
Text(option.label)
- .appFont(AppFont.compactSecondary.weight(.medium))
+ .font(.subheadline.weight(.medium))
.foregroundStyle(on ? Palette.text : Palette.secondary)
.lineLimit(1)
.frame(maxWidth: .infinity)
- .padding(.vertical, InterfaceMetrics.value(mac: 5, mobile: 8))
+ .padding(.vertical, 8)
.background {
if on {
Capsule().fill(Palette.background).matchedGeometryEffect(id: "thumb", in: thumb)
@@ -530,19 +312,19 @@ public struct ChoiceList<ID: Hashable>: View {
}
public var body: some View {
- VStack(alignment: .leading, spacing: InterfaceMetrics.value(mac: 10, mobile: 14)) {
+ VStack(alignment: .leading, spacing: 14) {
ForEach(options, id: \.id) { option in
Button { selection = option.id } label: {
HStack(spacing: 10) {
VStack(alignment: .leading, spacing: 2) {
Text(option.label).foregroundStyle(Palette.text)
if let detail = option.detail, !detail.isEmpty {
- Text(detail).appFont(AppFont.compactSecondary).foregroundStyle(Palette.secondary)
+ Text(detail).font(.subheadline).foregroundStyle(Palette.secondary)
}
}
Spacer(minLength: 8)
Image(systemName: "checkmark")
- .appFont(.caption.weight(.semibold))
+ .font(.caption.weight(.semibold))
.foregroundStyle(Palette.text)
.opacity(option.id == selection ? 1 : 0)
}
@@ -565,11 +347,11 @@ public struct CardForm<Content: View>: View {
public var body: some View {
ScrollView {
- VStack(alignment: .leading, spacing: InterfaceMetrics.value(mac: 28, mobile: 32)) {
+ VStack(alignment: .leading, spacing: 32) {
content
}
- .appFont(AppFont.compactBody)
- .padding(InterfaceMetrics.value(mac: 14, mobile: 20))
+ .font(.body)
+ .padding(20)
.frame(maxWidth: .infinity, alignment: .leading)
}
.scrollDismissesKeyboard(.interactively)
@@ -596,11 +378,11 @@ public struct CardSection<Content: View, Accessory: View>: View {
}
public var body: some View {
- VStack(alignment: .leading, spacing: InterfaceMetrics.value(mac: 10, mobile: 10)) {
+ VStack(alignment: .leading, spacing: 10) {
if let title {
HStack(spacing: 8) {
Text(title)
- .appFont(.system(size: InterfaceMetrics.value(mac: 13, mobile: 15), weight: .semibold))
+ .font(.system(size: 15, weight: .semibold))
.foregroundStyle(Palette.text)
.accessibilityAddTraits(.isHeader)
Spacer(minLength: 0)
@@ -615,7 +397,7 @@ public struct CardSection<Content: View, Accessory: View>: View {
.background(Palette.surface, in: RoundedRectangle(cornerRadius: 16, style: .continuous))
if let footer {
Text(footer)
- .appFont(.caption)
+ .font(.caption)
.foregroundStyle(Palette.secondary)
.lineSpacing(2)
.fixedSize(horizontal: false, vertical: true)
@@ -646,12 +428,12 @@ public struct Hairline: View {
/// Lays a section's rows out one under another with an inset hairline between each pair.
private struct HairlineRows: _VariadicView_MultiViewRoot {
func body(children: _VariadicView.Children) -> some View {
- let inset = InterfaceMetrics.value(mac: 16, mobile: 16)
+ let inset: CGFloat = 16
ForEach(children) { child in
child
- .frame(maxWidth: .infinity, minHeight: InterfaceMetrics.value(mac: 28, mobile: 32), alignment: .leading)
+ .frame(maxWidth: .infinity, minHeight: 32, alignment: .leading)
.padding(.horizontal, inset)
- .padding(.vertical, InterfaceMetrics.value(mac: 12, mobile: 14))
+ .padding(.vertical, 14)
if child.id != children.last?.id { Hairline().padding(.horizontal, inset) }
}
}
@@ -681,7 +463,7 @@ public struct ValueRow<Value: View>: View {
Text(label).foregroundStyle(Palette.text)
if let detail {
Text(detail)
- .appFont(.caption)
+ .font(.caption)
.foregroundStyle(Palette.secondary)
.lineSpacing(2)
.fixedSize(horizontal: false, vertical: true)
@@ -715,9 +497,9 @@ public struct SearchField: View {
.accessibilityLabel("Clear search")
}
}
- .appFont(AppFont.compactBody)
- .padding(.horizontal, InterfaceMetrics.value(mac: 10, mobile: 14))
- .padding(.vertical, InterfaceMetrics.value(mac: 7, mobile: 10))
+ .font(.body)
+ .padding(.horizontal, 14)
+ .padding(.vertical, 10)
.background(Palette.bubbleAgent, in: Capsule())
}
}
@@ -744,7 +526,7 @@ public struct Disclosure<Label: View, Content: View>: View {
label
Spacer(minLength: 8)
Image(systemName: "chevron.right")
- .appFont(.caption2.weight(.semibold))
+ .font(.caption2.weight(.semibold))
.foregroundStyle(Palette.secondary)
.rotationEffect(.degrees(isExpanded ? 90 : 0))
}
@@ -834,9 +616,9 @@ private struct DialogCard: View {
.onTapGesture { if cancel != nil { dismiss() } }
VStack(spacing: 14) {
VStack(spacing: 6) {
- Text(title).appFont(.headline).foregroundStyle(Palette.text)
+ Text(title).font(.headline).foregroundStyle(Palette.text)
if let message, !message.isEmpty {
- Text(message).appFont(AppFont.compactSecondary).foregroundStyle(Palette.secondary)
+ Text(message).font(.subheadline).foregroundStyle(Palette.secondary)
}
}
.multilineTextAlignment(.center)
@@ -873,9 +655,9 @@ private struct DialogButtonStyle: ButtonStyle {
func makeBody(configuration: Configuration) -> some View {
configuration.label
- .appFont(AppFont.compactBody.weight(.medium))
+ .font(.body.weight(.medium))
.foregroundStyle(destructive ? Color.white : (prominent ? Palette.onAccent : Palette.text))
- .padding(.vertical, InterfaceMetrics.value(mac: 8, mobile: 12))
+ .padding(.vertical, 12)
.background(destructive ? Palette.danger : (prominent ? Palette.accentFill : Palette.bubbleUser), in: Capsule())
.opacity(configuration.isPressed ? 0.85 : 1)
.scaleEffect(configuration.isPressed ? Motion.pressScale : 1)
@@ -895,8 +677,8 @@ extension View {
}
func pill(fill: Color = Palette.background) -> some View {
- padding(.horizontal, InterfaceMetrics.value(mac: 9, mobile: 12))
- .padding(.vertical, InterfaceMetrics.value(mac: 5, mobile: 7))
+ padding(.horizontal, 12)
+ .padding(.vertical, 7)
.background(fill, in: RoundedRectangle(cornerRadius: 10, style: .continuous))
}
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Marketplace/ComposioViews.swift b/apps/ios/Kit/Sources/CodyncUI/Marketplace/ComposioViews.swift
index ccf97327..9f3f53e2 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Marketplace/ComposioViews.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Marketplace/ComposioViews.swift
@@ -65,13 +65,13 @@ struct ComposioSection: View {
.frame(maxWidth: .infinity)
}
if let error {
- Text(error).appFont(.footnote).foregroundStyle(Palette.danger)
+ Text(error).font(.footnote).foregroundStyle(Palette.danger)
}
if status?.configured == true {
Button("Composio settings", systemImage: "key") { withAnimation(Motion.layout) { settingUp = true } }
.labelStyle(.titleAndIcon)
.buttonStyle(.plain)
- .appFont(.footnote)
+ .font(.footnote)
.foregroundStyle(Palette.tertiary)
}
}
@@ -121,7 +121,7 @@ struct AppLogo: View {
image.resizable().scaledToFit().padding(size * 0.18)
} placeholder: {
Text(name.prefix(1).uppercased())
- .appFont(.system(size: size * 0.4, weight: .semibold))
+ .font(.system(size: size * 0.4, weight: .semibold))
.foregroundStyle(Palette.secondary)
}
.frame(width: size, height: size)
@@ -163,7 +163,7 @@ struct ComposioKeySheet: View {
SecureField("API key", text: $key, prompt: Text(status?.configured == true ? "Saved (paste to replace)" : "ak_…"))
.plainTextInput()
if let url = URL(string: status?.keyUrl ?? "https://platform.composio.dev") {
- WebLink("Get a key from Composio", url: url).appFont(.footnote)
+ WebLink("Get a key from Composio", url: url).font(.footnote)
}
}
if status?.configured == true {
@@ -236,9 +236,9 @@ struct ComposioConnectSheet: View {
HStack(spacing: 14) {
AppLogo(url: app.logo, name: app.name, size: 52)
VStack(alignment: .leading, spacing: 2) {
- Text(app.name).appFont(.title3.weight(.semibold))
+ Text(app.name).font(.title3.weight(.semibold))
if let d = app.description {
- Text(d).appFont(.subheadline).foregroundStyle(Palette.secondary).lineLimit(3)
+ Text(d).font(.subheadline).foregroundStyle(Palette.secondary).lineLimit(3)
}
}
}
@@ -261,7 +261,7 @@ struct ComposioConnectSheet: View {
}
.plainTextInput()
if let d = f.description {
- Text(d + (f.required ? "" : " (optional)")).appFont(.caption).foregroundStyle(Palette.secondary)
+ Text(d + (f.required ? "" : " (optional)")).font(.caption).foregroundStyle(Palette.secondary)
}
}
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Marketplace/ConnectionRequestCard.swift b/apps/ios/Kit/Sources/CodyncUI/Marketplace/ConnectionRequestCard.swift
index 1ac71524..e0ecf9a3 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Marketplace/ConnectionRequestCard.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Marketplace/ConnectionRequestCard.swift
@@ -18,7 +18,7 @@ struct ConnectionRequestCard: View {
var body: some View {
VStack(alignment: .leading, spacing: 12) {
Label(request.title, systemImage: "lock.shield")
- .appFont(.headline)
+ .font(.headline)
if let text = entry.data.text { Text(text).foregroundStyle(Palette.secondary) }
if request.status == "pending" {
if request.kind == "login" {
@@ -27,14 +27,14 @@ struct ConnectionRequestCard: View {
SecureField("Password or op:// reference", text: $value)
.plainTextInput()
Text("Saved securely on this computer. The bot types it into the sign-in page but never sees it.")
- .appFont(.caption).foregroundStyle(Palette.secondary)
+ .font(.caption).foregroundStyle(Palette.secondary)
} else if request.kind == "secret" {
Text("\(request.field ?? "Credential") · \(request.location ?? "")")
- .appFont(.caption).foregroundStyle(Palette.secondary)
+ .font(.caption).foregroundStyle(Palette.secondary)
SecureField("Credential or op:// reference", text: $value)
.plainTextInput()
Text("Saved securely on this computer. Never added to the conversation.")
- .appFont(.caption).foregroundStyle(Palette.secondary)
+ .font(.caption).foregroundStyle(Palette.secondary)
}
HStack {
Button(request.kind == "login" ? "Save login" : request.kind == "secret" ? "Save and connect" : "Connect") { connect() }
@@ -46,7 +46,7 @@ struct ConnectionRequestCard: View {
} else {
Text(request.status == "ready" ? (request.kind == "login" ? "Saved" : "Connected") : "Cancelled").foregroundStyle(Palette.secondary)
}
- if let error { Text(error).appFont(.footnote).foregroundStyle(Palette.danger) }
+ if let error { Text(error).font(.footnote).foregroundStyle(Palette.danger) }
}
.padding(16)
.background(Palette.surface, in: RoundedRectangle(cornerRadius: 18))
@@ -125,7 +125,7 @@ struct CredentialsView: View {
.buttonStyle(.plain)
}
Text("Values stay hidden. Select a connection to replace its credentials.")
- .appFont(.caption).foregroundStyle(Palette.secondary)
+ .font(.caption).foregroundStyle(Palette.secondary)
}
LoginsSection()
CardSection("1Password", footer: "Use a service account with read access only to a dedicated shared vault. The 1Password CLI must be installed on the computer.") {
@@ -136,7 +136,7 @@ struct CredentialsView: View {
Button("Disconnect") { save("") }.buttonStyle(SecondaryButtonStyle()).disabled(busy)
}
Text("Use op://vault/item/field in a connector's credential field. Codync retrieves the value when the connector runs.")
- .appFont(.footnote).foregroundStyle(Palette.secondary)
+ .font(.footnote).foregroundStyle(Palette.secondary)
}
if busy { Spinner() }
if let error { Text(error).foregroundStyle(Palette.danger) }
@@ -181,7 +181,7 @@ private struct LoginsSection: View {
HStack {
VStack(alignment: .leading, spacing: 2) {
Text(login.site)
- if !login.username.isEmpty { Text(login.username).appFont(.caption).foregroundStyle(Palette.secondary) }
+ if !login.username.isEmpty { Text(login.username).font(.caption).foregroundStyle(Palette.secondary) }
}
Spacer()
IconButton("Remove", systemImage: "trash") { remove(login) }
@@ -193,7 +193,7 @@ private struct LoginsSection: View {
Button("Save sign-in") { save() }
.buttonStyle(PrimaryButtonStyle())
.disabled(busy || site.isEmpty || password.isEmpty)
- if let error { Text(error).appFont(.footnote).foregroundStyle(Palette.danger) }
+ if let error { Text(error).font(.footnote).foregroundStyle(Palette.danger) }
}
.task { await load() }
.onDisappear { password = "" }
diff --git a/apps/ios/Kit/Sources/CodyncUI/Marketplace/MarketplaceView.swift b/apps/ios/Kit/Sources/CodyncUI/Marketplace/MarketplaceView.swift
index de39424b..314b71f8 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Marketplace/MarketplaceView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Marketplace/MarketplaceView.swift
@@ -24,7 +24,7 @@ public struct MarketplaceView: View {
@State private var addingConnector = false
@State private var writingSkill = false
@State private var agent: Backend?
- /// Agents shown before "Load more agents" (two rows of the Mac grid).
+ /// Agents shown before "Load more agents".
@State private var agentLimit = 10
@State private var showInstalled = false
@State private var showCredentials = false
@@ -89,7 +89,6 @@ public struct MarketplaceView: View {
searchField
if !agents.isEmpty {
MarketSection(title: query.isEmpty ? "Agents" : "Agents matching “\(query)”") {
- // A swipeable row on the phone, a grid on the Mac.
ScrollView(.horizontal, showsIndicators: false) {
LazyHStack(spacing: 10) {
ForEach(agents.prefix(agentLimit)) { b in agentCard(b).frame(width: 128) }
@@ -170,10 +169,10 @@ public struct MarketplaceView: View {
}
}
if let error {
- Text(error).appFont(.footnote).foregroundStyle(Palette.danger)
+ Text(error).font(.footnote).foregroundStyle(Palette.danger)
}
Text("Connectors come from the official MCP Registry, apps through Composio, skills from Anthropic, agents from the ACP registry. Everything installs on \(model.hostName).")
- .appFont(.footnote)
+ .font(.footnote)
.foregroundStyle(Palette.tertiary)
}
.padding(.horizontal, 44)
@@ -197,7 +196,7 @@ public struct MarketplaceView: View {
ComputerBadge(model.computer, size: 32)
VStack(alignment: .leading, spacing: 0) {
Text("Marketplace")
- .appFont(.title2.weight(.semibold))
+ .font(.title2.weight(.semibold))
.foregroundStyle(Palette.text)
if let computer, computers.count > 1 {
DropdownMenu {
@@ -207,9 +206,9 @@ public struct MarketplaceView: View {
} label: {
HStack(spacing: 4) {
Text(model.hostName)
- Image(systemName: "chevron.down").appFont(.caption2.weight(.semibold))
+ Image(systemName: "chevron.down").font(.caption2.weight(.semibold))
}
- .appFont(.subheadline)
+ .font(.subheadline)
.foregroundStyle(Palette.secondary)
.contentShape(Rectangle())
}
@@ -217,7 +216,7 @@ public struct MarketplaceView: View {
.help("Switch computer")
} else {
Text(model.hostName)
- .appFont(.subheadline)
+ .font(.subheadline)
.foregroundStyle(Palette.secondary)
}
}
@@ -235,7 +234,7 @@ public struct MarketplaceView: View {
}
}
Text("\(installedCount) installed").foregroundStyle(Palette.secondary).lineLimit(1).fixedSize()
- Image(systemName: "chevron.right").appFont(.caption.weight(.semibold)).foregroundStyle(Palette.tertiary)
+ Image(systemName: "chevron.right").font(.caption.weight(.semibold)).foregroundStyle(Palette.tertiary)
}
.contentShape(Rectangle())
}
@@ -339,7 +338,7 @@ private struct InstalledView: View {
ScreenHeader {
BackButton(action: back).keyboardShortcut(.cancelAction)
} title: {
- Text("Installed").appFont(AppFont.compactBody.weight(.semibold)).foregroundStyle(Palette.text)
+ Text("Installed").font(.body.weight(.semibold)).foregroundStyle(Palette.text)
} trailing: {
EmptyView()
}
@@ -449,9 +448,9 @@ private struct EmptyState: View {
var body: some View {
VStack(spacing: 8) {
- Image(systemName: icon).appFont(.system(size: 28)).foregroundStyle(Palette.tertiary).accessibilityHidden(true)
- Text(title).appFont(AppFont.compactBody.weight(.semibold)).foregroundStyle(Palette.text)
- Text(detail).appFont(AppFont.compactSecondary).foregroundStyle(Palette.secondary).multilineTextAlignment(.center)
+ Image(systemName: icon).font(.system(size: 28)).foregroundStyle(Palette.tertiary).accessibilityHidden(true)
+ Text(title).font(.body.weight(.semibold)).foregroundStyle(Palette.text)
+ Text(detail).font(.subheadline).foregroundStyle(Palette.secondary).multilineTextAlignment(.center)
}
.frame(maxWidth: .infinity)
.padding(.vertical, 40)
@@ -470,7 +469,7 @@ private struct InstalledRow<Icon: View, Accessory: View>: View {
icon
VStack(alignment: .leading, spacing: 2) {
Text(title).foregroundStyle(Palette.text).lineLimit(1)
- Text(subtitle).appFont(.caption).foregroundStyle(Palette.secondary).lineLimit(1)
+ Text(subtitle).font(.caption).foregroundStyle(Palette.secondary).lineLimit(1)
}
Spacer(minLength: 12)
accessory
@@ -494,7 +493,7 @@ struct MarketSection<Content: View>: View {
var body: some View {
VStack(alignment: .leading, spacing: 12) {
- Text(title).appFont(.headline).foregroundStyle(Palette.text).padding(.leading, 4)
+ Text(title).font(.headline).foregroundStyle(Palette.text).padding(.leading, 4)
content
}
}
@@ -529,9 +528,9 @@ private struct AgentCard: View {
.frame(width: 64, height: 64)
.background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 18, style: .continuous))
VStack(spacing: 2) {
- Text(backend.name).appFont(.subheadline.weight(.semibold)).foregroundStyle(Palette.text).lineLimit(1)
+ Text(backend.name).font(.subheadline.weight(.semibold)).foregroundStyle(Palette.text).lineLimit(1)
Text(status)
- .appFont(.caption)
+ .font(.caption)
.foregroundStyle(Palette.secondary)
.lineLimit(1)
}
@@ -578,7 +577,7 @@ private struct AgentSheet: View {
.transition(.move(edge: .leading).combined(with: .opacity))
}
}
- .frame(minWidth: InterfaceMetrics.value(mac: 560, mobile: 0), minHeight: InterfaceMetrics.value(mac: 460, mobile: 0))
+ .frame(minWidth: 0, minHeight: 0)
// A known "signed in" needs no agent start; everything else asks the agent.
.task { if backend.signedIn != true { await check() } }
.onChange(of: route) { old, new in
@@ -608,9 +607,9 @@ private struct AgentSheet: View {
.frame(width: 52, height: 52)
.background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 14, style: .continuous))
VStack(alignment: .leading, spacing: 2) {
- Text(backend.name).appFont(.title3.weight(.semibold))
+ Text(backend.name).font(.title3.weight(.semibold))
if let d = backend.description, !d.isEmpty {
- Text(d).appFont(.subheadline).foregroundStyle(Palette.secondary).lineLimit(3)
+ Text(d).font(.subheadline).foregroundStyle(Palette.secondary).lineLimit(3)
}
}
}
@@ -653,7 +652,7 @@ private struct AgentSheet: View {
}
}
if signedIn != true, let detail = auth?.detail, !detail.isEmpty {
- Text(detail).appFont(.footnote).foregroundStyle(Palette.secondary).textSelection(.enabled)
+ Text(detail).font(.footnote).foregroundStyle(Palette.secondary).textSelection(.enabled)
}
// Some CLIs drop the current sign-in the moment a new one starts: no options once signed in.
if signedIn != true, !checking {
@@ -702,19 +701,19 @@ private struct AgentSheet: View {
Button(action: action) {
HStack(spacing: 12) {
Image(systemName: icon)
- .appFont(.body)
+ .font(.body)
.foregroundStyle(Palette.secondary)
.frame(width: 26)
.accessibilityHidden(true)
VStack(alignment: .leading, spacing: 2) {
- Text(title).appFont(.body.weight(.medium)).foregroundStyle(Palette.text)
- Text(detail).appFont(.subheadline).foregroundStyle(Palette.secondary).lineLimit(3)
+ Text(title).font(.body.weight(.medium)).foregroundStyle(Palette.text)
+ Text(detail).font(.subheadline).foregroundStyle(Palette.secondary).lineLimit(3)
}
Spacer(minLength: 8)
if busy {
ThinkingOrb(size: 16, color: Palette.secondary)
} else {
- Image(systemName: "chevron.right").appFont(.caption.weight(.semibold)).foregroundStyle(Palette.tertiary)
+ Image(systemName: "chevron.right").font(.caption.weight(.semibold)).foregroundStyle(Palette.tertiary)
}
}
.contentShape(Rectangle())
@@ -775,7 +774,7 @@ private struct AgentKeysForm: View {
ScreenHeader {
BackButton(action: back).keyboardShortcut(.cancelAction)
} title: {
- Text(method.name).appFont(AppFont.compactBody.weight(.semibold)).foregroundStyle(Palette.text).lineLimit(1)
+ Text(method.name).font(.body.weight(.semibold)).foregroundStyle(Palette.text).lineLimit(1)
} trailing: {
if saving {
Spinner()
@@ -804,7 +803,7 @@ private struct AgentKeysForm: View {
}
}
.plainTextInput()
- Text(v.label + (v.optional ? " (optional)" : "")).appFont(.caption).foregroundStyle(Palette.secondary)
+ Text(v.label + (v.optional ? " (optional)" : "")).font(.caption).foregroundStyle(Palette.secondary)
}
}
}
@@ -815,7 +814,7 @@ private struct AgentKeysForm: View {
WebLink("Get a key", url: url)
}
}
- .appFont(.caption)
+ .font(.caption)
.foregroundStyle(Palette.tertiary)
.padding(.horizontal, 4)
}
@@ -866,22 +865,22 @@ private struct SetupStepRow: View {
ZStack {
Circle().fill(done ? Palette.accentFill : Palette.bubbleAgent)
if done {
- Image(systemName: "checkmark").appFont(.caption.weight(.bold)).foregroundStyle(Palette.onAccent)
+ Image(systemName: "checkmark").font(.caption.weight(.bold)).foregroundStyle(Palette.onAccent)
} else {
- Text("\(number)").appFont(.caption.weight(.semibold)).foregroundStyle(Palette.secondary)
+ Text("\(number)").font(.caption.weight(.semibold)).foregroundStyle(Palette.secondary)
}
}
.frame(width: 26, height: 26)
.accessibilityHidden(true)
VStack(alignment: .leading, spacing: 2) {
- Text(title).appFont(.body.weight(.medium)).foregroundStyle(Palette.text)
- Text(detail).appFont(.subheadline).foregroundStyle(Palette.secondary).textSelection(.enabled)
+ Text(title).font(.body.weight(.medium)).foregroundStyle(Palette.text)
+ Text(detail).font(.subheadline).foregroundStyle(Palette.secondary).textSelection(.enabled)
}
Spacer(minLength: 8)
if let action {
Button(action.label, action: action.run)
.buttonStyle(.plain)
- .appFont(.subheadline.weight(.semibold))
+ .font(.subheadline.weight(.semibold))
.foregroundStyle(Palette.text)
.padding(.horizontal, 14)
.padding(.vertical, 7)
@@ -909,8 +908,8 @@ struct MarketRow<Icon: View>: View {
HStack(spacing: 14) {
icon.frame(width: 46, height: 46)
VStack(alignment: .leading, spacing: 2) {
- Text(title).appFont(.body.weight(.medium)).foregroundStyle(Palette.text).lineLimit(1)
- Text(subtitle).appFont(.subheadline).foregroundStyle(Palette.secondary).lineLimit(1)
+ Text(title).font(.body.weight(.medium)).foregroundStyle(Palette.text).lineLimit(1)
+ Text(subtitle).font(.subheadline).foregroundStyle(Palette.secondary).lineLimit(1)
}
Spacer(minLength: 8)
if busy {
@@ -918,14 +917,14 @@ struct MarketRow<Icon: View>: View {
} else if added {
Label("Added", systemImage: "checkmark")
.labelStyle(.iconOnly)
- .appFont(.subheadline.weight(.semibold))
+ .font(.subheadline.weight(.semibold))
.foregroundStyle(Palette.secondary)
.frame(width: 60)
.accessibilityLabel("Added")
} else {
Button(addLabel, action: add)
.buttonStyle(.plain)
- .appFont(.subheadline.weight(.semibold))
+ .font(.subheadline.weight(.semibold))
.foregroundStyle(Palette.text)
.padding(.horizontal, 16)
.padding(.vertical, 7)
@@ -993,7 +992,7 @@ private struct ServiceLogo: View {
ZStack {
shape.fill(Palette.bubbleAgent)
Text(name.first.map { String($0).uppercased() } ?? "?")
- .appFont(.system(size: size * 0.4, weight: .semibold, design: .rounded))
+ .font(.system(size: size * 0.4, weight: .semibold, design: .rounded))
.foregroundStyle(Palette.text)
if let faviconURL {
AsyncImage(url: faviconURL) { phase in
@@ -1017,7 +1016,7 @@ struct TileIcon: View {
var body: some View {
RoundedRectangle(cornerRadius: 12, style: .continuous)
.fill(Palette.bubbleAgent)
- .overlay(Image(systemName: systemName).appFont(.system(size: 18, weight: .medium)).foregroundStyle(Palette.text))
+ .overlay(Image(systemName: systemName).font(.system(size: 18, weight: .medium)).foregroundStyle(Palette.text))
}
}
@@ -1065,10 +1064,10 @@ struct InstallConnectorSheet: View {
CardForm {
CardSection {
VStack(alignment: .leading, spacing: 6) {
- Text(item.title).appFont(.title3.weight(.semibold))
+ Text(item.title).font(.title3.weight(.semibold))
if let d = item.description { Text(d).foregroundStyle(Palette.secondary) }
if let w = item.website, let url = URL(string: w) {
- WebLink(w, url: url).appFont(.footnote).lineLimit(1)
+ WebLink(w, url: url).font(.footnote).lineLimit(1)
}
}
.padding(.vertical, 4)
@@ -1099,7 +1098,7 @@ struct InstallConnectorSheet: View {
}
.plainTextInput()
if let d = input.description {
- Text(d + (input.required ? "" : " (optional)")).appFont(.caption).foregroundStyle(Palette.secondary)
+ Text(d + (input.required ? "" : " (optional)")).font(.caption).foregroundStyle(Palette.secondary)
}
}
}
@@ -1201,12 +1200,12 @@ private struct CustomConnectorSheet: View {
if mode == .config {
TextField("{ \"mcpServers\": { … } }", text: $config, axis: .vertical)
.lineLimit(6...16)
- .appFont(.callout.monospaced())
+ .font(.callout.monospaced())
.plainTextInput()
} else {
TextField("Name", text: $name)
TextField(mode == .url ? "https://example.com/mcp" : "npx -y @scope/server", text: $target)
- .appFont(.callout.monospaced())
+ .font(.callout.monospaced())
.plainTextInput()
}
}
@@ -1214,14 +1213,14 @@ private struct CustomConnectorSheet: View {
CardSection("Headers", footer: "Optional, one Name: value per line. Leave empty if the service has you sign in. Saved on \(model.hostName) only.") {
TextField("Authorization: Bearer …", text: $envText, axis: .vertical)
.lineLimit(2...6)
- .appFont(.callout.monospaced())
+ .font(.callout.monospaced())
.plainTextInput()
}
} else if mode == .command {
CardSection("Environment", footer: "One KEY=value per line. Saved on \(model.hostName) only.") {
TextField("API_KEY=…", text: $envText, axis: .vertical)
.lineLimit(2...6)
- .appFont(.callout.monospaced())
+ .font(.callout.monospaced())
.plainTextInput()
}
}
@@ -1365,7 +1364,3 @@ public struct AgentIcon: View {
UIImage(named: name, in: .module, with: nil) != nil
}
}
-
-private extension String {
- var nilIfEmpty: String? { isEmpty ? nil : self }
-}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Marketplace/SetupTerminal.swift b/apps/ios/Kit/Sources/CodyncUI/Marketplace/SetupTerminal.swift
index 7e5540a2..169e5aca 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Marketplace/SetupTerminal.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Marketplace/SetupTerminal.swift
@@ -22,7 +22,7 @@ struct SetupTerminalView: View {
BackButton(action: back).keyboardShortcut(.cancelAction)
} title: {
Text(step == .install ? "Install \(backend.name)" : method?.name ?? "Sign in to \(backend.name)")
- .appFont(AppFont.compactBody.weight(.semibold))
+ .font(.body.weight(.semibold))
.foregroundStyle(Palette.text)
.lineLimit(1)
} trailing: {
@@ -61,7 +61,7 @@ struct SetupTerminalView: View {
Button("Done", action: back).buttonStyle(.primary)
}
}
- .appFont(.footnote)
+ .font(.footnote)
.lineLimit(2)
.padding(.horizontal, 16)
.padding(.vertical, 10)
diff --git a/apps/ios/Kit/Sources/CodyncUI/Platform.swift b/apps/ios/Kit/Sources/CodyncUI/Platform.swift
index 84424503..e06eb2ea 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Platform.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Platform.swift
@@ -18,7 +18,7 @@ extension View {
extension View {
/// Liquid Glass where the OS has it (content scrolls visibly underneath), a material before that.
@ViewBuilder func glass(in shape: some Shape) -> some View {
- if #available(iOS 26, macOS 26, *) {
+ if #available(iOS 26, *) {
glassEffect(.regular, in: shape)
} else {
background(.ultraThinMaterial, in: shape)
@@ -27,39 +27,10 @@ extension View {
}
extension View {
- /// Grok's desktop floating surfaces (title pill, call bar): a dark frosted fill that lets the chat
+ /// Floating surfaces over the chat (Jump to latest): a dark frosted fill that lets the chat
/// show through faintly, not Liquid Glass's clear lens. No border: the fill carries the edge.
func frosted(in shape: some Shape) -> some View {
background(Color(light: 0xF4F4F4, dark: 0x232323).opacity(0.82), in: shape)
.background(.ultraThinMaterial, in: shape)
}
}
-
-extension View {
- /// The message box: Liquid Glass on iPhone; on the Mac a filled box with a
- /// soft shadow (as in Grok Bot's desktop app).
- @ViewBuilder func composerSurface(in shape: some Shape) -> some View {
- glass(in: shape)
- }
-
- /// Mac: Return sends, Shift-Return adds a new line. iPhone keeps Return as a new line.
- /// While an input method (Zhuyin, Pinyin, Japanese…) is composing, Return picks the candidate instead.
- @ViewBuilder func sendOnReturn(_ send: @escaping () -> Void) -> some View {
- self
- }
-}
-
-/// Compact desktop metrics while preserving the phone's touch layout and Dynamic Type.
-enum InterfaceMetrics {
- static func value(mac: CGFloat, mobile: CGFloat) -> CGFloat {
- mobile
- }
-
- static var body: Font {
- .body
- }
-
- static var secondary: Font {
- .subheadline
- }
-}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Routines/RoutineEditorView.swift b/apps/ios/Kit/Sources/CodyncUI/Routines/RoutineEditorView.swift
index c8f07299..24efcdfb 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Routines/RoutineEditorView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Routines/RoutineEditorView.swift
@@ -54,7 +54,7 @@ struct RoutineEditorView: View {
.disabled(busy || !loaded)
footer
}
- .appFont(.system(size: InterfaceMetrics.value(mac: 13, mobile: 16)))
+ .font(.system(size: 16))
.foregroundStyle(Palette.text)
.background(Palette.background)
.codyncDialog("Delete routine?", isPresented: $confirmDelete, message: "This deletes the routine and stops its future runs. This can't be undone.") {
@@ -108,12 +108,12 @@ struct RoutineEditorView: View {
} label: {
HStack(spacing: 6) {
Text("Run settings")
- Image(systemName: "chevron.down").appFont(.caption2.weight(.semibold))
+ Image(systemName: "chevron.down").font(.caption2.weight(.semibold))
.rotationEffect(.degrees(advanced ? 180 : 0))
Spacer()
if !advanced { Text("Timeout \(timeout)s").foregroundStyle(Palette.tertiary) }
}
- .appFont(AppFont.compactSecondary)
+ .font(.subheadline)
.foregroundStyle(Palette.secondary)
.padding(.leading, 4)
.contentShape(Rectangle())
@@ -123,7 +123,7 @@ struct RoutineEditorView: View {
if advanced {
Field("Timeout (seconds)") { TextField("3600", text: $timeout).routineInput().focused($typing) }
Text("A run is stopped after this long. 1 second to 24 hours.")
- .appFont(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
+ .font(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
}
}
}
@@ -172,12 +172,12 @@ struct RoutineEditorView: View {
RoutineWebhookPanel(botId: botId, routineId: routine.id)
} else {
Text("Runs each time something is posted to its URL. Save to get the URL and key.")
- .appFont(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
+ .font(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
.fixedSize(horizontal: false, vertical: true)
}
default:
Text("Set up by the bot. Pick Schedule or Webhook to replace it.")
- .appFont(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
+ .font(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
}
}
@@ -195,7 +195,7 @@ struct RoutineEditorView: View {
private var expressionField: some View {
Field("Cron") {
TextField("Cron", text: $schedule.expression, prompt: Text("0 9 * * 1-5").foregroundStyle(Palette.secondary))
- .appFont(.body.monospaced()).autocorrectionDisabled().routineInput().focused($typing)
+ .font(.body.monospaced()).autocorrectionDisabled().routineInput().focused($typing)
.frame(minWidth: 220)
}
}
@@ -211,21 +211,21 @@ struct RoutineEditorView: View {
@ViewBuilder private var schedulePreview: some View {
let preview = checkedSchedule == schedule ? preview : nil
if let previewError {
- Text(previewError).appFont(.caption).foregroundStyle(Palette.danger)
+ Text(previewError).font(.caption).foregroundStyle(Palette.danger)
.fixedSize(horizontal: false, vertical: true)
} else if let preview {
VStack(alignment: .leading, spacing: 2) {
- Text(preview.summary).appFont(.caption.weight(.medium))
+ Text(preview.summary).font(.caption.weight(.medium))
if let next = preview.nextRunAt {
Text("Next \(Date(milliseconds: next).formatted(date: .abbreviated, time: .shortened))")
- .appFont(.caption).foregroundStyle(Palette.secondary)
+ .font(.caption).foregroundStyle(Palette.secondary)
}
if let warning = preview.warning {
- Text(warning).appFont(.caption).foregroundStyle(Palette.secondary)
+ Text(warning).font(.caption).foregroundStyle(Palette.secondary)
}
}
} else {
- Text("minute hour day month weekday").appFont(.caption.monospaced()).foregroundStyle(Palette.tertiary)
+ Text("minute hour day month weekday").font(.caption.monospaced()).foregroundStyle(Palette.tertiary)
}
}
@@ -239,21 +239,21 @@ struct RoutineEditorView: View {
Button("Retry loading schedule") { Task { await loadSchedule() } }.buttonStyle(.plain)
}
if schedule.kind != "cron", let previewError {
- Text(previewError).appFont(.caption).foregroundStyle(Palette.danger)
+ Text(previewError).font(.caption).foregroundStyle(Palette.danger)
}
if let error {
Label(error, systemImage: "exclamationmark.circle")
- .appFont(.callout).foregroundStyle(Palette.danger).textSelection(.enabled)
+ .font(.callout).foregroundStyle(Palette.danger).textSelection(.enabled)
}
if model.isOffline {
Label("Connect to this computer to save your routine.", systemImage: "wifi.slash")
- .appFont(.caption).foregroundStyle(Palette.danger)
+ .font(.caption).foregroundStyle(Palette.danger)
}
if loaded, !model.isOffline,
name.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty ||
instruction.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
Text("Enter a name and instruction above to save.")
- .appFont(.caption).foregroundStyle(Palette.secondary)
+ .font(.caption).foregroundStyle(Palette.secondary)
}
HStack(spacing: 16) { routineActions; saveButton }
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Routines/RoutineWebhookPanel.swift b/apps/ios/Kit/Sources/CodyncUI/Routines/RoutineWebhookPanel.swift
index 831659bc..81005686 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Routines/RoutineWebhookPanel.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Routines/RoutineWebhookPanel.swift
@@ -30,12 +30,12 @@ struct RoutineWebhookPanel: View {
}
}
Text(note(webhook))
- .appFont(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
+ .font(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
.fixedSize(horizontal: false, vertical: true)
} else if let error {
- Text(error).appFont(.caption).foregroundStyle(Palette.danger).padding(.leading, 4)
+ Text(error).font(.caption).foregroundStyle(Palette.danger).padding(.leading, 4)
} else {
- Text("Loading webhook…").appFont(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
+ Text("Loading webhook…").font(.caption).foregroundStyle(Palette.secondary).padding(.leading, 4)
}
}
.task(id: routineId) { await load(rotate: false) }
@@ -57,7 +57,7 @@ struct RoutineWebhookPanel: View {
private func value(_ text: String, copy: String, @ViewBuilder extra: () -> some View = { EmptyView() }) -> some View {
HStack(alignment: .center, spacing: 8) {
Text(text)
- .appFont(.callout.monospaced())
+ .font(.callout.monospaced())
.lineLimit(2)
.truncationMode(.middle)
.textSelection(.enabled)
diff --git a/apps/ios/Kit/Sources/CodyncUI/Routines/RoutinesView.swift b/apps/ios/Kit/Sources/CodyncUI/Routines/RoutinesView.swift
index d64fcfc2..cd0eb7d5 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Routines/RoutinesView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Routines/RoutinesView.swift
@@ -1,7 +1,7 @@
import CodyncKit
import SwiftUI
-/// The same routine list in the Mac sidebar and the phone's modal; a row opens its editor.
+/// A bot's routines; a row opens its editor.
struct RoutinesView: View {
let botId: String
var initialId: String?
@@ -21,7 +21,7 @@ struct RoutinesView: View {
VStack(alignment: .leading, spacing: close == nil ? 10 : 16) {
HStack {
Text("Routines")
- .appFont(.system(size: 13, weight: .semibold))
+ .font(.system(size: 13, weight: .semibold))
.foregroundStyle(Palette.text)
.padding(.leading, 2)
Spacer(minLength: 0)
@@ -30,12 +30,12 @@ struct RoutinesView: View {
.disabled(model.isOffline)
if let close { IconButton("Close routines", systemImage: "xmark", action: close) }
}
- if let loadError { Text(loadError).appFont(.caption).foregroundStyle(Palette.danger) }
- if let error { Text(error).appFont(.caption).foregroundStyle(.red).textSelection(.enabled) }
+ if let loadError { Text(loadError).font(.caption).foregroundStyle(Palette.danger) }
+ if let error { Text(error).font(.caption).foregroundStyle(.red).textSelection(.enabled) }
listing
}
.foregroundStyle(Palette.text)
- .appFont(.system(size: 13))
+ .font(.system(size: 13))
.onChange(of: initialId) { _, id in
if let id { open(id) }
}
@@ -66,7 +66,7 @@ struct RoutinesView: View {
VStack(alignment: .leading, spacing: 0) {
if routines.isEmpty {
Text(loaded ? "No routines yet. Ask the bot for one, or set it up yourself with +." : "Loading routines…")
- .appFont(.system(size: 12))
+ .font(.system(size: 12))
.lineSpacing(3)
.foregroundStyle(Palette.secondary)
.fixedSize(horizontal: false, vertical: true)
@@ -92,7 +92,7 @@ struct RoutinesView: View {
VStack(alignment: .leading, spacing: 3) {
Text(routine.name).foregroundStyle(Palette.text)
Text(summary(routine))
- .appFont(.caption)
+ .font(.caption)
.foregroundStyle(routine.lastError == nil ? Palette.secondary : Palette.danger)
}
.padding(.vertical, 10)
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/Attachments.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/Attachments.swift
index 39dac13e..836417ca 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/Attachments.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/Attachments.swift
@@ -47,7 +47,6 @@ struct PickedFile: Transferable {
}
}
-/// ImageIO works the same on iPhone and Mac.
enum ImageData {
static func isImage(_ data: Data) -> Bool {
CGImageSourceCreateWithData(data as CFData, nil).map { CGImageSourceGetCount($0) > 0 } ?? false
@@ -126,16 +125,16 @@ struct AttachmentList: View {
private func card(_ file: Attachment) -> some View {
HStack(spacing: 8) {
Image(systemName: AttachmentIcon.symbol(file.name))
- .appFont(.system(size: 16))
+ .font(.system(size: 16))
.foregroundStyle(Palette.secondary)
VStack(alignment: .leading, spacing: 1) {
Text(file.name)
- .appFont(.subheadline)
+ .font(.subheadline)
.foregroundStyle(Palette.text)
.lineLimit(1)
.truncationMode(.middle)
Text(ByteCountFormatter.string(fromByteCount: file.size, countStyle: .file))
- .appFont(.caption2)
+ .font(.caption2)
.foregroundStyle(Palette.tertiary)
}
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows+iOS.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows+iOS.swift
deleted file mode 100644
index 3cb16728..00000000
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows+iOS.swift
+++ /dev/null
@@ -1,70 +0,0 @@
-import CodyncKit
-import SwiftUI
-
-/// iPhone: a row renders again only when what it shows changed, so a reply being written
-/// elsewhere in the chat skips it.
-extension ChatRow: @MainActor Equatable {
- static func == (a: Self, b: Self) -> Bool {
- a.entry == b.entry && a.groupStart == b.groupStart && a.chat?.isGroup == b.chat?.isGroup
- && a.chat?.isWorking == b.chat?.isWorking && (a.openThread == nil) == (b.openThread == nil)
- }
-}
-
-/// A reply as it's written. The host sends text in bursts; in between, what arrived is
-/// revealed at a steady pace, so the reply flows instead of jumping a line at a time.
-struct StreamingMarkdown: View {
- let text: String
- /// Still being written (`final == false`).
- let live: Bool
- /// Characters shown while revealing; nil shows all of it.
- @State private var shown: Int?
- /// Text is surfacing right now (caught up, the fade settles).
- @State private var revealing = false
- @Environment(\.accessibilityReduceMotion) private var reduceMotion
- @Environment(\.conversationScrolling) private var scrolling
-
- /// How long a burst takes to reveal: a bit over the host's flush interval, so bursts join up.
- private static let window = 0.32
- private static let frame = 1.0 / 60
-
- var body: some View {
- MarkdownText(shown.map { String(text.prefix($0)) } ?? text, streaming: live, revealing: revealing)
- .equatable()
- .onAppear {
- // A reply already well under way when it scrolls in shows as it is.
- if live, !reduceMotion, shown == nil { shown = text.count > 280 ? text.count : 0 }
- }
- .task(id: RevealTarget(text: text, live: live, paused: scrolling)) { await reveal() }
- }
-
- private func reveal() async {
- // While the reader scrolls, the text holds still: scrolling never competes with layout.
- guard let start = shown, !scrolling else { return }
- let total = text.count
- var position = Double(min(start, total))
- let step = max((Double(total) - position) / (Self.window / Self.frame), 0.5)
- revealing = position < Double(total)
- defer { if !Task.isCancelled { revealing = false } }
- while position < Double(total) {
- try? await Task.sleep(for: .seconds(Self.frame))
- if Task.isCancelled { return }
- position = min(Double(total), position + step)
- shown = Int(position)
- }
- // Between bursts the open end keeps its fade a moment, so it doesn't flicker.
- if live { try? await Task.sleep(for: .seconds(0.6)) }
- if Task.isCancelled { return }
- if !live { shown = nil }
- }
-
- private struct RevealTarget: Equatable {
- let text: String
- let live: Bool
- let paused: Bool
- }
-}
-
-extension EnvironmentValues {
- /// The reader is scrolling the conversation: streamed text holds still until they stop.
- @Entry var conversationScrolling = false
-}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows.swift
index 13a845ab..ae9cc73e 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows.swift
@@ -72,7 +72,7 @@ struct AuthorLabel: View {
HStack(spacing: 8) {
if let bot { CharacterAvatar(bot: bot, size: 26, animated: false) }
Text(model.authorName(botId))
- .appFont(.subheadline.weight(.medium))
+ .font(.subheadline.weight(.medium))
.foregroundStyle(bot.map { AvatarPalette.color($0.avatarColor) } ?? Palette.secondary)
}
}
@@ -94,19 +94,19 @@ struct ThreadChip: View {
}
}
Text(summary.count == 1 ? "1 reply" : "\(summary.count) replies")
- .appFont(.footnote.weight(.semibold))
+ .font(.footnote.weight(.semibold))
.foregroundStyle(Palette.accent)
if let unread = summary.unread, unread > 0 {
Text("\(unread) new")
- .appFont(.footnote.weight(.semibold))
+ .font(.footnote.weight(.semibold))
.foregroundStyle(Palette.text)
.transition(.opacity)
} else {
Text(RelativeTime.day(Date(milliseconds: summary.lastAt)))
- .appFont(.footnote)
+ .font(.footnote)
.foregroundStyle(Palette.tertiary)
}
- Image(systemName: "chevron.right").appFont(.caption2).foregroundStyle(Palette.tertiary)
+ Image(systemName: "chevron.right").font(.caption2).foregroundStyle(Palette.tertiary)
}
.padding(.horizontal, 10)
.padding(.vertical, 5)
@@ -128,8 +128,6 @@ struct UserBubble: View {
let botWorking: Bool
var reply: (() -> Void)?
@Environment(BotStore.self) private var model
- @Environment(\.conversationTypography) private var typography
- @State private var hovering = false
var body: some View {
VStack(alignment: .trailing, spacing: 4) {
@@ -139,18 +137,17 @@ struct UserBubble: View {
if !(entry.data.text ?? "").isEmpty { text }
status
}
- .hoverTracking($hovering)
.frame(maxWidth: .infinity, alignment: .trailing)
.padding(.leading, 56)
}
private var text: some View {
Text(entry.data.text ?? "")
- .font(typography.body)
+ .font(.body)
.foregroundStyle(Palette.text)
.textSelection(.enabled)
- .padding(.horizontal, InterfaceMetrics.value(mac: 12, mobile: 16))
- .padding(.vertical, InterfaceMetrics.value(mac: 8, mobile: 10))
+ .padding(.horizontal, 16)
+ .padding(.vertical, 10)
.background(Palette.bubbleUser, in: RoundedRectangle(cornerRadius: 22, style: .continuous))
.contextActions(reactions: model.reactionPick(entry)) {
var items = [MenuItem("Copy", icon: "square.on.square") { Pasteboard.copy(entry.data.text) }]
@@ -162,10 +159,10 @@ struct UserBubble: View {
@ViewBuilder private var status: some View {
switch entry.data.status {
case "sending":
- Text("Sending…").appFont(.caption2).foregroundStyle(Palette.tertiary)
+ Text("Sending…").font(.caption2).foregroundStyle(Palette.tertiary)
case "queued":
Text(botWorking ? "Queued until this response finishes" : "Queued")
- .appFont(.caption2)
+ .font(.caption2)
.foregroundStyle(Palette.tertiary)
case "failed":
HStack(spacing: 10) {
@@ -174,9 +171,9 @@ struct UserBubble: View {
Button("Delete", systemImage: "trash") { model.discard(entry) }.labelStyle(.iconOnly).help("Delete")
}
.buttonStyle(.plain)
- .appFont(.caption2.bold())
+ .font(.caption2.bold())
case "cancelled":
- Text("Not sent — stopped").appFont(.caption2).foregroundStyle(Palette.tertiary)
+ Text("Not sent — stopped").font(.caption2).foregroundStyle(Palette.tertiary)
case "waiting":
HStack(spacing: 10) {
Text("Waiting for the computer to come online").foregroundStyle(Palette.tertiary)
@@ -186,9 +183,9 @@ struct UserBubble: View {
.accessibilityLabel("Don't send")
}
.buttonStyle(.plain)
- .appFont(.caption2)
+ .font(.caption2)
case "delivering":
- Text("Delivered to the computer").appFont(.caption2).foregroundStyle(Palette.tertiary)
+ Text("Delivered to the computer").font(.caption2).foregroundStyle(Palette.tertiary)
default:
EmptyView()
}
@@ -200,7 +197,6 @@ struct AgentBubble: View {
let openTrace: () -> Void
var reply: (() -> Void)?
@Environment(BotStore.self) private var model
- @State private var hovering = false
@Environment(\.accessibilityReduceMotion) private var reduceMotion
/// The reply's text. iPhone: revealed steadily as it's written; the turn's next text
@@ -214,8 +210,8 @@ struct AgentBubble: View {
var body: some View {
VStack(alignment: .leading, spacing: 4) {
text
- .padding(.horizontal, InterfaceMetrics.value(mac: 12, mobile: 16))
- .padding(.vertical, InterfaceMetrics.value(mac: 8, mobile: 10))
+ .padding(.horizontal, 16)
+ .padding(.vertical, 10)
.background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 22, style: .continuous))
.contextActions(reactions: model.reactionPick(entry)) {
var items = [
@@ -239,7 +235,7 @@ struct NoticeRow: View {
let text = entry.data.text ?? ""
if let seconds = entry.data.callSeconds {
Label("\(text) · \(String(format: "%02d:%02d", seconds / 60, seconds % 60))", systemImage: "waveform")
- .appFont(.footnote.monospacedDigit())
+ .font(.footnote.monospacedDigit())
.foregroundStyle(Palette.secondary)
.frame(maxWidth: .infinity)
} else {
@@ -253,7 +249,7 @@ struct NoticeRow: View {
HStack(spacing: 10) {
Rectangle().fill(Palette.border).frame(height: 1)
Text(text)
- .appFont(.caption2)
+ .font(.caption2)
.foregroundStyle(Palette.tertiary)
.multilineTextAlignment(.center)
.fixedSize(horizontal: false, vertical: true)
@@ -264,7 +260,7 @@ struct NoticeRow: View {
.padding(.vertical, 6)
case "error":
Label {
- Text(text).appFont(.footnote).foregroundStyle(Palette.text).textSelection(.enabled)
+ Text(text).font(.footnote).foregroundStyle(Palette.text).textSelection(.enabled)
} icon: {
Image(systemName: "exclamationmark.triangle.fill").foregroundStyle(Palette.danger)
}
@@ -273,7 +269,7 @@ struct NoticeRow: View {
.background(Palette.danger.opacity(0.12), in: RoundedRectangle(cornerRadius: 12))
default:
Text(text)
- .appFont(.footnote)
+ .font(.footnote)
.foregroundStyle(Palette.secondary)
.multilineTextAlignment(.center)
.frame(maxWidth: .infinity)
@@ -299,17 +295,17 @@ struct WorkingIndicator: View {
HStack(spacing: 8) {
ThinkingOrb(state: bot.needsInput ? .listening : .working, size: 16, color: bot.needsInput ? Palette.warning : Palette.secondary)
Text(bot.activity.isEmpty ? "Working…" : bot.activity)
- .appFont(.subheadline)
+ .font(.subheadline)
.foregroundStyle(bot.needsInput ? Palette.warning : Palette.secondary)
.lineLimit(1)
if let started = bot.startedAt {
Text(Date(milliseconds: started), style: .timer)
- .appFont(.footnote.monospacedDigit())
+ .font(.footnote.monospacedDigit())
.foregroundStyle(Palette.tertiary)
}
if thinking != nil {
Image(systemName: "chevron.down")
- .appFont(.caption2.weight(.semibold))
+ .font(.caption2.weight(.semibold))
.foregroundStyle(Palette.tertiary)
.rotationEffect(.degrees(expanded ? 180 : 0))
}
@@ -317,7 +313,7 @@ struct WorkingIndicator: View {
if expanded, let thinking {
ScrollView {
Text(thinking)
- .appFont(.footnote)
+ .font(.footnote)
.foregroundStyle(Palette.secondary)
.textSelection(.enabled)
.frame(maxWidth: .infinity, alignment: .leading)
@@ -328,7 +324,7 @@ struct WorkingIndicator: View {
.transition(.opacity)
}
}
- .padding(.horizontal, InterfaceMetrics.value(mac: 12, mobile: 16))
+ .padding(.horizontal, 16)
.padding(.vertical, 12)
.background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 22, style: .continuous))
}
@@ -370,7 +366,7 @@ struct ReactionsRow: View {
ForEach(reactions, id: \.self) { emoji in
Button { model.react(entry, emoji) } label: {
Text(emoji)
- .appFont(.system(size: InterfaceMetrics.value(mac: 13, mobile: 15)))
+ .font(.system(size: 15))
.padding(.horizontal, 8)
.padding(.vertical, 3)
.background(Palette.surface, in: Capsule())
@@ -386,47 +382,70 @@ struct ReactionsRow: View {
}
}
-extension View {
- /// Mac: follows the pointer over the message (bubble and its footer), animated.
- func hoverTracking(_ hovering: Binding<Bool>) -> some View {
- modifier(HoverTracking(hovering: hovering))
+/// iPhone: a row renders again only when what it shows changed, so a reply being written
+/// elsewhere in the chat skips it.
+extension ChatRow: @MainActor Equatable {
+ static func == (a: Self, b: Self) -> Bool {
+ a.entry == b.entry && a.groupStart == b.groupStart && a.chat?.isGroup == b.chat?.isGroup
+ && a.chat?.isWorking == b.chat?.isWorking && (a.openThread == nil) == (b.openThread == nil)
}
}
-private struct HoverTracking: ViewModifier {
- @Binding var hovering: Bool
+/// A reply as it's written. The host sends text in bursts; in between, what arrived is
+/// revealed at a steady pace, so the reply flows instead of jumping a line at a time.
+struct StreamingMarkdown: View {
+ let text: String
+ /// Still being written (`final == false`).
+ let live: Bool
+ /// Characters shown while revealing; nil shows all of it.
+ @State private var shown: Int?
+ /// Text is surfacing right now (caught up, the fade settles).
+ @State private var revealing = false
@Environment(\.accessibilityReduceMotion) private var reduceMotion
+ @Environment(\.conversationScrolling) private var scrolling
- func body(content: Content) -> some View {
- content
- }
-}
-
-/// Mac: a message's quick actions, in its footer beside the time while the pointer is over it
-/// (next to the bubble, never on it): reactions, reply in thread, what it did, copy.
-struct MessageActions: View {
- static let height: CGFloat = 26
- let reactions: ReactionPick
- let reply: (() -> Void)?
- var trace: (() -> Void)?
- let copy: () -> Void
+ /// How long a burst takes to reveal: a bit over the host's flush interval, so bursts join up.
+ private static let window = 0.32
+ private static let frame = 1.0 / 60
var body: some View {
- HStack(spacing: 0) {
- ReactionStrip(pick: reactions)
- Rectangle().fill(Palette.text.opacity(0.12)).frame(width: 1, height: 12).padding(.horizontal, 4)
- if let reply { action("Reply in thread", "arrowshape.turn.up.left", reply) }
- if let trace { action("Show what it did", "list.bullet", trace) }
- action("Copy", "square.on.square", copy)
+ MarkdownText(shown.map { String(text.prefix($0)) } ?? text, streaming: live, revealing: revealing)
+ .equatable()
+ .onAppear {
+ // A reply already well under way when it scrolls in shows as it is.
+ if live, !reduceMotion, shown == nil { shown = text.count > 280 ? text.count : 0 }
+ }
+ .task(id: RevealTarget(text: text, live: live, paused: scrolling)) { await reveal() }
+ }
+
+ private func reveal() async {
+ // While the reader scrolls, the text holds still: scrolling never competes with layout.
+ guard let start = shown, !scrolling else { return }
+ let total = text.count
+ var position = Double(min(start, total))
+ let step = max((Double(total) - position) / (Self.window / Self.frame), 0.5)
+ revealing = position < Double(total)
+ defer { if !Task.isCancelled { revealing = false } }
+ while position < Double(total) {
+ try? await Task.sleep(for: .seconds(Self.frame))
+ if Task.isCancelled { return }
+ position = min(Double(total), position + step)
+ shown = Int(position)
}
- .fixedSize()
- .transition(.opacity)
+ // Between bursts the open end keeps its fade a moment, so it doesn't flicker.
+ if live { try? await Task.sleep(for: .seconds(0.6)) }
+ if Task.isCancelled { return }
+ if !live { shown = nil }
}
- private func action(_ title: String, _ icon: String, _ run: @escaping () -> Void) -> some View {
- Button(title, systemImage: icon, action: run)
- .labelStyle(.iconOnly)
- .buttonStyle(IconButtonStyle(size: Self.height))
- .help(title)
+ private struct RevealTarget: Equatable {
+ let text: String
+ let live: Bool
+ let paused: Bool
}
}
+
+extension EnvironmentValues {
+ /// The reader is scrolling the conversation: streamed text holds still until they stop.
+ @Entry var conversationScrolling = false
+}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/Composer.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/Composer.swift
index a6d4d45d..7bb04bf4 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/Composer.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/Composer.swift
@@ -15,7 +15,6 @@ struct Composer: View {
var onInterrupt: (() -> Void)?
@Environment(BotStore.self) private var model
@Environment(\.accessibilityReduceMotion) private var reduceMotion
- @Environment(\.conversationTypography) private var typography
@State private var draft = ""
/// Files going out with the next message.
@State private var files: [OutgoingFile] = []
@@ -27,7 +26,7 @@ struct Composer: View {
@State private var clipboardTick = 0
@FocusState private var focused: Bool
/// One line of the field's text, following Dynamic Type: the send button centers on the last line.
- @ScaledMetric(relativeTo: .body) private var lineHeight = InterfaceMetrics.value(mac: 15, mobile: 22)
+ @ScaledMetric(relativeTo: .body) private var lineHeight: CGFloat = 22
private var bot: Bot? { model.bots[botId] }
private var working: Bool { bot?.isWorking(in: botId, thread: thread) == true }
@@ -73,7 +72,7 @@ struct Composer: View {
Button { mention(member) } label: {
HStack(spacing: 6) {
CharacterAvatar(bot: member, size: 18, animated: false)
- Text(member.name).appFont(.subheadline).foregroundStyle(Palette.text)
+ Text(member.name).font(.subheadline).foregroundStyle(Palette.text)
}
.padding(.horizontal, 10)
.padding(.vertical, 6)
@@ -91,9 +90,9 @@ struct Composer: View {
.animation(Motion.layout, value: suggestions.map(\.id))
}
- private var fieldPadding: CGFloat { InterfaceMetrics.value(mac: 7, mobile: 10) }
- private var buttonSize: CGFloat { InterfaceMetrics.value(mac: 28, mobile: 34) }
- private var boxPadding: CGFloat { InterfaceMetrics.value(mac: 4, mobile: 6) }
+ private var fieldPadding: CGFloat { 10 }
+ private var buttonSize: CGFloat { 34 }
+ private var boxPadding: CGFloat { 6 }
/// The one-line field's height; the + circle matches it.
private var fieldHeight: CGFloat { max(textLineHeight + 2 * fieldPadding, buttonSize) + 2 * boxPadding }
private var textLineHeight: CGFloat {
@@ -111,7 +110,7 @@ struct Composer: View {
}
box
}
- .composerSurface(in: RoundedRectangle(cornerRadius: 24, style: .continuous))
+ .glass(in: RoundedRectangle(cornerRadius: 24, style: .continuous))
.animation(Motion.layout, value: draft)
}
.animation(Motion.layout, value: files.map(\.id))
@@ -179,7 +178,7 @@ struct Composer: View {
}
} label: {
Image(systemName: symbol)
- .appFont(.system(size: size, weight: .bold))
+ .font(.system(size: size, weight: .bold))
.contentTransition(.symbolEffect(.replace))
.foregroundStyle(ink)
.frame(width: state == .call ? buttonSize * 1.35 : buttonSize, height: buttonSize)
@@ -198,16 +197,15 @@ struct Composer: View {
HStack(alignment: .bottom, spacing: 8) {
TextField(placeholder, text: $draft, axis: .vertical)
.lineLimit(1...8)
- .font(typography.body)
+ .font(.body)
.textFieldStyle(.plain)
.focused($focused)
.padding(.vertical, fieldPadding)
- .sendOnReturn(submit)
trailingButton
.padding(.bottom, max(0, (textLineHeight + 2 * fieldPadding - buttonSize) / 2))
.animation(Motion.layout, value: isEmpty)
}
- .padding(.leading, InterfaceMetrics.value(mac: 14, mobile: 18))
+ .padding(.leading, 18)
.padding(.trailing, 6)
.padding(.vertical, boxPadding)
.onChange(of: model.routineDrafts[botId]) { _, value in
@@ -218,7 +216,7 @@ struct Composer: View {
}
}
- /// Photos or files (iPhone, a system menu), files (Mac); dropping files on the box works too.
+ /// Photos, files or the clipboard, from a system menu; dropping files on the box works too.
@ViewBuilder private var addButton: some View {
DropdownMenu {
var items = [MenuItem("Photos", icon: "photo.on.rectangle") { pickingPhotos = true },
@@ -233,10 +231,10 @@ struct Composer: View {
private var addLabel: some View {
Image(systemName: "plus")
- .appFont(.system(size: InterfaceMetrics.value(mac: 13, mobile: 18), weight: .medium))
+ .font(.system(size: 18, weight: .medium))
.foregroundStyle(Palette.text)
.frame(width: fieldHeight, height: fieldHeight)
- .composerSurface(in: Circle())
+ .glass(in: Circle())
.contentShape(Circle())
}
@@ -244,7 +242,7 @@ struct Composer: View {
HStack(spacing: 6) {
Button(action: pasteFiles) {
Label("Paste image", systemImage: "doc.on.clipboard")
- .appFont(.footnote.weight(.medium))
+ .font(.footnote.weight(.medium))
.foregroundStyle(Palette.text)
.padding(.horizontal, 10)
.padding(.vertical, 6)
@@ -252,7 +250,7 @@ struct Composer: View {
}
.buttonStyle(PressScale())
Button { pasteCount = UIPasteboard.general.changeCount } label: {
- Image(systemName: "xmark").appFont(.system(size: 10, weight: .bold)).foregroundStyle(Palette.secondary)
+ Image(systemName: "xmark").font(.system(size: 10, weight: .bold)).foregroundStyle(Palette.secondary)
}
.buttonStyle(.plain)
.accessibilityLabel("Don't paste")
@@ -269,7 +267,7 @@ struct Composer: View {
Image(systemName: AttachmentIcon.symbol(file.name))
.foregroundStyle(Palette.secondary)
Text(file.name)
- .appFont(.footnote)
+ .font(.footnote)
.foregroundStyle(Palette.text)
.lineLimit(1)
.truncationMode(.middle)
@@ -277,7 +275,7 @@ struct Composer: View {
Button {
files.removeAll { $0.id == file.id }
} label: {
- Image(systemName: "xmark").appFont(.system(size: 10, weight: .bold)).foregroundStyle(Palette.secondary)
+ Image(systemName: "xmark").font(.system(size: 10, weight: .bold)).foregroundStyle(Palette.secondary)
}
.buttonStyle(.plain)
.accessibilityLabel("Remove \(file.name)")
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/ConversationFollow+iOS.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/ConversationFollow.swift
similarity index 100%
rename from apps/ios/Kit/Sources/CodyncUI/Thread/ConversationFollow+iOS.swift
rename to apps/ios/Kit/Sources/CodyncUI/Thread/ConversationFollow.swift
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/ConversationTypography.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/ConversationTypography.swift
deleted file mode 100644
index e8059f0d..00000000
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/ConversationTypography.swift
+++ /dev/null
@@ -1,46 +0,0 @@
-import SwiftUI
-
-/// The Mac preference supplies one scale for conversation text and app chrome.
-public struct ConversationTypography: Sendable {
- public static let preferenceKey = "conversationFontSize"
- public static let defaultSize = 12.0
- public static let sizes: [Double] = [11, 12, 13, 14, 15, 16, 18]
-
- public let pointSize: Double
-
- /// The next larger (`up`) or smaller size in `sizes` for ⌘+ / ⌘−, staying at either end.
- public static func step(_ size: Double, up: Bool) -> Double {
- (up ? sizes.first { $0 > size } : sizes.last { $0 < size }) ?? size
- }
-
- public init(pointSize: Double = ConversationTypography.defaultSize) {
- self.pointSize = pointSize.isFinite ? min(max(pointSize, 11), 18) : Self.defaultSize
- }
-
- public var scale: CGFloat {
- 1
- }
-
- var body: Font {
- .body
- }
-
- func heading(level: Int) -> Font {
- level == 1 ? .title3.bold() : level == 2 ? .headline : .subheadline.bold()
- }
-
- var code: Font {
- .system(.footnote, design: .monospaced)
- }
-}
-
-private struct ConversationTypographyKey: EnvironmentKey {
- static let defaultValue = ConversationTypography()
-}
-
-public extension EnvironmentValues {
- var conversationTypography: ConversationTypography {
- get { self[ConversationTypographyKey.self] }
- set { self[ConversationTypographyKey.self] = newValue }
- }
-}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/MarkdownBlocks.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/MarkdownBlocks.swift
index 242b9ac4..1085d513 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/MarkdownBlocks.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/MarkdownBlocks.swift
@@ -2,7 +2,7 @@ import Foundation
/// Block-level Markdown as replies use it: paragraphs, headings, nested lists, quotes, rules,
/// tables and fenced code. Pure parsing, apart from the views, so it's tested on its own.
-/// The iPhone's `MarkdownText` renders these; the Mac's has its own smaller parser.
+/// `MarkdownText` renders these (the desktop app ports the same parser).
enum MarkdownBlocks {
enum Block: Hashable {
case paragraph(String)
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/MarkdownText+iOS.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/MarkdownText.swift
similarity index 94%
rename from apps/ios/Kit/Sources/CodyncUI/Thread/MarkdownText+iOS.swift
rename to apps/ios/Kit/Sources/CodyncUI/Thread/MarkdownText.swift
index 52477452..a027a01d 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/MarkdownText+iOS.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/MarkdownText.swift
@@ -44,7 +44,6 @@ public struct MarkdownText: View, Equatable {
private struct MarkdownBlock: View, @MainActor Equatable {
let block: MarkdownBlocks.Block
let writing: Bool
- @Environment(\.conversationTypography) private var typography
@Environment(\.accessibilityReduceMotion) private var reduceMotion
nonisolated static func == (a: Self, b: Self) -> Bool { a.block == b.block && a.writing == b.writing }
@@ -60,18 +59,18 @@ private struct MarkdownBlock: View, @MainActor Equatable {
switch block {
case let .paragraph(t):
Text(MarkdownText.inline(t))
- .font(typography.body)
+ .font(.body)
.foregroundStyle(Palette.text)
case let .heading(t, level):
Text(MarkdownText.inline(t))
- .font(typography.heading(level: level))
+ .font(level == 1 ? .title3.bold() : level == 2 ? .headline : .subheadline.bold())
.foregroundStyle(Palette.text)
case let .bullet(t, marker, depth):
HStack(alignment: .firstTextBaseline, spacing: 6) {
Text(marker).foregroundStyle(Palette.secondary).monospacedDigit()
Text(MarkdownText.inline(t)).foregroundStyle(Palette.text)
}
- .font(typography.body)
+ .font(.body)
.padding(.leading, CGFloat(depth) * 16)
case .rule:
Rectangle().fill(Palette.border).frame(height: 1).padding(.vertical, 4)
@@ -79,14 +78,14 @@ private struct MarkdownBlock: View, @MainActor Equatable {
MarkdownTable(header: header, rows: rows)
case let .quote(t):
Text(MarkdownText.inline(t))
- .font(typography.body)
+ .font(.body)
.foregroundStyle(Palette.secondary)
.padding(.leading, 10)
.overlay(alignment: .leading) { Rectangle().fill(Palette.border).frame(width: 3) }
case let .code(t, _):
ScrollView(.horizontal, showsIndicators: false) {
Text(t)
- .font(typography.code)
+ .font(.system(.footnote, design: .monospaced))
.foregroundStyle(Palette.text)
.padding(10)
}
@@ -99,7 +98,6 @@ private struct MarkdownBlock: View, @MainActor Equatable {
private struct MarkdownTable: View {
let header: [String]
let rows: [[String]]
- @Environment(\.conversationTypography) private var typography
var body: some View {
let columns = max(header.count, rows.map(\.count).max() ?? 0)
@@ -119,7 +117,7 @@ private struct MarkdownTable: View {
}
}
}
- .font(typography.body)
+ .font(.body)
.foregroundStyle(Palette.text)
.fixedSize()
.padding(.vertical, 2)
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/PermissionCard.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/PermissionCard.swift
index 63714098..b2f02e6c 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/PermissionCard.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/PermissionCard.swift
@@ -27,17 +27,17 @@ struct PermissionCard: View {
var body: some View {
VStack(alignment: .leading, spacing: 10) {
HStack(spacing: 8) {
- Text(headline).appFont(.headline).foregroundStyle(Palette.text)
+ Text(headline).font(.headline).foregroundStyle(Palette.text)
if pending {
Circle().fill(Palette.warning).frame(width: 7, height: 7)
}
}
Text(d.title ?? "")
- .appFont(.subheadline.monospaced())
+ .font(.subheadline.monospaced())
.foregroundStyle(Palette.secondary)
.lineLimit(expanded ? nil : 3)
Label("Runs on \(hostName)\(d.cwd.map { " · \(($0 as NSString).lastPathComponent)" } ?? "")", systemImage: "desktopcomputer")
- .appFont(.caption)
+ .font(.caption)
.foregroundStyle(Palette.tertiary)
if hasDetail {
@@ -53,7 +53,7 @@ struct PermissionCard: View {
}
.padding(.top, 6)
} label: {
- Text("Details").appFont(.caption.weight(.medium)).foregroundStyle(Palette.secondary)
+ Text("Details").font(.caption.weight(.medium)).foregroundStyle(Palette.secondary)
}
}
@@ -61,7 +61,7 @@ struct PermissionCard: View {
buttons
} else {
Text(outcome)
- .appFont(.caption.weight(.medium))
+ .font(.caption.weight(.medium))
.foregroundStyle(Palette.secondary)
}
}
@@ -98,7 +98,7 @@ struct PermissionCard: View {
Button { respond(o.optionId) } label: {
HStack(spacing: 8) {
Text(label(o))
- .appFont(.body.weight(o.kind == "allow_once" ? .semibold : .regular))
+ .font(.body.weight(o.kind == "allow_once" ? .semibold : .regular))
.foregroundStyle(o.kind.hasPrefix("allow") ? Palette.text : Palette.danger)
Spacer(minLength: 0)
if answering == o.optionId { Spinner(size: 14) }
@@ -139,7 +139,7 @@ struct CodeBox: View {
var body: some View {
ScrollView(.horizontal, showsIndicators: false) {
Text(text)
- .appFont(.system(.caption, design: .monospaced))
+ .font(.system(.caption, design: .monospaced))
.foregroundStyle(Palette.text)
.textSelection(.enabled)
.padding(8)
@@ -161,7 +161,7 @@ struct DiffView: View {
Text("+\(diff.added)").foregroundStyle(Palette.added)
Text("−\(diff.removed)").foregroundStyle(Palette.removed)
}
- .appFont(.caption.monospaced())
+ .font(.caption.monospaced())
.foregroundStyle(Palette.secondary)
ScrollView(.horizontal, showsIndicators: false) {
VStack(alignment: .leading, spacing: 0) {
@@ -170,7 +170,7 @@ struct DiffView: View {
.foregroundStyle(line.hasPrefix("+") ? Palette.added : line.hasPrefix("-") ? Palette.removed : Palette.secondary)
}
}
- .appFont(.system(.caption2, design: .monospaced))
+ .font(.system(.caption2, design: .monospaced))
.padding(8)
}
.frame(maxHeight: 260)
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/RepliesView+iOS.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/RepliesView+iOS.swift
deleted file mode 100644
index c43e2f35..00000000
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/RepliesView+iOS.swift
+++ /dev/null
@@ -1,56 +0,0 @@
-import CodyncKit
-import SwiftUI
-
-extension RepliesView {
- /// iPhone: the replies follow the newest one until the reader scrolls away.
- @ViewBuilder var messages: some View {
- let replies = model.replies(botId, root: rootId)
- let working = chat?.isWorking(in: botId, thread: rootId) == true && !model.isOffline
- let items = ChatItem.build(replies, streaming: working, steady: true)
- ScrollView {
- VStack(alignment: .leading, spacing: 0) {
- if let root {
- ChatRow(entry: root, groupStart: true, chat: chat) { showTrace = true }
- .equatable()
- HStack(spacing: 10) {
- Text(replies.isEmpty ? "No replies yet" : replies.count == 1 ? "1 reply" : "\(replies.count) replies")
- .appFont(.caption)
- .foregroundStyle(Palette.tertiary)
- .fixedSize()
- Rectangle().fill(Palette.border).frame(height: 1)
- }
- .padding(.vertical, 12)
- }
- ForEach(items) { item in
- if case let .entry(e, groupStart) = item.kind {
- ChatRow(entry: e, groupStart: groupStart, chat: chat) { showTrace = true }
- .equatable()
- .id(item.id)
- .transition(item.id == items.last?.id
- ? .asymmetric(insertion: .move(edge: .bottom).combined(with: .opacity), removal: .opacity)
- : .identity)
- }
- }
- if let chat, working {
- WorkingIndicator(bot: chat, thinking: model.currentThinking(botId, thread: rootId))
- .padding(.top, 6)
- .transition(.opacity)
- }
- Color.clear.frame(height: 8).id("bottom")
- }
- .padding(.horizontal, 16)
- .padding(.top, 8)
- .animation(Motion.reduced(Motion.conversation, reduceMotion), value: items.last?.id)
- .animation(Motion.reduced(Motion.layout, reduceMotion), value: working)
- }
- .scrollIndicators(.never)
- .followsConversation($following)
- .scrollDismissesKeyboard(.interactively)
- .onChange(of: items.last?.id) { _, _ in
- if items.last?.isUserMessage == true { following = true }
- }
- .overlay(alignment: .bottom) {
- JumpToLatest(visible: !following && !items.isEmpty) { following = true }
- }
- }
-}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/RepliesView.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/RepliesView.swift
index 81e57591..b4a78014 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/RepliesView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/RepliesView.swift
@@ -21,16 +21,16 @@ struct RepliesView: View {
VStack(spacing: 0) {
HStack(spacing: 8) {
VStack(alignment: .leading, spacing: 0) {
- Text("Thread").appFont(AppFont.compactBody.weight(.semibold)).foregroundStyle(Palette.text)
- Text(chat?.name ?? "").appFont(.caption).foregroundStyle(Palette.tertiary).lineLimit(1)
+ Text("Thread").font(.body.weight(.semibold)).foregroundStyle(Palette.text)
+ Text(chat?.name ?? "").font(.caption).foregroundStyle(Palette.tertiary).lineLimit(1)
}
Spacer(minLength: 8)
IconButton("Close thread", systemImage: "xmark", action: close)
.keyboardShortcut(.cancelAction)
}
- .padding(.leading, InterfaceMetrics.value(mac: 16, mobile: 20))
- .padding(.trailing, InterfaceMetrics.value(mac: 10, mobile: 12))
- .frame(height: InterfaceMetrics.value(mac: 48, mobile: 56))
+ .padding(.leading, 20)
+ .padding(.trailing, 12)
+ .frame(height: 56)
Rectangle().fill(Palette.border).frame(height: 0.5)
// The replies: each platform's own `messages`, in its `RepliesView+` file.
@@ -59,3 +59,57 @@ struct RepliesView: View {
struct ThreadTarget: Identifiable, Equatable {
let id: String
}
+
+extension RepliesView {
+ /// iPhone: the replies follow the newest one until the reader scrolls away.
+ @ViewBuilder var messages: some View {
+ let replies = model.replies(botId, root: rootId)
+ let working = chat?.isWorking(in: botId, thread: rootId) == true && !model.isOffline
+ let items = ChatItem.build(replies, streaming: working, steady: true)
+ ScrollView {
+ VStack(alignment: .leading, spacing: 0) {
+ if let root {
+ ChatRow(entry: root, groupStart: true, chat: chat) { showTrace = true }
+ .equatable()
+ HStack(spacing: 10) {
+ Text(replies.isEmpty ? "No replies yet" : replies.count == 1 ? "1 reply" : "\(replies.count) replies")
+ .font(.caption)
+ .foregroundStyle(Palette.tertiary)
+ .fixedSize()
+ Rectangle().fill(Palette.border).frame(height: 1)
+ }
+ .padding(.vertical, 12)
+ }
+ ForEach(items) { item in
+ if case let .entry(e, groupStart) = item.kind {
+ ChatRow(entry: e, groupStart: groupStart, chat: chat) { showTrace = true }
+ .equatable()
+ .id(item.id)
+ .transition(item.id == items.last?.id
+ ? .asymmetric(insertion: .move(edge: .bottom).combined(with: .opacity), removal: .opacity)
+ : .identity)
+ }
+ }
+ if let chat, working {
+ WorkingIndicator(bot: chat, thinking: model.currentThinking(botId, thread: rootId))
+ .padding(.top, 6)
+ .transition(.opacity)
+ }
+ Color.clear.frame(height: 8).id("bottom")
+ }
+ .padding(.horizontal, 16)
+ .padding(.top, 8)
+ .animation(Motion.reduced(Motion.conversation, reduceMotion), value: items.last?.id)
+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: working)
+ }
+ .scrollIndicators(.never)
+ .followsConversation($following)
+ .scrollDismissesKeyboard(.interactively)
+ .onChange(of: items.last?.id) { _, _ in
+ if items.last?.isUserMessage == true { following = true }
+ }
+ .overlay(alignment: .bottom) {
+ JumpToLatest(visible: !following && !items.isEmpty) { following = true }
+ }
+ }
+}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView+iOS.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView+iOS.swift
deleted file mode 100644
index 1cc720b9..00000000
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView+iOS.swift
+++ /dev/null
@@ -1,175 +0,0 @@
-import CodyncKit
-import SwiftUI
-import UIKit
-
-extension ThreadView {
- var platformBody: some View {
- conversation
- .codyncSheet(item: $openThread) { target in
- RepliesView(botId: botId, rootId: target.id) { closeThread() }
- }
- }
-
- /// Messages rendered per page, newest first.
- static let page = 40
- /// Paging needs to know when the reader nears the top (scroll geometry); before that, all render.
- static var paged: Bool {
- if #available(iOS 18, *) { true } else { false }
- }
-
- private var streaming: Bool { bot?.isWorking(in: botId, thread: nil) == true && !model.isOffline }
-
- /// iPhone's messages: the newest page first, earlier ones as the reader scrolls up (from
- /// this device, then from the computer); the chat follows the newest message until they
- /// scroll away, and a reply is revealed steadily as it's written.
- @ViewBuilder var transcript: some View {
- let thread = model.chat(botId)
- let all = ChatItem.build(thread, streaming: streaming, steady: true)
- let start = Self.paged ? firstShown.flatMap { id in all.firstIndex { $0.id == id } } ?? max(0, all.count - Self.page) : 0
- let items = Array(all[start...])
- let moreOnComputer = !model.historyComplete.contains(botId) && thread.count >= 50
- ScrollView {
- // Not lazy: only a page or a few render, and lazy rows of very different heights
- // (long replies) mis-estimate on the way to the bottom and can leave it blank.
- VStack(alignment: .leading, spacing: 0) {
- if start > 0 || moreOnComputer {
- Spinner(size: 14)
- .frame(maxWidth: .infinity)
- .padding(.vertical, 14)
- .onChange(of: following) { _, _ in showEarlier() }
- .accessibilityLabel("Loading earlier messages")
- }
- if all.isEmpty, let bot {
- if bot.isGroup { GroupIntroCard(group: bot).padding(.top, 40) } else { IntroCard(bot: bot).padding(.top, 40) }
- }
- ForEach(items) { item in
- row(item)
- .id(item.id)
- .transition(item.id == items.last?.id
- ? .asymmetric(insertion: .move(edge: .bottom).combined(with: .opacity), removal: .opacity)
- : .identity)
- }
- // Offline, "working" is only what the computer last said; don't show it as live.
- if let bot, bot.isWorking(in: botId, thread: nil), !model.isOffline {
- WorkingIndicator(bot: bot, thinking: model.currentThinking(botId, thread: nil))
- .padding(.top, 6)
- .id("working")
- .transition(.opacity)
- }
- Color.clear.frame(height: 8).id("bottom")
- }
- .padding(.horizontal, 16)
- .padding(.top, 8)
- .animation(Motion.reduced(Motion.conversation, reduceMotion), value: items.last?.id)
- .animation(Motion.reduced(Motion.layout, reduceMotion), value: bot?.isWorking(in: botId, thread: nil))
- }
- .scrollIndicators(.never)
- .nearTop { near in
- topVisible = near
- showEarlier()
- }
- .followsConversation($following, keepingPlace: $keepingPlace)
- .scrollDismissesKeyboard(.interactively)
- .conversationScrollEdges()
- .simultaneousGesture(TapGesture().onEnded { dismissChatKeyboard() })
- .onChange(of: items.last?.id) { _, _ in
- // Sending brings the chat back down to your message.
- if items.last?.isUserMessage == true { following = true }
- }
- .overlay(alignment: .bottom) {
- JumpToLatest(visible: !following && !items.isEmpty) { following = true }
- }
- .onAppear { if firstShown == nil { firstShown = items.first?.id } }
- }
-
- /// The reader scrolled up to the top: render the previous page, fetching it from the
- /// computer when this device has no more. The message they were on keeps its place.
- private func showEarlier() {
- guard topVisible, !following, !loadingEarlier else { return }
- loadingEarlier = true
- Task {
- var list = ChatItem.build(model.chat(botId), streaming: streaming, steady: true)
- var start = firstShown.flatMap { id in list.firstIndex { $0.id == id } } ?? max(0, list.count - Self.page)
- if start == 0 {
- let anchor = list.first?.id
- await model.loadOlder(botId)
- list = ChatItem.build(model.chat(botId), streaming: streaming, steady: true)
- start = anchor.flatMap { id in list.firstIndex { $0.id == id } } ?? 0
- }
- guard start > 0 else {
- loadingEarlier = false
- return
- }
- keepingPlace = list[start].id
- firstShown = list[max(0, start - Self.page)].id
- // Rows above settle over a few layout passes.
- try? await Task.sleep(for: .milliseconds(400))
- keepingPlace = nil
- loadingEarlier = false
- // Still at the top with more to show: keep going.
- showEarlier()
- }
- }
-
- /// The system navigation bar: the title pill holds the bot's actions; the corner is the computer.
- func platformChrome(_ content: some View) -> some View {
- content
- .navigationBarTitleDisplayMode(.inline)
- .toolbar(.visible, for: .navigationBar)
- .toolbar {
- ToolbarItem(placement: .principal) {
- VStack(spacing: 0) {
- header
- connectionSubtitle
- }
- }
- if model.screen != nil {
- ToolbarItem(placement: .topBarTrailing) { computerButton }
- }
- }
- }
-
- var header: some View {
- // Like Grok Bot: the title pill holds the bot's actions; the corner is the computer.
- Menu {
- Text("\(model.hostName) · \(model.connectionLabel)")
- Button("Reconnect", systemImage: "arrow.clockwise") { model.restartStream() }
- Divider()
- Button("Details", systemImage: "info.circle", action: openDetails)
- ForEach(menuItems) { item in
- if item.divider { Divider() }
- Button(role: item.destructive ? .destructive : nil, action: item.action) {
- if let icon = item.icon { Label(item.title, systemImage: icon) } else { Text(item.title) }
- }
- }
- } label: {
- title
- }
- .accessibilityLabel("\(bot?.name ?? "Conversation") actions")
- }
-
- private func openDetails() {
- if bot?.isGroup == true { editingGroup = true } else if let bot { editing = EditorRequest(BotDraft(bot)) }
- }
-
- /// Opens the computer's screen; pulses while this bot is operating it (watch, then take over).
- private var computerButton: some View {
- let operating = model.screen?.agentBot == botId
- return Button("Computer", systemImage: "desktopcomputer") {
- model.screenRequest = operating ? ScreenRequest(watching: botId) : ScreenRequest()
- }
- .symbolEffect(.pulse, options: .repeating, isActive: operating)
- }
-
- func dismissChatKeyboard() {
- UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
- }
-
- func presentRoutine() {
- showRoutines = true
- }
-
- func editProfile(_ bot: Bot) {
- editing = EditorRequest(BotDraft(bot))
- }
-}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView.swift
index 3b3b006f..bd6173d3 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView.swift
@@ -1,9 +1,10 @@
import CodyncKit
import SwiftUI
+import UIKit
/// One endless conversation with a bot or a group chat. Only deliberate messages show
/// here; tool calls and thinking live in the "Full conversation" sheet. Any message can
-/// start a thread, which opens beside the chat (Mac) or over it (iPhone).
+/// start a thread, which opens over it.
public struct ThreadView: View {
let botId: String
@@ -17,11 +18,6 @@ public struct ThreadView: View {
@State var templateRequest: EditorRequest?
@State var confirmNewSession = false
@State var confirmDelete: Bot?
- /// Desktop: the bot's settings as an inspector beside the chat.
- @State var showSettings = true
- @State var editingDetails = false
- @State var availableWidth: CGFloat = 800
- @State var compactDetails = false
@State var calling = false
@State var callSpeaking = false
@State var interruptCall: (() -> Void)?
@@ -41,7 +37,6 @@ public struct ThreadView: View {
var bot: Bot? { model.bots[botId] }
- public var body: some View { platformBody }
func closeThread() {
withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { openThread = nil }
@@ -82,7 +77,7 @@ public struct ThreadView: View {
}
var conversation: some View {
- platformChrome(chat)
+ chrome(chat)
.readingConversation(botId)
.codyncSheet(isPresented: $showTrace) {
TraceView(botId: botId)
@@ -116,7 +111,7 @@ public struct ThreadView: View {
switch item.kind {
case .separator(let date):
Text(RelativeTime.separator(date))
- .appFont(.footnote)
+ .font(.footnote)
.foregroundStyle(Palette.tertiary)
.frame(maxWidth: .infinity)
.padding(.top, 18)
@@ -127,7 +122,7 @@ public struct ThreadView: View {
openRoutine(id)
} label: {
Label(e.data.text ?? "Routine", systemImage: "clock.arrow.circlepath")
- .appFont(.footnote).foregroundStyle(Palette.secondary).padding(.vertical, 10)
+ .font(.footnote).foregroundStyle(Palette.secondary).padding(.vertical, 10)
}.buttonStyle(.plain)
} else {
ChatRow(entry: e, groupStart: groupStart, chat: bot) {
@@ -148,7 +143,7 @@ public struct ThreadView: View {
if model.shownConnection == .connecting {
Spinner(size: 8)
} else {
- Image(systemName: connectionSymbol).appFont(.system(size: 8, weight: .medium))
+ Image(systemName: connectionSymbol).font(.system(size: 8, weight: .medium))
}
}
.frame(width: 12)
@@ -157,7 +152,7 @@ public struct ThreadView: View {
.lineLimit(1)
.truncationMode(.middle)
}
- .appFont(.system(size: 10, weight: .medium))
+ .font(.system(size: 10, weight: .medium))
.foregroundStyle(Palette.secondary)
.accessibilityElement(children: .ignore)
.accessibilityLabel("\(model.hostName), \(connectionDescription)")
@@ -198,7 +193,7 @@ public struct ThreadView: View {
if bot.isGroup { GroupAvatar(members: model.members(of: bot), size: size) } else { CharacterAvatar(bot: bot, size: size) }
}
Text(bot?.name ?? "")
- .appFont(.system(size: InterfaceMetrics.value(mac: 14, mobile: 13), weight: .semibold))
+ .font(.system(size: 13, weight: .semibold))
.foregroundStyle(Palette.text)
.lineLimit(1)
}
@@ -296,9 +291,6 @@ struct ChatItem: Identifiable {
if case let .entry(entry, _) = kind { entry.kind == "user" } else { false }
}
- var textContent: String? {
- if case let .entry(entry, _) = kind { entry.data.text } else { nil }
- }
}
/// The start of an empty group chat: who's in it and how the room works.
@@ -309,19 +301,19 @@ struct GroupIntroCard: View {
var body: some View {
VStack(spacing: 12) {
GroupAvatar(members: model.members(of: group), size: 72)
- Text(group.name).appFont(.title2.weight(.semibold)).foregroundStyle(Palette.text)
+ Text(group.name).font(.title2.weight(.semibold)).foregroundStyle(Palette.text)
Text(model.members(of: group).map(\.name).joined(separator: " · "))
- .appFont(.subheadline)
+ .font(.subheadline)
.foregroundStyle(Palette.secondary)
.multilineTextAlignment(.center)
if !group.description.isEmpty {
Text(group.description)
- .appFont(.subheadline)
+ .font(.subheadline)
.foregroundStyle(Palette.secondary)
.multilineTextAlignment(.center)
}
Text("Everyone answers in turn. @mention a bot to ask just that one. Each bot works in its own folder.")
- .appFont(.footnote)
+ .font(.footnote)
.foregroundStyle(Palette.tertiary)
.multilineTextAlignment(.center)
.padding(.top, 4)
@@ -338,19 +330,19 @@ struct IntroCard: View {
var body: some View {
VStack(spacing: 12) {
CharacterAvatar(bot: bot, size: 72)
- Text(bot.name).appFont(.title2.weight(.semibold)).foregroundStyle(Palette.text)
+ Text(bot.name).font(.title2.weight(.semibold)).foregroundStyle(Palette.text)
Text(bot.managedWorkspace ? "\(model.backendName(bot.backend)) · Personal workspace" : "\(model.backendName(bot.backend)) in \(bot.cwd)")
- .appFont(.footnote.monospaced())
+ .font(.footnote.monospaced())
.foregroundStyle(Palette.tertiary)
.multilineTextAlignment(.center)
if !bot.description.isEmpty {
Text(bot.description)
- .appFont(.subheadline)
+ .font(.subheadline)
.foregroundStyle(Palette.secondary)
.multilineTextAlignment(.center)
}
Text("Tell it what you need. You'll get a notification when it's done or needs you.")
- .appFont(.footnote)
+ .font(.footnote)
.foregroundStyle(Palette.tertiary)
.multilineTextAlignment(.center)
.padding(.top, 4)
@@ -361,32 +353,184 @@ struct IntroCard: View {
}
extension View {
- @ViewBuilder func conversationInitialBottomAnchor() -> some View {
- if #available(iOS 18, macOS 15, *) {
- defaultScrollAnchor(.bottom, for: .initialOffset)
+
+ @ViewBuilder func conversationScrollEdges() -> some View {
+ if #available(iOS 26, *) {
+ scrollEdgeEffectStyle(.soft, for: .top)
} else {
- defaultScrollAnchor(.bottom)
+ self
}
}
+}
- @ViewBuilder func conversationBottomObserver(_ isAtBottom: Binding<Bool>) -> some View {
- if #available(iOS 18, macOS 15, *) {
- onScrollGeometryChange(for: Bool.self) { geometry in
- geometry.contentSize.height - geometry.visibleRect.maxY < 48
- } action: { _, isAtBottomNow in
- isAtBottom.wrappedValue = isAtBottomNow
+extension ThreadView {
+ public var body: some View {
+ conversation
+ .codyncSheet(item: $openThread) { target in
+ RepliesView(botId: botId, rootId: target.id) { closeThread() }
}
- } else {
- self
+ }
+
+ /// Messages rendered per page, newest first.
+ static let page = 40
+ /// Paging needs to know when the reader nears the top (scroll geometry); before that, all render.
+ static var paged: Bool {
+ if #available(iOS 18, *) { true } else { false }
+ }
+
+ private var streaming: Bool { bot?.isWorking(in: botId, thread: nil) == true && !model.isOffline }
+
+ /// iPhone's messages: the newest page first, earlier ones as the reader scrolls up (from
+ /// this device, then from the computer); the chat follows the newest message until they
+ /// scroll away, and a reply is revealed steadily as it's written.
+ @ViewBuilder var transcript: some View {
+ let thread = model.chat(botId)
+ let all = ChatItem.build(thread, streaming: streaming, steady: true)
+ let start = Self.paged ? firstShown.flatMap { id in all.firstIndex { $0.id == id } } ?? max(0, all.count - Self.page) : 0
+ let items = Array(all[start...])
+ let moreOnComputer = !model.historyComplete.contains(botId) && thread.count >= 50
+ ScrollView {
+ // Not lazy: only a page or a few render, and lazy rows of very different heights
+ // (long replies) mis-estimate on the way to the bottom and can leave it blank.
+ VStack(alignment: .leading, spacing: 0) {
+ if start > 0 || moreOnComputer {
+ Spinner(size: 14)
+ .frame(maxWidth: .infinity)
+ .padding(.vertical, 14)
+ .onChange(of: following) { _, _ in showEarlier() }
+ .accessibilityLabel("Loading earlier messages")
+ }
+ if all.isEmpty, let bot {
+ if bot.isGroup { GroupIntroCard(group: bot).padding(.top, 40) } else { IntroCard(bot: bot).padding(.top, 40) }
+ }
+ ForEach(items) { item in
+ row(item)
+ .id(item.id)
+ .transition(item.id == items.last?.id
+ ? .asymmetric(insertion: .move(edge: .bottom).combined(with: .opacity), removal: .opacity)
+ : .identity)
+ }
+ // Offline, "working" is only what the computer last said; don't show it as live.
+ if let bot, bot.isWorking(in: botId, thread: nil), !model.isOffline {
+ WorkingIndicator(bot: bot, thinking: model.currentThinking(botId, thread: nil))
+ .padding(.top, 6)
+ .id("working")
+ .transition(.opacity)
+ }
+ Color.clear.frame(height: 8).id("bottom")
+ }
+ .padding(.horizontal, 16)
+ .padding(.top, 8)
+ .animation(Motion.reduced(Motion.conversation, reduceMotion), value: items.last?.id)
+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: bot?.isWorking(in: botId, thread: nil))
}
+ .scrollIndicators(.never)
+ .nearTop { near in
+ topVisible = near
+ showEarlier()
+ }
+ .followsConversation($following, keepingPlace: $keepingPlace)
+ .scrollDismissesKeyboard(.interactively)
+ .conversationScrollEdges()
+ .simultaneousGesture(TapGesture().onEnded { dismissChatKeyboard() })
+ .onChange(of: items.last?.id) { _, _ in
+ // Sending brings the chat back down to your message.
+ if items.last?.isUserMessage == true { following = true }
+ }
+ .overlay(alignment: .bottom) {
+ JumpToLatest(visible: !following && !items.isEmpty) { following = true }
+ }
+ .onAppear { if firstShown == nil { firstShown = items.first?.id } }
}
- @ViewBuilder func conversationScrollEdges() -> some View {
- if #available(iOS 26, macOS 26, *) {
- scrollEdgeEffectStyle(.soft, for: .top)
- } else {
- self
+ /// The reader scrolled up to the top: render the previous page, fetching it from the
+ /// computer when this device has no more. The message they were on keeps its place.
+ private func showEarlier() {
+ guard topVisible, !following, !loadingEarlier else { return }
+ loadingEarlier = true
+ Task {
+ var list = ChatItem.build(model.chat(botId), streaming: streaming, steady: true)
+ var start = firstShown.flatMap { id in list.firstIndex { $0.id == id } } ?? max(0, list.count - Self.page)
+ if start == 0 {
+ let anchor = list.first?.id
+ await model.loadOlder(botId)
+ list = ChatItem.build(model.chat(botId), streaming: streaming, steady: true)
+ start = anchor.flatMap { id in list.firstIndex { $0.id == id } } ?? 0
+ }
+ guard start > 0 else {
+ loadingEarlier = false
+ return
+ }
+ keepingPlace = list[start].id
+ firstShown = list[max(0, start - Self.page)].id
+ // Rows above settle over a few layout passes.
+ try? await Task.sleep(for: .milliseconds(400))
+ keepingPlace = nil
+ loadingEarlier = false
+ // Still at the top with more to show: keep going.
+ showEarlier()
}
}
-}
+ /// The system navigation bar: the title pill holds the bot's actions; the corner is the computer.
+ func chrome(_ content: some View) -> some View {
+ content
+ .navigationBarTitleDisplayMode(.inline)
+ .toolbar(.visible, for: .navigationBar)
+ .toolbar {
+ ToolbarItem(placement: .principal) {
+ VStack(spacing: 0) {
+ header
+ connectionSubtitle
+ }
+ }
+ if model.screen != nil {
+ ToolbarItem(placement: .topBarTrailing) { computerButton }
+ }
+ }
+ }
+
+ var header: some View {
+ // Like Grok Bot: the title pill holds the bot's actions; the corner is the computer.
+ Menu {
+ Text("\(model.hostName) · \(model.connectionLabel)")
+ Button("Reconnect", systemImage: "arrow.clockwise") { model.restartStream() }
+ Divider()
+ Button("Details", systemImage: "info.circle", action: openDetails)
+ ForEach(menuItems) { item in
+ if item.divider { Divider() }
+ Button(role: item.destructive ? .destructive : nil, action: item.action) {
+ if let icon = item.icon { Label(item.title, systemImage: icon) } else { Text(item.title) }
+ }
+ }
+ } label: {
+ title
+ }
+ .accessibilityLabel("\(bot?.name ?? "Conversation") actions")
+ }
+
+ private func openDetails() {
+ if bot?.isGroup == true { editingGroup = true } else if let bot { editing = EditorRequest(BotDraft(bot)) }
+ }
+
+ /// Opens the computer's screen; pulses while this bot is operating it (watch, then take over).
+ private var computerButton: some View {
+ let operating = model.screen?.agentBot == botId
+ return Button("Computer", systemImage: "desktopcomputer") {
+ model.screenRequest = operating ? ScreenRequest(watching: botId) : ScreenRequest()
+ }
+ .symbolEffect(.pulse, options: .repeating, isActive: operating)
+ }
+
+ func dismissChatKeyboard() {
+ UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
+ }
+
+ func presentRoutine() {
+ showRoutines = true
+ }
+
+ func editProfile(_ bot: Bot) {
+ editing = EditorRequest(BotDraft(bot))
+ }
+}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/TraceView.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/TraceView.swift
index 3cfc673f..ab0d70df 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/TraceView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/TraceView.swift
@@ -20,7 +20,7 @@ public struct TraceView: View {
VStack(spacing: 0) {
ModalHeader("Full conversation")
ScrollView {
- LazyVStack(alignment: .leading, spacing: InterfaceMetrics.value(mac: 14, mobile: 22)) {
+ LazyVStack(alignment: .leading, spacing: 22) {
if turns.isEmpty {
Text("Nothing yet.").foregroundStyle(Palette.tertiary)
}
@@ -29,7 +29,7 @@ public struct TraceView: View {
// A plain one-line turn header (CardSection's own title wraps).
Text(entries.first { $0.kind == "user" }?.data.text ?? "Turn \(turn)")
.lineLimit(1)
- .appFont(AppFont.compactSecondary.weight(.semibold))
+ .font(.subheadline.weight(.semibold))
.foregroundStyle(Palette.text)
.padding(.leading, 4)
CardSection {
@@ -38,7 +38,7 @@ public struct TraceView: View {
}
}
}
- .padding(InterfaceMetrics.value(mac: 14, mobile: 20))
+ .padding(20)
.frame(maxWidth: .infinity, alignment: .leading)
}
.defaultScrollAnchor(.bottom)
@@ -56,25 +56,25 @@ private struct TraceRow: View {
switch entry.kind {
case "user":
Label { Text(d.text ?? "").foregroundStyle(Palette.text) } icon: { Image(systemName: "person.fill").foregroundStyle(Palette.secondary) }
- .appFont(.subheadline)
+ .font(.subheadline)
case "agent":
VStack(alignment: .leading, spacing: 4) {
- Text(d.final == true ? "Reply" : "Said").appFont(.caption2.bold()).foregroundStyle(Palette.tertiary)
+ Text(d.final == true ? "Reply" : "Said").font(.caption2.bold()).foregroundStyle(Palette.tertiary)
MarkdownText(d.text ?? "")
}
case "thought":
Disclosure(isExpanded: $expanded) {
- Text(d.text ?? "").appFont(.footnote).foregroundStyle(Palette.secondary).textSelection(.enabled)
+ Text(d.text ?? "").font(.footnote).foregroundStyle(Palette.secondary).textSelection(.enabled)
} label: {
Label { Text("Thinking") } icon: {
ThinkingOrb(size: 16, color: Palette.secondary, animated: false)
- }.appFont(.subheadline).foregroundStyle(Palette.secondary)
+ }.font(.subheadline).foregroundStyle(Palette.secondary)
}
case "tool":
ToolRow(data: d)
case "plan":
VStack(alignment: .leading, spacing: 6) {
- Label("Plan", systemImage: "checklist").appFont(.subheadline.bold())
+ Label("Plan", systemImage: "checklist").font(.subheadline.bold())
ForEach(Array((d.entries ?? []).enumerated()), id: \.offset) { _, item in
Label {
Text(item.content).strikethrough(item.status == "completed").foregroundStyle(Palette.text)
@@ -82,15 +82,15 @@ private struct TraceRow: View {
Image(systemName: item.status == "completed" ? "checkmark.circle.fill" : item.status == "in_progress" ? "circle.dotted" : "circle")
.foregroundStyle(item.status == "completed" ? Palette.accent : Palette.tertiary)
}
- .appFont(.footnote)
+ .font(.footnote)
}
}
case "permission":
Label(d.title ?? "Approval", systemImage: "hand.raised")
- .appFont(.subheadline)
+ .font(.subheadline)
.foregroundStyle(Palette.secondary)
default:
- Text(d.text ?? "").appFont(.footnote).foregroundStyle(Palette.tertiary)
+ Text(d.text ?? "").font(.footnote).foregroundStyle(Palette.tertiary)
}
}
}
@@ -133,7 +133,7 @@ struct ToolRow: View {
private var label: some View {
HStack(spacing: 8) {
Image(systemName: icon).frame(width: 18).foregroundStyle(Palette.secondary)
- Text(data.title ?? "Tool").appFont(.subheadline).foregroundStyle(Palette.text).lineLimit(2)
+ Text(data.title ?? "Tool").font(.subheadline).foregroundStyle(Palette.text).lineLimit(2)
Spacer(minLength: 4)
switch data.status {
case "completed": Image(systemName: "checkmark").foregroundStyle(Palette.accent)
@@ -141,6 +141,6 @@ struct ToolRow: View {
default: ThinkingOrb(state: data.toolKind == "search" ? .searching : data.toolKind == "fetch" ? .connecting : .working, size: 16, color: Palette.secondary)
}
}
- .appFont(.caption)
+ .font(.caption)
}
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/UpdateNeededCard.swift b/apps/ios/Kit/Sources/CodyncUI/UpdateNeededCard.swift
index 742510b5..f9eafe1e 100644
--- a/apps/ios/Kit/Sources/CodyncUI/UpdateNeededCard.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/UpdateNeededCard.swift
@@ -1,7 +1,7 @@
import CodyncKit
import SwiftUI
-/// Updates this app: the App Store on iPhone, Sparkle on the Mac.
+/// Updates this app (opens its App Store page).
public struct AppUpdateAction: Sendable {
let action: @MainActor @Sendable () -> Void
@@ -10,21 +10,8 @@ public struct AppUpdateAction: Sendable {
@MainActor public func callAsFunction() { action() }
}
-/// Updates a computer's host from this app, for the computers it can (the Mac's own host).
-public struct HostUpdateAction: Sendable {
- let available: @MainActor @Sendable (BotStore) -> Bool
- let action: @MainActor @Sendable (BotStore) -> Void
-
- public init(available: @escaping @MainActor @Sendable (BotStore) -> Bool,
- _ action: @escaping @MainActor @Sendable (BotStore) -> Void) {
- self.available = available
- self.action = action
- }
-}
-
public extension EnvironmentValues {
@Entry var appUpdate: AppUpdateAction?
- @Entry var hostUpdate: HostUpdateAction?
}
/// Says which side has to update before this app and a computer can work together, and offers
@@ -34,7 +21,6 @@ public struct UpdateNeededCard: View {
let store: BotStore
let mismatch: VersionMismatch
@Environment(\.appUpdate) private var appUpdate
- @Environment(\.hostUpdate) private var hostUpdate
@Environment(AppUpdates.self) private var appUpdates: AppUpdates?
public init(store: BotStore, mismatch: VersionMismatch) {
@@ -45,13 +31,13 @@ public struct UpdateNeededCard: View {
public var body: some View {
HStack(alignment: .top, spacing: 12) {
Image(systemName: "arrow.down.circle")
- .appFont(.title3)
+ .font(.title3)
.foregroundStyle(Palette.warning)
.accessibilityHidden(true)
VStack(alignment: .leading, spacing: 6) {
- Text(title).appFont(.subheadline.weight(.semibold)).foregroundStyle(Palette.text)
+ Text(title).font(.subheadline.weight(.semibold)).foregroundStyle(Palette.text)
Text(detail)
- .appFont(.footnote)
+ .font(.footnote)
.foregroundStyle(Palette.secondary)
.fixedSize(horizontal: false, vertical: true)
if let action {
@@ -89,13 +75,13 @@ public struct UpdateNeededCard: View {
guard let appUpdate else { return nil }
return ("Update Codync", { appUpdate() })
case .updateHost:
- guard let hostUpdate, hostUpdate.available(store) else { return nil }
- return ("Update \(store.hostName)", { hostUpdate.action(store) })
+ // The computer updates itself; the card says how.
+ return nil
}
}
}
-/// The words every client uses for a version mismatch (the Linux app and the terminal client
+/// The words every client uses for a version mismatch (the desktop app and the terminal client
/// mirror them).
public enum UpdateNeededText {
public static func title(_ mismatch: VersionMismatch, host: String) -> String {
@@ -174,13 +160,13 @@ public struct UpdateReminderCard: View {
public var body: some View {
HStack(alignment: .top, spacing: 12) {
Image(systemName: "sparkles")
- .appFont(.title3)
+ .font(.title3)
.foregroundStyle(Palette.secondary)
.accessibilityHidden(true)
VStack(alignment: .leading, spacing: 6) {
- Text(title).appFont(.subheadline.weight(.semibold)).foregroundStyle(Palette.text)
+ Text(title).font(.subheadline.weight(.semibold)).foregroundStyle(Palette.text)
Text(detail)
- .appFont(.footnote)
+ .font(.footnote)
.foregroundStyle(Palette.secondary)
.fixedSize(horizontal: false, vertical: true)
if let actionTitle {
diff --git a/apps/ios/Kit/Sources/CodyncUI/Usage/UsageViews.swift b/apps/ios/Kit/Sources/CodyncUI/Usage/UsageViews.swift
index 19cb64d8..518b40d7 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Usage/UsageViews.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Usage/UsageViews.swift
@@ -1,38 +1,2 @@
import CodyncKit
import SwiftUI
-
-/// Every limit as a bar under its provider, the way the menu bar lists them.
-public struct UsageLimits: View {
- let usage: Usage
- @AppStorage(SharedStore.usageIconStyleKey, store: UserDefaults(suiteName: SharedStore.appGroup))
- private var usageIconStyle = UsageIconStyle.character.rawValue
-
- public init(usage: Usage) { self.usage = usage }
-
- public var body: some View {
- VStack(alignment: .leading, spacing: 18) {
- ForEach(usage.providers) { provider in
- VStack(alignment: .leading, spacing: 10) {
- HStack(spacing: 8) {
- ProviderMascot(provider, size: 18, style: UsageIconStyle(rawValue: usageIconStyle) ?? .character)
- Text(provider.name).appFont(.system(size: 13, weight: .semibold)).foregroundStyle(Palette.text)
- }
- ForEach(provider.windows) { window in
- HStack(spacing: 10) {
- Text(window.title).foregroundStyle(Palette.text)
- .frame(width: 64, alignment: .leading)
- UsageBar(percent: window.percent, tint: provider.tint)
- Text("\(Int(window.percent.rounded()))%").monospacedDigit().foregroundStyle(Palette.text)
- .frame(width: 36, alignment: .trailing)
- Text(window.resetDescription ?? "").foregroundStyle(Palette.secondary)
- .frame(width: 130, alignment: .trailing)
- }
- .appFont(.system(size: 12))
- .lineLimit(1)
- .accessibilityElement(children: .combine)
- }
- }
- }
- }
- }
-}
diff --git a/apps/ios/Kit/Tests/CodyncUITests/ConversationTypographyTests.swift b/apps/ios/Kit/Tests/CodyncUITests/ConversationTypographyTests.swift
deleted file mode 100644
index f83def72..00000000
--- a/apps/ios/Kit/Tests/CodyncUITests/ConversationTypographyTests.swift
+++ /dev/null
@@ -1,22 +0,0 @@
-import SwiftUI
-import Testing
-@testable import CodyncUI
-
-@Test func conversationTypographySanitizesImportedPreferences() throws {
- let defaultSize = ConversationTypography().pointSize
- for invalid in [Double.nan, .infinity, -.infinity] {
- #expect(ConversationTypography(pointSize: invalid).pointSize == defaultSize)
- }
- #expect(ConversationTypography(pointSize: -100).pointSize == ConversationTypography.sizes.first)
- #expect(ConversationTypography(pointSize: 100).pointSize == ConversationTypography.sizes.last)
- #expect(ConversationTypography(pointSize: 12.5).pointSize == 12.5)
-}
-
-@Test func conversationTypographyStepsThroughSizes() {
- #expect(ConversationTypography.step(12, up: true) == 13)
- #expect(ConversationTypography.step(12.5, up: true) == 13)
- #expect(ConversationTypography.step(12.5, up: false) == 12)
- #expect(ConversationTypography.step(18, up: true) == 18)
- #expect(ConversationTypography.step(11, up: false) == 11)
-}
-
diff --git a/docs/design/ui-conventions.md b/docs/design/ui-conventions.md
index 70e6a20b..f054cf33 100644
--- a/docs/design/ui-conventions.md
+++ b/docs/design/ui-conventions.md
@@ -10,7 +10,7 @@ Do not wrap those toolbar controls in `IconButtonStyle`, hand-sized rounded back
Connecting and reconnecting are background work. `BotStore` gives initial offline reports 1 second to recover and holds drops from online (including relay "computer offline" reports) for 5 seconds. "No access" shows immediately. Automatic read acknowledgements never open an error dialog and visible conversations are acknowledged again after reconnecting. An action taken during a reconnect (back in the foreground, a new network, a drop still inside its grace) waits for the link, up to 20 seconds, instead of failing; while one waits, headers read `Connecting…` and the conversation's connection label shows a spinner. Calls that are safe to repeat (send, stop, approvals, pin, hide, mark as read, delete) are tried again when the link drops under them. Tapping while the header says Offline because the computer can't be reached starts a fresh connection attempt and waits for it, instead of failing until the backoff gets there; a computer the relay reports as off fails at once, since the relay says when it is back. A permission card shows a spinner on the chosen option, dims the others and takes no second answer until the computer has it. The desktop app's `BotStore` (`apps/desktop/src/renderer/store/bot-store.ts`) applies the same graces and 20-second wait. The TUI follows the same rule over loopback: a command the host can't be reached for is retried for up to 20 seconds behind its "Reconnecting…" indicator (the `hello` probe that explains an unreachable host still answers at once), and its permission cards spin on the chosen option. The "Something went wrong" dialog is left for a computer that is off, a refused device, the computer's own answers, and reconnects that outlast the wait. Background work (cloud refresh, device registration, automatic access requests) logs connection, busy-cloud and stale-token failures instead of showing them. The iOS app disconnects only in `.background`, not `.inactive`. Connection status lives only in headers and their menus. The roster header shows a small summary (`1 connected`, `1/2 connected`, `2 offline`, or `Connecting…`). Its computer menu supports multiple selections, Show only, All computers, reconnect, and management. At least one available computer stays selected; if saved exclusions would hide every computer, the list falls back to all. Filters persist on the device. Bots sort pinned first, then by recency. On iPhone, when more than one computer is shown, each computer gets a light heading (badge, name, connection, and "No bots yet" when empty) above its own bots; with one computer the list stays flat. Tapping a heading folds that computer's bots away (chevron; saved on the device). Long-press a heading to lift the whole section and drag it up or down; the other sections slide out of its way and the order is saved on the device on release (`AccountStore.move`; VoiceOver: Move up / Move down). The desktop app shows a flat roster. There are no connection banners. The compact desktop rail uses a computer icon for the same menu. Conversation headers show a small connection label, with the computer name available in the header menu or help text. Pull-to-refresh remains available on iPhone. Computer setup and access requests live under Manage computers.
-Sources: `apps/ios/Views/BotListView.swift`, `AccountSwitcherView.swift`, `apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView+iOS.swift`, `Bots/ComputerFilterHeader.swift`, `Store/ComputerSelection.swift`, `Bots/BotRow.swift`; desktop: `apps/desktop/src/renderer/views/ChatWindow.tsx`, `ComputerFilterHeader.tsx`, `BotRow.tsx`.
+Sources: `apps/ios/Views/BotListView.swift`, `AccountSwitcherView.swift`, `apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView.swift`, `Bots/ComputerFilterHeader.swift`, `Store/ComputerSelection.swift`, `Bots/BotRow.swift`; desktop: `apps/desktop/src/renderer/views/ChatWindow.tsx`, `ComputerFilterHeader.tsx`, `BotRow.tsx`.
## Desktop menu bar (tray)
@@ -25,7 +25,7 @@ The tray menu is Electron's native `Menu` (`apps/desktop/src/main/tray.ts`), the
The menu retains host installation/restart, bot conversation/stop actions, approval review, usage limits, remote-screen permissions, open-at-login and quit. Pairing opens a separate titled window because its QR needs a persistent scanning surface. The chat window retains its own UI conventions.
Usage limits appear directly in the top-level menu, grouped by provider with native section headers. Show each window's percentage, reset time when available, and the provider's last update; do not hide them in submenus. The account menu's
-Usage row shows no number; it opens Settings' Usage page with the same per-provider bars (`UsageLimits`).
+Usage row shows no number; it opens Settings' Usage page with the same per-provider bars.
## Account menu and Settings (desktop)
@@ -35,7 +35,7 @@ The chat window's account menu copies Grok Bot's: Usage, Get Codync for mobile,
The iPhone and the desktop no longer share UI code. `CodyncUI` (`apps/ios/Kit/`) is the iPhone app's own package; the desktop app (`apps/desktop/src/renderer/`) is a TypeScript port of the same screens with its own `BotStore`, chat items (`views/thread/chat-items.ts`) and Markdown blocks (`markdown-blocks.ts`).
-- iPhone chrome lives in whole-file platform extensions (`ThreadView+iOS.swift`: `platformBody`, `platformChrome`, `header`). The iPhone conversation renders the newest page first and earlier ones as the reader scrolls up, follows the newest message until they scroll away (`ConversationFollow+iOS.swift`, with a round "Jump to latest" button), and reveals a reply steadily as it's written (`ChatRows+iOS.swift`, `MarkdownText+iOS.swift`).
+- The iPhone chat's chrome is in `ThreadView.swift` (`body`, `chrome`, `header`). The iPhone conversation renders the newest page first and earlier ones as the reader scrolls up, follows the newest message until they scroll away (`ConversationFollow.swift`, with a round "Jump to latest" button), and reveals a reply steadily as it's written (`ChatRows.swift`, `MarkdownText.swift`).
- The desktop UI rules (custom controls, no system menus except the tray, icon-only buttons, fill or border) are implemented in `apps/desktop/src/renderer/components/` (`Controls.tsx`, `Overlay.tsx`, `Icon.tsx`).
- A change to one lands in the other and the TUI in the same change; see [native client parity](#native-client-parity).
@@ -57,7 +57,7 @@ Avoid adding stock `Menu`, `Picker`, `Form`/`List` styling, switch toggles, aler
No scroll bars: scroll indicators never show (`.scrollIndicators(.never)` on the iPhone app's root, so every scroll view inherits it; hidden scrollbars in `apps/desktop/src/renderer/styles/theme.css`).
-Anything with a background fill gets no extra drawn border. Use `Palette`, `InterfaceMetrics` and `Motion`; visibility changes animate and honor Reduce Motion. Icon-only actions have an accessibility label and desktop help where applicable. Reserve text for actions an icon cannot clearly express.
+Anything with a background fill gets no extra drawn border. Use `Palette` and `Motion`; visibility changes animate and honor Reduce Motion. Icon-only actions have an accessibility label and desktop help where applicable. Reserve text for actions an icon cannot clearly express.
## Motion and status