From 31bb4d979886f41e8ccdb489e78fa1170e658b02 Mon Sep 17 00:00:00 2001 From: Ivan Babkin Date: Fri, 30 Aug 2019 14:06:23 +0300 Subject: [PATCH 1/2] Add method for processing cursor response --- CHANGELOG.md | 1 + Sources/Classes/DataLoading/Cursors/TotalCountCursor.swift | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25e9613a..a593e405 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ### 0.9.26 +- **Add**: method `processResultFromConfigurationSingle` for `TotalCountCursor` that allows to get server response. - **Add**: possibility to override `loadNextBatch` method from `TotalCountCursor`. - **Add**: possibility to inherit from `TotalCountCursor`. diff --git a/Sources/Classes/DataLoading/Cursors/TotalCountCursor.swift b/Sources/Classes/DataLoading/Cursors/TotalCountCursor.swift index b993b04e..c40393f0 100644 --- a/Sources/Classes/DataLoading/Cursors/TotalCountCursor.swift +++ b/Sources/Classes/DataLoading/Cursors/TotalCountCursor.swift @@ -54,8 +54,12 @@ open class TotalCountCursor: configuration = other.configuration.reset() } - open func loadNextBatch() -> Single<[Element]> { + open func processResultFromConfigurationSingle() -> Single { return configuration.resultSingle() + } + + public func loadNextBatch() -> Single<[Element]> { + return processResultFromConfigurationSingle() .do(onSuccess: { [weak self] listingResult in self?.totalCount = listingResult.totalCount self?.elements = (self?.elements ?? []) + listingResult.results From f01730d4c8db0ef6d4626283da1f9b745043833a Mon Sep 17 00:00:00 2001 From: Ivan Babkin Date: Fri, 30 Aug 2019 14:06:52 +0300 Subject: [PATCH 2/2] Fix changelog --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a593e405..0686dd8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,6 @@ ### 0.9.26 - **Add**: method `processResultFromConfigurationSingle` for `TotalCountCursor` that allows to get server response. -- **Add**: possibility to override `loadNextBatch` method from `TotalCountCursor`. - **Add**: possibility to inherit from `TotalCountCursor`. ### 0.9.25