Cleanup unused code

This commit is contained in:
Alfonso Grillo
2023-01-26 10:14:26 +01:00
parent f280692d49
commit 694112e6de
3 changed files with 7 additions and 20 deletions
@@ -35,7 +35,6 @@ final class PollHistoryService: PollHistoryServiceProtocol {
// polls updates
private let updatesSubject: PassthroughSubject<TimelinePollDetails, Never> = .init()
private let pollErrorsSubject: PassthroughSubject<Error, Never> = .init()
// timestamps
private var targetTimestamp: Date = .init()
@@ -45,10 +44,6 @@ final class PollHistoryService: PollHistoryServiceProtocol {
updatesSubject.eraseToAnyPublisher()
}
var pollErrors: AnyPublisher<Error, Never> {
pollErrorsSubject.eraseToAnyPublisher()
}
init(room: MXRoom, chunkSizeInDays: UInt) {
self.room = room
self.chunkSizeInDays = chunkSizeInDays
@@ -211,8 +206,10 @@ private extension MXEvent {
extension PollHistoryService: PollAggregatorDelegate {
func pollAggregatorDidStartLoading(_ aggregator: PollAggregator) { }
func pollAggregator(_ aggregator: PollAggregator, didFailWithError: Error) { }
func pollAggregatorDidEndLoading(_ aggregator: PollAggregator) {
guard let context = pollAggregationContexts[aggregator.poll.id], !context.published else {
guard let context = pollAggregationContexts[aggregator.poll.id], context.published == false else {
return
}
@@ -227,11 +224,10 @@ extension PollHistoryService: PollAggregatorDelegate {
}
}
func pollAggregator(_ aggregator: PollAggregator, didFailWithError: Error) {
pollErrorsSubject.send(didFailWithError)
}
func pollAggregatorDidUpdateData(_ aggregator: PollAggregator) {
guard let context = pollAggregationContexts[aggregator.poll.id], context.published else {
return
}
updatesSubject.send(.init(poll: aggregator.poll, represent: .started))
}
}
@@ -33,11 +33,6 @@ final class MockPollHistoryService: PollHistoryServiceProtocol {
updatesPublisher
}
var pollErrorPublisher: AnyPublisher<Error, Never> = Empty().eraseToAnyPublisher()
var pollErrors: AnyPublisher<Error, Never> {
pollErrorPublisher
}
var hasNextBatch = true
var fetchedUpToPublisher: AnyPublisher<Date, Never> = Just(.init()).eraseToAnyPublisher()
@@ -21,13 +21,9 @@ protocol PollHistoryServiceProtocol {
/// 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 `nextBatch()` publishers.
/// Publishes updates for the polls previously pusblished by the `nextBatch()` or `livePolls` publishers.
var updates: AnyPublisher<TimelinePollDetails, Never> { get }
/// Publishes errors regarding poll aggregations.
/// Note: `nextBatch()` will continue to publish new polls even if some poll isn't being aggregated correctly.
var pollErrors: AnyPublisher<Error, Never> { get }
/// Publishes live polls not related with the current batch.
var livePolls: AnyPublisher<TimelinePollDetails, Never> { get }