2020-03-11 14:43:19 -07:00
|
|
|
//
|
|
|
|
|
// DeactivateAppOperation.swift
|
|
|
|
|
// AltStore
|
|
|
|
|
//
|
|
|
|
|
// Created by Riley Testut on 3/4/20.
|
|
|
|
|
// Copyright © 2020 Riley Testut. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
2020-09-03 16:39:08 -07:00
|
|
|
import AltStoreCore
|
2020-03-11 14:43:19 -07:00
|
|
|
import AltSign
|
|
|
|
|
import Roxas
|
2022-11-02 17:58:59 -07:00
|
|
|
import minimuxer
|
2020-03-11 14:43:19 -07:00
|
|
|
|
|
|
|
|
@objc(DeactivateAppOperation)
|
2023-01-04 09:52:12 -05:00
|
|
|
final class DeactivateAppOperation: ResultOperation<InstalledApp>
|
2020-03-11 14:43:19 -07:00
|
|
|
{
|
|
|
|
|
let app: InstalledApp
|
|
|
|
|
let context: OperationContext
|
|
|
|
|
|
|
|
|
|
init(app: InstalledApp, context: OperationContext)
|
|
|
|
|
{
|
|
|
|
|
self.app = app
|
|
|
|
|
self.context = context
|
|
|
|
|
|
|
|
|
|
super.init()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override func main()
|
|
|
|
|
{
|
|
|
|
|
super.main()
|
|
|
|
|
|
2024-12-07 17:45:09 +05:30
|
|
|
if let error = self.context.error
|
|
|
|
|
{
|
|
|
|
|
self.finish(.failure(error))
|
|
|
|
|
return
|
|
|
|
|
}
|
2020-03-11 14:43:19 -07:00
|
|
|
|
2022-11-02 17:58:59 -07:00
|
|
|
DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in
|
|
|
|
|
let installedApp = context.object(with: self.app.objectID) as! InstalledApp
|
|
|
|
|
let appExtensionProfiles = installedApp.appExtensions.map { $0.resignedBundleIdentifier }
|
|
|
|
|
let allIdentifiers = [installedApp.resignedBundleIdentifier] + appExtensionProfiles
|
|
|
|
|
|
|
|
|
|
for profile in allIdentifiers {
|
2023-10-17 17:37:29 -04:00
|
|
|
do {
|
|
|
|
|
try remove_provisioning_profile(profile)
|
|
|
|
|
self.progress.completedUnitCount += 1
|
|
|
|
|
installedApp.isActive = false
|
|
|
|
|
self.finish(.success(installedApp))
|
|
|
|
|
break
|
|
|
|
|
} catch {
|
|
|
|
|
self.finish(.failure(error))
|
2020-03-11 14:43:19 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|