Skip to content

Commit 0e92a4b

Browse files
committed
app-ios: minor bug fix
1 parent acc8e1c commit 0e92a4b

File tree

8 files changed

+431
-392
lines changed

8 files changed

+431
-392
lines changed

app-ios/app-ios/Models/PortForward.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ struct PortForward: Identifiable, Equatable {
1414
let remotePort: Int
1515
let localPort: Int
1616
let useHttps: Bool
17+
let customName: String?
1718
var isActive: Bool = false
1819
var webSocket: URLSessionWebSocketTask?
1920

@@ -26,6 +27,7 @@ struct PortForward: Identifiable, Equatable {
2627
lhs.remotePort == rhs.remotePort &&
2728
lhs.localPort == rhs.localPort &&
2829
lhs.useHttps == rhs.useHttps &&
30+
lhs.customName == rhs.customName &&
2931
lhs.isActive == rhs.isActive
3032
// Note: we don't compare webSocket as it's not relevant for equality
3133
}
@@ -37,7 +39,8 @@ struct PortForward: Identifiable, Equatable {
3739
remoteHost: String,
3840
remotePort: Int,
3941
localPort: Int,
40-
useHttps: Bool = false
42+
useHttps: Bool = false,
43+
customName: String? = nil
4144
) {
4245
self.id = id
4346
self.clientId = clientId
@@ -46,9 +49,13 @@ struct PortForward: Identifiable, Equatable {
4649
self.remotePort = remotePort
4750
self.localPort = localPort
4851
self.useHttps = useHttps
52+
self.customName = customName
4953
}
5054

5155
var displayName: String {
56+
if let customName = customName, !customName.isEmpty {
57+
return customName
58+
}
5259
return "\(clientName) - \(remoteHost):\(remotePort)\(useHttps ? " (https)" : "")"
5360
}
5461

app-ios/app-ios/ViewModels/PortForwardViewModel.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ class PortForwardViewModel: ObservableObject {
6767
for client: Client,
6868
remoteHost: String,
6969
remotePort: Int,
70-
useHttps: Bool = false
70+
useHttps: Bool = false,
71+
customName: String? = nil
7172
) -> PortForward {
7273
// Increment local port counter to get a unique local port
7374
localPortCounter += 1
@@ -79,7 +80,8 @@ class PortForwardViewModel: ObservableObject {
7980
remoteHost: remoteHost,
8081
remotePort: remotePort,
8182
localPort: localPort,
82-
useHttps: useHttps
83+
useHttps: useHttps,
84+
customName: customName
8385
)
8486

8587
// Store the port forward

app-ios/app-ios/Views/ClientDetailView.swift

Lines changed: 0 additions & 259 deletions
This file was deleted.

app-ios/app-ios/Views/ClientsListView.swift

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,15 @@ struct SearchBar: View {
172172
Image(systemName: "magnifyingglass")
173173
.foregroundColor(Color(hex: "64748b"))
174174

175-
TextField(placeholder, text: $text)
176-
.foregroundColor(.white)
175+
ZStack(alignment: .leading) {
176+
if text.isEmpty {
177+
Text(placeholder)
178+
.foregroundColor(Color(hex: "94a3b8")) // Lighter color for placeholder
179+
}
180+
181+
TextField("", text: $text)
182+
.foregroundColor(.white)
183+
}
177184

178185
if !text.isEmpty {
179186
Button(
@@ -201,15 +208,9 @@ struct ClientRow: View {
201208

202209
var body: some View {
203210
HStack {
204-
VStack(alignment: .leading, spacing: 4) {
205-
Text(client.name ?? client.mid)
206-
.font(.headline)
207-
.foregroundColor(.white)
208-
209-
Text(client.mid)
210-
.font(.caption)
211-
.foregroundColor(Color(hex: "94a3b8"))
212-
}
211+
Text(client.name ?? client.mid)
212+
.font(.headline)
213+
.foregroundColor(.white)
213214

214215
Spacer()
215216

0 commit comments

Comments
 (0)