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

View File

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

View File

@@ -12,6 +12,8 @@ struct Adobe_DownloaderApp: App {
@AppStorage("defaultLanguage") private var defaultLanguage: String = "ALL" @AppStorage("defaultLanguage") private var defaultLanguage: String = "ALL"
@AppStorage("downloadAppleSilicon") private var downloadAppleSilicon: Bool = true @AppStorage("downloadAppleSilicon") private var downloadAppleSilicon: Bool = true
@AppStorage("confirmRedownload") private var confirmRedownload: Bool = true @AppStorage("confirmRedownload") private var confirmRedownload: Bool = true
@AppStorage("useDefaultDirectory") private var useDefaultDirectory: Bool = true
@AppStorage("defaultDirectory") private var defaultDirectory: String = "Downloads"
init() { init() {
let isFirstRun = UserDefaults.standard.object(forKey: "downloadAppleSilicon") == nil || let isFirstRun = UserDefaults.standard.object(forKey: "downloadAppleSilicon") == nil ||
@@ -34,7 +36,8 @@ struct Adobe_DownloaderApp: App {
} }
if UserDefaults.standard.object(forKey: "useDefaultDirectory") == nil { 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,7 +87,22 @@ struct Adobe_DownloaderApp: App {
showLanguagePicker = true showLanguagePicker = true
} }
.padding(.trailing, 5) .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() Divider()
@@ -106,7 +124,7 @@ struct Adobe_DownloaderApp: App {
.lineLimit(1) .lineLimit(1)
.truncationMode(.middle) .truncationMode(.middle)
} }
.onChange(of: downloadAppleSilicon) { _, newValue in .onChange(of: downloadAppleSilicon) { newValue in
networkManager.updateAllowedPlatform(useAppleSilicon: newValue) 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() { private func checkCreativeCloudSetup() {
let setupPath = "/Library/Application Support/Adobe/Adobe Desktop Common/HDBox/Setup" let setupPath = "/Library/Application Support/Adobe/Adobe Desktop Common/HDBox/Setup"
if !FileManager.default.fileExists(atPath: setupPath) { if !FileManager.default.fileExists(atPath: setupPath) {

View File

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

View File

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

View File

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

View File

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

View File

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