Skip to content

Commit

Permalink
Uses display title for pinned sites
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarik Eshaq committed Dec 8, 2022
1 parent a192b4a commit b34f29d
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions Client/Frontend/Browser/MainMenuActionHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ class MainMenuActionHelper:
iconString: ImageIdentifiers.addShortcut) { _ in

guard let url = self.selectedTab?.url?.displayURL,
let title = self.selectedTab?.title
let title = self.selectedTab?.displayTitle
else { return }

self.profile.history.addPinnedTopSite(Site(url: url.absoluteString, title: title)).uponQueue(.main) { result in
Expand All @@ -750,15 +750,11 @@ class MainMenuActionHelper:
return SingleActionViewModel(title: .AppMenu.RemoveFromShortcuts,
iconString: ImageIdentifiers.removeFromShortcut) { _ in

guard let url = self.selectedTab?.url?.displayURL, let sql = self.profile.history as? SQLiteHistory else { return }

sql.getSites(forURLs: [url.absoluteString]).bind { val -> Success in
guard let site = val.successValue?.asArray().first?.flatMap({ $0 }) else {
return succeed()
}
guard let url = self.selectedTab?.url?.displayURL,
let title = self.selectedTab?.displayTitle
else { return }

return self.profile.history.removeFromPinnedTopSites(site)
}.uponQueue(.main) { result in
self.profile.history.removeFromPinnedTopSites(Site(url: url.absoluteString, title: title)).uponQueue(.main) { result in
if result.isSuccess {
self.delegate?.showToast(message: .AppMenu.RemovePinFromShortcutsConfirmMessage, toastAction: .removePinPage, url: nil)
}
Expand Down

0 comments on commit b34f29d

Please sign in to comment.