mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-22 01:22:46 +02:00
Merge branch 'develop' into flescio/1040-poll_detail
# Conflicts: # Riot/Assets/en.lproj/Vector.strings # Riot/Generated/Strings.swift
This commit is contained in:
@@ -51,7 +51,7 @@ private extension PollHistoryViewModel {
|
||||
state.isLoading = true
|
||||
|
||||
pollService
|
||||
.next()
|
||||
.nextBatch()
|
||||
.collect()
|
||||
.sink { [weak self] _ in
|
||||
#warning("Handle errors")
|
||||
@@ -69,7 +69,7 @@ private extension PollHistoryViewModel {
|
||||
pollService
|
||||
.updates
|
||||
.sink { [weak self] detail in
|
||||
self?.updatePolls(with: detail)
|
||||
self?.update(poll: detail)
|
||||
self?.updateViewState()
|
||||
}
|
||||
.store(in: &subcriptions)
|
||||
@@ -82,7 +82,7 @@ private extension PollHistoryViewModel {
|
||||
.store(in: &subcriptions)
|
||||
}
|
||||
|
||||
func updatePolls(with poll: TimelinePollDetails) {
|
||||
func update(poll: TimelinePollDetails) {
|
||||
guard let pollIndex = polls?.firstIndex(where: { $0.id == poll.id }) else {
|
||||
return
|
||||
}
|
||||
@@ -103,3 +103,20 @@ private extension PollHistoryViewModel {
|
||||
state.polls = renderedPolls?.sorted(by: { $0.startDate > $1.startDate })
|
||||
}
|
||||
}
|
||||
|
||||
extension PollHistoryViewModel.Context {
|
||||
var emptyPollsText: String {
|
||||
let days = PollHistoryConstants.chunkSizeInDays
|
||||
|
||||
switch (viewState.bindings.mode, viewState.canLoadMoreContent) {
|
||||
case (.active, true):
|
||||
return VectorL10n.pollHistoryNoActivePollPeriodText("\(days)")
|
||||
case (.active, false):
|
||||
return VectorL10n.pollHistoryNoActivePollText
|
||||
case (.past, true):
|
||||
return VectorL10n.pollHistoryNoPastPollPeriodText("\(days)")
|
||||
case (.past, false):
|
||||
return VectorL10n.pollHistoryNoPastPollText
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user