mirror of
https://github.com/SideStore/SideStore.git
synced 2026-04-10 04:35:41 +02:00
Always asks to add source when installing app if not yet added
This commit is contained in:
@@ -525,7 +525,8 @@ extension AppViewController
|
|||||||
{
|
{
|
||||||
guard self.app.installedApp == nil else { return }
|
guard self.app.installedApp == nil else { return }
|
||||||
|
|
||||||
let group = AppManager.shared.install(self.app, presentingViewController: self) { (result) in
|
Task<Void, Never>(priority: .userInitiated) {
|
||||||
|
let group = await AppManager.shared.installAsync(self.app, presentingViewController: self) { (result) in
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
_ = try result.get()
|
_ = try result.get()
|
||||||
@@ -537,21 +538,28 @@ extension AppViewController
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
let toastView = ToastView(error: error, opensLog: true)
|
let toastView = ToastView(error: error)
|
||||||
|
toastView.opensErrorLog = true
|
||||||
toastView.show(in: self)
|
toastView.show(in: self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
|
let toastView = ToastView(error: error, opensLog: true)
|
||||||
|
toastView.show(in: self)
|
||||||
self.bannerView.button.progress = nil
|
self.bannerView.button.progress = nil
|
||||||
self.navigationBarDownloadButton.progress = nil
|
self.navigationBarDownloadButton.progress = nil
|
||||||
self.update()
|
self.update()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !group.progress.isCancelled
|
||||||
|
{
|
||||||
self.bannerView.button.progress = group.progress
|
self.bannerView.button.progress = group.progress
|
||||||
self.navigationBarDownloadButton.progress = group.progress
|
self.navigationBarDownloadButton.progress = group.progress
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func open(_ installedApp: InstalledApp)
|
func open(_ installedApp: InstalledApp)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -563,19 +563,22 @@ private extension BrowseViewController
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Task<Void, Never>(priority: .userInitiated) { @MainActor in
|
||||||
if let installedApp = app.installedApp, installedApp.isUpdateAvailable
|
if let installedApp = app.installedApp, installedApp.isUpdateAvailable
|
||||||
{
|
{
|
||||||
AppManager.shared.update(installedApp, presentingViewController: self, completionHandler: finish(_:))
|
AppManager.shared.update(installedApp, presentingViewController: self, completionHandler: finish(_:))
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AppManager.shared.install(app, presentingViewController: self, completionHandler: finish(_:))
|
await AppManager.shared.installAsync(app, presentingViewController: self, completionHandler: finish(_:))
|
||||||
}
|
}
|
||||||
|
|
||||||
UIView.performWithoutAnimation {
|
UIView.performWithoutAnimation {
|
||||||
self.collectionView.reloadItems(at: [indexPath])
|
self.collectionView.reloadItems(at: [indexPath])
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@MainActor
|
||||||
func finish(_ result: Result<InstalledApp, Error>)
|
func finish(_ result: Result<InstalledApp, Error>)
|
||||||
{
|
{
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
|
|||||||
@@ -453,6 +453,7 @@ extension AppManager
|
|||||||
completionHandler(.failure(error))
|
completionHandler(.failure(error))
|
||||||
|
|
||||||
let group = RefreshGroup(context: context)
|
let group = RefreshGroup(context: context)
|
||||||
|
group.progress.cancel()
|
||||||
return group
|
return group
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -337,19 +337,22 @@ private extension NewsViewController
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Task<Void, Never>(priority: .userInitiated) { @MainActor in
|
||||||
if let installedApp = storeApp.installedApp, installedApp.isUpdateAvailable
|
if let installedApp = storeApp.installedApp, installedApp.isUpdateAvailable
|
||||||
{
|
{
|
||||||
AppManager.shared.update(installedApp, presentingViewController: self, completionHandler: finish(_:))
|
AppManager.shared.update(installedApp, presentingViewController: self, completionHandler: finish(_:))
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AppManager.shared.install(storeApp, presentingViewController: self, completionHandler: finish(_:))
|
await AppManager.shared.installAsync(storeApp, presentingViewController: self, completionHandler: finish(_:))
|
||||||
}
|
}
|
||||||
|
|
||||||
UIView.performWithoutAnimation {
|
UIView.performWithoutAnimation {
|
||||||
self.collectionView.reloadSections(IndexSet(integer: indexPath.section))
|
self.collectionView.reloadSections(IndexSet(integer: indexPath.section))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@MainActor
|
||||||
func finish(_ result: Result<InstalledApp, Error>)
|
func finish(_ result: Result<InstalledApp, Error>)
|
||||||
{
|
{
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
|
|||||||
Reference in New Issue
Block a user