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.

iPhone app uses Codync's own tab bar, headers and sheets

leepokai483d79b5457a
diff --git a/apps/ios/App/CodyncApp.swift b/apps/ios/App/CodyncApp.swift
index 68f636a2..8e6524b9 100644
--- a/apps/ios/App/CodyncApp.swift
+++ b/apps/ios/App/CodyncApp.swift
@@ -20,10 +20,11 @@ struct CodyncApp: App {
.environment(app.accounts)
.environment(app.account)
.tint(Palette.accent)
- .sheet(isPresented: Binding(
+ .codyncSheet(isPresented: Binding(
get: { onboardingCompleted && app.account.showSwitcher },
set: { app.account.showSwitcher = $0 }
)) {
+ // Holds the pushes inside the sheet (Computers & settings, Widgets); no bar shows.
NavigationStack { AccountSwitcherView() }
.environment(app)
.environment(app.accounts)
diff --git a/apps/ios/Views/AccessRequestView.swift b/apps/ios/Views/AccessRequestView.swift
index 2b6e6533..9c2cf654 100644
--- a/apps/ios/Views/AccessRequestView.swift
+++ b/apps/ios/Views/AccessRequestView.swift
@@ -7,8 +7,9 @@ import SwiftUI
struct AccessRequestView: View {
let computer: CloudComputer
@Environment(AccountStore.self) private var accounts
- @Environment(\.dismiss) private var dismiss
+ @Environment(\.dismissModal) private var dismiss
@State private var error: String?
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
/// A code was shown: when it goes away without an approval, the request is over (denied or expired).
@State private var sawTicket: Bool
@@ -47,30 +48,29 @@ struct AccessRequestView: View {
HStack(spacing: 8) {
Spinner()
Text("Waiting for approval…").foregroundStyle(Palette.secondary)
- Button("Cancel request", systemImage: "xmark.circle.fill") {
+ IconButton("Cancel request", systemImage: "xmark.circle.fill") {
Task {
await accounts.cancelAccess(computer.computerId)
dismiss()
}
}
- .labelStyle(.iconOnly)
- .foregroundStyle(Palette.tertiary)
- .help("Cancel request")
}
.font(.subheadline)
} else if let error {
Text(error)
.foregroundStyle(Palette.danger)
.multilineTextAlignment(.center)
- Button("Try again") { self.error = nil }
+ Button("Try again") { withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { self.error = nil } }
.buttonStyle(.secondary)
} else if sawTicket {
Text(accounts.lastError ?? "\(computer.name) didn't approve this request.")
.foregroundStyle(Palette.secondary)
.multilineTextAlignment(.center)
Button("Ask again") {
- accounts.lastError = nil
- sawTicket = false
+ withAnimation(Motion.reduced(Motion.layout, reduceMotion)) {
+ accounts.lastError = nil
+ sawTicket = false
+ }
}
.buttonStyle(.secondary)
} else {
@@ -88,14 +88,8 @@ struct AccessRequestView: View {
.padding(24)
.frame(maxWidth: .infinity)
.background(Palette.background)
- .navigationTitle("Access")
- .navigationBarTitleDisplayMode(.inline)
- .toolbar {
- ToolbarItem(placement: .cancellationAction) {
- // Closing keeps waiting in the background; the computer shows up once approved.
- Button("Close", systemImage: "xmark") { dismiss() }.labelStyle(.iconOnly)
- }
- }
+ // Closing keeps waiting in the background; the computer shows up once approved.
+ .safeAreaInset(edge: .top, spacing: 0) { ModalHeader("Access") }
.onChange(of: ticket?.requestId) { _, id in if id != nil { sawTicket = true } }
.onChange(of: approved) { _, done in
guard done else { return }
diff --git a/apps/ios/Views/AccountSwitcherView.swift b/apps/ios/Views/AccountSwitcherView.swift
index ef7405ad..1dfb310c 100644
--- a/apps/ios/Views/AccountSwitcherView.swift
+++ b/apps/ios/Views/AccountSwitcherView.swift
@@ -14,6 +14,7 @@ struct AccountSwitcherButton: View {
.foregroundStyle(Palette.secondary)
}
}
+ .buttonStyle(PressScale())
.accessibilityLabel("Switch account")
.accessibilityValue(account.email ?? "Local pairing")
}
@@ -22,7 +23,7 @@ struct AccountSwitcherButton: View {
struct AccountSwitcherView: View {
@Environment(AppStore.self) private var app
@Environment(AccountSession.self) private var account
- @Environment(\.dismiss) private var dismiss
+ @State private var showSettings = false
var body: some View {
CardForm {
@@ -67,9 +68,7 @@ struct AccountSwitcherView: View {
}
CardSection(footer: "Computers are kept separately for each account on this iPhone. Signed in, you also see the computers added to your account.") {
- NavigationLink {
- SettingsView()
- } label: {
+ Button { showSettings = true } label: {
HStack {
Label("Computers & settings", systemImage: "desktopcomputer").foregroundStyle(Palette.text)
Spacer(minLength: 8)
@@ -108,20 +107,19 @@ struct AccountSwitcherView: View {
}
}
}
- .navigationTitle("Accounts")
- .navigationBarTitleDisplayMode(.inline)
- .toolbar {
- ToolbarItem(placement: .cancellationAction) {
- Button("Close", systemImage: "xmark") { dismiss() }
- .labelStyle(.iconOnly)
- }
- if account.isBusy {
- ToolbarItem(placement: .topBarTrailing) {
+ .safeAreaInset(edge: .top, spacing: 0) {
+ ModalHeader("Accounts") {
+ if account.isBusy {
ThinkingOrb(state: .connecting, size: 20)
.accessibilityHidden(false).accessibilityLabel("Signing in")
+ .transition(.opacity)
}
}
+ .background(Palette.background)
+ .animation(Motion.fade, value: account.isBusy)
}
+ .hidesSystemNavigationBar()
+ .navigationDestination(isPresented: $showSettings) { SettingsView(pushed: true) }
}
}
diff --git a/apps/ios/Views/ActivityGalleryView.swift b/apps/ios/Views/ActivityGalleryView.swift
index 0c8021ba..4fc90dcb 100644
--- a/apps/ios/Views/ActivityGalleryView.swift
+++ b/apps/ios/Views/ActivityGalleryView.swift
@@ -5,6 +5,7 @@ import SwiftUI
struct ActivityGalleryView: View {
@Environment(\.scenePhase) private var scenePhase
+ @Environment(\.openURL) private var openURL
@AppStorage("liveActivitiesEnabled") private var enabled = true
@State private var allowed = ActivityAuthorizationInfo().areActivitiesEnabled
@State private var form = BotActivityPreview.Form.lockScreen
@@ -35,8 +36,10 @@ struct ActivityGalleryView: View {
if !allowed {
Text("Live Activities are turned off in iOS Settings.")
.font(.footnote).foregroundStyle(Palette.secondary)
- Link("Open iOS Settings", destination: URL(string: UIApplication.openSettingsURLString)!)
+ Button("Open iOS Settings") { openURL(URL(string: UIApplication.openSettingsURLString)!) }
+ .buttonStyle(.plain)
.font(.footnote.weight(.medium))
+ .foregroundStyle(Palette.accent)
}
}
.padding(16).background(Palette.surface, in: RoundedRectangle(cornerRadius: 20))
@@ -71,8 +74,7 @@ struct ActivityGalleryView: View {
.padding(18).frame(maxWidth: 560).frame(maxWidth: .infinity)
}
.background(Palette.background)
- .navigationTitle("Live Activity")
- .navigationBarTitleDisplayMode(.inline)
+ .page("Live Activity", pushed: true)
.tint(Palette.accent)
.onChange(of: enabled) { _, value in if !value { LiveActivities.shared.endAll() } }
.onChange(of: scenePhase) { _, value in
@@ -116,7 +118,6 @@ struct LockWidgetGalleryView: View {
.padding(18).frame(maxWidth: 560).frame(maxWidth: .infinity)
}
.background(Palette.background)
- .navigationTitle("Lock Screen widgets")
- .navigationBarTitleDisplayMode(.inline)
+ .page("Lock Screen widgets", pushed: true)
}
}
diff --git a/apps/ios/Views/BotListView.swift b/apps/ios/Views/BotListView.swift
index 39e1205d..b1abb24a 100644
--- a/apps/ios/Views/BotListView.swift
+++ b/apps/ios/Views/BotListView.swift
@@ -42,29 +42,26 @@ struct BotListView: View {
.padding(.horizontal, 16)
}
.background(Palette.background)
- .navigationTitle("Bots")
- .navigationBarTitleDisplayMode(.inline)
- .toolbar {
- ToolbarItem(placement: .topBarLeading) {
+ // Grok-style bare top bar: no visible title, just the buttons.
+ .safeAreaInset(edge: .top, spacing: 0) {
+ ScreenHeader {
AccountSwitcherButton()
- }
- // Grok-style bare top bar: no visible title, just the buttons.
- ToolbarItem(placement: .principal) { Color.clear.frame(width: 1, height: 1) }
- ToolbarItem(placement: .topBarTrailing) {
- Button("Computers", systemImage: "desktopcomputer") { app.showComputers = true }
- }
- ToolbarItem(placement: .topBarTrailing) {
- Button("New bot", systemImage: "plus", action: newBot)
+ } title: {
+ EmptyView()
+ } trailing: {
+ IconButton("Computers", systemImage: "desktopcomputer") { app.showComputers = true }
+ IconButton("New bot", systemImage: "plus", action: newBot)
.disabled(onlineStores.isEmpty)
}
}
+ .hidesSystemNavigationBar()
.refreshable {
for computer in accounts.computers { accounts.store(for: computer.id)?.restartStream() }
await accounts.refreshCloud()
}
- .sheet(item: $editing) { target in
+ .codyncSheet(item: $editing) { target in
if let store = accounts.store(for: target.computerId) {
- NavigationStack { BotEditorView(draft: target.draft) }
+ BotEditorView(draft: target.draft)
.environment(store)
.onChange(of: store.selection) { _, botId in
// A new bot opens its chat, on the computer it was created on.
@@ -74,14 +71,14 @@ struct BotListView: View {
}
}
}
- .sheet(isPresented: $pickingComputer) {
- NavigationStack {
- ComputerPicker(stores: onlineStores) { store in
- pickingComputer = false
+ .codyncSheet(isPresented: $pickingComputer) {
+ ComputerPicker(stores: onlineStores) { store in
+ // Let the picker slide away before the editor slides up.
+ Task {
+ try? await Task.sleep(for: .milliseconds(450))
editing = EditTarget(computerId: store.computer.id, draft: BotDraft())
}
}
- .presentationDetents([.medium])
}
.codyncDialog("Delete \(confirmDelete?.bot.name ?? "bot")?",
isPresented: Binding(get: { confirmDelete != nil }, set: { if !$0 { confirmDelete = nil } }),
@@ -139,30 +136,37 @@ private struct EditTarget: Identifiable {
private struct ComputerPicker: View {
let stores: [BotStore]
let pick: (BotStore) -> Void
- @Environment(\.dismiss) private var dismiss
+ @Environment(\.dismissModal) private var dismiss
var body: some View {
- List(stores, id: \.computer.id) { store in
- Button { pick(store) } label: {
- HStack(spacing: 12) {
- ComputerBadge(store.computer, size: 36)
- VStack(alignment: .leading, spacing: 2) {
- Text(store.hostName).font(.body.weight(.semibold)).foregroundStyle(Palette.text)
- Text("\(store.roster.count) bot\(store.roster.count == 1 ? "" : "s")")
- .font(.subheadline).foregroundStyle(Palette.secondary)
+ VStack(spacing: 0) {
+ ModalHeader("Run it on")
+ ScrollView {
+ VStack(spacing: 4) {
+ ForEach(stores, id: \.computer.id) { store in
+ Button {
+ dismiss()
+ pick(store)
+ } label: {
+ HStack(spacing: 12) {
+ ComputerBadge(store.computer, size: 36)
+ VStack(alignment: .leading, spacing: 2) {
+ Text(store.hostName).font(.body.weight(.semibold)).foregroundStyle(Palette.text)
+ Text("\(store.roster.count) bot\(store.roster.count == 1 ? "" : "s")")
+ .font(.subheadline).foregroundStyle(Palette.secondary)
+ }
+ Spacer()
+ RouteIcon(route: store.hostRoute).foregroundStyle(Palette.tertiary)
+ }
+ .padding(.horizontal, 20)
+ .padding(.vertical, 10)
+ .contentShape(Rectangle())
+ }
+ .buttonStyle(PressScale())
}
- Spacer()
- RouteIcon(route: store.hostRoute).foregroundStyle(Palette.tertiary)
}
}
}
- .navigationTitle("Run it on")
- .navigationBarTitleDisplayMode(.inline)
- .toolbar {
- ToolbarItem(placement: .cancellationAction) {
- Button("Close", systemImage: "xmark") { dismiss() }.labelStyle(.iconOnly)
- }
- }
}
}
diff --git a/apps/ios/Views/PairingView.swift b/apps/ios/Views/PairingView.swift
index ba536059..79b5d832 100644
--- a/apps/ios/Views/PairingView.swift
+++ b/apps/ios/Views/PairingView.swift
@@ -6,9 +6,11 @@ import VisionKit
/// First run: explain the model, then pair with a computer running codync-host.
struct PairingView: View {
var introductory = true
- /// Set when adding another computer from the computers sheet; shows a close button.
- var onDone: (() -> Void)?
+ /// Adding another computer from the computers sheet: titled, with a close button; closes once paired.
+ var inModal = false
@Environment(AppStore.self) private var app
+ @Environment(\.dismissModal) private var dismissModal
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
@State private var scanning = false
@State private var pairing = false
@State private var pasted = ""
@@ -39,7 +41,7 @@ struct PairingView: View {
.font(.body)
.foregroundStyle(Palette.secondary)
}
- .padding(.top, !introductory && onDone != nil ? 48 : 0)
+
VStack(alignment: .leading, spacing: 14) {
Step(n: 1, title: "Install Codync on your computer", detail: "Mac — then open Codync in the menu bar and click Install host:", code: "brew install --cask leepokai/codync/codync")
@@ -71,9 +73,7 @@ struct PairingView: View {
.textInputAutocapitalization(.never)
.autocorrectionDisabled()
.font(.callout.monospaced())
- Button("Pair", systemImage: "arrow.right.circle.fill") { pair(pasted) }
- .labelStyle(.iconOnly)
- .font(.title3)
+ IconButton("Pair", systemImage: "arrow.right.circle.fill") { pair(pasted) }
.disabled(pasted.isEmpty || pairing)
}
.padding(12)
@@ -81,6 +81,7 @@ struct PairingView: View {
if let error {
Text(error).font(.footnote).foregroundStyle(Palette.danger)
+ .transition(.opacity)
}
}
@@ -91,25 +92,13 @@ struct PairingView: View {
.padding(24)
}
.background(Palette.background)
- .overlay(alignment: .topLeading) {
- if let onDone {
- Button("Close", systemImage: "xmark", action: onDone)
- .labelStyle(.iconOnly)
- .font(.body.weight(.semibold))
- .frame(width: 44, height: 44)
- .background(Palette.bubbleAgent, in: Circle())
- .foregroundStyle(Palette.text)
- .padding(16)
- }
+ .safeAreaInset(edge: .top, spacing: 0) {
+ if inModal { ModalHeader("Pair a computer").background(Palette.background) }
}
// Coming back from the Tailscale app: show whether it's connected now.
.onChange(of: scenePhase) { _, phase in if phase == .active { tailscaleOn = Tailscale.isConnected } }
- .sheet(isPresented: $scanning) {
- QRScanner { code in
- scanning = false
- pair(code)
- }
- .ignoresSafeArea()
+ .codyncSheet(isPresented: $scanning) {
+ ScannerSheet { code in pair(code) }
}
}
@@ -118,22 +107,26 @@ struct PairingView: View {
do {
p = try Pairing.parse(text.trimmingCharacters(in: .whitespacesAndNewlines))
} catch {
- self.error = error.localizedDescription
+ show(error)
return
}
- error = nil
+ withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { error = nil }
pairing = true
Task {
defer { pairing = false }
do {
_ = try await app.pair(p)
pasted = ""
- onDone?()
+ if inModal { dismissModal() }
} catch {
- self.error = error.localizedDescription
+ show(error)
}
}
}
+
+ private func show(_ error: Error) {
+ withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { self.error = error.localizedDescription }
+ }
}
private struct Step: View {
@@ -170,6 +163,7 @@ private struct Step: View {
/// Optional: Tailscale is an alternative way in for people who already use it; the relay doesn't need it.
private struct TailscaleStep: View {
let connected: Bool
+ @Environment(\.openURL) private var openURL
var body: some View {
HStack(alignment: .top, spacing: 12) {
@@ -188,16 +182,35 @@ private struct TailscaleStep: View {
.font(.subheadline.weight(.medium))
.foregroundStyle(Palette.added)
} else {
- Link(destination: Tailscale.downloadURL) {
+ Button { openURL(Tailscale.downloadURL) } label: {
Label("Get Tailscale", systemImage: "arrow.down.circle")
.font(.subheadline.weight(.medium))
+ .foregroundStyle(Palette.accent)
}
+ .buttonStyle(PressScale())
}
}
}
}
}
+/// The camera scanner in a Codync sheet; closes as soon as it reads a pairing code.
+private struct ScannerSheet: View {
+ let onCode: (String) -> Void
+ @Environment(\.dismissModal) private var dismiss
+
+ var body: some View {
+ VStack(spacing: 0) {
+ ModalHeader("Scan pairing code")
+ QRScanner { code in
+ dismiss()
+ onCode(code)
+ }
+ .ignoresSafeArea(edges: .bottom)
+ }
+ }
+}
+
/// VisionKit live QR scanner.
struct QRScanner: UIViewControllerRepresentable {
let onCode: (String) -> Void
diff --git a/apps/ios/Views/RootView.swift b/apps/ios/Views/RootView.swift
index 0c8d8556..4f29d39b 100644
--- a/apps/ios/Views/RootView.swift
+++ b/apps/ios/Views/RootView.swift
@@ -7,6 +7,7 @@ struct RootView: View {
@Environment(AppStore.self) private var app
@Environment(AccountStore.self) private var accounts
@AppStorage("onboardingCompleted") private var onboardingCompleted = false
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
/// The open bot, as a NavigationStack path.
private var path: Binding<[BotReference]> {
@@ -16,31 +17,14 @@ struct RootView: View {
var body: some View {
Group {
if accounts.computers.isEmpty && accounts.cloudComputers.isEmpty {
- NavigationStack {
+ VStack(spacing: 0) {
+ if onboardingCompleted {
+ ScreenHeader { AccountSwitcherButton() } title: { EmptyView() } trailing: { EmptyView() }
+ }
PairingView(introductory: !onboardingCompleted)
- .toolbar {
- if onboardingCompleted {
- ToolbarItem(placement: .topBarLeading) { AccountSwitcherButton() }
- }
- }
}
} else {
- TabView(selection: Bindable(app).tab) {
- Tab("Bots", systemImage: "bubble.left.and.bubble.right.fill", value: .bots) {
- NavigationStack(path: path) {
- BotListView()
- .navigationDestination(for: BotReference.self) { ref in
- ChatScreen(ref: ref)
- .toolbar(.hidden, for: .tabBar)
- }
- }
- }
- Tab("Usage", systemImage: "chart.bar.fill", value: .usage) {
- NavigationStack { UsageTab() }
- }
- }
- // Opening a bot (notification, widget, link) always lands on the Bots tab.
- .onChange(of: accounts.selection) { _, ref in if ref != nil { app.tab = .bots } }
+ tabs
}
}
.background(Palette.background)
@@ -50,25 +34,52 @@ struct RootView: View {
if !empty { onboardingCompleted = true }
}
.codyncDialog("Something went wrong", isPresented: errorShown, message: errorMessage, cancel: "OK") { [] }
- .fullScreenCover(item: screenTarget) { target in
- if let store = accounts.store(for: target.computerId) {
+ .codyncOverlay(isPresented: Binding(get: { screenTarget.wrappedValue != nil }, set: { if !$0 { screenTarget.wrappedValue = nil } })) { _ in
+ if let target = screenTarget.wrappedValue, let store = accounts.store(for: target.computerId) {
ScreenView(watching: target.request.watching)
.environment(store)
+ .id(target.id)
}
}
- .sheet(isPresented: Bindable(app).showComputers) {
+ .codyncSheet(isPresented: Bindable(app).showComputers) {
+ // Holds the pushes inside the sheet (Widgets, Live Activity); no bar shows.
NavigationStack { SettingsView() }
}
- .sheet(isPresented: Binding(get: { app.marketplace != nil }, set: { if !$0 { app.marketplace = nil } })) {
+ .codyncSheet(isPresented: Binding(get: { app.marketplace != nil }, set: { if !$0 { app.marketplace = nil } })) {
if let store = app.marketplace.flatMap(accounts.store(for:)) {
- NavigationStack {
- MarketplaceView { app.marketplace = nil }
- }
- .environment(store)
+ MarketplaceView { app.marketplace = nil }
+ .environment(store)
}
}
}
+ /// Both tab stacks stay alive (scroll position, open thread); the tab bar hides while a thread is open.
+ private var tabs: some View {
+ ZStack {
+ NavigationStack(path: path) {
+ BotListView()
+ .navigationDestination(for: BotReference.self) { ref in ChatScreen(ref: ref) }
+ }
+ .tabLayer(app.tab == .bots)
+ UsageTab()
+ .tabLayer(app.tab == .usage)
+ }
+ .animation(Motion.reduced(Motion.fade, reduceMotion), value: app.tab)
+ .safeAreaInset(edge: .bottom, spacing: 0) {
+ if accounts.selection == nil {
+ TabBar(selection: Bindable(app).tab, tabs: [
+ (id: AppTab.bots, title: "Bots", icon: "bubble.left.and.bubble.right.fill"),
+ (id: AppTab.usage, title: "Usage", icon: "chart.bar.fill"),
+ ])
+ .padding(.bottom, 4)
+ .transition(.move(edge: .bottom).combined(with: .opacity))
+ }
+ }
+ .animation(Motion.reduced(Motion.layout, reduceMotion), value: accounts.selection == nil)
+ // Opening a bot (notification, widget, link) always lands on the Bots tab.
+ .onChange(of: accounts.selection) { _, ref in if ref != nil { app.tab = .bots } }
+ }
+
// MARK: one place for every computer's errors and screen requests
private var errorMessage: String? {
@@ -112,7 +123,12 @@ private struct ChatScreen: View {
ThreadView(botId: ref.botId)
.environment(store)
} else {
- ContentUnavailableView("This computer was removed", systemImage: "desktopcomputer.trianglebadge.exclamationmark")
+ VStack(spacing: 0) {
+ ScreenHeader { BackButton { accounts.selection = nil } } title: { EmptyView() } trailing: { EmptyView() }
+ EmptyState(title: "This computer was removed", systemImage: "desktopcomputer.trianglebadge.exclamationmark")
+ }
+ .background(Palette.background)
+ .hidesSystemNavigationBar()
}
}
}
@@ -125,31 +141,111 @@ private struct UsageTab: View {
@State private var picked: ComputerID?
var body: some View {
- if let store = picked.flatMap(accounts.store(for:)) ?? app.currentStore {
- UsageView()
- .environment(store)
- .toolbar {
- if accounts.computers.count > 1 {
- ToolbarItem(placement: .topBarTrailing) {
- DropdownMenu {
- accounts.computers.map { computer in
- MenuItem(computer.name, selected: computer.id == store.computer.id) {
- picked = computer.id
- accounts.storage.lastComputerId = computer.id
- WidgetCenter.shared.reloadTimelines(ofKind: "CodyncUsage")
- }
- }
- } label: {
- ComputerBadge(store.computer, size: 28)
+ let store = picked.flatMap(accounts.store(for:)) ?? app.currentStore
+ VStack(spacing: 0) {
+ ScreenHeader {
+ EmptyView()
+ } title: {
+ Text("Usage").font(.body.weight(.semibold)).foregroundStyle(Palette.text)
+ } trailing: {
+ if let store, accounts.computers.count > 1 {
+ DropdownMenu {
+ accounts.computers.map { computer in
+ MenuItem(computer.name, selected: computer.id == store.computer.id) {
+ picked = computer.id
+ accounts.storage.lastComputerId = computer.id
+ WidgetCenter.shared.reloadTimelines(ofKind: "CodyncUsage")
}
- .accessibilityLabel("Computer: \(store.computer.name)")
}
+ } label: {
+ ComputerBadge(store.computer, size: 28)
}
+ .accessibilityLabel("Computer: \(store.computer.name)")
}
- .id(store.computer.id)
+ }
+ if let store {
+ UsageView()
+ .environment(store)
+ .id(store.computer.id)
+ } else {
+ EmptyState(title: "No computer yet", systemImage: "chart.bar",
+ message: "Usage shows up once a computer is connected.")
+ }
+ }
+ .background(Palette.background)
+ }
+}
+
+/// A centered icon, title and optional line: what a screen shows when it has nothing yet.
+struct EmptyState: View {
+ let title: String
+ let systemImage: String
+ var message: String?
+
+ var body: some View {
+ VStack(spacing: 8) {
+ Image(systemName: systemImage).font(.system(size: 40)).foregroundStyle(Palette.tertiary)
+ Text(title).font(.title3.weight(.semibold)).foregroundStyle(Palette.text)
+ if let message {
+ Text(message).font(.subheadline).foregroundStyle(Palette.secondary)
+ }
+ }
+ .multilineTextAlignment(.center)
+ .padding(24)
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+ }
+}
+
+/// A page's title row inside a modal: the close button on the modal's first page,
+/// a back button once pushed inside it.
+struct PageHeader<Trailing: View>: View {
+ let title: String
+ var pushed = false
+ let trailing: Trailing
+ @Environment(\.dismiss) private var pop
+
+ init(_ title: String, pushed: Bool = false, @ViewBuilder trailing: () -> Trailing) {
+ self.title = title
+ self.pushed = pushed
+ self.trailing = trailing()
+ }
+
+ var body: some View {
+ if pushed {
+ ScreenHeader {
+ BackButton { pop() }
+ } title: {
+ Text(title).font(.body.weight(.semibold)).foregroundStyle(Palette.text).lineLimit(1)
+ } trailing: {
+ trailing
+ }
} else {
- ContentUnavailableView("No computer yet", systemImage: "chart.bar",
- description: Text("Usage shows up once a computer is connected."))
+ ModalHeader(title) { trailing }
+ }
+ }
+}
+
+extension PageHeader where Trailing == EmptyView {
+ init(_ title: String, pushed: Bool = false) { self.init(title, pushed: pushed) { EmptyView() } }
+}
+
+extension View {
+ /// Tops a screen with its `PageHeader` in place of the system navigation bar.
+ func page(_ title: String, pushed: Bool = false) -> some View {
+ VStack(spacing: 0) {
+ PageHeader(title, pushed: pushed)
+ self
}
+ .background(Palette.background)
+ .hidesSystemNavigationBar()
+ }
+}
+
+private extension View {
+ /// One tab's stack in the root ZStack: visible and interactive only while selected.
+ func tabLayer(_ selected: Bool) -> some View {
+ opacity(selected ? 1 : 0)
+ .allowsHitTesting(selected)
+ .accessibilityHidden(!selected)
}
}
diff --git a/apps/ios/Views/SettingsView.swift b/apps/ios/Views/SettingsView.swift
index 75291932..2f315a29 100644
--- a/apps/ios/Views/SettingsView.swift
+++ b/apps/ios/Views/SettingsView.swift
@@ -6,9 +6,13 @@ import UserNotifications
/// Every computer this iPhone can use or ask for — paired here and in the account, merged by
/// computer ID — plus settings for the selected account.
struct SettingsView: View {
+ /// Pushed inside Accounts rather than opened as its own sheet.
+ var pushed = false
@Environment(AppStore.self) private var app
@Environment(AccountStore.self) private var accounts
- @Environment(\.dismiss) private var dismiss
+ @Environment(\.dismissModal) private var dismissModal
+ @Environment(\.openURL) private var openURL
+ @State private var page: Page?
@State private var notificationsAllowed: Bool?
@State private var addingComputer = false
@State private var confirmForget: Computer?
@@ -48,8 +52,8 @@ struct SettingsView: View {
CardSection {
ForEach(onlineStores, id: \.computer.id) { store in
Button {
- closeSheets()
- app.marketplace = store.computer.id
+ let id = store.computer.id
+ closeSheets { app.marketplace = id }
} label: {
LinkRow {
VStack(alignment: .leading, spacing: 2) {
@@ -64,13 +68,11 @@ struct SettingsView: View {
}
CardSection {
- NavigationLink {
- WidgetGalleryView()
- } label: {
+ Button { page = .widgets } label: {
LinkRow { Label("Widgets", systemImage: "square.grid.2x2") }
}
.buttonStyle(.plain)
- NavigationLink { ActivityGalleryView() } label: {
+ Button { page = .activity } label: {
LinkRow { Label("Live Activity & Dynamic Island", systemImage: "waveform") }
}
.buttonStyle(.plain)
@@ -88,10 +90,9 @@ struct SettingsView: View {
Text(store.hostName).font(.caption).foregroundStyle(Palette.tertiary)
}
Spacer()
- Button("Unhide", systemImage: "eye") { store.setHidden(bot, false) }
- .labelStyle(.iconOnly)
- .buttonStyle(.plain)
- .foregroundStyle(Palette.text)
+ IconButton("Unhide", systemImage: "eye") {
+ withAnimation(Motion.layout) { store.setHidden(bot, false) }
+ }
}
}
}
@@ -99,24 +100,25 @@ struct SettingsView: View {
CardSection {
ValueRow("App version", value: Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "")
- Link("Source code", destination: URL(string: "https://github.com/leepokai/Codync")!)
+ Button("Source code") { openURL(URL(string: "https://github.com/leepokai/Codync")!) }
+ .buttonStyle(.plain)
.foregroundStyle(Palette.text)
}
}
- .navigationTitle("Computers & settings")
- .navigationBarTitleDisplayMode(.inline)
- .toolbar {
- ToolbarItem(placement: .cancellationAction) {
- Button("Close", systemImage: "xmark") { dismiss() }.labelStyle(.iconOnly)
+ .refreshable { await accounts.refreshCloud() }
+ .page("Computers & settings", pushed: pushed)
+ .navigationDestination(item: $page) { page in
+ switch page {
+ case .widgets: WidgetGalleryView(pushed: true)
+ case .activity: ActivityGalleryView()
}
}
- .refreshable { await accounts.refreshCloud() }
.task { await accounts.refreshCloud() }
- .sheet(isPresented: $addingComputer) {
- PairingView(introductory: false) { addingComputer = false }
+ .codyncSheet(isPresented: $addingComputer) {
+ PairingView(introductory: false, inModal: true)
}
- .sheet(item: $access) { target in
- NavigationStack { AccessRequestView(computer: target.computer, pending: accounts.pendingAccess[target.id] != nil) }
+ .codyncSheet(item: $access) { target in
+ AccessRequestView(computer: target.computer, pending: accounts.pendingAccess[target.id] != nil)
}
.codyncDialog("Remove \(confirmForget?.name ?? "computer")?",
isPresented: Binding(get: { confirmForget != nil }, set: { if !$0 { confirmForget = nil } }),
@@ -142,6 +144,8 @@ struct SettingsView: View {
}
}
+ private enum Page: Hashable { case widgets, activity }
+
private struct AccessTarget: Identifiable {
let computer: CloudComputer
var id: ComputerID { computer.computerId }
@@ -172,21 +176,20 @@ struct SettingsView: View {
}
}
- /// This screen is a sheet of its own or inside Accounts; the marketplace and screen open over the app.
- private func closeSheets() {
- app.showComputers = false
- app.account.showSwitcher = false
- }
-
- private func openScreen(_ store: BotStore) {
- closeSheets()
+ /// This screen is a sheet of its own or inside Accounts; the marketplace and screen open over the app,
+ /// once that sheet has slid away.
+ private func closeSheets(then open: @escaping @MainActor () -> Void) {
+ dismissModal()
Task {
- // Let the sheet finish closing before covering the screen.
try? await Task.sleep(for: .milliseconds(450))
- store.screenRequest = ScreenRequest()
+ open()
}
}
+ private func openScreen(_ store: BotStore) {
+ closeSheets { store.screenRequest = ScreenRequest() }
+ }
+
@ViewBuilder private var notificationsRow: some View {
if notificationsAllowed == true {
ValueRow("Notifications", value: "On")
@@ -231,10 +234,7 @@ private struct ComputerRow: View {
}
Spacer()
if store.screen != nil, store.connection == .online {
- Button("Screen", systemImage: "display", action: openScreen)
- .labelStyle(.iconOnly)
- .buttonStyle(.plain)
- .foregroundStyle(Palette.text)
+ IconButton("Screen", systemImage: "display", action: openScreen)
}
if inAccount != nil {
Image(systemName: "person.crop.circle.badge.checkmark")
@@ -247,7 +247,7 @@ private struct ComputerRow: View {
.contextActions {
var items = [
MenuItem("Color", icon: "paintpalette") {
- // ponytail: waits for the menu popover to close before opening the swatches; one popover at a time.
+ // ponytail: waits for the menu to fade out before opening the swatches; one overlay at a time.
Task {
try? await Task.sleep(for: .milliseconds(350))
coloring = true
@@ -263,15 +263,17 @@ private struct ComputerRow: View {
items.append(MenuItem("Remove", icon: "trash", destructive: true, divider: revoke == nil, action: remove))
return items
}
- .background {
- Color.clear.popover(isPresented: $coloring, arrowEdge: .bottom) {
+ .codyncOverlay(isPresented: $coloring) { close in
+ ZStack {
+ Color.black.opacity(0.35).ignoresSafeArea().onTapGesture(perform: close)
SwatchPanel(selected: store.computer.color) { id in
- coloring = false
+ close()
accounts.setColor(store.computer.id, id)
}
- .presentationCompactAdaptation(.popover)
- .presentationBackground(Palette.bubbleAgent)
+ .background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 22, style: .continuous))
+ .shadow(color: .black.opacity(0.25), radius: 24, y: 10)
}
+ .accessibilityAddTraits(.isModal)
}
}
diff --git a/apps/ios/Views/UsageView.swift b/apps/ios/Views/UsageView.swift
index 1a5f82ad..d00a8766 100644
--- a/apps/ios/Views/UsageView.swift
+++ b/apps/ios/Views/UsageView.swift
@@ -37,19 +37,11 @@ struct UsageView: View {
.padding(16)
}
.background(Palette.background)
- .navigationTitle("Usage")
- .navigationBarTitleDisplayMode(.inline)
.refreshable { await model.refreshUsage() }
- .sheet(isPresented: $widgetHelp) {
- NavigationStack {
- WidgetGalleryView()
- .toolbar {
- ToolbarItem(placement: .cancellationAction) {
- Button("Close", systemImage: "xmark") { widgetHelp = false }.labelStyle(.iconOnly)
- }
- }
- }
- .environment(model)
+ .codyncSheet(isPresented: $widgetHelp) {
+ // Holds the pushes inside the sheet (Lock Screen widgets, Live Activity); no bar shows.
+ NavigationStack { WidgetGalleryView() }
+ .environment(model)
}
}
}
@@ -57,6 +49,7 @@ struct UsageView: View {
private struct ProviderCard: View {
let provider: UsageProvider
@Binding var collapsed: Bool
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
var body: some View {
VStack(alignment: .leading, spacing: 12) {
@@ -66,13 +59,10 @@ private struct ProviderCard: View {
.background(provider.tint.opacity(0.12), in: RoundedRectangle(cornerRadius: 10, style: .continuous))
Text(provider.name).font(.subheadline.weight(.semibold)).foregroundStyle(Palette.text)
Spacer()
- Button(collapsed ? "Expand" : "Collapse", systemImage: "chevron.up") {
- withAnimation(.snappy) { collapsed.toggle() }
+ IconButton(collapsed ? "Expand" : "Collapse", systemImage: "chevron.up") {
+ withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { collapsed.toggle() }
}
- .labelStyle(.iconOnly)
- .buttonStyle(.plain)
.rotationEffect(.degrees(collapsed ? 180 : 0))
- .foregroundStyle(Palette.tertiary)
}
if let top = provider.tightest {
@@ -93,7 +83,6 @@ private struct ProviderCard: View {
}
if !collapsed {
- Divider()
VStack(spacing: 8) {
ForEach(provider.windows) { w in
row(w.label, "\(Int(w.percent.rounded()))%")
diff --git a/apps/ios/Views/WidgetGalleryView.swift b/apps/ios/Views/WidgetGalleryView.swift
index 686638c8..dc388fc3 100644
--- a/apps/ios/Views/WidgetGalleryView.swift
+++ b/apps/ios/Views/WidgetGalleryView.swift
@@ -5,7 +5,11 @@ import WidgetKit
/// The installed widgets and these previews share their rendering components.
struct WidgetGalleryView: View {
+ /// Pushed inside Computers & settings rather than opened as its own sheet.
+ var pushed = false
@Environment(AccountStore.self) private var accounts
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
+ @State private var page: Page?
@Environment(\.scenePhase) private var scenePhase
@Environment(\.dynamicTypeSize) private var typeSize
@State private var kind = "usage"
@@ -38,7 +42,7 @@ struct WidgetGalleryView: View {
sectionLabel("Get set up")
VStack(spacing: 0) {
setupRow("Connect a computer", complete: !accounts.computers.isEmpty)
- Divider().padding(.leading, 42)
+ Rectangle().fill(Palette.border).frame(height: 0.5).padding(.leading, 42)
setupRow("Add a Codync widget", complete: hasWidget == true,
status: hasWidget == nil ? (widgetCheckFailed ? "Unable to check" : "Checking") : nil)
}
@@ -48,6 +52,7 @@ struct WidgetGalleryView: View {
Text("Couldn't check your widgets. You can still add one using the steps below.")
.foregroundStyle(Palette.secondary)
Button("Check again") { checkWidgets() }
+ .buttonStyle(.secondary)
}
.font(.caption)
} else {
@@ -83,12 +88,14 @@ struct WidgetGalleryView: View {
VStack(alignment: .leading, spacing: 12) {
sectionLabel("More ways to stay up to date")
- NavigationLink { LockWidgetGalleryView() } label: {
- Label("Lock Screen widgets", systemImage: "lock.rectangle")
+ Button { page = .lockScreen } label: {
+ Label("Lock Screen widgets", systemImage: "lock.rectangle").foregroundStyle(Palette.accent)
}
- NavigationLink { ActivityGalleryView() } label: {
- Label("Live Activity & Dynamic Island", systemImage: "waveform")
+ .buttonStyle(PressScale())
+ Button { page = .activity } label: {
+ Label("Live Activity & Dynamic Island", systemImage: "waveform").foregroundStyle(Palette.accent)
}
+ .buttonStyle(PressScale())
}
.font(.subheadline)
.frame(maxWidth: .infinity, alignment: .leading)
@@ -107,12 +114,19 @@ struct WidgetGalleryView: View {
.frame(maxWidth: .infinity)
}
.background(Palette.background)
- .navigationTitle("Widgets")
- .navigationBarTitleDisplayMode(.inline)
+ .page("Widgets", pushed: pushed)
+ .navigationDestination(item: $page) { page in
+ switch page {
+ case .lockScreen: LockWidgetGalleryView()
+ case .activity: ActivityGalleryView()
+ }
+ }
.task { checkWidgets() }
.onChange(of: scenePhase) { _, phase in if phase == .active { checkWidgets() } }
}
+ private enum Page: Hashable { case lockScreen, activity }
+
private static let kinds: [(id: String, label: String)] = [("usage", "Provider usage"), ("bots", "Bots")]
private static let providers: [(id: String, label: String)] = [("claude", "Claude"), ("codex", "Codex")]
@@ -178,12 +192,15 @@ struct WidgetGalleryView: View {
}
private func checkWidgets() {
- widgetCheckFailed = false
+ let animation = Motion.reduced(Motion.layout, reduceMotion)
+ withAnimation(animation) { widgetCheckFailed = false }
WidgetCenter.shared.getCurrentConfigurations { result in
let installed = (try? result.get())?.contains { $0.kind.hasPrefix("Codync") }
Task { @MainActor in
- hasWidget = installed
- widgetCheckFailed = installed == nil
+ withAnimation(animation) {
+ hasWidget = installed
+ widgetCheckFailed = installed == nil
+ }
}
}
}