mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-09 06:43:25 +01:00
Fixes refreshing tweaked apps with removed app extensions
In addition to removing the app extensions themselves, we also need to remove references to them from SC_Info/Manifest.plist in the app bundle (if the file exists). Otherwise, subsequent installations (resigning, (de)-activating, etc.) will fail due to “missing” app extensions.
This commit is contained in:
@@ -989,6 +989,25 @@ private extension MyAppsViewController
|
|||||||
{
|
{
|
||||||
guard !application.appExtensions.isEmpty else { return completion(.success(())) }
|
guard !application.appExtensions.isEmpty else { return completion(.success(())) }
|
||||||
|
|
||||||
|
func removeAppExtensions() throws
|
||||||
|
{
|
||||||
|
for appExtension in application.appExtensions
|
||||||
|
{
|
||||||
|
try FileManager.default.removeItem(at: appExtension.fileURL)
|
||||||
|
}
|
||||||
|
|
||||||
|
let scInfoURL = application.fileURL.appendingPathComponent("SC_Info")
|
||||||
|
let manifestPlistURL = scInfoURL.appendingPathComponent("Manifest.plist")
|
||||||
|
|
||||||
|
if let manifestPlist = NSMutableDictionary(contentsOf: manifestPlistURL),
|
||||||
|
let sinfReplicationPaths = manifestPlist["SinfReplicationPaths"] as? [String]
|
||||||
|
{
|
||||||
|
let replacementPaths = sinfReplicationPaths.filter { !$0.starts(with: "PlugIns/") } // Filter out app extension paths.
|
||||||
|
manifestPlist["SinfReplicationPaths"] = replacementPaths
|
||||||
|
try manifestPlist.write(to: manifestPlistURL)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let firstSentence: String
|
let firstSentence: String
|
||||||
|
|
||||||
if UserDefaults.standard.activeAppLimitIncludesExtensions
|
if UserDefaults.standard.activeAppLimitIncludesExtensions
|
||||||
@@ -1010,19 +1029,8 @@ private extension MyAppsViewController
|
|||||||
completion(.success(()))
|
completion(.success(()))
|
||||||
})
|
})
|
||||||
alertController.addAction(UIAlertAction(title: NSLocalizedString("Remove App Extensions", comment: ""), style: .destructive) { (action) in
|
alertController.addAction(UIAlertAction(title: NSLocalizedString("Remove App Extensions", comment: ""), style: .destructive) { (action) in
|
||||||
do
|
let result = Result { try removeAppExtensions() }
|
||||||
{
|
completion(result)
|
||||||
for appExtension in application.appExtensions
|
|
||||||
{
|
|
||||||
try FileManager.default.removeItem(at: appExtension.fileURL)
|
|
||||||
}
|
|
||||||
|
|
||||||
completion(.success(()))
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
completion(.failure(error))
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
self.present(alertController, animated: true, completion: nil)
|
self.present(alertController, animated: true, completion: nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user