mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
Supports joining Patreon via web view + downloading app in single flow
Asks user to connect Patreon account if they are signed-in inside WebViewController but not in AltStore settings.
This commit is contained in:
@@ -1315,9 +1315,21 @@ private extension AppManager
|
||||
}
|
||||
}
|
||||
|
||||
let downloadedAppURL = context.temporaryDirectory.appendingPathComponent("Cached.app")
|
||||
var verifyPledgeOperation: VerifyAppPledgeOperation?
|
||||
if let storeApp = app.storeApp
|
||||
{
|
||||
verifyPledgeOperation = VerifyAppPledgeOperation(storeApp: storeApp, presentingViewController: context.presentingViewController)
|
||||
verifyPledgeOperation?.resultHandler = { result in
|
||||
switch result
|
||||
{
|
||||
case .failure(let error): context.error = error
|
||||
case .success: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Download */
|
||||
let downloadedAppURL = context.temporaryDirectory.appendingPathComponent("Cached.app")
|
||||
let downloadOperation = DownloadAppOperation(app: downloadingApp, destinationURL: downloadedAppURL, context: context)
|
||||
downloadOperation.resultHandler = { (result) in
|
||||
do
|
||||
@@ -1332,6 +1344,11 @@ private extension AppManager
|
||||
}
|
||||
progress.addChild(downloadOperation.progress, withPendingUnitCount: 25)
|
||||
|
||||
if let verifyPledgeOperation
|
||||
{
|
||||
downloadOperation.addDependency(verifyPledgeOperation)
|
||||
}
|
||||
|
||||
|
||||
/* Verify App */
|
||||
let permissionsMode = UserDefaults.shared.permissionCheckingDisabled ? .none : permissionReviewMode
|
||||
@@ -1604,7 +1621,7 @@ private extension AppManager
|
||||
progress.addChild(installOperation.progress, withPendingUnitCount: 30)
|
||||
installOperation.addDependency(sendAppOperation)
|
||||
|
||||
let operations = [downloadOperation, verifyOperation, deactivateAppsOperation, removeAppExtensionsOperation, patchAppOperation, refreshAnisetteDataOperation, fetchProvisioningProfilesOperation, resignAppOperation, sendAppOperation, installOperation]
|
||||
var operations = [verifyPledgeOperation, downloadOperation, verifyOperation, deactivateAppsOperation, patchAppOperation, refreshAnisetteDataOperation, fetchProvisioningProfilesOperation, resignAppOperation, sendAppOperation, installOperation].compactMap { $0 }
|
||||
group.add(operations)
|
||||
|
||||
if let storeApp = downloadingApp.storeApp, storeApp.isPledgeRequired
|
||||
@@ -2208,7 +2225,7 @@ private extension AppManager
|
||||
switch operation
|
||||
{
|
||||
case _ where requiresSerialQueue: fallthrough
|
||||
case is InstallAppOperation, is RefreshAppOperation, is BackupAppOperation:
|
||||
case is InstallAppOperation, is RefreshAppOperation, is BackupAppOperation, is VerifyAppPledgeOperation:
|
||||
if let installAltStoreOperation = operation as? InstallAppOperation, installAltStoreOperation.context.bundleIdentifier == StoreApp.altstoreAppID
|
||||
{
|
||||
// Add dependencies on previous serial operations in `context` to ensure re-installing AltStore goes last.
|
||||
|
||||
Reference in New Issue
Block a user