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)) }