From 1b89b81de0c421ad548dc06436ab9ec501f31fd2 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Wed, 1 Apr 2020 13:26:22 -0700 Subject: [PATCH] Enables sideloading for public versions --- AltStore/Managing Apps/AppManager.swift | 2 -- AltStore/My Apps/MyAppsViewController.swift | 39 ++------------------- AltStore/Operations/OperationError.swift | 5 --- 3 files changed, 2 insertions(+), 44 deletions(-) diff --git a/AltStore/Managing Apps/AppManager.swift b/AltStore/Managing Apps/AppManager.swift index 7dd1d397..75b12d59 100644 --- a/AltStore/Managing Apps/AppManager.swift +++ b/AltStore/Managing Apps/AppManager.swift @@ -21,8 +21,6 @@ extension AppManager static let didFetchSourceNotification = Notification.Name("com.altstore.AppManager.didFetchSource") static let expirationWarningNotificationID = "altstore-expiration-warning" - - static let whitelistedSideloadingBundleIDs: Set = ["science.xnu.undecimus"] } class AppManager diff --git a/AltStore/My Apps/MyAppsViewController.swift b/AltStore/My Apps/MyAppsViewController.swift index 34915de3..38bff614 100644 --- a/AltStore/My Apps/MyAppsViewController.swift +++ b/AltStore/My Apps/MyAppsViewController.swift @@ -70,12 +70,6 @@ class MyAppsViewController: UICollectionViewController { super.viewDidLoad() - #if !BETA - // Set leftBarButtonItem to invisible UIBarButtonItem so we can still use it - // to show an activity indicator while sideloading whitelisted apps. - self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil) - #endif - // Allows us to intercept delegate callbacks. self.updatesDataSource.fetchedResultsController.delegate = self @@ -119,9 +113,7 @@ class MyAppsViewController: UICollectionViewController self.updateDataSource() - #if BETA self.fetchAppIDs() - #endif } override func prepare(for segue: UIStoryboardSegue, sender: Any?) @@ -715,27 +707,8 @@ private extension MyAppsViewController case .failure(OperationError.cancelled): break case .failure(let error): - if let localizedError = error as? OperationError, case OperationError.sideloadingAppNotSupported = localizedError - { - let message = NSLocalizedString(""" - Sideloading apps is in beta, and is currently limited to a small number of apps. This restriction is temporary, and you will be able to sideload any app once the feature is finished. - - In the meantime, you can help us beta test sideloading apps by becoming a Patron. - """, comment: "") - - let alertController = UIAlertController(title: localizedError.localizedDescription, message: message, preferredStyle: .alert) - alertController.addAction(.cancel) - alertController.addAction(UIAlertAction(title: NSLocalizedString("Become a Patron", comment: ""), style: .default, handler: { (action) in - NotificationCenter.default.post(name: AppDelegate.openPatreonSettingsDeepLinkNotification, object: nil) - })) - - self.present(alertController, animated: true, completion: nil) - } - else - { - let toastView = ToastView(error: error) - toastView.show(in: self) - } + let toastView = ToastView(error: error) + toastView.show(in: self) completion(.failure(error)) } @@ -751,10 +724,6 @@ private extension MyAppsViewController guard let application = ALTApplication(fileURL: unzippedApplicationURL) else { throw OperationError.invalidApp } - #if !BETA - guard AppManager.whitelistedSideloadingBundleIDs.contains(application.bundleIdentifier) else { throw OperationError.sideloadingAppNotSupported(application) } - #endif - func install() { self.sideloadingProgress = AppManager.shared.install(application, presentingViewController: self) { (result) in @@ -1324,7 +1293,6 @@ extension MyAppsViewController: UICollectionViewDelegateFlowLayout func appIDsFooterSize() -> CGSize { - #if BETA guard let _ = DatabaseManager.shared.activeTeam() else { return .zero } let indexPath = IndexPath(row: 0, section: section.rawValue) @@ -1334,9 +1302,6 @@ extension MyAppsViewController: UICollectionViewDelegateFlowLayout withHorizontalFittingPriority: .required, verticalFittingPriority: .fittingSizeLevel) return size - #else - return .zero - #endif } switch section diff --git a/AltStore/Operations/OperationError.swift b/AltStore/Operations/OperationError.swift index 12c49b3d..f509a46b 100644 --- a/AltStore/Operations/OperationError.swift +++ b/AltStore/Operations/OperationError.swift @@ -24,7 +24,6 @@ enum OperationError: LocalizedError case invalidParameters case iOSVersionNotSupported(ALTApplication) - case sideloadingAppNotSupported(ALTApplication) case maximumAppIDLimitReached(application: ALTApplication, requiredAppIDs: Int, availableAppIDs: Int, nextExpirationDate: Date) case noSources @@ -52,10 +51,6 @@ enum OperationError: LocalizedError let localizedDescription = String(format: NSLocalizedString("%@ requires %@.", comment: ""), name, version) return localizedDescription - case .sideloadingAppNotSupported(let app): - let localizedDescription = String(format: NSLocalizedString("Sideloading “%@” Not Supported", comment: ""), app.name) - return localizedDescription - case .maximumAppIDLimitReached: return NSLocalizedString("Cannot register more than 10 App IDs.", comment: "") } }