mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-18 19:23:43 +01:00
[AltBackup] No longer assumes AltStore app group is first in ALTAppGroups
This commit is contained in:
@@ -77,10 +77,6 @@ struct BackupError: ALTLocalizedError
|
|||||||
|
|
||||||
class BackupController: NSObject
|
class BackupController: NSObject
|
||||||
{
|
{
|
||||||
private var altstoreAppGroup: String? {
|
|
||||||
return Bundle.main.appGroups.first
|
|
||||||
}
|
|
||||||
|
|
||||||
private let fileCoordinator = NSFileCoordinator(filePresenter: nil)
|
private let fileCoordinator = NSFileCoordinator(filePresenter: nil)
|
||||||
private let operationQueue = OperationQueue()
|
private let operationQueue = OperationQueue()
|
||||||
|
|
||||||
@@ -96,7 +92,7 @@ class BackupController: NSObject
|
|||||||
guard let bundleIdentifier = Bundle.main.bundleIdentifier else { throw BackupError(.invalidBundleID, description: NSLocalizedString("Unable to create backup directory.", comment: "")) }
|
guard let bundleIdentifier = Bundle.main.bundleIdentifier else { throw BackupError(.invalidBundleID, description: NSLocalizedString("Unable to create backup directory.", comment: "")) }
|
||||||
|
|
||||||
guard
|
guard
|
||||||
let altstoreAppGroup = self.altstoreAppGroup,
|
let altstoreAppGroup = Bundle.main.altstoreAppGroup,
|
||||||
let sharedDirectoryURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: altstoreAppGroup)
|
let sharedDirectoryURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: altstoreAppGroup)
|
||||||
else { throw BackupError(.appGroupNotFound(nil), description: NSLocalizedString("Unable to create backup directory.", comment: "")) }
|
else { throw BackupError(.appGroupNotFound(nil), description: NSLocalizedString("Unable to create backup directory.", comment: "")) }
|
||||||
|
|
||||||
@@ -193,7 +189,7 @@ class BackupController: NSObject
|
|||||||
guard let bundleIdentifier = Bundle.main.bundleIdentifier else { throw BackupError(.invalidBundleID, description: NSLocalizedString("Unable to access backup.", comment: "")) }
|
guard let bundleIdentifier = Bundle.main.bundleIdentifier else { throw BackupError(.invalidBundleID, description: NSLocalizedString("Unable to access backup.", comment: "")) }
|
||||||
|
|
||||||
guard
|
guard
|
||||||
let altstoreAppGroup = self.altstoreAppGroup,
|
let altstoreAppGroup = Bundle.main.altstoreAppGroup,
|
||||||
let sharedDirectoryURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: altstoreAppGroup)
|
let sharedDirectoryURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: altstoreAppGroup)
|
||||||
else { throw BackupError(.appGroupNotFound(nil), description: NSLocalizedString("Unable to access backup.", comment: "")) }
|
else { throw BackupError(.appGroupNotFound(nil), description: NSLocalizedString("Unable to access backup.", comment: "")) }
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ public extension Bundle
|
|||||||
|
|
||||||
public extension Bundle
|
public extension Bundle
|
||||||
{
|
{
|
||||||
|
static var baseAltStoreAppGroupID = "group.com.rileytestut.AltStore"
|
||||||
|
|
||||||
var infoPlistURL: URL {
|
var infoPlistURL: URL {
|
||||||
let infoPlistURL = self.bundleURL.appendingPathComponent("Info.plist")
|
let infoPlistURL = self.bundleURL.appendingPathComponent("Info.plist")
|
||||||
return infoPlistURL
|
return infoPlistURL
|
||||||
@@ -42,4 +44,9 @@ public extension Bundle
|
|||||||
var appGroups: [String] {
|
var appGroups: [String] {
|
||||||
return self.infoDictionary?[Bundle.Info.appGroups] as? [String] ?? []
|
return self.infoDictionary?[Bundle.Info.appGroups] as? [String] ?? []
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var altstoreAppGroup: String? {
|
||||||
|
let appGroup = self.appGroups.first { $0.contains(Bundle.baseAltStoreAppGroupID) }
|
||||||
|
return appGroup
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user