Fixed additional merge issues

This commit is contained in:
Arnfried Griesert
2023-06-12 06:08:33 +02:00
parent 51e98cfe61
commit 4fc5e366e3
7 changed files with 42 additions and 19 deletions
@@ -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,