From 2e024c5c0e1063a96ca6c37b977ab14f4fe08fca Mon Sep 17 00:00:00 2001
From: Sabrina Tardio <44158575+SabrinaTardio@users.noreply.github.com>
Date: Wed, 28 Feb 2024 12:17:12 +0100
Subject: [PATCH] fix autofill UI for long copy (#2241)
Task/Issue URL:
https://app.asana.com/0/1199230911884351/1206628858529171/f
**Description**: Fix Ui to accomodate long copy (in preparation of
localisation)
---
.../View/PasswordManagementItemList.swift | 4 +-
.../View/PasswordManager.storyboard | 94 ++++++++++---------
.../View/SaveCredentialsViewController.swift | 19 ++++
3 files changed, 69 insertions(+), 48 deletions(-)
diff --git a/DuckDuckGo/SecureVault/View/PasswordManagementItemList.swift b/DuckDuckGo/SecureVault/View/PasswordManagementItemList.swift
index c717288450..6c91e23fc9 100644
--- a/DuckDuckGo/SecureVault/View/PasswordManagementItemList.swift
+++ b/DuckDuckGo/SecureVault/View/PasswordManagementItemList.swift
@@ -123,8 +123,6 @@ struct PasswordManagementItemListCategoryView: View {
return 11
}
- Spacer()
-
// MenuButton incorrectly displays a disabled state when you re-render it with a different image.
// According to Stack Overflow, this was fixed in macOS 12, but it can still be reproduced on 12.2.
// This also happens with Menu in macOS 11.0+, so using that on later macOS versions doesn't help.
@@ -135,8 +133,10 @@ struct PasswordManagementItemListCategoryView: View {
if model.sortDescriptor.order == .ascending {
PasswordManagementSortButton(imageName: "SortAscending")
+ .frame(width: 24)
} else {
PasswordManagementSortButton(imageName: "SortDescending")
+ .frame(width: 24)
}
}
.padding(.vertical, -4)
diff --git a/DuckDuckGo/SecureVault/View/PasswordManager.storyboard b/DuckDuckGo/SecureVault/View/PasswordManager.storyboard
index 9435721706..efa488a53a 100644
--- a/DuckDuckGo/SecureVault/View/PasswordManager.storyboard
+++ b/DuckDuckGo/SecureVault/View/PasswordManager.storyboard
@@ -11,21 +11,21 @@
-
+
-
+
-
+
-
+
-
+
@@ -36,15 +36,15 @@
-
+
-
+
-
+
@@ -112,7 +112,7 @@
-
+
@@ -179,20 +179,20 @@
-
+
-
+
-
+
-
+
-
+
@@ -238,7 +238,7 @@
-
+
@@ -246,18 +246,18 @@
-
+
-
+
-
+
-
-
+
+
@@ -324,7 +324,7 @@
-
+
@@ -402,7 +402,7 @@
-
+
@@ -422,8 +422,8 @@
-
-
+
+
@@ -482,8 +482,8 @@
-
-
+
+
@@ -491,6 +491,8 @@
+
+
@@ -607,7 +609,7 @@
-
-
+
+
-
+
-
+
@@ -639,7 +638,7 @@ DQ
@@ -946,8 +945,11 @@ DQ
-
-
+
+
+
+
+
@@ -1056,7 +1058,7 @@ DQ
-
+
diff --git a/DuckDuckGo/SecureVault/View/SaveCredentialsViewController.swift b/DuckDuckGo/SecureVault/View/SaveCredentialsViewController.swift
index 2f6fbd8601..91f2aea8c6 100644
--- a/DuckDuckGo/SecureVault/View/SaveCredentialsViewController.swift
+++ b/DuckDuckGo/SecureVault/View/SaveCredentialsViewController.swift
@@ -108,6 +108,10 @@ final class SaveCredentialsViewController: NSViewController {
fireproofCheckDescription.title = UserText.passwordManagementSaveCredentialsFireproofCheckboxDescription
saveButton.title = UserText.save
notNowSegmentedControl.setLabel(UserText.dontSave, forSegment: 0)
+ let fontAttributes = [NSAttributedString.Key.font: NSFont.systemFont(ofSize: NSFont.systemFontSize)]
+ let titleSize = (UserText.dontSave as NSString).size(withAttributes: fontAttributes)
+ notNowSegmentedControl.setWidth(titleSize.width + 16, forSegment: 0)
+ notNowSegmentedControl.setLabel(UserText.dontSave, forSegment: 0)
updateButton.title = UserText.update
openPasswordManagerButton.title = UserText.bitwardenPreferencesOpenBitwarden
dontUpdateButton.title = UserText.dontUpdate
@@ -170,6 +174,21 @@ final class SaveCredentialsViewController: NSViewController {
titleLabel.stringValue = UserText.pmSaveCredentialsNonEditableTitle
view.window?.makeFirstResponder(nil)
}
+ let notNowTrailingToOpenPasswordConstraint = passwordManagerNotNowButton.trailingAnchor.constraint(equalTo: openPasswordManagerButton.leadingAnchor, constant: -12)
+ let notNowTrailingToSaveButtonConstraint = passwordManagerNotNowButton.trailingAnchor.constraint(equalTo: saveButton.leadingAnchor, constant: -12)
+ let dontUpdateRrailingToOpenPasswordConstraint = dontUpdateButton.trailingAnchor.constraint(equalTo: openPasswordManagerButton.leadingAnchor, constant: -12)
+ let dontUpdateTrailingToUpdateButtonConstraint = dontUpdateButton.trailingAnchor.constraint(equalTo: updateButton.leadingAnchor, constant: -12)
+ if openPasswordManagerButton.isHidden {
+ notNowTrailingToOpenPasswordConstraint.isActive = false
+ dontUpdateRrailingToOpenPasswordConstraint.isActive = false
+ notNowTrailingToSaveButtonConstraint.isActive = true
+ dontUpdateTrailingToUpdateButtonConstraint.isActive = true
+ } else {
+ notNowTrailingToSaveButtonConstraint.isActive = false
+ dontUpdateTrailingToUpdateButtonConstraint.isActive = false
+ notNowTrailingToOpenPasswordConstraint.isActive = true
+ dontUpdateRrailingToOpenPasswordConstraint.isActive = true
+ }
}
private func updateSaveSegmentedControl() {