Downloads latest _available_ version when updating from AppViewController

Asks user to fall back to latest supported verson if version is not compatible with device’s iOS version.
This commit is contained in:
Riley Testut
2023-12-01 16:03:06 -06:00
parent 2c1ffedfe3
commit 92f3be07f6
3 changed files with 47 additions and 30 deletions

View File

@@ -557,9 +557,9 @@ extension AppManager
}
@discardableResult
func update(_ installedApp: InstalledApp, presentingViewController: UIViewController?, context: AuthenticatedOperationContext = AuthenticatedOperationContext(), completionHandler: @escaping (Result<InstalledApp, Error>) -> Void) -> Progress
func update(_ installedApp: InstalledApp, to version: AppVersion? = nil, presentingViewController: UIViewController?, context: AuthenticatedOperationContext = AuthenticatedOperationContext(), completionHandler: @escaping (Result<InstalledApp, Error>) -> Void) -> Progress
{
guard let appVersion = installedApp.storeApp?.latestSupportedVersion else {
guard let appVersion = version ?? installedApp.storeApp?.latestSupportedVersion else {
completionHandler(.failure(OperationError.appNotFound(name: installedApp.name)))
return Progress.discreteProgress(totalUnitCount: 1)
}