mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-26 19:34:25 +02:00
Fixed additional merge issues
This commit is contained in:
@@ -29,6 +29,7 @@ final class TimelinePollCoordinator: Coordinator, Presentable, PollAggregatorDel
|
||||
|
||||
// MARK: Private
|
||||
|
||||
private let navigationRouter: NavigationRouterType?
|
||||
private let parameters: TimelinePollCoordinatorParameters
|
||||
private let selectedAnswerIdentifiersSubject = PassthroughSubject<[String], Never>()
|
||||
|
||||
@@ -43,10 +44,11 @@ final class TimelinePollCoordinator: Coordinator, Presentable, PollAggregatorDel
|
||||
|
||||
// MARK: - Setup
|
||||
|
||||
init(parameters: TimelinePollCoordinatorParameters) throws {
|
||||
init(parameters: TimelinePollCoordinatorParameters, navigationRouter: NavigationRouterType? = nil) throws {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = TimelinePollViewModel(timelinePollDetailsState: .loading)
|
||||
self.navigationRouter = navigationRouter
|
||||
viewModel = TimelinePollViewModel(timelinePollDetailsState: .loading)
|
||||
try pollAggregator = PollAggregator(session: parameters.session, room: parameters.room, pollEvent: parameters.pollEvent, delegate: self)
|
||||
|
||||
viewModel.completion = { [weak self] result in
|
||||
@@ -55,6 +57,9 @@ final class TimelinePollCoordinator: Coordinator, Presentable, PollAggregatorDel
|
||||
switch result {
|
||||
case .selectedAnswerOptionsWithIdentifiers(let identifiers):
|
||||
self.selectedAnswerIdentifiersSubject.send(identifiers)
|
||||
case .showParticipants:
|
||||
self.showParticipantsView()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +109,23 @@ final class TimelinePollCoordinator: Coordinator, Presentable, PollAggregatorDel
|
||||
}
|
||||
}
|
||||
|
||||
func showParticipantsView() {
|
||||
if let navigationRouter = navigationRouter, let poll = pollAggregator.poll {
|
||||
let parameters = PollParticipantDetailsCoordinatorParameters(room: parameters.room, poll: poll)
|
||||
let coordinator = PollParticipantDetailsCoordinator(parameters: parameters)
|
||||
|
||||
add(childCoordinator: coordinator)
|
||||
|
||||
if navigationRouter.modules.isEmpty == false {
|
||||
navigationRouter.push(coordinator, animated: true, popCompletion: nil)
|
||||
} else {
|
||||
navigationRouter.setRootModule(coordinator, popCompletion: nil)
|
||||
}
|
||||
|
||||
coordinator.start()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - PollAggregatorDelegate
|
||||
|
||||
func pollAggregatorDidUpdateData(_ aggregator: PollAggregator) {
|
||||
@@ -142,7 +164,8 @@ extension TimelinePollDetails {
|
||||
text: pollAnswerOption.text,
|
||||
count: pollAnswerOption.count,
|
||||
winner: pollAnswerOption.isWinner,
|
||||
selected: pollAnswerOption.isCurrentUserSelection)
|
||||
selected: pollAnswerOption.isCurrentUserSelection,
|
||||
voters:pollAnswerOption.voters)
|
||||
}
|
||||
|
||||
self.init(id: poll.id,
|
||||
@@ -152,6 +175,7 @@ extension TimelinePollDetails {
|
||||
startDate: poll.startDate,
|
||||
totalAnswerCount: poll.totalAnswerCount,
|
||||
type: poll.kind.timelinePollType,
|
||||
showParticipants: poll.showParticipants,
|
||||
eventType: eventType,
|
||||
maxAllowedSelections: poll.maxAllowedSelections,
|
||||
hasBeenEdited: poll.hasBeenEdited,
|
||||
|
||||
Reference in New Issue
Block a user