From 4fb07176e391c1603c69cdb3fdfae9000453c7e2 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Wed, 31 Jul 2019 14:33:23 -0700 Subject: [PATCH] [AltStore] Skips choose team/certificate UI when there is only 1 --- .../Operations/AuthenticationOperation.swift | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/AltStore/Operations/AuthenticationOperation.swift b/AltStore/Operations/AuthenticationOperation.swift index 081734ee..2935095f 100644 --- a/AltStore/Operations/AuthenticationOperation.swift +++ b/AltStore/Operations/AuthenticationOperation.swift @@ -242,6 +242,11 @@ private extension AuthenticationOperation { func selectTeam(from teams: [ALTTeam]) { + if let team = teams.first, teams.count == 1 + { + return completionHandler(.success(team)) + } + DispatchQueue.main.async { let selectTeamViewController = self.storyboard.instantiateViewController(withIdentifier: "selectTeamViewController") as! SelectTeamViewController selectTeamViewController.teams = teams @@ -321,6 +326,22 @@ private extension AuthenticationOperation func replaceCertificate(from certificates: [ALTCertificate]) { + if let certificate = certificates.first, certificates.count == 1 + { + ALTAppleAPI.shared.revoke(certificate, for: team) { (success, error) in + if let error = error, !success + { + completionHandler(.failure(error)) + } + else + { + requestCertificate() + } + } + + return + } + DispatchQueue.main.async { let replaceCertificateViewController = self.storyboard.instantiateViewController(withIdentifier: "replaceCertificateViewController") as! ReplaceCertificateViewController replaceCertificateViewController.team = team