Fix for Refresh Operation causing renewal/install of provisioning profiles for removed app extensions (#727)

* Fix AppExtensions not being updated on Disk after db is updated in InstallAppOperation

* refresh-Extensions: Added check to ensure extensions in DB and DISK matches if not then cancel current refresh request
This commit is contained in:
Magesh K
2024-11-04 04:00:39 +05:30
committed by GitHub
parent e5febcdc6c
commit 9c150d5f4a
2 changed files with 38 additions and 1 deletions

View File

@@ -112,6 +112,22 @@ final class InstallAppOperation: ResultOperation<InstalledApp>
}
installedApp.appExtensions = installedExtensions
// Remove stale "PlugIns" (Extensions) from currently installed App
if let installedAppExns = ALTApplication(fileURL: installedApp.fileURL)?.appExtensions {
let currentAppExns = Set(installedApp.appExtensions).map{ $0.bundleIdentifier }
let staleAppExns = installedAppExns.filter{ !currentAppExns.contains($0.bundleIdentifier) }
for staleAppExn in staleAppExns {
do {
try FileManager.default.removeItem(at: staleAppExn.fileURL)
print("InstallAppOperation.appExtensions: removed stale app-extension: \(staleAppExn.fileURL)")
} catch {
print("InstallAppOperation.appExtensions processing error Error: \(error)")
}
}
}
self.context.beginInstallationHandler?(installedApp)