Skip to content

Commit

Permalink
Fix "Details" copy alignment for Fire pop-up (#2739)
Browse files Browse the repository at this point in the history
Task/Issue URL: https://app.asana.com/0/1177771139624306/1205409896979119/f

**Description**:
Fixed the alignment for the “Details” button in the  `Fire` Popover.
  • Loading branch information
alessandroboron authored May 17, 2024
1 parent 6fff033 commit e889707
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 71 deletions.
1 change: 0 additions & 1 deletion DuckDuckGo/Common/Localizables/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ struct UserText {
static let currentWindow = NSLocalizedString("fire.currentWindow", value: "All sites visited in current window", comment: "Configuration option for fire button")
static let allDataDescription = NSLocalizedString("fire.all-data.description", value: "Clear all tabs and related site data", comment: "Description of the 'All Data' configuration option for the fire button")
static let currentWindowDescription = NSLocalizedString("fire.current-window.description", value: "Clear current window and related site data", comment: "Description of the 'Current Window' configuration option for the fire button")
static let selectedDomainsDescription = NSLocalizedString("fire.selected-domains.description", value: "Clear data only for selected domains", comment: "Description of the 'Current Window' configuration option for the fire button")
static let selectSiteToClear = NSLocalizedString("fire.select-site-to-clear", value: "Select a site to clear its data.", comment: "Info label in the fire button popover")
static func activeTabsInfo(tabs: Int, sites: Int) -> String {
let localized = NSLocalizedString("fire.active-tabs-info",
Expand Down
20 changes: 10 additions & 10 deletions DuckDuckGo/Fire/View/FirePopoverViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ final class FirePopoverViewController: NSViewController {
setUpStrings()
updateClearButtonAppearance()
setupOptionsButton()
updateCloseDetailsButton()
setupOpenCloseDetailsButton()
updateWarningWrapperView()

subscribeToViewModel()
Expand All @@ -125,7 +125,6 @@ final class FirePopoverViewController: NSViewController {
openFireWindowsTitleLabel.stringValue = UserText.fireDialogFireWindowTitle
fireWindowDescriptionLabel.stringValue = UserText.fireDialogFireWindowDescription
closeTabsLabel.stringValue = UserText.fireDialogCloseTabs
openDetailsButton.title = UserText.details
closeBurnerWindowButton.title = UserText.fireDialogBurnWindowButton
clearButton.title = UserText.clear
cancelButton.title = UserText.cancel
Expand All @@ -137,7 +136,6 @@ final class FirePopoverViewController: NSViewController {
return
}
firePopoverViewModel.clearingOption = clearingOption
updateCloseDetailsButton()
updateWarningWrapperView()
}

Expand Down Expand Up @@ -221,13 +219,16 @@ final class FirePopoverViewController: NSViewController {
button.attributedTitle = attrTitle
}

private func updateCloseDetailsButton() {
guard firePopoverViewModel.areAllSelected else {
closeDetailsButton.title = " \(UserText.selectedDomainsDescription)"
return
}
private func setupOpenCloseDetailsButton() {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.firstLineHeadIndent = 15
let title = NSMutableAttributedString(string: UserText.fireDialogDetails)
title.addAttributes([.paragraphStyle: paragraphStyle], range: NSRange(location: 0, length: title.length))

closeDetailsButton.title = " \(UserText.fireDialogDetails)"
openDetailsButton.attributedTitle = title
openDetailsButton.alignment = .left
closeDetailsButton.attributedTitle = title
closeDetailsButton.alignment = .left
}

private func updateWarningWrapperView() {
Expand Down Expand Up @@ -288,7 +289,6 @@ final class FirePopoverViewController: NSViewController {
let selectionIndexPaths = Set(selected.map {IndexPath(item: $0, section: self.firePopoverViewModel.selectableSectionIndex)})
self.collectionView.selectionIndexPaths = selectionIndexPaths
self.updateInfoLabel()
self.updateCloseDetailsButton()
}
}

Expand Down
60 changes: 0 additions & 60 deletions DuckDuckGo/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -19935,66 +19935,6 @@
}
}
},
"fire.selected-domains.description" : {
"comment" : "Description of the 'Current Window' configuration option for the fire button",
"extractionState" : "extracted_with_value",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Daten nur für ausgewählte Domains löschen"
}
},
"en" : {
"stringUnit" : {
"state" : "new",
"value" : "Clear data only for selected domains"
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
"value" : "Borrar datos solo para los dominios seleccionados"
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
"value" : "N'effacer les données que des domaines sélectionnés"
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
"value" : "Cancella i dati solo per i domini selezionati"
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Alleen gegevens wissen voor de geselecteerde domeinen"
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
"value" : "Wyczyść dane dotyczące tylko wybranych domen"
}
},
"pt" : {
"stringUnit" : {
"state" : "translated",
"value" : "Limpar dados apenas para domínios selecionados"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
"value" : "Функция Fire Button сотрет только данные выбранных сайтов"
}
}
}
},
"fireproof" : {
"comment" : "Fireproof button",
"extractionState" : "extracted_with_value",
Expand Down

0 comments on commit e889707

Please sign in to comment.