Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit 83bdc95

Browse files
authored
Fix bug
1 parent 223a18c commit 83bdc95

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

Sources/prostore/install/installApp.swift

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,31 @@ public func installApp(from ipaURL: URL) async throws
145145
let viewModel = InstallerStatusViewModel(isIdevice: isIdevice)
146146

147147
// Debug logging for status changes
148-
viewModel.$status
149-
.sink { status in
150-
print("[Installer] status ->", status)
151-
}
152-
.store(in: &cancellables)
148+
// Watch status for completion / errors (replace the previous $isCompleted sink)
149+
viewModel.$status
150+
.sink { newStatus in
151+
// If the view model exposes a computed Bool isCompleted, use it (safe regardless of enum shape)
152+
if viewModel.isCompleted {
153+
print("[Installer] detected completion via viewModel.isCompleted")
154+
continuation.yield((1.0, "✅ Successfully installed app!"))
155+
continuation.finish()
156+
cancellables.removeAll()
157+
return
158+
}
159+
160+
// If the status enum contains an error / broken case, finish with that error
161+
// This covers the case where broken carries an associated Error
162+
if case .broken(let error) = newStatus {
163+
print("[Installer] detected broken status ->", error)
164+
continuation.finish(throwing: transformInstallError(error))
165+
cancellables.removeAll()
166+
return
167+
}
168+
169+
// Optional: handle a status that carries failure inside .completed (if that variant exists)
170+
// e.g. if your enum had `.completed(.failure(let e))` then add handling here.
171+
}
172+
.store(in: &cancellables)
153173

154174
// Progress stream (combine upload & install progress)
155175
viewModel.$uploadProgress

Sources/prostore/views/AppsView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public struct AppRaw: Decodable {
8686
}
8787
}
8888
}
89-
public struct AppVersion: Decodable {
89+
public struct AppVersion: Decodable, Sendable {
9090
let version: String?
9191
let date: String?
9292
let downloadURL: String?

0 commit comments

Comments
 (0)