Skip to content

Commit 0c5f8be

Browse files
MBL-2801: Clean up search feature flags (#2626)
* MBL-2801: Clean up search feature flags * Address PR comments
1 parent f487e29 commit 0c5f8be

File tree

37 files changed

+150
-481
lines changed

37 files changed

+150
-481
lines changed

Kickstarter-iOS/Features/Search/Controller/SearchViewController.swift

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ internal final class SearchViewController: UITableViewController {
2323

2424
private let backgroundView = UIView()
2525
private let searchLoaderIndicator = UIActivityIndicatorView()
26-
private let showSortAndFilterHeader = MutableProperty<Bool>(false) // Bound to the view model property
27-
2826
private var sortAndFilterHeader: UIViewController?
2927

3028
private var searchBarWidth: CGFloat {
@@ -95,15 +93,11 @@ internal final class SearchViewController: UITableViewController {
9593
self.viewModel.outputs.showEmptyState
9694
.observeForUI()
9795
.observeValues { [weak self] params, visible in
98-
if featureSearchNewEmptyState() {
99-
let data = SearchEmptyStateSearchData(
100-
query: params.query,
101-
hasFilters: self?.viewModel.outputs.searchFilters.hasFilters == true
102-
)
103-
self?.dataSource.load(data: data, visible: visible)
104-
} else {
105-
self?.dataSource.load(params: params, visible: visible)
106-
}
96+
let data = SearchEmptyStateSearchData(
97+
query: params.query,
98+
hasFilters: self?.viewModel.outputs.searchFilters.hasFilters == true
99+
)
100+
self?.dataSource.load(data: data, visible: visible)
107101
self?.tableView.reloadData()
108102
}
109103

@@ -127,8 +121,6 @@ internal final class SearchViewController: UITableViewController {
127121
// All other filters go to the same modal.
128122
self?.showFilters(filterType: type)
129123
}
130-
131-
self.showSortAndFilterHeader <~ self.viewModel.outputs.showSortAndFilterHeader
132124
}
133125

134126
fileprivate func present(sheet viewController: UIViewController, withHeight _: CGFloat) {
@@ -263,8 +255,7 @@ internal final class SearchViewController: UITableViewController {
263255
}
264256

265257
override func tableView(_: UITableView, viewForHeaderInSection section: Int) -> UIView? {
266-
guard section == SearchDataSource.Section.projects.rawValue,
267-
self.showSortAndFilterHeader.value == true else {
258+
guard section == SearchDataSource.Section.projects.rawValue else {
268259
return nil
269260
}
270261

@@ -273,8 +264,7 @@ internal final class SearchViewController: UITableViewController {
273264

274265
private var headerHeight: CGFloat? = nil
275266
override func tableView(_: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
276-
guard section == SearchDataSource.Section.projects.rawValue,
277-
self.showSortAndFilterHeader.value == true else {
267+
guard section == SearchDataSource.Section.projects.rawValue else {
278268
return 0
279269
}
280270

Kickstarter-iOS/Features/Search/Controller/SearchViewControllerTests.swift

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,6 @@ internal final class SearchViewContollerTests: TestCase {
136136
GraphAPI.SearchQuery.Data.emptyResults
137137
)]
138138

139-
let mockRemoteConfig = MockRemoteConfigClient()
140-
mockRemoteConfig.features = [
141-
RemoteConfigFeature.searchNewEmptyState.rawValue: true
142-
]
143-
144139
var emptyStateTypeIterator = 0
145140

146141
orthogonalCombos(
@@ -151,7 +146,7 @@ internal final class SearchViewContollerTests: TestCase {
151146
.forEach { language, device, style in
152147
withEnvironment(
153148
apiService: MockService(fetchGraphQLResponses: emptyResponse),
154-
language: language, remoteConfigClient: mockRemoteConfig
149+
language: language
155150
) {
156151
let controller = Storyboard.Search.instantiate(SearchViewController.self)
157152
controller.overrideUserInterfaceStyle = style
@@ -178,29 +173,6 @@ internal final class SearchViewContollerTests: TestCase {
178173
}
179174
}
180175

181-
func testView_LegacyEmptyState() {
182-
let emptyResponse = [(
183-
GraphAPI.SearchQuery.self,
184-
GraphAPI.SearchQuery.Data.emptyResults
185-
)]
186-
187-
orthogonalCombos(Language.allLanguages, [Device.phone4_7inch, Device.phone5_8inch, Device.pad])
188-
.forEach { language, device in
189-
withEnvironment(
190-
apiService: MockService(fetchGraphQLResponses: emptyResponse), language: language
191-
) {
192-
let controller = Storyboard.Search.instantiate(SearchViewController.self)
193-
let (parent, _) = traitControllers(device: device, orientation: .portrait, child: controller)
194-
195-
controller.viewModel.inputs.searchTextChanged("abcdefgh")
196-
197-
self.scheduler.run()
198-
199-
assertSnapshot(matching: parent.view, as: .image, named: "lang_\(language)_device_\(device)")
200-
}
201-
}
202-
}
203-
204176
func testView_SearchState() {
205177
let searchResponse = [(
206178
GraphAPI.SearchQuery.self,
-220 Bytes
Loading
1.32 KB
Loading
Loading

0 commit comments

Comments
 (0)