Skip to content

Commit f4e6617

Browse files
authored
Merge pull request #164 from TaskarCenterAtUW/feature-handle-quest-exception
show alert when clicked on workspace for quest not defined
2 parents a0284ee + 21f6168 commit f4e6617

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

GoInfoGame/GoInfoGame/UI/InitialView/InitialView.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ struct WorkspacesListView: View {
7373

7474
@Binding var isLoading: Bool
7575

76+
@State private var showAlert = false
77+
7678
var body: some View {
7779

7880
if viewModel.workspaces.count == 1 {
@@ -91,6 +93,11 @@ struct WorkspacesListView: View {
9193
DispatchQueue.main.async {
9294
self.shouldNavigateToMapView = true
9395
}
96+
} else {
97+
DispatchQueue.main.async {
98+
showAlert = true
99+
self.shouldNavigateToMapView = false
100+
}
94101
}
95102
}
96103
}
@@ -131,6 +138,11 @@ struct WorkspacesListView: View {
131138

132139
let workspaceId = "\(workspace.id)"
133140
_ = KeychainManager.save(key: "workspaceID", data: workspaceId)
141+
} else {
142+
DispatchQueue.main.async {
143+
showAlert = true
144+
self.shouldNavigateToMapView = false
145+
}
134146
}
135147
})
136148
} label: {
@@ -151,6 +163,9 @@ struct WorkspacesListView: View {
151163
}
152164
.padding()
153165
}
166+
.alert("Workspace or quest not configured", isPresented: $showAlert) {
167+
Button("OK", role: .cancel) { }
168+
}
154169
}
155170

156171
if shouldNavigateToMapView, let selectedWorkspace = selectedWorkspace {

0 commit comments

Comments
 (0)