diff --git a/iphone/Maps/Bookmarks/BookmarksList/BookmarksListInterfaces.swift b/iphone/Maps/Bookmarks/BookmarksList/BookmarksListInterfaces.swift index 772a42175d..191cd03d44 100644 --- a/iphone/Maps/Bookmarks/BookmarksList/BookmarksListInterfaces.swift +++ b/iphone/Maps/Bookmarks/BookmarksList/BookmarksListInterfaces.swift @@ -6,6 +6,11 @@ enum BookmarksListVisibilityButtonState { case showAll } +enum BookmarkToolbarButtonSource { + case sort + case more +} + protocol IBookmarksListSectionViewModel { var numberOfItems: Int { get } var sectionTitle: String { get } @@ -51,7 +56,7 @@ protocol IBookmarksListView: AnyObject { func setInfo(_ info: IBookmarksListInfoViewModel) func setSections(_ sections: [IBookmarksListSectionViewModel]) func setMoreItemTitle(_ itemTitle: String) - func showMenu(_ items: [IBookmarksListMenuItem]) + func showMenu(_ items: [IBookmarksListMenuItem], from source: BookmarkToolbarButtonSource) func showColorPicker(with pickerType: ColorPickerType, _ completion: ((UIColor) -> Void)?) func enableEditing(_ enable: Bool) func share(_ url: URL, completion: @escaping () -> Void) diff --git a/iphone/Maps/Bookmarks/BookmarksList/BookmarksListPresenter.swift b/iphone/Maps/Bookmarks/BookmarksList/BookmarksListPresenter.swift index 231a75e705..9a5b955883 100644 --- a/iphone/Maps/Bookmarks/BookmarksList/BookmarksListPresenter.swift +++ b/iphone/Maps/Bookmarks/BookmarksList/BookmarksListPresenter.swift @@ -126,7 +126,7 @@ final class BookmarksListPresenter { sortItems.append(BookmarksListMenuItem(title: L("sort_default"), action: { [weak self] in self?.setDefaultSections() })) - view.showMenu(sortItems) + view.showMenu(sortItems, from: .sort) } private func showMoreMenu() { @@ -162,7 +162,7 @@ final class BookmarksListPresenter { self?.interactor.deleteBookmarksGroup() self?.delegate?.bookmarksListDidDeleteGroup() })) - view.showMenu(moreItems) + view.showMenu(moreItems, from: .more) } private func viewOnMap() { diff --git a/iphone/Maps/Bookmarks/BookmarksList/BookmarksListViewController.swift b/iphone/Maps/Bookmarks/BookmarksList/BookmarksListViewController.swift index bb791d25b9..45844cb8f0 100644 --- a/iphone/Maps/Bookmarks/BookmarksList/BookmarksListViewController.swift +++ b/iphone/Maps/Bookmarks/BookmarksList/BookmarksListViewController.swift @@ -214,7 +214,7 @@ extension BookmarksListViewController: IBookmarksListView { moreToolbarItem.title = itemTitle } - func showMenu(_ items: [IBookmarksListMenuItem]) { + func showMenu(_ items: [IBookmarksListMenuItem], from source: BookmarkToolbarButtonSource) { let actionSheet = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) items.forEach { item in let action = UIAlertAction(title: item.title, style: item.destructive ? .destructive : .default) { _ in @@ -224,7 +224,11 @@ extension BookmarksListViewController: IBookmarksListView { actionSheet.addAction(action) } actionSheet.addAction(UIAlertAction(title: L("cancel"), style: .cancel, handler: nil)) - actionSheet.popoverPresentationController?.barButtonItem = sortToolbarItem + let barButtonItem = switch source { + case .sort: sortToolbarItem + case .more: moreToolbarItem + } + actionSheet.popoverPresentationController?.barButtonItem = barButtonItem present(actionSheet, animated: true) }