diff --git a/Scribe/InstallationTab/DownloadDataScreen.swift b/Scribe/InstallationTab/DownloadDataScreen.swift index 60676443..bd196c3b 100644 --- a/Scribe/InstallationTab/DownloadDataScreen.swift +++ b/Scribe/InstallationTab/DownloadDataScreen.swift @@ -167,27 +167,22 @@ struct LanguageListView: View { comment: "" ) - private let allLanguagesText = NSLocalizedString( - "i18n.app.download.menu_ui.download_data.all_languages", - value: "All languages", - comment: "" - ) - @State private var showConfirmDialog = false @State private var targetLanguage = "" @State private var selectedLanguageCode = "" let userDefaults = UserDefaults(suiteName: "group.be.scri.userDefaultsContainer")! - private func handleButtonClick(targetLang: String, langCode: String) { - if langCode == "all" { - let toDownload = stateManager.downloadStates.keys.filter { + private func handleUpdateAllLanguages() { + let toDownload = stateManager.downloadStates.keys.filter { stateManager.downloadStates[$0] != .updated && stateManager.downloadStates[$0] != .downloading - } - for lang in toDownload { + } + + for lang in toDownload { stateManager.handleDownloadAction(key: lang) } - return - } + } + + private func handleButtonClick(targetLang: String, langCode: String) { targetLanguage = targetLang selectedLanguageCode = langCode @@ -219,17 +214,22 @@ struct LanguageListView: View { EmptyStateView() } else { VStack(spacing: 0) { - LanguageDownloadCard( - language: allLanguagesText, - state: allLanguagesState, - action: { - handleButtonClick(targetLang: allLanguagesText, langCode: "all") + HStack { + Spacer() + Text(NSLocalizedString( + "i18n.app.download.menu_ui.download_data.update_all", + value: "Update all", + comment: "" + )) + .foregroundColor(Color("linkBlue")) + .font(.system(size: 20, weight: .medium)) + .padding(.horizontal, 12) + .padding(.bottom, 10) + .onTapGesture { + handleUpdateAllLanguages() } - ) - - Divider() - .padding(.vertical, 8) - + } + .padding(.horizontal, 4) ForEach(Array(languages.enumerated()), id: \.offset) { index, section in let langCode: String = { if case let .specificLang(code) = section.sectionState { diff --git a/Scribe/InstallationTab/DownloadStateManager.swift b/Scribe/InstallationTab/DownloadStateManager.swift index c3e7afa0..2a6d60d1 100644 --- a/Scribe/InstallationTab/DownloadStateManager.swift +++ b/Scribe/InstallationTab/DownloadStateManager.swift @@ -21,7 +21,7 @@ class DownloadStateManager: ObservableObject { /// Initialize download states for languages. func initializeStates(languages: [String]) { - for language in languages where language != "all" { + for language in languages { if downloadStates[language] != nil { continue } // Check if data exists locally. @@ -102,7 +102,7 @@ class DownloadStateManager: ObservableObject { /// Check all downloaded languages for updates. func checkAllForUpdates() { - for (language, state) in downloadStates where language != "all" && state == .updated { + for (language, state) in downloadStates where state == .updated { checkForUpdates(language: language) } } diff --git a/Scribe/Views/Cells/InfoChildTableViewCell/InfoChildTableViewCell.swift b/Scribe/Views/Cells/InfoChildTableViewCell/InfoChildTableViewCell.swift index 756dfeda..541dba9b 100644 --- a/Scribe/Views/Cells/InfoChildTableViewCell/InfoChildTableViewCell.swift +++ b/Scribe/Views/Cells/InfoChildTableViewCell/InfoChildTableViewCell.swift @@ -69,7 +69,7 @@ final class InfoChildTableViewCell: UITableViewCell { var languageCode: String { guard let parentSection = parentSection, - case let .specificLang(lang) = parentSection.sectionState else { return "all" } + case let .specificLang(lang) = parentSection.sectionState else { return "" } return lang }