From 64c87030f3fa70ff3af1acaa1841caa47d6bb33c Mon Sep 17 00:00:00 2001 From: Kiryl Kaveryn Date: Mon, 6 May 2024 17:53:21 +0400 Subject: [PATCH] [ios] hide the `export all` button when there are no bookmarks Signed-off-by: Kiryl Kaveryn --- .../Categories/BMCViewModel/BMCDefaultViewModel.swift | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/iphone/Maps/Bookmarks/Categories/BMCViewModel/BMCDefaultViewModel.swift b/iphone/Maps/Bookmarks/Categories/BMCViewModel/BMCDefaultViewModel.swift index 88adf9c2c7310..31fd9ad90b457 100644 --- a/iphone/Maps/Bookmarks/Categories/BMCViewModel/BMCDefaultViewModel.swift +++ b/iphone/Maps/Bookmarks/Categories/BMCViewModel/BMCDefaultViewModel.swift @@ -32,7 +32,10 @@ final class BMCDefaultViewModel: NSObject { } private func setActions() { - actions = [.create, .exportAll] + actions = [.create] + if !manager.areAllCategoriesEmpty() { + actions.append(.exportAll) + } } private func setNotifications() { @@ -121,8 +124,8 @@ extension BMCDefaultViewModel { let category = categories[index] categories.remove(at: index) - manager.deleteCategory(category.categoryId) view?.delete(at: [IndexPath(row: index, section: section)]) + manager.deleteCategory(category.categoryId) } func checkCategory(name: String) -> Bool { @@ -165,6 +168,10 @@ extension BMCDefaultViewModel: BookmarksObserver { reloadData() } + func onBookmarksCategoryDeleted(_ groupId: MWMMarkGroupID) { + reloadData() + } + func onBookmarkDeleted(_: MWMMarkID) { reloadData() }