forked from organicmaps/organicmaps
[ios] Hide all instead of show all.
This commit is contained in:
parent
ab8d95ad28
commit
c484ee3afa
5 changed files with 15 additions and 11 deletions
|
@ -247,7 +247,7 @@ extension BMCViewController: UITableViewDelegate {
|
|||
switch viewModel.sectionType(section: section) {
|
||||
case .permissions: return permissionsHeader
|
||||
case .categories:
|
||||
categoriesHeader.isShowAll = !viewModel.areAllCategoriesVisible()
|
||||
categoriesHeader.isShowAll = viewModel.areAllCategoriesInvisible()
|
||||
return categoriesHeader
|
||||
case .actions: return actionsHeader
|
||||
case .notifications: return notificationsHeader
|
||||
|
@ -289,7 +289,7 @@ extension BMCViewController: BMCPermissionsCellDelegate {
|
|||
extension BMCViewController: BMCCategoryCellDelegate {
|
||||
func visibilityAction(category: BMCCategory) {
|
||||
viewModel.updateCategoryVisibility(category: category)
|
||||
categoriesHeader.isShowAll = !viewModel.areAllCategoriesVisible()
|
||||
categoriesHeader.isShowAll = viewModel.areAllCategoriesInvisible()
|
||||
}
|
||||
|
||||
func moreAction(category: BMCCategory, anchor: UIView) {
|
||||
|
@ -307,6 +307,6 @@ extension BMCViewController: BMCPermissionsHeaderDelegate {
|
|||
extension BMCViewController: BMCCategoriesHeaderDelegate {
|
||||
func visibilityAction(isShowAll: Bool) {
|
||||
viewModel.updateAllCategoriesVisibility(isShowAll: isShowAll)
|
||||
categoriesHeader.isShowAll = !viewModel.areAllCategoriesVisible()
|
||||
categoriesHeader.isShowAll = viewModel.areAllCategoriesInvisible()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -123,8 +123,8 @@ extension BMCDefaultViewModel: BMCViewModel {
|
|||
}
|
||||
}
|
||||
|
||||
func areAllCategoriesVisible() -> Bool {
|
||||
return categories.reduce(true) { $0 && $1.isVisible }
|
||||
func areAllCategoriesInvisible() -> Bool {
|
||||
return BM.areAllCategoriesInvisible()
|
||||
}
|
||||
|
||||
func updateAllCategoriesVisibility(isShowAll: Bool) {
|
||||
|
|
|
@ -24,7 +24,8 @@ protocol BMCViewModel: AnyObject {
|
|||
|
||||
func item(indexPath: IndexPath) -> BMCModel
|
||||
|
||||
func areAllCategoriesVisible() -> Bool
|
||||
func areAllCategoriesInvisible() -> Bool
|
||||
|
||||
func updateAllCategoriesVisibility(isShowAll: Bool)
|
||||
func updateCategoryVisibility(category: BMCCategory)
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
+ (NSUInteger)filesCountForConversion;
|
||||
+ (void)convertAll;
|
||||
|
||||
+ (BOOL)areAllCategoriesInvisible;
|
||||
|
||||
- (instancetype)init __attribute__((unavailable("call +manager instead")));
|
||||
- (instancetype)copy __attribute__((unavailable("call +manager instead")));
|
||||
- (instancetype)copyWithZone:(NSZone *)zone __attribute__((unavailable("call +manager instead")));
|
||||
|
|
|
@ -162,11 +162,7 @@ using TLoopBlock = void (^)(Observer observer);
|
|||
|
||||
+ (void)setAllCategoriesVisible:(BOOL)isVisible
|
||||
{
|
||||
auto & bm = GetFramework().GetBookmarkManager();
|
||||
auto editSession = bm.GetEditSession();
|
||||
auto const & list = bm.GetBmGroupsIdList();
|
||||
for (auto const & groupId : list)
|
||||
editSession.SetIsVisible(groupId, isVisible);
|
||||
GetFramework().GetBookmarkManager().SetAllCategoriesVisibility(isVisible);
|
||||
}
|
||||
|
||||
+ (void)deleteCategory:(MWMMarkGroupID)groupId
|
||||
|
@ -294,4 +290,9 @@ using TLoopBlock = void (^)(Observer observer);
|
|||
[[UIViewController topViewController] presentViewController:alert animated:YES completion:nil];
|
||||
}
|
||||
|
||||
+ (BOOL)areAllCategoriesInvisible
|
||||
{
|
||||
return GetFramework().GetBookmarkManager().AreAllCategoriesInvisible();
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Add table
Reference in a new issue