Skip to content

Commit

Permalink
Addressed Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDervishi committed Dec 23, 2024
1 parent bd56b05 commit 9d07d43
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
}
}

Expand Down

0 comments on commit 9d07d43

Please sign in to comment.