Skip to content

Commit 9833004

Browse files
authored
feat(ios): alert when active connection is deleted mid-session (#1163)
1 parent f33d4a9 commit 9833004

5 files changed

Lines changed: 21 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
- iOS: alert when the active connection is deleted mid-session (for example via iCloud sync from another device), so a stale screen no longer fails silently on the next action
1213
- iOS: Face ID, Touch ID, or Optic ID lock with cold-launch protection and idle timeout (1, 5, 15, or 60 minutes), opt-in from Settings
1314
- iOS: Connection Info tab replaces the per-connection Settings tab, showing host, SSL, SSH tunnel, active database, and live connection status
1415
- MCP Setup sheet adds Zed alongside Claude Desktop, Claude Code, and Cursor with a one-paste `context_servers` snippet

TableProMobile/TableProMobile/Coordinators/ConnectionCoordinator.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ final class ConnectionCoordinator {
3333
}
3434
}
3535
var pendingQuery: String?
36-
var navigationPath = NavigationPath()
36+
var tablesPath = NavigationPath()
3737
var showingEditSheet = false
3838

3939
private(set) var queryHistory: [QueryHistoryItem] = []
@@ -281,7 +281,7 @@ final class ConnectionCoordinator {
281281
appState.pendingTableName = nil
282282
selectedTab = .tables
283283
Task { @MainActor in
284-
navigationPath.append(table)
284+
tablesPath.append(table)
285285
}
286286
}
287287

TableProMobile/TableProMobile/Localizable.xcstrings

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,9 @@
831831
}
832832
}
833833
}
834+
},
835+
"Connection Deleted" : {
836+
834837
},
835838
"Connection Failed" : {
836839
"localizations" : {
@@ -3825,6 +3828,9 @@
38253828
}
38263829
}
38273830
}
3831+
},
3832+
"This connection no longer exists. It may have been removed from another device." : {
3833+
38283834
},
38293835
"This database has no tables." : {
38303836
"localizations" : {

TableProMobile/TableProMobile/Views/ConnectedView.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ struct ConnectedView: View {
1818
@State private var coordinator: ConnectionCoordinator?
1919
@State private var hapticSuccess = false
2020
@State private var hapticError = false
21+
@State private var showDeletedAlert = false
2122

2223
var body: some View {
2324
Group {
@@ -38,6 +39,16 @@ struct ConnectedView: View {
3839
}
3940
.navigationTitle(connection.name.isEmpty ? connection.host : connection.name)
4041
.navigationBarTitleDisplayMode(.inline)
42+
.onChange(of: appState.connections) { _, newConnections in
43+
if !newConnections.contains(where: { $0.id == connection.id }) {
44+
showDeletedAlert = true
45+
}
46+
}
47+
.alert(String(localized: "Connection Deleted"), isPresented: $showDeletedAlert) {
48+
Button("OK", role: .cancel) { dismiss() }
49+
} message: {
50+
Text("This connection no longer exists. It may have been removed from another device.")
51+
}
4152
.task {
4253
if let cached = cachedCoordinator {
4354
coordinator = cached
@@ -88,7 +99,7 @@ struct ConnectedView: View {
8899

89100
private func connectedContent(_ coordinator: ConnectionCoordinator) -> some View {
90101
@Bindable var coordinator = coordinator
91-
return NavigationStack(path: $coordinator.navigationPath) {
102+
return NavigationStack(path: $coordinator.tablesPath) {
92103
TabView(selection: $coordinator.selectedTab) {
93104
Tab("Tables", systemImage: "tablecells", value: .tables) {
94105
TableListView()

TableProMobile/TableProMobile/Views/ConnectionInfoView.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ struct ConnectionInfoView: View {
5151

5252
statsSection
5353
}
54-
.navigationTitle("Info")
55-
.navigationBarTitleDisplayMode(.inline)
5654
.sheet(isPresented: Binding(
5755
get: { coordinator.showingEditSheet },
5856
set: { coordinator.showingEditSheet = $0 }

0 commit comments

Comments
 (0)