Skip to content

Commit

Permalink
Bugfix FXIOS-8686 [Login Autofill improvements] There is no confirmat…
Browse files Browse the repository at this point in the history
…ion toast message that the login was deleted (#23669)

* Fix: Delete password confirmation toast added

* currentTheme fix according merge changes

* Fix conflicts

* Improve string comments and add proper key value

* Adapt text to feedback on PR

* Remove strings that shouldn't be part of this PR

* Forgot one conflict to fix

---------

Co-authored-by: Nikolay Pochekuev <[email protected]>
  • Loading branch information
lmarceau and Nikolay Pochekuev authored Dec 11, 2024
1 parent d1c0308 commit ba0f5a2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions BrowserKit/Sources/Shared/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6871,6 +6871,11 @@ extension String {
tableName: "LoginManager",
value: nil,
comment: "Label for the button used to delete the current login.")
public static let LoginListDeleteToast = MZLocalizedString(
key: "LoginList.DeleteToast.v135",
tableName: "LoginManager",
value: "Password removed",
comment: "This message appears briefly as a notification (toast) to inform the user that a password has been successfully removed.")
}

// MARK: - Login Detail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ class PasswordManagerCoordinator: BaseCoordinator,
func pressedPasswordDetail(model: PasswordDetailViewControllerModel) {
let viewController = PasswordDetailViewController(viewModel: model, windowUUID: windowUUID)
viewController.coordinator = self
viewController.deleteHandler = { [weak self] in
self?.passwordManager?.showToast()
}
router.push(viewController)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ class PasswordManagerListViewController: SensitiveViewController, Themeable {
dismiss(animated: true)
}

func showToast() {
SimpleToast().showAlertWithText(.LoginListDeleteToast,
bottomContainer: view,
theme: themeManager.getCurrentTheme(for: windowUUID))
}

lazy var editButton = UIBarButtonItem(barButtonSystemItem: .edit,
target: self,
action: #selector(beginEditing))
Expand Down Expand Up @@ -328,6 +334,7 @@ private extension PasswordManagerListViewController {
self.cancelSelection()
self.loadLogins()
self.sendLoginsDeletedTelemetry()
self.showToast()
}
}
}, hasSyncedLogins: yes.successValue ?? true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class PasswordDetailViewController: SensitiveViewController, Themeable {
var notificationCenter: NotificationProtocol
let windowUUID: WindowUUID
var currentWindowUUID: UUID? { windowUUID }
var deleteHandler: (() -> Void)?

private lazy var tableView: UITableView = .build { [weak self] tableView in
guard let self = self else { return }
Expand Down Expand Up @@ -342,8 +343,9 @@ extension PasswordDetailViewController {
self.deleteAlert = UIAlertController.deleteLoginAlertWithDeleteCallback({ [unowned self] _ in
self.sendLoginsDeletedTelemetry()
self.viewModel.profile.logins.deleteLogin(id: self.viewModel.login.id) { _ in
DispatchQueue.main.async {
_ = self.navigationController?.popViewController(animated: true)
DispatchQueue.main.async { [weak self] in
_ = self?.navigationController?.popViewController(animated: true)
self?.deleteHandler?()
}
}
}, hasSyncedLogins: yes.successValue ?? true)
Expand Down

0 comments on commit ba0f5a2

Please sign in to comment.