mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-21 20:53:26 +01:00
Enables sideloading for public versions
This commit is contained in:
@@ -21,8 +21,6 @@ extension AppManager
|
|||||||
static let didFetchSourceNotification = Notification.Name("com.altstore.AppManager.didFetchSource")
|
static let didFetchSourceNotification = Notification.Name("com.altstore.AppManager.didFetchSource")
|
||||||
|
|
||||||
static let expirationWarningNotificationID = "altstore-expiration-warning"
|
static let expirationWarningNotificationID = "altstore-expiration-warning"
|
||||||
|
|
||||||
static let whitelistedSideloadingBundleIDs: Set<String> = ["science.xnu.undecimus"]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class AppManager
|
class AppManager
|
||||||
|
|||||||
@@ -70,12 +70,6 @@ class MyAppsViewController: UICollectionViewController
|
|||||||
{
|
{
|
||||||
super.viewDidLoad()
|
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.
|
// Allows us to intercept delegate callbacks.
|
||||||
self.updatesDataSource.fetchedResultsController.delegate = self
|
self.updatesDataSource.fetchedResultsController.delegate = self
|
||||||
|
|
||||||
@@ -119,9 +113,7 @@ class MyAppsViewController: UICollectionViewController
|
|||||||
|
|
||||||
self.updateDataSource()
|
self.updateDataSource()
|
||||||
|
|
||||||
#if BETA
|
|
||||||
self.fetchAppIDs()
|
self.fetchAppIDs()
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override func prepare(for segue: UIStoryboardSegue, sender: Any?)
|
override func prepare(for segue: UIStoryboardSegue, sender: Any?)
|
||||||
@@ -715,27 +707,8 @@ private extension MyAppsViewController
|
|||||||
case .failure(OperationError.cancelled): break
|
case .failure(OperationError.cancelled): break
|
||||||
|
|
||||||
case .failure(let error):
|
case .failure(let error):
|
||||||
if let localizedError = error as? OperationError, case OperationError.sideloadingAppNotSupported = localizedError
|
let toastView = ToastView(error: error)
|
||||||
{
|
toastView.show(in: self)
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
completion(.failure(error))
|
completion(.failure(error))
|
||||||
}
|
}
|
||||||
@@ -751,10 +724,6 @@ private extension MyAppsViewController
|
|||||||
|
|
||||||
guard let application = ALTApplication(fileURL: unzippedApplicationURL) else { throw OperationError.invalidApp }
|
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()
|
func install()
|
||||||
{
|
{
|
||||||
self.sideloadingProgress = AppManager.shared.install(application, presentingViewController: self) { (result) in
|
self.sideloadingProgress = AppManager.shared.install(application, presentingViewController: self) { (result) in
|
||||||
@@ -1324,7 +1293,6 @@ extension MyAppsViewController: UICollectionViewDelegateFlowLayout
|
|||||||
|
|
||||||
func appIDsFooterSize() -> CGSize
|
func appIDsFooterSize() -> CGSize
|
||||||
{
|
{
|
||||||
#if BETA
|
|
||||||
guard let _ = DatabaseManager.shared.activeTeam() else { return .zero }
|
guard let _ = DatabaseManager.shared.activeTeam() else { return .zero }
|
||||||
|
|
||||||
let indexPath = IndexPath(row: 0, section: section.rawValue)
|
let indexPath = IndexPath(row: 0, section: section.rawValue)
|
||||||
@@ -1334,9 +1302,6 @@ extension MyAppsViewController: UICollectionViewDelegateFlowLayout
|
|||||||
withHorizontalFittingPriority: .required,
|
withHorizontalFittingPriority: .required,
|
||||||
verticalFittingPriority: .fittingSizeLevel)
|
verticalFittingPriority: .fittingSizeLevel)
|
||||||
return size
|
return size
|
||||||
#else
|
|
||||||
return .zero
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch section
|
switch section
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ enum OperationError: LocalizedError
|
|||||||
case invalidParameters
|
case invalidParameters
|
||||||
|
|
||||||
case iOSVersionNotSupported(ALTApplication)
|
case iOSVersionNotSupported(ALTApplication)
|
||||||
case sideloadingAppNotSupported(ALTApplication)
|
|
||||||
case maximumAppIDLimitReached(application: ALTApplication, requiredAppIDs: Int, availableAppIDs: Int, nextExpirationDate: Date)
|
case maximumAppIDLimitReached(application: ALTApplication, requiredAppIDs: Int, availableAppIDs: Int, nextExpirationDate: Date)
|
||||||
|
|
||||||
case noSources
|
case noSources
|
||||||
@@ -52,10 +51,6 @@ enum OperationError: LocalizedError
|
|||||||
let localizedDescription = String(format: NSLocalizedString("%@ requires %@.", comment: ""), name, version)
|
let localizedDescription = String(format: NSLocalizedString("%@ requires %@.", comment: ""), name, version)
|
||||||
return localizedDescription
|
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: "")
|
case .maximumAppIDLimitReached: return NSLocalizedString("Cannot register more than 10 App IDs.", comment: "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user