From 29dda98736ff89cb511165bbb55177a7a4623e35 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Fri, 8 May 2020 11:45:23 -0700 Subject: [PATCH] Fixes updating DolphiniOS due to mismatched bundle IDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Manually sets Dolphin’s CFBundleIdentifier to match the source bundle ID to prevent breaking updates for existing users. --- AltStore/Model/StoreApp.swift | 2 ++ AltStore/Operations/DownloadAppOperation.swift | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/AltStore/Model/StoreApp.swift b/AltStore/Model/StoreApp.swift index ecaa600c..d6a7abe2 100644 --- a/AltStore/Model/StoreApp.swift +++ b/AltStore/Model/StoreApp.swift @@ -24,6 +24,8 @@ extension StoreApp static let altstoreAppID = "com.rileytestut.AltStore" static let alternativeAltStoreAppIDs: Set = ["com.rileytestut.AltStore.Beta", "com.rileytestut.AltStore.Alpha"] #endif + + static let dolphinAppID = "me.oatmealdome.dolphinios-njb" } @objc(StoreApp) diff --git a/AltStore/Operations/DownloadAppOperation.swift b/AltStore/Operations/DownloadAppOperation.swift index 903336e9..ce13bfc3 100644 --- a/AltStore/Operations/DownloadAppOperation.swift +++ b/AltStore/Operations/DownloadAppOperation.swift @@ -83,6 +83,19 @@ class DownloadAppOperation: ResultOperation 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 } self.finish(.success(copiedApplication)) }