Fixes updating DolphiniOS due to mismatched bundle IDs

Manually sets Dolphin’s CFBundleIdentifier to match the source bundle ID to prevent breaking updates for existing users.
This commit is contained in:
Riley Testut
2020-05-08 11:45:23 -07:00
parent 76008022e7
commit 29dda98736
2 changed files with 15 additions and 0 deletions

View File

@@ -24,6 +24,8 @@ extension StoreApp
static let altstoreAppID = "com.rileytestut.AltStore" static let altstoreAppID = "com.rileytestut.AltStore"
static let alternativeAltStoreAppIDs: Set<String> = ["com.rileytestut.AltStore.Beta", "com.rileytestut.AltStore.Alpha"] static let alternativeAltStoreAppIDs: Set<String> = ["com.rileytestut.AltStore.Beta", "com.rileytestut.AltStore.Alpha"]
#endif #endif
static let dolphinAppID = "me.oatmealdome.dolphinios-njb"
} }
@objc(StoreApp) @objc(StoreApp)

View File

@@ -83,6 +83,19 @@ class DownloadAppOperation: ResultOperation<ALTApplication>
try FileManager.default.copyItem(at: appBundleURL, to: self.destinationURL, shouldReplace: true) try FileManager.default.copyItem(at: appBundleURL, to: self.destinationURL, shouldReplace: true)
if self.context.bundleIdentifier == StoreApp.dolphinAppID, self.context.bundleIdentifier != application.bundleIdentifier
{
let infoPlistURL = self.destinationURL.appendingPathComponent("Info.plist")
if var infoPlist = NSDictionary(contentsOf: infoPlistURL) as? [String: Any]
{
// Manually update the app's bundle identifier to match the one specified in the source.
// This allows people who previously installed the app to still update and refresh normally.
infoPlist[kCFBundleIdentifierKey as String] = StoreApp.dolphinAppID
(infoPlist as NSDictionary).write(to: infoPlistURL, atomically: true)
}
}
guard let copiedApplication = ALTApplication(fileURL: self.destinationURL) else { throw OperationError.invalidApp } guard let copiedApplication = ALTApplication(fileURL: self.destinationURL) else { throw OperationError.invalidApp }
self.finish(.success(copiedApplication)) self.finish(.success(copiedApplication))
} }