Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
Allow users choose between optimizing Aperture for macOS Big Sur and …
Browse files Browse the repository at this point in the history
…macOS Catalina.
  • Loading branch information
cormiertyshawn895 committed Nov 15, 2020
1 parent cf46a34 commit d972274
Show file tree
Hide file tree
Showing 21 changed files with 101 additions and 40 deletions.
8 changes: 6 additions & 2 deletions Retroactive.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@
040914A524558D7300EC2475 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -850,6 +851,7 @@
040914A624558D7300EC2475 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -981,10 +983,11 @@
32D181CA23640CDF006253DE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
CODE_SIGN_ENTITLEMENTS = Retroactive/Support/Retroactive.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 84;
CURRENT_PROJECT_VERSION = 85;
INFOPLIST_FILE = Retroactive/Support/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -1002,10 +1005,11 @@
32D181CB23640CDF006253DE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
CODE_SIGN_ENTITLEMENTS = Retroactive/Support/Retroactive.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 84;
CURRENT_PROJECT_VERSION = 85;
INFOPLIST_FILE = Retroactive/Support/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down
23 changes: 23 additions & 0 deletions Retroactive/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,29 @@ class AppDelegate: NSObject, NSApplicationDelegate {
static func pushCompletionVC() {
AppDelegate.rootVC?.navigationController.pushViewController(CompletionViewController.instantiate(), animated: true)
}

static func pushAuthenticateVC() {
if ((AppManager.shared.chosenApp == .aperture || AppManager.shared.chosenApp == .iphoto) && discouraged_osExactlyCatalina) {
let appName = AppManager.shared.nameOfChosenApp
let messageText = String(format: "If you choose “Optimize for macOS Catalina”, %@ will enjoy improved stability and optimization, but only works on macOS Catalina. After upgrading to macOS Big Sur, you must unlock %@ with Retroactive again.".localized(), appName, appName) + "\n\n" + String(format: "If you choose “Optimize for macOS Big Sur”, %@ will work on both macOS Catalina and after upgrading to macOS Big Sur. However some features such as importing photos from removable media will be unavailable on macOS Catalina.".localized(), appName)
AppDelegate.showOptionSheet(title: String(format: "Retroactive can optimize %@ for either macOS Catalina or macOS Big Sur.".localized(), appName),
text: messageText,
firstButtonText: "Optimize for macOS Catalina".localized(),
secondButtonText: "Optimize for macOS Big Sur".localized(),
thirdButtonText: "") { (response) in
if (response == .alertFirstButtonReturn) {
AppManager.shared.maximizePhotoAppCompatibility = false
}
self.skipCheck_pushAuthenticateVC()
}
return
}
skipCheck_pushAuthenticateVC()
}

static func skipCheck_pushAuthenticateVC() {
AppDelegate.rootVC?.navigationController.pushViewController(AuthenticateViewController.instantiate(), animated: true)
}
}

extension NSApplication {
Expand Down
4 changes: 3 additions & 1 deletion Retroactive/AppManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ class AppManager: NSObject {
AppManager.shared.chosenApp = .proVideoUpdate
AppManager.shared.locationOfChosenApp = cachedLocation

AppDelegate.rootVC?.navigationController.pushViewController(AuthenticateViewController.instantiate(), animated: true)
AppDelegate.skipCheck_pushAuthenticateVC()
} else {
AppDelegate.showTextSheet(title: "You need to install Final Cut Pro 7 first.".localized(), text: String(format: "After you have already installed Final Cut Pro 7 from a DVD installer or DMG image, Retroactive can download and update Final Cut Pro 7 from version 7.0 to 7.0.3, and unlock it to be compatible with %@.".localized(), ProcessInfo.versionName))
}
Expand Down Expand Up @@ -1582,6 +1582,8 @@ class AppManager: NSObject {
return self.chosenApp == .itunes && !Permission.shared.bashHasFullDiskAccess()
}

var maximizePhotoAppCompatibility = true

static func runTask(toolPath: String, arguments: [String], path: String, wait: Bool = true, allowError: Bool = false) -> OSStatus {
if (AppManager.shared.willRelaunchSoon) {
return errAuthorizationCanceled
Expand Down
4 changes: 2 additions & 2 deletions Retroactive/Common/Extensions/ProcesssInfo-Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let osAtLeast2021 = processInfo.isOperatingSystemAtLeast(OperatingSystemVersion(

let discouraged_osExactlyHighSierra = osMajorVersion == 10 && osMinorVersion == 13
let discouraged_osExactlyMojave = osMajorVersion == 10 && osMinorVersion == 14
private let osExactlyCatalina = osMajorVersion == 10 && osMinorVersion == 15
let discouraged_osExactlyCatalina = osMajorVersion == 10 && osMinorVersion == 15
let discouraged_osExactlyBigSur = (osMajorVersion == 10 && osMinorVersion == 16) || osMajorVersion == 11
let discouraged_osHasExperimentalSupport = false

Expand All @@ -38,7 +38,7 @@ extension ProcessInfo {
if (discouraged_osExactlyMojave) {
return "macOS Mojave"
}
if (osExactlyCatalina) {
if (discouraged_osExactlyCatalina) {
return "macOS Catalina"
}
if (discouraged_osExactlyBigSur) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,11 @@
24829F6F235E478C00D5891C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
CLANG_ENABLE_OBJC_ARC = NO;
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 8;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
Expand All @@ -298,10 +299,11 @@
24829F70235E478C00D5891C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
CLANG_ENABLE_OBJC_ARC = NO;
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 8;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DYLIB_COMPATIBILITY_VERSION = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
60E4B4CE24022A8C00919F36 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
Expand All @@ -305,6 +306,7 @@
60E4B4CF24022A8C00919F36 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
Expand Down
Binary file modified Retroactive/Dependencies/ProcInfo/lib/libprocInfo.a
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 7D83A9DB1EB6465D001506F0;
Expand Down Expand Up @@ -280,6 +281,7 @@
7D83A9EE1EB6465D001506F0 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
CODE_SIGN_IDENTITY = "";
DEVELOPMENT_TEAM = VBG97UB4TA;
EXECUTABLE_PREFIX = lib;
Expand All @@ -294,6 +296,7 @@
7D83A9EF1EB6465D001506F0 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
CODE_SIGN_IDENTITY = "";
DEVELOPMENT_TEAM = VBG97UB4TA;
EXECUTABLE_PREFIX = lib;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 55ABCB4019881CA600B03F31;
Expand Down Expand Up @@ -312,13 +313,15 @@
55ABCB5319881CA600B03F31 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
55ABCB5419881CA600B03F31 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = x86_64;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
Expand All @@ -333,6 +336,7 @@
55708CC41B308025002D62A8 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
55ABCB4419881CA600B03F31 /* Build configuration list for PBXProject "insert_dylib" */ = {
isa = XCConfigurationList;
Expand Down
Binary file modified Retroactive/Dependencies/killpkg/bin/killpkg
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = x86_64;
CODE_SIGN_IDENTITY = "";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
Expand All @@ -292,6 +293,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ARCHS = x86_64;
CODE_SIGN_IDENTITY = "";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
Expand Down
2 changes: 1 addition & 1 deletion Retroactive/StepFour/CompletionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ class CompletionViewController: NSViewController {

@IBAction func behindTheScenesClicked(_ sender: Any) {
if (AppManager.shared.allowPatchingAgain == true) {
self.navigationController.pushViewController(AuthenticateViewController.instantiate(), animated: true)
AppDelegate.pushAuthenticateVC()
return
}
AppDelegate.current.safelyOpenURL(AppManager.shared.behindTheScenesOfChosenApp)
Expand Down
12 changes: 4 additions & 8 deletions Retroactive/StepOne/AppFinder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class AppFinder: NSObject {
return
}
}
self.pushAuthenticateVC()
AppDelegate.pushAuthenticateVC()
}
}

Expand Down Expand Up @@ -182,7 +182,7 @@ class AppFinder: NSObject {
AppManager.shared.updateSelectedApp()
}
if (result == .alertSecondButtonReturn) {
self.pushAuthenticateVC()
AppDelegate.pushAuthenticateVC()
}
}
return
Expand All @@ -209,7 +209,7 @@ class AppFinder: NSObject {
}
if matchesCompatible && AppManager.shared.existingBundleIDOfChosenApp.contains(identifier) {
AppManager.shared.locationOfChosenApp = bundlePath
self.pushAuthenticateVC()
AppDelegate.pushAuthenticateVC()
} else {
let text = String(format: "%@ %@ is not %@ %@. To proceed, you need to locate a valid copy of %@ %@.".localized(), url?.deletingPathExtension().lastPathComponent ?? "", displayShortVersionNumberString, name, compat, name, compat)
AppDelegate.showTextSheet(title: "Selected app is incompatible".localized(), text: text)
Expand All @@ -231,7 +231,7 @@ class AppFinder: NSObject {
if AppManager.shared.chosenApp == .itunes {
let itunesPath = "/Applications/iTunes.app"
AppManager.shared.locationOfChosenApp = itunesPath
self.pushAuthenticateVC()
AppDelegate.pushAuthenticateVC()
return
}
AppDelegate.rootVC?.navigationController.pushViewController(GuidanceViewController.instantiate(), animated: true)
Expand All @@ -248,8 +248,4 @@ class AppFinder: NSObject {
AppDelegate.pushCompletionVC()
}

private func pushAuthenticateVC() {
AppDelegate.rootVC?.navigationController.pushViewController(AuthenticateViewController.instantiate(), animated: true)
}

}
21 changes: 16 additions & 5 deletions Retroactive/StepThree/ProgressViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ class ProgressViewController: NSViewController, URLSessionDelegate, URLSessionDa
let audioAnalysisPath = "\(appPath)/Contents/Frameworks/NyxAudioAnalysis.framework"
let pluginManagerPath = "\(appPath)/Contents/Frameworks/PluginManager.framework"
let fakeAppKitPath = "\(appPath)/Contents/Frameworks/AppKit.framework"
let maximizeCompatibility = AppManager.shared.maximizePhotoAppCompatibility

self.runTaskAtTemp(toolPath: "/bin/rm", arguments: ["-rf", audioAnalysisPath])
self.runTaskAtTemp(toolPath: "/bin/rm", arguments: ["-rf", photoFixerPath])
Expand All @@ -288,18 +289,28 @@ class ProgressViewController: NSViewController, URLSessionDelegate, URLSessionDa

self.runTask(toolPath: "/bin/cp", arguments: ["-R", "\(resourcePath)/NyxAudioAnalysis", audioAnalysisPath])
self.runTask(toolPath: "/bin/cp", arguments: ["-R", "\(resourcePath)/ApertureFixer", photoFixerPath])
self.runTask(toolPath: "/bin/cp", arguments: ["-R", "\(resourcePath)/PluginManager", pluginManagerPath])
self.runTask(toolPath: "/bin/cp", arguments: ["-R", "\(resourcePath)/AppKitAperture", fakeAppKitPath])

if (maximizeCompatibility) {
self.runTask(toolPath: "/bin/cp", arguments: ["-R", "\(resourcePath)/PluginManager", pluginManagerPath])
self.runTask(toolPath: "/bin/cp", arguments: ["-R", "\(resourcePath)/AppKitAperture", fakeAppKitPath])
}

self.stage3Started()
let originalPluginManagerPath = "/Library/Frameworks/PluginManager.framework/Versions/B/PluginManager"
let patchedPluginManagerPath = "@executable_path/../Frameworks/PluginManager.framework/Versions/B/PluginManager"
let originalAppKitPath = "/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit"
let patchedAppKitPath = "@executable_path/../Frameworks/AppKit.framework/Versions/C/AppKit"
let resolvedOldAppKitArg = maximizeCompatibility ? originalAppKitPath : patchedAppKitPath
let resolvedNewAppKitArg = maximizeCompatibility ? patchedAppKitPath : originalAppKitPath
ProgressViewController.runTask(toolPath: "install_name_tool_packed", arguments: ["-change", "/Library/Frameworks/NyxAudioAnalysis.framework/Versions/A/NyxAudioAnalysis", "@executable_path/../Frameworks/NyxAudioAnalysis.framework/Versions/A/NyxAudioAnalysis", "\(appPath)/Contents/Frameworks/iLifeSlideshow.framework/Versions/A/iLifeSlideshow"], path: resourcePath)
ProgressViewController.runTask(toolPath: "install_name_tool_packed", arguments: ["-change", "/Library/Frameworks/PluginManager.framework/Versions/B/PluginManager", "@executable_path/../Frameworks/PluginManager.framework/Versions/B/PluginManager", "\(appPath)/Contents/MacOS/Aperture"], path: resourcePath)
ProgressViewController.runTask(toolPath: "install_name_tool_packed", arguments: ["-change", "/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit", "@executable_path/../Frameworks/AppKit.framework/Versions/C/AppKit", "\(appPath)/Contents/Frameworks/ProKit.framework/Versions/A/ProKit"], path: resourcePath)
ProgressViewController.runTask(toolPath: "install_name_tool_packed", arguments: ["-change", "/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit", "@executable_path/../Frameworks/AppKit.framework/Versions/C/AppKit", "\(appPath)/Contents/Frameworks/iLifeKit.framework/Versions/A/iLifeKit"], path: resourcePath)
ProgressViewController.runTask(toolPath: "install_name_tool_packed", arguments: ["-change", maximizeCompatibility ? originalPluginManagerPath : patchedPluginManagerPath, maximizeCompatibility ? patchedPluginManagerPath : originalPluginManagerPath, "\(appPath)/Contents/MacOS/Aperture"], path: resourcePath)
ProgressViewController.runTask(toolPath: "install_name_tool_packed", arguments: ["-change", resolvedOldAppKitArg, resolvedNewAppKitArg, "\(appPath)/Contents/Frameworks/ProKit.framework/Versions/A/ProKit"], path: resourcePath)
ProgressViewController.runTask(toolPath: "install_name_tool_packed", arguments: ["-change", resolvedOldAppKitArg, resolvedNewAppKitArg, "\(appPath)/Contents/Frameworks/iLifeKit.framework/Versions/A/iLifeKit"], path: resourcePath)
ProgressViewController.runTask(toolPath: "insert_dylib", arguments: [AppManager.shared.fixerBinaryRelativeToExecutablePath, "\(appPath)/Contents/MacOS/\(AppManager.shared.binaryNameOfChosenApp)", "--inplace"], path: resourcePath)
if let patchedBundleID = AppManager.shared.patchedBundleIDOfChosenApp {
self.runTask(toolPath: "/usr/bin/plutil", arguments: ["-replace", kCFBundleIdentifier, "-string", patchedBundleID, "Contents/Info.plist"])
}
self.runTask(toolPath: "/usr/bin/plutil", arguments: ["-replace", kLSMinimumSystemVersion, "-string", "10.10", "Contents/Info.plist"])
self.runTask(toolPath: "/bin/mkdir", arguments: ["-p", "/Library/Application Support/Aperture/Plug-Ins"])

self.stage4Started()
Expand Down
Binary file modified Retroactive/Support/ApertureFixer/Versions/A/ApertureFixer
Binary file not shown.
18 changes: 10 additions & 8 deletions Retroactive/Support/ApertureFixer/Versions/A/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>19G2021</string>
<string>19H15</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand All @@ -23,21 +23,23 @@
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>7</string>
<string>8</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>11E801a</string>
<string>12B45b</string>
<key>DTPlatformName</key>
<string>macosx</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<string>11.0</string>
<key>DTSDKBuild</key>
<string>19G68</string>
<string>20A2408</string>
<key>DTSDKName</key>
<string>macosx10.15</string>
<string>macosx11.0</string>
<key>DTXcode</key>
<string>1170</string>
<string>1220</string>
<key>DTXcodeBuild</key>
<string>11E801a</string>
<string>12B45b</string>
<key>LSMinimumSystemVersion</key>
<string>10.10</string>
</dict>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<dict>
<key>Resources/Info.plist</key>
<data>
S0THKQcBOXHkjSOgLIzZumml+CI=
CfxFYTs9HnCOP6kbb4u9WZxOboE=
</data>
</dict>
<key>files2</key>
Expand Down Expand Up @@ -37,11 +37,11 @@
<dict>
<key>hash</key>
<data>
S0THKQcBOXHkjSOgLIzZumml+CI=
CfxFYTs9HnCOP6kbb4u9WZxOboE=
</data>
<key>hash2</key>
<data>
w3zD0e2vOAqX76fIZiEpPFed1pEF1MJDiCaYg94BsUQ=
iaBJ1O0sj1We8pE7kmX4WV5K3BPQNsN+iAjH/1nKueI=
</data>
</dict>
</dict>
Expand Down
Loading

0 comments on commit d972274

Please sign in to comment.