Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when downloading apps #449

Merged
merged 1 commit into from Oct 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 11 additions & 9 deletions PlayCover/Views/App Views/StoreAppView.swift
Expand Up @@ -44,7 +44,9 @@ struct StoreAppView: View {
})

observation = downloadTask.progress.observe(\.fractionCompleted) { progress, _ in
downloadVM.progress = progress.fractionCompleted
DispatchQueue.main.async {
downloadVM.progress = progress.fractionCompleted
}
}

downloadTask.resume()
Expand Down Expand Up @@ -76,14 +78,14 @@ struct StoreAppView: View {
.appendingPathExtension("ipa")
try FileManager.default.moveItem(at: url, to: tmpDir)
uif.ipaUrl = tmpDir
Installer.install(ipaUrl: uif.ipaUrl!, export: false, returnCompletion: { _ in
DispatchQueue.main.async {
AppsVM.shared.fetchApps()
NotifyService.shared.notify(
NSLocalizedString("notification.appInstalled", comment: ""),
NSLocalizedString("notification.appInstalled.message", comment: ""))
}
})
DispatchQueue.main.async {
Installer.install(ipaUrl: uif.ipaUrl!, export: false, returnCompletion: { _ in
AppsVM.shared.fetchApps()
NotifyService.shared.notify(
NSLocalizedString("notification.appInstalled", comment: ""),
NSLocalizedString("notification.appInstalled.message", comment: ""))
})
}
} catch {
Log.shared.error(error)
}
Expand Down