From 4ef18b88a110b18cedd6d8b133fa669e635cc7aa Mon Sep 17 00:00:00 2001 From: Selim Mustafaev Date: Wed, 25 Jan 2023 22:23:06 +0300 Subject: [PATCH] Fix search --- AutoCat.xcodeproj/project.pbxproj | 4 ++-- AutoCat/Controllers/ReportController.swift | 3 +-- AutoCat/Controllers/SearchController.swift | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/AutoCat.xcodeproj/project.pbxproj b/AutoCat.xcodeproj/project.pbxproj index 00d0f22..776b895 100644 --- a/AutoCat.xcodeproj/project.pbxproj +++ b/AutoCat.xcodeproj/project.pbxproj @@ -1136,7 +1136,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 105; + CURRENT_PROJECT_VERSION = 107; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; @@ -1161,7 +1161,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 105; + CURRENT_PROJECT_VERSION = 107; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; diff --git a/AutoCat/Controllers/ReportController.swift b/AutoCat/Controllers/ReportController.swift index eaad1da..4460128 100644 --- a/AutoCat/Controllers/ReportController.swift +++ b/AutoCat/Controllers/ReportController.swift @@ -15,8 +15,7 @@ class ReportController: FormViewController, MediaBrowserViewControllerDataSource var vehicle: Vehicle? { didSet { - //loadViewIfNeeded() - if isViewLoaded { + if isViewLoaded && self.view.window != nil { self.updateReport() self.form.allSections.forEach { $0.reload() } self.navigationController?.setNavigationBarHidden(self.vehicle == nil, animated: false) diff --git a/AutoCat/Controllers/SearchController.swift b/AutoCat/Controllers/SearchController.swift index f16443f..a972409 100644 --- a/AutoCat/Controllers/SearchController.swift +++ b/AutoCat/Controllers/SearchController.swift @@ -60,12 +60,11 @@ class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDe DispatchQueue.main.async { self.filterRelay - //.throttle(.seconds(2), scheduler: MainScheduler.instance) .debounce(.milliseconds(500), scheduler: MainScheduler.instance) .do(onNext: { _ in self.showProgress() }) - .flatMap { Api.getVehicles(with: $0, pageToken: self.datasource.pageToken).do(onError: { print($0) }).catchErrorJustReturn(PagedResponse()) } + .flatMapLatest { Api.getVehicles(with: $0, pageToken: self.datasource.pageToken).do(onError: { print($0) }).catchErrorJustReturn(PagedResponse()) } .observeOn(MainScheduler.instance) .do(onNext: { if let count = $0.count {