commit
680e588e4d
|
|
@ -178,7 +178,7 @@ where Delegate.Cursor == Cursor {
|
|||
|
||||
currentPlaceholderView = loadingIndicatorView
|
||||
} else {
|
||||
tableView.finishInfiniteScroll()
|
||||
removeInfiniteScroll()
|
||||
tableView.tableFooterView = nil
|
||||
}
|
||||
}
|
||||
|
|
@ -224,9 +224,7 @@ where Delegate.Cursor == Cursor {
|
|||
|
||||
currentPlaceholderView = errorView
|
||||
} else if case .loadingMore = afterState {
|
||||
tableView.finishInfiniteScroll()
|
||||
|
||||
tableView.removeInfiniteScroll()
|
||||
removeInfiniteScroll()
|
||||
|
||||
guard let retryButton = delegate?.retryLoadMoreButton(forPaginationWrapper: self),
|
||||
let retryButtonHeigth = delegate?.retryLoadMoreButtonHeight(forPaginationWrapper: self) else {
|
||||
|
|
@ -260,7 +258,7 @@ where Delegate.Cursor == Cursor {
|
|||
// MARK: private stuff
|
||||
|
||||
private func onExhaustedState() {
|
||||
tableView.removeInfiniteScroll()
|
||||
removeInfiniteScroll()
|
||||
}
|
||||
|
||||
private func addInfiniteScroll() {
|
||||
|
|
@ -271,6 +269,11 @@ where Delegate.Cursor == Cursor {
|
|||
tableView.infiniteScrollIndicatorView = delegate?.loadingMoreIndicator(forPaginationWrapper: self).view
|
||||
}
|
||||
|
||||
private func removeInfiniteScroll() {
|
||||
tableView.finishInfiniteScroll()
|
||||
tableView.removeInfiniteScroll()
|
||||
}
|
||||
|
||||
private func createRefreshControl() {
|
||||
let refreshControl = UIRefreshControl()
|
||||
refreshControl.rx.controlEvent(.valueChanged)
|
||||
|
|
@ -285,7 +288,7 @@ where Delegate.Cursor == Cursor {
|
|||
private func bindViewModelStates() {
|
||||
typealias State = PaginationViewModel<Cursor>.State
|
||||
|
||||
paginationViewModel.state.flatMapLatest { [applicationCurrentyActive] state -> Driver<State> in
|
||||
paginationViewModel.state.flatMap { [applicationCurrentyActive] state -> Driver<State> in
|
||||
if applicationCurrentyActive.value {
|
||||
return .just(state)
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -85,4 +85,21 @@ class CursorTests: XCTestCase {
|
|||
waitForExpectations(timeout: 10, handler: nil)
|
||||
}
|
||||
|
||||
func testStaticCursor() {
|
||||
let cursor = StaticCursor(content: Array(1...40).map(String.init))
|
||||
|
||||
let cursorExpectation = expectation(description: "Static cursor expectation")
|
||||
|
||||
cursor.loadNextBatch().subscribe(onSuccess: { loadedItems in
|
||||
XCTAssertEqual(loadedItems.count, 40)
|
||||
|
||||
cursorExpectation.fulfill()
|
||||
}) { error in
|
||||
XCTFail(error.localizedDescription)
|
||||
}
|
||||
.addDisposableTo(disposeBag)
|
||||
|
||||
waitForExpectations(timeout: 10, handler: nil)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue