Add an iPhone client sharing the macOS app's SwiftUI code

This commit is contained in:
Ian Gulliver
2026-10-21 22:00:54 -07:00
parent 57d660c57f
commit 9e81e9107d
46 changed files with 1625 additions and 287 deletions
+12 -10
View File
@@ -23,12 +23,12 @@ struct SettingsView: View {
ScrollView {
VStack(alignment: .leading, spacing: 0) {
heading("Window color")
Text("Windows for this server have a border in this color, on every Mac you use.")
Text("Windows for this server have a border in this color, on every device you use.")
.foregroundStyle(Palette.muted)
.fixedSize(horizontal: false, vertical: true)
ServerColorPicker()
heading("Font size")
Text("The size of body text and of code, on every Mac you use. Other text grows and shrinks with them.")
Text("The size of body text and of code, on every device you use. Other text grows and shrinks with them.")
.foregroundStyle(Palette.muted)
.fixedSize(horizontal: false, vertical: true)
FontSizeStepper(label: "Text", size: FontSize.shared.body) { n in
@@ -54,11 +54,13 @@ struct SettingsView: View {
SavedCommands()
heading("iCloud sync")
SyncState()
#if os(macOS)
heading("This Mac's permissions")
Text("The macOS privacy grants byre's app needs for agents to see and control this Mac. Checking asks macOS for any that are missing.")
.foregroundStyle(Palette.muted)
.fixedSize(horizontal: false, vertical: true)
PermissionsCheck(run: checkLocalPermissions)
#endif
}
.padding(.horizontal, 16)
.padding(.top, 8)
@@ -133,10 +135,10 @@ private struct SyncState: View {
TimelineView(.periodic(from: .now, by: 30)) { _ in
if let sync = Servers.shared.sync {
if sync.ok {
Text("This Mac shares its servers, window colors, font sizes, drafts and task visits through iCloud. Last synced \(ago(sync.at)).")
Text("This \(deviceKind) shares its servers, window colors, font sizes, drafts and task visits through iCloud. Last synced \(ago(sync.at)).")
.fixedSize(horizontal: false, vertical: true)
} else {
Text("iCloud sync is failing on this Mac, so changes made here aren't reaching your other Macs. Failed \(ago(sync.at)): \(sync.error ?? "")")
Text("iCloud sync is failing on this \(deviceKind), so changes made here aren't reaching your other devices. Failed \(ago(sync.at)): \(sync.error ?? "")")
.foregroundStyle(Palette.danger)
.textSelection(.enabled)
.fixedSize(horizontal: false, vertical: true)
@@ -158,13 +160,13 @@ private struct DeviceNotifications: View {
case .none:
EmptyView()
case .denied:
Text("Notifications are blocked for byre in System Settings.").foregroundStyle(Palette.muted)
Text(touchOnly ? "Notifications are blocked for byre in Settings." : "Notifications are blocked for byre in System Settings.").foregroundStyle(Palette.muted)
case .authorized, .provisional:
Text("This Mac shows notifications while byre is running.")
Text(touchOnly ? "This iPhone shows notifications while byre is open." : "This Mac shows notifications while byre is running.")
default:
VStack(alignment: .leading, spacing: 8) {
Text("This Mac doesn't show notifications from byre.")
Button("Turn on for this Mac") {
Text("This \(deviceKind) doesn't show notifications from byre.")
Button("Turn on for this \(deviceKind)") {
asking = true
Task {
_ = try? await UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound])
@@ -181,7 +183,7 @@ private struct DeviceNotifications: View {
.task {
await read()
}
.onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { _ in
.onReceive(NotificationCenter.default.publisher(for: appBecameActive)) { _ in
Task {
await read()
}
@@ -298,7 +300,7 @@ private struct SavedCommands: View {
return HStack(spacing: 6) {
TextField("Name", text: $name)
.modifier(FieldStyle())
.frame(width: 180)
.frame(width: touchOnly ? 100 : 180)
.onSubmit {
save(id, valid)
}