Finally fix retries for minimuxer calls

This commit is contained in:
Nythepegasus
2023-07-24 16:58:09 -04:00
committed by nythepegasus
parent 090456bba1
commit cc5c280882
6 changed files with 55 additions and 33 deletions

View File

@@ -31,10 +31,7 @@ final class DeactivateAppOperation: ResultOperation<InstalledApp>
{
super.main()
if let error = self.context.error
{
return self.finish(.failure(error))
}
if let error = self.context.error { return self.finish(.failure(error)) }
DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in
let installedApp = context.object(with: self.app.objectID) as! InstalledApp
@@ -42,13 +39,21 @@ final class DeactivateAppOperation: ResultOperation<InstalledApp>
let allIdentifiers = [installedApp.resignedBundleIdentifier] + appExtensionProfiles
for profile in allIdentifiers {
do {
try remove_provisioning_profile(profile)
self.progress.completedUnitCount += 1
installedApp.isActive = false
return self.finish(.success(installedApp))
} catch {
return self.finish(.failure(error))
var attempts = 5
while (attempts > 0){
print("Remove Provisioning profile attempts left: \(attempts)")
do {
try remove_provisioning_profile(profile)
self.progress.completedUnitCount += 1
installedApp.isActive = false
self.finish(.success(installedApp))
break
} catch {
attempts -= 1
if (attempts <= 0){
self.finish(.failure(error))
}
}
}
}
}