Deactivates apps by backing up + deleting them on iOS 13.5+

Deactivating apps by removing their profiles no longer works on iOS 13.5. Instead, AltStore will now back up the app by temporarily replacing it with AltBackup, then remove the app from the phone.
This commit is contained in:
Riley Testut
2020-05-16 16:17:18 -07:00
parent 19bf19350e
commit 2d87c396f1
9 changed files with 293 additions and 46 deletions

View File

@@ -63,7 +63,7 @@ class AuthenticatedOperationContext: OperationContext
class AppOperationContext
{
let bundleIdentifier: String
private let authenticatedContext: AuthenticatedOperationContext
let authenticatedContext: AuthenticatedOperationContext
var app: ALTApplication?
var provisioningProfiles: [String: ALTProvisioningProfile]?

View File

@@ -21,6 +21,10 @@ class RefreshGroup: NSObject
private(set) var results = [String: Result<InstalledApp, Error>]()
// Keep strong references to managed object contexts
// so they don't die out from under us.
private(set) var _contexts = Set<NSManagedObjectContext>()
private var isFinished = false
private let dispatchGroup = DispatchGroup()
@@ -33,6 +37,8 @@ class RefreshGroup: NSObject
super.init()
}
/// Used to keep track of which operations belong to this group.
/// This does _not_ add them to any operation queue.
func add(_ operations: [Foundation.Operation])
{
for operation in operations
@@ -57,6 +63,14 @@ class RefreshGroup: NSObject
func set(_ result: Result<InstalledApp, Error>, forAppWithBundleIdentifier bundleIdentifier: String)
{
self.results[bundleIdentifier] = result
switch result
{
case .failure: break
case .success(let installedApp):
guard let context = installedApp.managedObjectContext else { break }
self._contexts.insert(context)
}
}
func cancel()

View File

@@ -89,8 +89,13 @@ private extension SendAppOperation
connection.send(appData, prependSize: false) { (result) in
switch result
{
case .failure(let error): completionHandler(.failure(error))
case .success: completionHandler(.success(()))
case .failure(let error):
print("Failed to send app data (\(appData.count) bytes)")
completionHandler(.failure(error))
case .success:
print("Successfully sent app data (\(appData.count) bytes)")
completionHandler(.success(()))
}
}
}