Skip to content

Commit 7dd853e

Browse files
committed
Fixed workspaces details accessing issue - imagery issue fixed
1 parent 232c65b commit 7dd853e

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

GoInfoGame/GoInfoGame/UI/InitialView/InitialView.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ struct WorkspacesListView: View {
8686
VStack {
8787
}
8888
.onAppear {
89-
viewModel.fetchLongQuestsFor(workspaceId: "\(selectedWorkspace.id)") { success, errorMessage in
89+
viewModel.fetchLongQuestsFor(workspaceId: "\(selectedWorkspace.id)") { success, errorMessage, workspace in
9090
if success {
91-
self.selectedWorkspace = selectedWorkspace
91+
self.selectedWorkspace = workspace
9292
let workspaceId = "\(selectedWorkspace.id)"
9393
_ = KeychainManager.save(key: "workspaceID", data: workspaceId)
9494
DispatchQueue.main.async {
@@ -157,10 +157,10 @@ struct WorkspacesListView: View {
157157
ForEach(viewModel.workspaces?.filter({$0.type == "osw" && $0.externalAppAccess == 1}) ?? [], id: \.id) { workspace in
158158
Button {
159159
viewModel.checkAndDeleteWorkspaceDB(workspaceId: "\(workspace.id)")
160-
viewModel.fetchLongQuestsFor(workspaceId: "\(workspace.id)", completion: { success, errorMessage in
160+
viewModel.fetchLongQuestsFor(workspaceId: "\(workspace.id)", completion: { success, errorMessage, ws in
161161
if success {
162162
shouldNavigateToMapView = true
163-
selectedWorkspace = workspace
163+
selectedWorkspace = ws
164164

165165
let workspaceId = "\(workspace.id)"
166166
_ = KeychainManager.save(key: "workspaceID", data: workspaceId)

GoInfoGame/GoInfoGame/UI/InitialView/InitialViewModel.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,19 @@ class InitialViewModel: ObservableObject {
7070

7171
}
7272

73-
func fetchLongQuestsFor(workspaceId: String,completion: @escaping (Bool, String?) -> Void) {
73+
func fetchLongQuestsFor(workspaceId: String,completion: @escaping (Bool, String?, Workspace?) -> Void) {
7474

7575
isLoading = true
7676

7777
ApiManager.shared.performRequest(to: .fetchWorkspaceDetails(workspaceId), setupType: .workspace, modelType: Workspace.self) { [weak self] result in
78-
guard let self = self else { return completion(false, "Object memory released.") }
78+
guard let self = self else { return completion(false, "Object memory released.", nil) }
7979
DispatchQueue.main.async { [unowned self] in
8080
switch result {
8181
case .success(let workspaces):
8282

8383
guard let longQuestsResponse = workspaces.longFormQuest else {
8484
self.isLoading = false
85-
completion(false, "Please configure longform." )
85+
completion(false, "Please configure longform.", nil )
8686
return
8787
}
8888
// Validate quest query
@@ -93,7 +93,7 @@ class InitialViewModel: ObservableObject {
9393
} catch {
9494
print("Invalid quest filter: \(error)")
9595
self.isLoading = false
96-
completion(false, "Invalid quest query.")
96+
completion(false, "Invalid quest query.", workspaces)
9797
return
9898
}
9999

@@ -117,11 +117,11 @@ class InitialViewModel: ObservableObject {
117117
}
118118

119119
self.isLoading = false
120-
completion(true, "")
120+
completion(true, "", workspaces)
121121
case .failure(let error):
122122
print("ERROR from workspace details api ----?>>>>>>\(error.localizedDescription)")
123123
self.isLoading = false
124-
completion(false, "Not able to load the workspace details. Please try again later." )
124+
completion(false, "Not able to load the workspace details. Please try again later.", nil )
125125
}
126126
}
127127
}

0 commit comments

Comments
 (0)