Increasing timeout limit.
Fixing search filtering
This commit is contained in:
parent
956915491d
commit
2fb34f43d0
@ -847,7 +847,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 64;
|
CURRENT_PROJECT_VERSION = 65;
|
||||||
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
||||||
INFOPLIST_FILE = AutoCat/Info.plist;
|
INFOPLIST_FILE = AutoCat/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||||
@ -870,7 +870,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 64;
|
CURRENT_PROJECT_VERSION = 65;
|
||||||
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
DEVELOPMENT_TEAM = 46DTTB8X4S;
|
||||||
INFOPLIST_FILE = AutoCat/Info.plist;
|
INFOPLIST_FILE = AutoCat/Info.plist;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||||
|
|||||||
@ -44,7 +44,7 @@ class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDe
|
|||||||
//.throttle(.seconds(2), scheduler: MainScheduler.instance)
|
//.throttle(.seconds(2), scheduler: MainScheduler.instance)
|
||||||
.debounce(.milliseconds(500), scheduler: MainScheduler.instance)
|
.debounce(.milliseconds(500), scheduler: MainScheduler.instance)
|
||||||
.do(onNext: { _ in self.pageLoadingIndicator.startAnimating() })
|
.do(onNext: { _ in self.pageLoadingIndicator.startAnimating() })
|
||||||
.flatMap { Api.getVehicles(with: $0, pageToken: self.datasource.pageToken).catchErrorJustReturn(PagedResponse<Vehicle>()) }
|
.flatMap { Api.getVehicles(with: $0, pageToken: self.datasource.pageToken).do(onError: { print($0) }).catchErrorJustReturn(PagedResponse<Vehicle>()) }
|
||||||
.observeOn(MainScheduler.instance)
|
.observeOn(MainScheduler.instance)
|
||||||
.do(onNext: {
|
.do(onNext: {
|
||||||
if let count = $0.count {
|
if let count = $0.count {
|
||||||
@ -89,6 +89,7 @@ class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDe
|
|||||||
guard self.filter.searchString != newQuery else { return }
|
guard self.filter.searchString != newQuery else { return }
|
||||||
|
|
||||||
self.filter.searchString = newQuery
|
self.filter.searchString = newQuery
|
||||||
|
self.datasource.reset()
|
||||||
self.filterRelay.accept(self.filter)
|
self.filterRelay.accept(self.filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +101,7 @@ class SearchController: UIViewController, UISearchResultsUpdating, UITableViewDe
|
|||||||
controller.filter = self.filter
|
controller.filter = self.filter
|
||||||
controller.onDone = {
|
controller.onDone = {
|
||||||
self.filter = controller.filter
|
self.filter = controller.filter
|
||||||
|
self.datasource.reset()
|
||||||
self.filterRelay.accept(self.filter)
|
self.filterRelay.accept(self.filter)
|
||||||
}
|
}
|
||||||
self.navigationController?.pushViewController(controller, animated: true)
|
self.navigationController?.pushViewController(controller, animated: true)
|
||||||
|
|||||||
@ -4,6 +4,13 @@ import RxCocoa
|
|||||||
|
|
||||||
class Api {
|
class Api {
|
||||||
|
|
||||||
|
private static let session: URLSession = {
|
||||||
|
let sessionConfig = URLSessionConfiguration.default
|
||||||
|
sessionConfig.timeoutIntervalForRequest = 60.0
|
||||||
|
sessionConfig.timeoutIntervalForResource = 60.0
|
||||||
|
return URLSession(configuration: sessionConfig)
|
||||||
|
}()
|
||||||
|
|
||||||
// MARK: - Private wrappres
|
// MARK: - Private wrappres
|
||||||
|
|
||||||
private static func genError(_ msg: String, suggestion: String, code: Int = 0) -> Error {
|
private static func genError(_ msg: String, suggestion: String, code: Int = 0) -> Error {
|
||||||
@ -39,7 +46,7 @@ class Api {
|
|||||||
return Single.error(self.genError("Error creating request", suggestion: ""))
|
return Single.error(self.genError("Error creating request", suggestion: ""))
|
||||||
}
|
}
|
||||||
|
|
||||||
return URLSession.shared.rx.data(request: request).asSingle().map { data in
|
return self.session.rx.data(request: request).asSingle().map { data in
|
||||||
// let str = String(data: data, encoding: .utf8)
|
// let str = String(data: data, encoding: .utf8)
|
||||||
// print("================================")
|
// print("================================")
|
||||||
// if let string = str?.replacingOccurrences(of: "\\\"", with: "\"")
|
// if let string = str?.replacingOccurrences(of: "\\\"", with: "\"")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user