Refreshes apps by installing provisioning profiles when possible

Assuming the certificate used to originally sign an app is still valid, we can refresh an app simply by installing new provisioning profiles. However, if the signing certificate is no longer valid, we fall back to the old method of resigning + reinstalling.
This commit is contained in:
Riley Testut
2020-03-06 17:08:35 -08:00
parent 27bce4e456
commit 4f00018164
25 changed files with 1272 additions and 1082 deletions

View File

@@ -16,11 +16,11 @@ import Roxas
@objc(InstallAppOperation)
class InstallAppOperation: ResultOperation<InstalledApp>
{
let context: AppOperationContext
let context: InstallAppOperationContext
private var didCleanUp = false
init(context: AppOperationContext)
init(context: InstallAppOperationContext)
{
self.context = context
@@ -40,6 +40,7 @@ class InstallAppOperation: ResultOperation<InstalledApp>
}
guard
let certificate = self.context.certificate,
let resignedApp = self.context.resignedApp,
let connection = self.context.installationConnection
else { return self.finish(.failure(OperationError.invalidParameters)) }
@@ -57,10 +58,10 @@ class InstallAppOperation: ResultOperation<InstalledApp>
}
else
{
installedApp = InstalledApp(resignedApp: resignedApp, originalBundleIdentifier: self.context.bundleIdentifier, context: backgroundContext)
installedApp = InstalledApp(resignedApp: resignedApp, originalBundleIdentifier: self.context.bundleIdentifier, certificateSerialNumber: certificate.serialNumber, context: backgroundContext)
}
installedApp.update(resignedApp: resignedApp)
installedApp.update(resignedApp: resignedApp, certificateSerialNumber: certificate.serialNumber)
if let team = DatabaseManager.shared.activeTeam(in: backgroundContext)
{
@@ -108,7 +109,7 @@ class InstallAppOperation: ResultOperation<InstalledApp>
// Temporary directory and resigned .ipa no longer needed, so delete them now to ensure AltStore doesn't quit before we get the chance to.
self.cleanUp()
self.context.group.beginInstallationHandler?(installedApp)
self.context.beginInstallationHandler?(installedApp)
let request = BeginInstallationRequest()
connection.send(request) { (result) in