Linux + iPhone Continuity / iMessage / SMS
fix pasteboard
Zack Bartel704cc4a07b67
diff --git a/apple/Tether/ViewModels/TetherViewModel.swift b/apple/Tether/ViewModels/TetherViewModel.swiftindex 9ed8899..4a073b7 100644--- a/apple/Tether/ViewModels/TetherViewModel.swift+++ b/apple/Tether/ViewModels/TetherViewModel.swift@@ -60,10 +60,17 @@ struct FileTransfer: Identifiable {}/// Main app ViewModel — owns all services and coordinates their interactions.-@Observable-final class TetherViewModel {+ private static let autoSyncClipboardKey = "TetherAutoSyncClipboard"+// MARK: - Published State+ /// Whether clipboard updates from remote devices are automatically written to the local pasteboard.+ var autoSyncClipboard: Bool = true {+ didSet {+ UserDefaults.standard.set(autoSyncClipboard, forKey: Self.autoSyncClipboardKey)+ }+ }+/// Overall connection state.private(set) var appState: AppConnectionState = .disconnected@@ -101,6 +108,10 @@ final class TetherViewModel {/// Call once at app startup.func initialize() {+ if UserDefaults.standard.object(forKey: Self.autoSyncClipboardKey) != nil {+ autoSyncClipboard = UserDefaults.standard.bool(forKey: Self.autoSyncClipboardKey)+ }+certificateManager.initialize()setupConnectionHandlers()startDiscovery()@@ -328,6 +339,10 @@ final class TetherViewModel {if clipboardHistory.count > 50 {clipboardHistory = Array(clipboardHistory.prefix(50))}++ if autoSyncClipboard {+ copyToLocalClipboard(content)+ }}case .clipboardContent:@@ -335,6 +350,9 @@ final class TetherViewModel {let sourceName = connectedDeviceName ?? "Desktop"let entry = ClipboardEntry(content: content, timestamp: Date(), source: .remote(sourceName))clipboardHistory.insert(entry, at: 0)++ // Manual requests ALWAYS write to the pasteboard+ copyToLocalClipboard(content)}case .pairPending:diff --git a/apple/Tether/Views/SettingsView.swift b/apple/Tether/Views/SettingsView.swiftindex 1717b6b..9a6525a 100644--- a/apple/Tether/Views/SettingsView.swift+++ b/apple/Tether/Views/SettingsView.swift@@ -119,6 +119,31 @@ struct SettingsView: View {}}+ // Sync Settings+ Section {+ Toggle(isOn: Bindable(viewModel).autoSyncClipboard) {+ HStack(spacing: 14) {+ Image(systemName: "arrow.triangle.2.circlepath")+ .font(.title3)+ .foregroundStyle(.teal)+ .frame(width: 32)++ VStack(alignment: .leading, spacing: 2) {+ Text("Automatic Clipboard Sync")+ .font(.body.weight(.medium))++ Text("Write remote updates to system pasteboard")+ .font(.caption2)+ .foregroundStyle(.tertiary)+ }+ }+ }+ } header: {+ Text("Sync Settings")+ } footer: {+ Text("When enabled, the iPhone's clipboard will be updated immediately when a connected desktop clipboard changes.")+ }+// ConnectionSection {HStack {