From 9d07d4386deee0a1614c4f2d414ef326f0caad41 Mon Sep 17 00:00:00 2001 From: Daniel Dervishi <58835213+DanielDervishi@users.noreply.github.com> Date: Mon, 23 Dec 2024 16:00:28 -0500 Subject: [PATCH] Addressed Comments --- .../Bookmarks/BookmarksViewController.swift | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/firefox-ios/Client/Frontend/Library/Bookmarks/BookmarksViewController.swift b/firefox-ios/Client/Frontend/Library/Bookmarks/BookmarksViewController.swift index 0cf048705ff0..f0e86da17bd8 100644 --- a/firefox-ios/Client/Frontend/Library/Bookmarks/BookmarksViewController.swift +++ b/firefox-ios/Client/Frontend/Library/Bookmarks/BookmarksViewController.swift @@ -18,6 +18,7 @@ class BookmarksViewController: SiteTableViewController, static let FolderIconSize = CGSize(width: 24, height: 24) static let RowFlashDelay: TimeInterval = 0.4 static let toastDismissDelay = DispatchTimeInterval.seconds(8) + static let toastDelayBefore = DispatchTimeInterval.milliseconds(0) } // MARK: - Properties @@ -279,11 +280,13 @@ class BookmarksViewController: SiteTableViewController, self.deleteBookmarkNode(indexPath, bookmarkNode: bookmarkNode) - let toast = ActionToast(text: - String(format: .Bookmarks.Menu.DeletedBookmark, bookmarkNode.title), - bottomContainer: self.view, + let toastVM = ButtonToastViewModel( + labelText: String(format: .Bookmarks.Menu.DeletedBookmark, bookmarkNode.title), + buttonText: .UndoString, + textAlignment: .left) + let toast = ButtonToast(viewModel: toastVM, theme: self.currentTheme(), - buttonTitle: .UndoString) { + completion: {buttonPressed in guard let parentGUID = bookmarkTreeRoot.parentGUID else { return } self.restoreBookmarkTree(bookmarkTreeRoot: bookmarkTreeRoot, parentFolderGUID: parentGUID) { guid in self.profile.places.getBookmark(guid: guid).uponQueue(.main) { result in @@ -292,8 +295,14 @@ class BookmarksViewController: SiteTableViewController, self.addBookmarkNodeToTable(bookmarkNode: fxBookmarkNode) } } + }) + toast.showToast(viewController: self, delay: UX.toastDelayBefore, duration: UX.toastDismissDelay) { toast in + [ + toast.leadingAnchor.constraint(equalTo: self.view.leadingAnchor), + toast.trailingAnchor.constraint(equalTo: self.view.trailingAnchor), + toast.bottomAnchor.constraint(equalTo: self.view.bottomAnchor) + ] } - toast.show(toastDismissAfter: UX.toastDismissDelay) } }