Update: Supports macOS 13.5 and above.

This commit is contained in:
X1a0He
2024-11-06 21:57:17 +08:00
parent db6046141a
commit bc51149048
8 changed files with 143 additions and 60 deletions

View File

@@ -275,7 +275,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14.6;
MACOSX_DEPLOYMENT_TARGET = 13.5;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.x1a0he.macOS.Adobe-Downloader";
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -306,7 +306,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 14.6;
MACOSX_DEPLOYMENT_TARGET = 13.5;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.x1a0he.macOS.Adobe-Downloader";
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@@ -31,7 +31,7 @@
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"

View File

@@ -12,6 +12,8 @@ struct Adobe_DownloaderApp: App {
@AppStorage("defaultLanguage") private var defaultLanguage: String = "ALL"
@AppStorage("downloadAppleSilicon") private var downloadAppleSilicon: Bool = true
@AppStorage("confirmRedownload") private var confirmRedownload: Bool = true
@AppStorage("useDefaultDirectory") private var useDefaultDirectory: Bool = true
@AppStorage("defaultDirectory") private var defaultDirectory: String = "Downloads"
init() {
let isFirstRun = UserDefaults.standard.object(forKey: "downloadAppleSilicon") == nil ||
@@ -34,7 +36,8 @@ struct Adobe_DownloaderApp: App {
}
if UserDefaults.standard.object(forKey: "useDefaultDirectory") == nil {
UserDefaults.standard.set(false, forKey: "useDefaultDirectory")
UserDefaults.standard.set(true, forKey: "useDefaultDirectory")
UserDefaults.standard.set("Downloads", forKey: "defaultDirectory")
}
}
@@ -84,11 +87,26 @@ struct Adobe_DownloaderApp: App {
showLanguagePicker = true
}
.padding(.trailing, 5)
.buttonStyle(.borderless)
}
Divider()
HStack {
Toggle("使用默认目录", isOn: $useDefaultDirectory)
.padding(.leading, 5)
Spacer()
Text(formatPath(defaultDirectory))
.foregroundColor(.secondary)
.lineLimit(1)
.truncationMode(.middle)
Button("选择") {
selectDirectory()
}
.padding(.trailing, 5)
}
Divider()
HStack {
Toggle("重新下载时需要确认", isOn: $confirmRedownload)
.padding(.leading, 5)
@@ -106,7 +124,7 @@ struct Adobe_DownloaderApp: App {
.lineLimit(1)
.truncationMode(.middle)
}
.onChange(of: downloadAppleSilicon) { _, newValue in
.onChange(of: downloadAppleSilicon) { newValue in
networkManager.updateAllowedPlatform(useAppleSilicon: newValue)
}
}
@@ -154,6 +172,24 @@ struct Adobe_DownloaderApp: App {
}
}
private func formatPath(_ path: String) -> String {
if path.isEmpty { return String(localized: "未设置") }
return URL(fileURLWithPath: path).lastPathComponent
}
private func selectDirectory() {
let panel = NSOpenPanel()
panel.title = "选择默认下载目录"
panel.canCreateDirectories = true
panel.canChooseDirectories = true
panel.canChooseFiles = false
if panel.runModal() == .OK {
defaultDirectory = panel.url?.path ?? "Downloads"
useDefaultDirectory = true
}
}
private func checkCreativeCloudSetup() {
let setupPath = "/Library/Application Support/Adobe/Adobe Desktop Common/HDBox/Setup"
if !FileManager.default.fileExists(atPath: setupPath) {

View File

@@ -40,11 +40,19 @@ struct ContentView: View {
SearchField(text: $searchText)
.frame(maxWidth: 200)
SettingsLink {
Image(systemName: "gearshape")
.imageScale(.medium)
if #available(macOS 14.0, *) {
SettingsLink {
Image(systemName: "gearshape")
.imageScale(.medium)
}
.buttonStyle(.borderless)
} else {
Button(action: openSettings) {
Image(systemName: "gearshape")
.imageScale(.medium)
}
.buttonStyle(.borderless)
}
.buttonStyle(.borderless)
Button(action: refreshData) {
Image(systemName: "arrow.clockwise")
@@ -117,11 +125,18 @@ struct ContentView: View {
case .success:
if filteredProducts.isEmpty {
ContentUnavailableView(
"没有找到产品",
systemImage: "magnifyingglass",
description: Text("尝试使用不同的搜索关键词")
)
VStack {
Image(systemName: "magnifyingglass")
.font(.system(size: 36))
.foregroundColor(.secondary)
Text("没有找到产品")
.font(.headline)
.padding(.top)
Text("尝试使用不同的搜索关键词")
.font(.subheadline)
.foregroundColor(.secondary)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
} else {
ScrollView(showsIndicators: false) {
LazyVGrid(

View File

@@ -11,12 +11,12 @@ struct AboutView: View {
TabView {
GeneralSettingsView()
.tabItem {
Label("General", systemImage: "gear")
Label("通用", systemImage: "gear")
}
AboutAppView()
.tabItem {
Label("About", systemImage: "info.circle")
Label("关于", systemImage: "info.circle")
}
}
.frame(width: 500, height: 400)
@@ -82,7 +82,7 @@ struct GeneralSettingsView: View {
.lineLimit(1)
.truncationMode(.middle)
}
.onChange(of: downloadAppleSilicon) { _, newValue in
.onChange(of: downloadAppleSilicon) { newValue in
networkManager.updateAllowedPlatform(useAppleSilicon: newValue)
}
}
@@ -132,7 +132,7 @@ struct AboutAppView: View {
.resizable()
.frame(width: 96, height: 96)
Text("Welcome to Adobe Downloader")
Text("Adobe Downloader")
.font(.title2)
.bold()
@@ -140,7 +140,7 @@ struct AboutAppView: View {
.font(.subheadline)
.foregroundColor(.secondary)
Link("Contect @X1a0He",
Link("联系 @X1a0He",
destination: URL(string: "https://t.me/X1a0He")!)
.font(.caption)
.foregroundColor(.blue)
@@ -149,17 +149,17 @@ struct AboutAppView: View {
.font(.caption)
.foregroundColor(.blue)
Link("Thanks Drovosek01: adobe-packager",
Link("感谢 Drovosek01: adobe-packager",
destination: URL(string: "https://github.com/Drovosek01/adobe-packager")!)
.font(.caption)
.foregroundColor(.blue)
Link("Thanks QiuChenly: InjectLib",
Link("感谢 QiuChenly: InjectLib",
destination: URL(string: "https://github.com/QiuChenly/InjectLib")!)
.font(.caption)
.foregroundColor(.blue)
Text("Released under GPLv3.")
Text("GNU通用公共许可证GPL v3.")
.font(.caption)
.foregroundColor(.secondary)
}

View File

@@ -142,7 +142,7 @@ private struct LogSection: View {
.stroke(Color.secondary.opacity(0.2), lineWidth: 1)
)
.padding(.horizontal, 20)
.onChange(of: logs) { _, newValue in
.onChange(of: logs) { newValue in
if !newValue.isEmpty {
withAnimation {
proxy.scrollTo(newValue.count - 1, anchor: .bottom)

View File

@@ -81,11 +81,18 @@ struct LanguagePickerView: View {
}
if filteredLanguages.isEmpty {
ContentUnavailableView(
"未找到语言",
systemImage: "magnifyingglass",
description: Text("尝试其他搜索关键词")
)
VStack {
Image(systemName: "magnifyingglass")
.font(.system(size: 36))
.foregroundColor(.secondary)
Text("未找到语言")
.font(.headline)
.padding(.top)
Text("尝试其他搜索关键词")
.font(.subheadline)
.foregroundColor(.secondary)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
.frame(width: 320, height: 400)

View File

@@ -70,16 +70,6 @@
}
}
},
"About" : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "关于"
}
}
}
},
"Adobe Downloader" : {
},
@@ -96,27 +86,21 @@
"By X1a0He. ❤️ Love from China. ❤️" : {
},
"Contect @X1a0He" : {
"Github: Adobe Downloader" : {
},
"General" : {
"GNU通用公共许可证GPL v3." : {
"localizations" : {
"zh-Hans" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "通用"
"value" : "Released under GPLv3."
}
}
}
},
"Github: Adobe Downloader" : {
},
"OK" : {
},
"Released under GPLv3." : {
},
"Setup未备份提示" : {
"localizations" : {
@@ -127,15 +111,6 @@
}
}
}
},
"Thanks Drovosek01: adobe-packager" : {
},
"Thanks QiuChenly: InjectLib" : {
},
"Welcome to Adobe Downloader" : {
},
"下载" : {
"localizations" : {
@@ -310,6 +285,16 @@
}
}
},
"关于" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "About"
}
}
}
},
"关闭" : {
"localizations" : {
"en" : {
@@ -415,7 +400,7 @@
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "try using different keywords"
"value" : "Try using different keywords"
}
}
}
@@ -425,7 +410,7 @@
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "try other search keywords"
"value" : "Try other search keywords"
}
}
}
@@ -471,6 +456,26 @@
}
}
},
"感谢 Drovosek01: adobe-packager" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Thanks Drovosek01: adobe-packager"
}
}
}
},
"感谢 QiuChenly: InjectLib" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Thanks QiuChenly: InjectLib"
}
}
}
},
"按名称" : {
"localizations" : {
"en" : {
@@ -754,6 +759,16 @@
}
}
},
"联系 @X1a0He" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Contact @X1a0He"
}
}
}
},
"语言:" : {
"localizations" : {
"en" : {
@@ -795,6 +810,16 @@
}
}
},
"通用" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "General"
}
}
}
},
"重新下载" : {
"localizations" : {
"en" : {