Skip to content

Commit 230bb09

Browse files
committed
review
1 parent 2a91e6e commit 230bb09

File tree

7 files changed

+75
-96
lines changed

7 files changed

+75
-96
lines changed

Coder-Desktop/Coder-Desktop/State.swift

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,6 @@ class AppState: ObservableObject {
6363
}
6464
}
6565

66-
// Temporary feature flag
67-
@Published var showFileSyncUI: Bool = UserDefaults.standard.bool(forKey: Keys.showFileSyncUI) {
68-
didSet {
69-
guard persistent else { return }
70-
UserDefaults.standard.set(showFileSyncUI, forKey: Keys.showFileSyncUI)
71-
}
72-
}
73-
7466
func tunnelProviderProtocol() -> NETunnelProviderProtocol? {
7567
if !hasSession { return nil }
7668
let proto = NETunnelProviderProtocol()
@@ -172,8 +164,6 @@ class AppState: ObservableObject {
172164
static let literalHeaders = "LiteralHeaders"
173165
static let stopVPNOnQuit = "StopVPNOnQuit"
174166
static let startVPNOnLaunch = "StartVPNOnLaunch"
175-
176-
static let showFileSyncUI = "showFileSyncUI"
177167
}
178168
}
179169

Coder-Desktop/Coder-Desktop/Views/FileSync/FileSyncConfig.swift

Lines changed: 2 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,12 @@
11
import SwiftUI
22
import VPNLib
33

4-
struct FileSyncRow: Identifiable {
5-
var id = UUID()
6-
var localPath: URL
7-
var workspace: String
8-
// This is a string as to be host-OS agnostic
9-
var remotePath: String
10-
var status: FileSyncStatus
11-
var size: String
12-
}
13-
14-
enum FileSyncStatus {
15-
case unknown
16-
case error(String)
17-
case okay
18-
case paused
19-
case needsAttention(String)
20-
case working(String)
21-
22-
var color: Color {
23-
switch self {
24-
case .okay:
25-
.white
26-
case .paused:
27-
.secondary
28-
case .unknown:
29-
.red
30-
case .error:
31-
.red
32-
case .needsAttention:
33-
.orange
34-
case .working:
35-
.white
36-
}
37-
}
38-
39-
var description: String {
40-
switch self {
41-
case .unknown:
42-
"Unknown"
43-
case let .error(msg):
44-
msg
45-
case .okay:
46-
"OK"
47-
case .paused:
48-
"Paused"
49-
case let .needsAttention(msg):
50-
msg
51-
case let .working(msg):
52-
msg
53-
}
54-
}
55-
56-
var body: some View {
57-
Text(description).foregroundColor(color)
58-
}
59-
}
60-
614
struct FileSyncConfig<VPN: VPNService, FS: FileSyncDaemon>: View {
625
@EnvironmentObject var vpn: VPN
636

64-
@State private var selection: FileSyncRow.ID?
7+
@State private var selection: FileSyncSession.ID?
658
@State private var addingNewSession: Bool = false
66-
@State private var items: [FileSyncRow] = []
9+
@State private var items: [FileSyncSession] = []
6710

6811
var body: some View {
6912
Group {

Coder-Desktop/Coder-Desktop/Views/FileSync/FileSyncSessionModal.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import SwiftUI
22
import VPNLib
33

44
struct FileSyncSessionModal<VPN: VPNService, FS: FileSyncDaemon>: View {
5-
var existingSession: FileSyncRow?
5+
var existingSession: FileSyncSession?
66
@Environment(\.dismiss) private var dismiss
77
@EnvironmentObject private var vpn: VPN
88
@EnvironmentObject private var fileSync: FS

Coder-Desktop/Coder-Desktop/Views/Settings/GeneralTab.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ struct GeneralTab: View {
1818
Text("Start Coder Connect on launch")
1919
}
2020
}
21-
Section {
22-
Toggle(isOn: $state.showFileSyncUI) {
23-
Text("Show experimental File Sync UI")
24-
}
25-
}
2621
}.formStyle(.grouped)
2722
}
2823
}

Coder-Desktop/Coder-Desktop/Views/VPN/VPNMenu.swift

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,21 @@ struct VPNMenu<VPN: VPNService, FS: FileSyncDaemon>: View {
6262
}.buttonStyle(.plain)
6363
TrayDivider()
6464
}
65-
if state.showFileSyncUI, vpn.state == .connected {
66-
Button {
67-
openWindow(id: .fileSync)
68-
} label: {
69-
ButtonRowView {
70-
HStack {
71-
StatusDot(color: fileSync.state.color)
72-
Text("Configure file sync")
65+
#if DEBUG
66+
if vpn.state == .connected {
67+
Button {
68+
openWindow(id: .fileSync)
69+
} label: {
70+
ButtonRowView {
71+
HStack {
72+
StatusDot(color: fileSync.state.color)
73+
Text("Configure file sync")
74+
}
7375
}
74-
}
75-
}.buttonStyle(.plain)
76-
TrayDivider()
77-
}
76+
}.buttonStyle(.plain)
77+
TrayDivider()
78+
}
79+
#endif
7880
if vpn.state == .failed(.systemExtensionError(.needsUserApproval)) {
7981
Button {
8082
openSystemExtensionSettings()

Coder-Desktop/VPNLib/FileSync/FileSyncDaemon.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,6 @@ public protocol FileSyncDaemon: ObservableObject {
1515
func createSession(with: FileSyncSession) async throws
1616
}
1717

18-
public struct FileSyncSession {
19-
public let id: String
20-
public let name: String
21-
public let localPath: URL
22-
public let workspace: String
23-
public let agent: String
24-
public let remotePath: URL
25-
}
26-
2718
@MainActor
2819
public class MutagenDaemon: FileSyncDaemon {
2920
private let logger = Logger(subsystem: Bundle.main.bundleIdentifier!, category: "mutagen")
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import SwiftUI
2+
3+
public struct FileSyncSession: Identifiable {
4+
public let id: String
5+
public let localPath: URL
6+
public let workspace: String
7+
// This is a string as to be host-OS agnostic
8+
public let remotePath: String
9+
public let status: FileSyncStatus
10+
public let size: String
11+
}
12+
13+
public enum FileSyncStatus {
14+
case unknown
15+
case error(String)
16+
case ok
17+
case paused
18+
case needsAttention(String)
19+
case working(String)
20+
21+
public var color: Color {
22+
switch self {
23+
case .ok:
24+
.white
25+
case .paused:
26+
.secondary
27+
case .unknown:
28+
.red
29+
case .error:
30+
.red
31+
case .needsAttention:
32+
.orange
33+
case .working:
34+
.white
35+
}
36+
}
37+
38+
public var description: String {
39+
switch self {
40+
case .unknown:
41+
"Unknown"
42+
case let .error(msg):
43+
msg
44+
case .ok:
45+
"Watching"
46+
case .paused:
47+
"Paused"
48+
case let .needsAttention(msg):
49+
msg
50+
case let .working(msg):
51+
msg
52+
}
53+
}
54+
55+
public var body: some View {
56+
Text(description).foregroundColor(color)
57+
}
58+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy