diff --git a/BrowserKit/Sources/Shared/Strings.swift b/BrowserKit/Sources/Shared/Strings.swift index 9f3210484065..eb718a7c20ff 100644 --- a/BrowserKit/Sources/Shared/Strings.swift +++ b/BrowserKit/Sources/Shared/Strings.swift @@ -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 diff --git a/firefox-ios/Client/Coordinators/PasswordManagerCoordinator.swift b/firefox-ios/Client/Coordinators/PasswordManagerCoordinator.swift index f0fe6c832299..613e5f76cb5d 100644 --- a/firefox-ios/Client/Coordinators/PasswordManagerCoordinator.swift +++ b/firefox-ios/Client/Coordinators/PasswordManagerCoordinator.swift @@ -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) } diff --git a/firefox-ios/Client/Frontend/PasswordManagement/PasswordManagerListViewController.swift b/firefox-ios/Client/Frontend/PasswordManagement/PasswordManagerListViewController.swift index 2feaf39b4928..9b9cc93064ec 100644 --- a/firefox-ios/Client/Frontend/PasswordManagement/PasswordManagerListViewController.swift +++ b/firefox-ios/Client/Frontend/PasswordManagement/PasswordManagerListViewController.swift @@ -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)) @@ -328,6 +334,7 @@ private extension PasswordManagerListViewController { self.cancelSelection() self.loadLogins() self.sendLoginsDeletedTelemetry() + self.showToast() } } }, hasSyncedLogins: yes.successValue ?? true) diff --git a/firefox-ios/Client/Frontend/Settings/PasswordDetailViewController.swift b/firefox-ios/Client/Frontend/Settings/PasswordDetailViewController.swift index 2388bc4f9468..718fcb65663b 100644 --- a/firefox-ios/Client/Frontend/Settings/PasswordDetailViewController.swift +++ b/firefox-ios/Client/Frontend/Settings/PasswordDetailViewController.swift @@ -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 } @@ -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)