Skip to content

Commit

Permalink
Ship review styling and copy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mallexxx committed Dec 17, 2023
1 parent 8064382 commit 5d5451b
Show file tree
Hide file tree
Showing 9 changed files with 162 additions and 95 deletions.
8 changes: 5 additions & 3 deletions DuckDuckGo/Common/Localizables/UserText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,8 @@ struct UserText {

// MARK: - Login Import & Export

static let importLoginsCSV = NSLocalizedString("import.logins.csv.title", value: "CSV Passwords File", comment: "Title text for the CSV importer")
static let importBookmarksHTML = NSLocalizedString("import.bookmarks.html.title", value: "HTML Bookmarks File", comment: "Title text for the HTML Bookmarks importer")
static let importLoginsCSV = NSLocalizedString("import.logins.csv.title", value: "CSV Passwords File (for other browsers)", comment: "Title text for the CSV importer")
static let importBookmarksHTML = NSLocalizedString("import.bookmarks.html.title", value: "HTML Bookmarks File (for other browsers)", comment: "Title text for the HTML Bookmarks importer")
static let importBookmarksSelectHTMLFile = NSLocalizedString("import.bookmarks.select-html-file", value: "Select Bookmarks HTML File…", comment: "Button text for selecting HTML Bookmarks file")
static let importLoginsSelectCSVFile = NSLocalizedString("import.logins.select-csv-file", value: "Select Passwords CSV File…", comment: "Button text for selecting a CSV file")
static func importLoginsSelectCSVFile(from source: DataImport.Source) -> String {
Expand All @@ -564,7 +564,9 @@ struct UserText {
static let importLoginsPasswords = NSLocalizedString("import.logins.passwords", value: "Passwords", comment: "Title text for the Passwords import option")

static let initiateImport = NSLocalizedString("import.data.initiate", value: "Import", comment: "Button text for importing data")
static let skipImportFormat = NSLocalizedString("import.data.skip.format", value: "Skip %@", comment: "Button text to skip a kind of imported data (Bookmarks or Passwords - %@)")
static let skipBookmarksImport = NSLocalizedString("import.data.skip.bookmarks", value: "Skip bookmarks", comment: "Button text to skip bookmarks manual import")
static let skipPasswordsImport = NSLocalizedString("import.data.skip.passwords", value: "Skip passwords", comment: "Button text to skip bookmarks manual import")
static let skip = NSLocalizedString("import.data.skip", value: "Skip", comment: "Button text to skip an import step")
static let done = NSLocalizedString("import.data.done", value: "Done", comment: "Button text for finishing the data import")
static let manualImport = NSLocalizedString("import.data.manual", value: "Manual import…", comment: "Button text for initiating manual data import using a HTML or CSV file when automatic import has failed")

Expand Down
12 changes: 9 additions & 3 deletions DuckDuckGo/DataImport/View/DataImportErrorView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@ struct DataImportErrorView: View {

var body: some View {
VStack(alignment: .leading, spacing: 8) {
Text("We were unable to import \(dataType.displayName) directly from \(source.importSourceName).",
comment: "Message when data import fails from a browser. %1$@ - Bookmarks or Passwords; %2$@ - a browser name")
.bold()
switch dataType {
case .bookmarks:
Text("We were unable to import bookmarks directly from \(source.importSourceName).",
comment: "Message when data import fails from a browser. %@ - a browser name")
.bold()
case .passwords:
Text("We were unable to import passwords directly from \(source.importSourceName).",
comment: "Message when data import fails from a browser. %@ - a browser name")
}

Text("Let’s try doing it manually. It won’t take long.",
comment: "Suggestion to switch to a Manual File Data Import when data import fails.")
Expand Down
18 changes: 14 additions & 4 deletions DuckDuckGo/DataImport/View/DataImportNoDataView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,21 @@ struct DataImportNoDataView: View {

var body: some View {
VStack(alignment: .leading, spacing: 8) {
Text("We couldn‘t find any \(dataType.displayName)", comment: "Data import error message: Bookmarks or Passwords (%@) weren‘t found.")
.bold()
switch dataType {
case .bookmarks:
Text("We couldn‘t find any bookmarks.", comment: "Data import error message: Bookmarks weren‘t found.")
.bold()

Text("You could try importing \(dataType.displayName) manually.",
comment: "Data import error subtitle: suggestion to import Bookmarks or Passwords (%@) manually by selecting a CSV or HTML file.")
Text("Try importing bookmarks manually instead.",
comment: "Data import error subtitle: suggestion to import Bookmarks manually by selecting a CSV or HTML file.")

case .passwords:
Text("We couldn‘t find any passwords.", comment: "Data import error message: Passwords weren‘t found.")
.bold()

Text("Try importing passwords manually instead.",
comment: "Data import error subtitle: suggestion to import Passwords manually by selecting a CSV or HTML file.")
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions DuckDuckGo/DataImport/View/DataImportSummaryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ struct DataImportSummaryView: View {
case (.passwords, .failure):
HStack {
failureImage()
Text("Passwords import failed.",
Text("Password import failed.",
comment: "Data import summary message of failed passwords import.")
}

Expand All @@ -103,7 +103,7 @@ struct DataImportSummaryView: View {
if summary.failed > 0 {
HStack {
failureImage()
Text("Passwords import failed: ",
Text("Password import failed: ",
comment: "Data import summary format of how many passwords (%lld) failed to import.")
+ Text(" " as String)
+ Text(String(summary.failed)).bold()
Expand Down
7 changes: 4 additions & 3 deletions DuckDuckGo/DataImport/View/DataImportTypePicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ struct DataImportTypePicker: View {
.disabled(!viewModel.importSource.supportedDataTypes.contains(dataType))

// subtitle
if !viewModel.importSource.supportedDataTypes.contains(dataType) {
Text("\(viewModel.importSource.importSourceName) does not support storing \(dataType.displayName)",
comment: "Data Import disabled checkbox message about a browser (%1$@) not supporting storing a data type (%2$@ - Bookmarks or Passwords)")
if case .passwords = dataType,
!viewModel.importSource.supportedDataTypes.contains(.passwords) {
Text("\(viewModel.importSource.importSourceName) does not support storing passwords",
comment: "Data Import disabled checkbox message about a browser (%@) not supporting storing passwords")
.foregroundColor(Color(.disabledControlTextColor))
}
}
Expand Down
21 changes: 17 additions & 4 deletions DuckDuckGo/DataImport/View/DataImportView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ struct DataImportView: View {
}
#endif
}
.font(.custom("SF Pro Text", size: 13))
.font(Font(NSFont(name: "SF Pro Text", size: 13)
// fallback when SF Pro Text is missing
?? NSFont.systemFont(ofSize: 13) as CTFont))
.frame(width: 512)
.fixedSize()
}
Expand All @@ -103,7 +105,7 @@ struct DataImportView: View {

// browser to import data from picker popup
if case .feedback = model.screen {} else {
DataImportSourcePicker(selectedSource: model.importSource) { importSource in
DataImportSourcePicker(importSources: model.availableImportSources, selectedSource: model.importSource) { importSource in
model.update(with: importSource)
}
.disabled(model.isImportSourcePickerDisabled)
Expand Down Expand Up @@ -242,7 +244,11 @@ struct DataImportView: View {
.padding(.leading, 20)
Spacer()
if case .normal = NSApp.runType {
Button("" as String) { debugViewDisabled.toggle() }
Button {
debugViewDisabled.toggle()
} label: {
Image(.closeLarge)
}
.buttonStyle(.borderless)
.padding(.trailing, 20)
}
Expand Down Expand Up @@ -353,7 +359,14 @@ extension DataImportViewModel.ButtonType {
case .initiateImport:
UserText.initiateImport
case .skip:
String(format: UserText.skipImportFormat, dataType?.displayName ?? "")
switch dataType {
case .bookmarks:
UserText.skipBookmarksImport
case .passwords:
UserText.skipPasswordsImport
case nil:
UserText.skip
}
case .cancel:
UserText.cancel
case .back:
Expand Down
51 changes: 30 additions & 21 deletions DuckDuckGo/DataImport/View/FileImportView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func fileImportInstructionsBuilder(source: DataImport.Source, dataType: DataImpo
%d Open **%s**
%d In a fresh tab, click %@ then **Google Password Manager → Settings**
%d Find “Export Passwords” and click **Download File**
%d Save the passwords file someplace you can find it (e.g. Desktop)
%d Save the passwords file someplace you can find it (e.g., Desktop)
%d %@
""", comment: """
Instructions to import Passwords as CSV from Google Chrome browser.
Expand All @@ -50,7 +50,7 @@ func fileImportInstructionsBuilder(source: DataImport.Source, dataType: DataImpo
%d Click %@ to open the application menu then click **Password Manager**
%d Click %@ **at the top left** of the Password Manager and select **Settings**
%d Find “Export Passwords” and click **Download File**
%d Save the passwords file someplace you can find it (e.g. Desktop)
%d Save the passwords file someplace you can find it (e.g., Desktop)
%d %@
""", comment: """
Instructions to import Passwords as CSV from Brave browser.
Expand All @@ -71,7 +71,7 @@ func fileImportInstructionsBuilder(source: DataImport.Source, dataType: DataImpo
%d Open **%s**
%d In a fresh tab, click %@ then **Password Manager → Settings**
%d Find “Export Passwords” and click **Download File**
%d Save the passwords file someplace you can find it (e.g. Desktop)
%d Save the passwords file someplace you can find it (e.g., Desktop)
%d %@
""", comment: """
Instructions to import Passwords as CSV from Chromium-based browsers.
Expand All @@ -88,9 +88,9 @@ func fileImportInstructionsBuilder(source: DataImport.Source, dataType: DataImpo
case (.coccoc, .passwords):
NSLocalizedString("import.csv.instructions.coccoc", value: """
%d Open **%s**
%d Type “_coccoc://settings/passwords_” into the Address field
%d Type “_coccoc://settings/passwords_” into the Address bar
%d Click %@ (on the right from _Saved Passwords_) and select **Export passwords**
%d Save the passwords file someplace you can find it (e.g. Desktop)
%d Save the passwords file someplace you can find it (e.g., Desktop)
%d %@
""", comment: """
Instructions to import Passwords as CSV from Chromium-based browsers.
Expand All @@ -110,7 +110,7 @@ func fileImportInstructionsBuilder(source: DataImport.Source, dataType: DataImpo
%d Use the Menu Bar to select **View → Show Password Manager**
%d Select **Settings**
%d Find “Export Passwords” and click **Download File**
%d Save the passwords file someplace you can find it (e.g. Desktop)
%d Save the passwords file someplace you can find it (e.g., Desktop)
%d %@
""", comment: """
Instructions to import Passwords as CSV from Chromium-based browsers.
Expand All @@ -125,7 +125,7 @@ func fileImportInstructionsBuilder(source: DataImport.Source, dataType: DataImpo
case (.vivaldi, .passwords):
NSLocalizedString("import.csv.instructions.vivaldi", value: """
%d Open **%s**
%d Type “_chrome://settings/passwords_” into the Address field
%d Type “_chrome://settings/passwords_” into the Address bar
%d Click %@ (on the right from _Saved Passwords_) and select **Export passwords**
%d Save the file someplace you can find it (e.g., Desktop)
%d %@
Expand All @@ -146,7 +146,7 @@ func fileImportInstructionsBuilder(source: DataImport.Source, dataType: DataImpo
%d Open **%s**
%d Use the Menu Bar to select **View → Show Password Manager**
%d Click %@ (on the right from _Saved Passwords_) and select **Export passwords**
%d Save the passwords file someplace you can find it (e.g. Desktop)
%d Save the passwords file someplace you can find it (e.g., Desktop)
%d %@
""", comment: """
Instructions to import Passwords as CSV from Chromium-based browsers.
Expand All @@ -166,7 +166,7 @@ func fileImportInstructionsBuilder(source: DataImport.Source, dataType: DataImpo
%d Click %@ to open the application menu then click **Passwords and cards**
%d Click %@ then **Export passwords**
%d Choose **To a text file (not secure)** and click **Export**
%d Save the passwords file someplace you can find it (e.g. Desktop)
%d Save the passwords file someplace you can find it (e.g., Desktop)
%d %@
""", comment: """
Instructions to import Passwords as CSV from Yandex Browser.
Expand Down Expand Up @@ -278,7 +278,7 @@ func fileImportInstructionsBuilder(source: DataImport.Source, dataType: DataImpo
NSLocalizedString("import.csv.instructions.safari", value: """
%d Open **Safari**
%d Select **File → Export → Passwords**
%d Save the passwords file someplace you can find it (e.g. Desktop)
%d Save the passwords file someplace you can find it (e.g., Desktop)
%d %@
""", comment: """
Instructions to import Passwords as CSV from Safari.
Expand All @@ -292,7 +292,7 @@ func fileImportInstructionsBuilder(source: DataImport.Source, dataType: DataImpo
NSLocalizedString("import.html.instructions.safari", value: """
%d Open **Safari**
%d Select **File → Export → Bookmarks**
%d Save the passwords file someplace you can find it (e.g. Desktop)
%d Save the passwords file someplace you can find it (e.g., Desktop)
%d %@
""", comment: """
Instructions to import Bookmarks exported as HTML from Safari.
Expand All @@ -307,7 +307,7 @@ func fileImportInstructionsBuilder(source: DataImport.Source, dataType: DataImpo
%d Open **%s**
%d Click %@ to open the application menu then click **Passwords**
%d Click %@ then **Export Logins…**
%d Save the passwords file someplace you can find it (e.g. Desktop)
%d Save the passwords file someplace you can find it (e.g., Desktop)
%d %@
""", comment: """
Instructions to import Passwords as CSV from Firefox.
Expand Down Expand Up @@ -347,7 +347,7 @@ func fileImportInstructionsBuilder(source: DataImport.Source, dataType: DataImpo
%d Select **File → Export** from the Menu Bar and choose the account you want to export
%d Enter your 1Password account password
%d Select the File Format: **CSV (Logins and Passwords only)**
%d Click Export Data and save the file someplace you can find it (e.g. Desktop)
%d Click Export Data and save the file someplace you can find it (e.g., Desktop)
%d %@
""", comment: """
Instructions to import Passwords as CSV from 1Password 8.
Expand All @@ -361,11 +361,11 @@ func fileImportInstructionsBuilder(source: DataImport.Source, dataType: DataImpo
case (.onePassword7, .passwords):
NSLocalizedString("import.csv.instructions.onePassword7", value: """
%d Open and unlock **%s**
%d Select the vault you want to Export (You cannot export from “All Vaults.”)
%d Select the vault you want to export (you can only export one vault at a time)
%d Select **File → Export → All Items** from the Menu Bar
%d Enter your 1Password master or account password
%d Select the File Format: **iCloud Keychain (.csv)**
%d Save the passwords file someplace you can find it (e.g. Desktop)
%d Save the passwords file someplace you can find it (e.g., Desktop)
%d %@
""", comment: """
Instructions to import Passwords as CSV from 1Password 7.
Expand All @@ -381,8 +381,8 @@ func fileImportInstructionsBuilder(source: DataImport.Source, dataType: DataImpo
%d Open and unlock **%s**
%d Select **File → Export vault** from the Menu Bar
%d Select the File Format: **.csv**
%d Enter your Bitwarden Master password
%d Click %@ and save the file someplace you can find it (e.g. Desktop)
%d Enter your Bitwarden master password
%d Click %@ and save the file someplace you can find it (e.g., Desktop)
%d %@
""", comment: """
Instructions to import Passwords as CSV from Bitwarden.
Expand Down Expand Up @@ -485,9 +485,18 @@ struct FileImportView: View {
if [.onePassword7, .onePassword8].contains(source) {
HStack {
Image(.info)
Text("""
You can find your version by selecting **\(source.importSourceName) → About \(source.importSourceName)** from the Menu Bar
""", comment: "Instructions how to find an installed 1Password password manager app version. %1$@, %2$@ - app name (1Password)")
// markdown not supported on macOS 11
InstructionsView {
NSLocalizedString("import.onePassword.app.version.info", value: """
You can find your version by selecting **%s → About %s** from the Menu Bar.
""", comment: """
Instructions how to find an installed 1Password password manager app version.
%1$s, %2$s - app name (1Password)
""")
source.importSourceName
source.importSourceName
}

Spacer()
}
.padding(EdgeInsets(top: 8, leading: 8, bottom: 8, trailing: 8))
Expand Down Expand Up @@ -819,7 +828,7 @@ struct CircleNumberView: View {

#Preview {
HStack {
FileImportView(source: .yandex, dataType: .passwords, isButtonDisabled: false)
FileImportView(source: .onePassword8, dataType: .passwords, isButtonDisabled: false)
.padding()
.frame(width: 512 - 20)
}
Expand Down
Loading

0 comments on commit 5d5451b

Please sign in to comment.