mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-12 16:23:32 +01:00
[AltStore] Uses GrandSlam Authentication
Retrieves anisette data from AltServer so we can authenticate with GSA.
This commit is contained in:
@@ -80,12 +80,26 @@ extension AppManager
|
||||
#endif
|
||||
}
|
||||
|
||||
func authenticate(presentingViewController: UIViewController?, completionHandler: @escaping (Result<ALTSigner, Error>) -> Void)
|
||||
func authenticate(presentingViewController: UIViewController?, completionHandler: @escaping (Result<(ALTSigner, ALTAppleAPISession), Error>) -> Void)
|
||||
{
|
||||
let authenticationOperation = AuthenticationOperation(presentingViewController: presentingViewController)
|
||||
let group = OperationGroup()
|
||||
|
||||
let findServerOperation = FindServerOperation(group: group)
|
||||
findServerOperation.resultHandler = { (result) in
|
||||
switch result
|
||||
{
|
||||
case .failure(let error): group.error = error
|
||||
case .success(let server): group.server = server
|
||||
}
|
||||
}
|
||||
|
||||
let authenticationOperation = AuthenticationOperation(group: group, presentingViewController: presentingViewController)
|
||||
authenticationOperation.addDependency(findServerOperation)
|
||||
authenticationOperation.resultHandler = { (result) in
|
||||
completionHandler(result)
|
||||
}
|
||||
|
||||
self.operationQueue.addOperation(findServerOperation)
|
||||
self.operationQueue.addOperation(authenticationOperation)
|
||||
}
|
||||
}
|
||||
@@ -194,21 +208,30 @@ private extension AppManager
|
||||
}
|
||||
operations.append(findServerOperation)
|
||||
|
||||
if group.signer == nil
|
||||
let authenticationOperation: AuthenticationOperation?
|
||||
|
||||
if group.signer == nil || group.session == nil
|
||||
{
|
||||
/* Authenticate */
|
||||
let authenticationOperation = AuthenticationOperation(presentingViewController: presentingViewController)
|
||||
authenticationOperation.resultHandler = { (result) in
|
||||
let operation = AuthenticationOperation(group: group, presentingViewController: presentingViewController)
|
||||
operation.resultHandler = { (result) in
|
||||
switch result
|
||||
{
|
||||
case .failure(let error): group.error = error
|
||||
case .success(let signer): group.signer = signer
|
||||
case .success(let signer, let session):
|
||||
group.signer = signer
|
||||
group.session = session
|
||||
}
|
||||
}
|
||||
operations.append(authenticationOperation)
|
||||
operations.append(operation)
|
||||
operation.addDependency(findServerOperation)
|
||||
|
||||
findServerOperation.addDependency(authenticationOperation)
|
||||
}
|
||||
authenticationOperation = operation
|
||||
}
|
||||
else
|
||||
{
|
||||
authenticationOperation = nil
|
||||
}
|
||||
|
||||
for app in apps
|
||||
{
|
||||
@@ -222,7 +245,7 @@ private extension AppManager
|
||||
guard let resignedApp = self.process(result, context: context) else { return }
|
||||
context.resignedApp = resignedApp
|
||||
}
|
||||
resignAppOperation.addDependency(findServerOperation)
|
||||
resignAppOperation.addDependency(authenticationOperation ?? findServerOperation)
|
||||
progress.addChild(resignAppOperation.progress, withPendingUnitCount: 20)
|
||||
operations.append(resignAppOperation)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user