Skip to content

Commit

Permalink
Refactor next() -> nextBatch()
Browse files Browse the repository at this point in the history
  • Loading branch information
alfogrillo committed Jan 24, 2023
1 parent ff229ff commit d0196d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private extension PollHistoryViewModel {
state.isLoading = true

pollService
.next()
.nextBatch()
.collect()
.sink { [weak self] _ in
#warning("Handle errors")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final class MockPollHistoryService: PollHistoryServiceProtocol {
.setFailureType(to: Error.self)
.eraseToAnyPublisher()

func next() -> AnyPublisher<TimelinePollDetails, Error> {
func nextBatch() -> AnyPublisher<TimelinePollDetails, Error> {
nextPublisher
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//
//
// Copyright 2023 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -18,13 +18,13 @@ import Combine

protocol PollHistoryServiceProtocol {
/// Returns a Publisher publishing the polls in the next batch.
/// Implementations should return the same publisher if `next()` is called again before the previous publisher completes.
func next() -> AnyPublisher<TimelinePollDetails, Error>
/// Implementations should return the same publisher if `nextBatch()` is called again before the previous publisher completes.
func nextBatch() -> AnyPublisher<TimelinePollDetails, Error>

/// Publishes updates for the polls previously pusblished by the `next()` publishers.
/// Publishes updates for the polls previously pusblished by the `nextBatch()` publishers.
var updates: AnyPublisher<TimelinePollDetails, Never> { get }

/// Publishes errors regarding poll aggregations.
/// Note: `next()` will continue to publish new polls even if some poll isn't being aggregated correctly.
/// Note: `nextBatch()` will continue to publish new polls even if some poll isn't being aggregated correctly.
var pollErrors: AnyPublisher<Error, Never> { get }
}

0 comments on commit d0196d7

Please sign in to comment.