From 8386bd23539c80760f0a9b981a0769abe2469ca3 Mon Sep 17 00:00:00 2001 From: "Tanner W. Stokes" Date: Tue, 3 May 2022 14:40:07 -0400 Subject: [PATCH] Make the filter bar visibility optional. --- .../FilterableCategoriesViewController.swift | 15 ++++++++------- ...iteDesignContentCollectionViewController.swift | 3 ++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Gutenberg/Layout Picker/FilterableCategoriesViewController.swift b/WordPress/Classes/ViewRelated/Gutenberg/Layout Picker/FilterableCategoriesViewController.swift index 2128ae5c2cdf..cf6073b4c9ff 100644 --- a/WordPress/Classes/ViewRelated/Gutenberg/Layout Picker/FilterableCategoriesViewController.swift +++ b/WordPress/Classes/ViewRelated/Gutenberg/Layout Picker/FilterableCategoriesViewController.swift @@ -22,7 +22,7 @@ class FilterableCategoriesViewController: CollapsableHeaderViewController { debounceSelectionChange.call() } } - private let filterBar: CollapsableHeaderFilterBar + private let filterBar: CollapsableHeaderFilterBar? internal var categorySections: [CategorySection] { get { fatalError("This should be overridden by the subclass to provide a conforming collection of categories") @@ -57,14 +57,15 @@ class FilterableCategoriesViewController: CollapsableHeaderViewController { prompt: String? = nil, primaryActionTitle: String, secondaryActionTitle: String? = nil, - defaultActionTitle: String? = nil + defaultActionTitle: String? = nil, + showsFilterBar: Bool = true ) { self.analyticsLocation = analyticsLocation tableView = UITableView(frame: .zero, style: .plain) tableView.separatorStyle = .singleLine tableView.separatorInset = .zero tableView.showsVerticalScrollIndicator = false - filterBar = CollapsableHeaderFilterBar() + filterBar = showsFilterBar ? CollapsableHeaderFilterBar() : nil super.init(scrollableView: tableView, mainTitle: mainTitle, prompt: prompt, @@ -81,7 +82,7 @@ class FilterableCategoriesViewController: CollapsableHeaderViewController { override func viewDidLoad() { super.viewDidLoad() tableView.register(CategorySectionTableViewCell.nib, forCellReuseIdentifier: CategorySectionTableViewCell.cellReuseIdentifier) - filterBar.filterDelegate = self + filterBar?.filterDelegate = self tableView.dataSource = self configureCloseButton() } @@ -102,9 +103,9 @@ class FilterableCategoriesViewController: CollapsableHeaderViewController { } public func loadingStateChanged(_ isLoading: Bool) { - filterBar.shouldShowGhostContent = isLoading - filterBar.allowsMultipleSelection = !isLoading - filterBar.reloadData() + filterBar?.shouldShowGhostContent = isLoading + filterBar?.allowsMultipleSelection = !isLoading + filterBar?.reloadData() } } diff --git a/WordPress/Classes/ViewRelated/Site Creation/Design Selection/SiteDesignContentCollectionViewController.swift b/WordPress/Classes/ViewRelated/Site Creation/Design Selection/SiteDesignContentCollectionViewController.swift index 44636bed9c9a..fe8c9bd4cb8c 100644 --- a/WordPress/Classes/ViewRelated/Site Creation/Design Selection/SiteDesignContentCollectionViewController.swift +++ b/WordPress/Classes/ViewRelated/Site Creation/Design Selection/SiteDesignContentCollectionViewController.swift @@ -71,7 +71,8 @@ class SiteDesignContentCollectionViewController: FilterableCategoriesViewControl analyticsLocation: "site_creation", mainTitle: TextContent.mainTitle, primaryActionTitle: createsSite ? TextContent.createSiteButton : TextContent.chooseButton, - secondaryActionTitle: TextContent.previewButton + secondaryActionTitle: TextContent.previewButton, + showsFilterBar: false ) }