Skip to content

Commit

Permalink
Fixed Number Range Component Length issue (#404)
Browse files Browse the repository at this point in the history
Fixed Reset search API not called issue
  • Loading branch information
ankitgoyalgloballogic authored Nov 12, 2021
1 parent e3b5e24 commit 89ec46c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,14 @@ extension SearchNumberRangeComponentViewController: UITextFieldDelegate {
guard CharacterSet(charactersIn: "0123456789").isSuperset(of: CharacterSet(charactersIn: string)) else {
return false
}

let text = textField.updatedText(for: range, replacementString: string) ?? ""
if text.count > numberRangeViewModel.maxCharacters {
return false
}

if textField == minRangeTextField {
let text = textField.updatedText(for: range, replacementString: string)
checkForError(for: text, and: maxRangeTextField.text)
} else {
let text = textField.updatedText(for: range, replacementString: string)
checkForError(for: minRangeTextField.text, and: text)
}
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class SearchNumberRangeComponentViewModel: NSObject {
var selectedCategory: SearchCategories?
let stringConcatenator = "-"
var queryBuilder: String?
let maxCharacters = 9

var title: String {
return selectedCategory?.name ?? ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ extension ResultViewController {
dropDown.selectionAction = { (index: Int, item: String) in
self.resultsViewModel?.searchModel.selectedSearchFilter = self.resultsViewModel?.searchFilters[index]
self.updateCategory()
self.pageController?.refreshList() // refresh list by calling search api
}
}
}
Expand All @@ -252,6 +251,7 @@ extension ResultViewController {
categoryNameLabel.text = resultsViewModel?.selectedFilterName(for: selectedConfig)
resultsViewModel?.resetAdvanceSearch() // reset categories for selected value
resetChipCollectionView()
pageController?.refreshList() // refresh list by calling search api
showResetFilterButton()
}
}
Expand Down Expand Up @@ -487,6 +487,7 @@ extension ResultViewController {
if let selectedCategory = resultsViewModel?.getSelectedCategory() {
let viewController = SearchTextComponentViewController.instantiateViewController()
let bottomSheet = MDCBottomSheetController(contentViewController: viewController)
bottomSheet.dismissOnDraggingDownSheet = false
bottomSheet.delegate = self
viewController.coordinatorServices = coordinatorServices
viewController.textViewModel.selectedCategory = selectedCategory
Expand All @@ -507,6 +508,7 @@ extension ResultViewController {
if let selectedCategory = resultsViewModel?.getSelectedCategory() {
let viewController = SearchListComponentViewController.instantiateViewController()
let bottomSheet = MDCBottomSheetController(contentViewController: viewController)
bottomSheet.dismissOnDraggingDownSheet = false
bottomSheet.delegate = self
viewController.coordinatorServices = coordinatorServices
viewController.listViewModel.isRadioList = isRadio
Expand All @@ -528,6 +530,7 @@ extension ResultViewController {
if let selectedCategory = resultsViewModel?.getSelectedCategory() {
let viewController = SearchNumberRangeComponentViewController.instantiateViewController()
let bottomSheet = MDCBottomSheetController(contentViewController: viewController)
bottomSheet.dismissOnDraggingDownSheet = false
bottomSheet.delegate = self
viewController.coordinatorServices = coordinatorServices
viewController.numberRangeViewModel.selectedCategory = selectedCategory
Expand All @@ -548,6 +551,7 @@ extension ResultViewController {
if let selectedCategory = resultsViewModel?.getSelectedCategory() {
let viewController = SearchSliderRangeComponentViewController.instantiateViewController()
let bottomSheet = MDCBottomSheetController(contentViewController: viewController)
bottomSheet.dismissOnDraggingDownSheet = false
bottomSheet.delegate = self
viewController.coordinatorServices = coordinatorServices
viewController.sliderViewModel.selectedCategory = selectedCategory
Expand All @@ -568,6 +572,7 @@ extension ResultViewController {
if let selectedCategory = resultsViewModel?.getSelectedCategory() {
let viewController = SearchCalendarComponentViewController.instantiateViewController()
let bottomSheet = MDCBottomSheetController(contentViewController: viewController)
bottomSheet.dismissOnDraggingDownSheet = false
bottomSheet.delegate = self
viewController.coordinatorServices = coordinatorServices
viewController.calendarViewModel.selectedCategory = selectedCategory
Expand Down

0 comments on commit 89ec46c

Please sign in to comment.