mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-29 20:56:57 +02:00
MESSENGER-4484 poi participants in history
This commit is contained in:
@@ -57,7 +57,7 @@ final class PollHistoryCoordinator: NSObject, Coordinator, Presentable {
|
||||
|
||||
func showPollDetail(_ poll: TimelinePollDetails) {
|
||||
guard let event = parameters.room.mxSession.store.event(withEventId: poll.id, inRoom: parameters.room.roomId),
|
||||
let detailCoordinator: PollHistoryDetailCoordinator = try? .init(parameters: .init(event: event, poll: poll, room: parameters.room)) else {
|
||||
let detailCoordinator: PollHistoryDetailCoordinator = try? .init(parameters: .init(event: event, poll: poll, room: parameters.room, navigationRouter: navigationRouter)) else {
|
||||
pollHistoryViewModel.context.alertInfo = .init(id: true, title: VectorL10n.settingsDiscoveryErrorMessage)
|
||||
return
|
||||
}
|
||||
@@ -68,8 +68,20 @@ final class PollHistoryCoordinator: NSObject, Coordinator, Presentable {
|
||||
}
|
||||
|
||||
add(childCoordinator: detailCoordinator)
|
||||
detailCoordinator.start()
|
||||
toPresentable().present(detailCoordinator.toPresentable(), animated: true)
|
||||
|
||||
// bwi #4484: Participant details need a navigation controller not a presented VC
|
||||
if BWIBuildSettings.shared.bwiPollParticipantsInHistory {
|
||||
if navigationRouter.modules.isEmpty == false {
|
||||
navigationRouter.push(detailCoordinator, animated: true, popCompletion: nil)
|
||||
} else {
|
||||
navigationRouter.setRootModule(detailCoordinator, popCompletion: nil)
|
||||
}
|
||||
|
||||
detailCoordinator.start()
|
||||
} else {
|
||||
detailCoordinator.start()
|
||||
toPresentable().present(detailCoordinator.toPresentable(), animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
func toPresentable() -> UIViewController {
|
||||
|
||||
+3
-1
@@ -19,10 +19,12 @@ import CommonKit
|
||||
import MatrixSDK
|
||||
import SwiftUI
|
||||
|
||||
// bwi #4484: Poi history needs to pass a navigation router to show participants
|
||||
struct PollHistoryDetailCoordinatorParameters {
|
||||
let event: MXEvent
|
||||
let poll: TimelinePollDetails
|
||||
let room: MXRoom
|
||||
let navigationRouter: NavigationRouterType
|
||||
}
|
||||
|
||||
final class PollHistoryDetailCoordinator: Coordinator, Presentable {
|
||||
@@ -36,7 +38,7 @@ final class PollHistoryDetailCoordinator: Coordinator, Presentable {
|
||||
|
||||
init(parameters: PollHistoryDetailCoordinatorParameters) throws {
|
||||
self.parameters = parameters
|
||||
let timelinePollCoordinator = try TimelinePollCoordinator(parameters: .init(session: parameters.room.mxSession, room: parameters.room, pollEvent: parameters.event))
|
||||
let timelinePollCoordinator = try TimelinePollCoordinator(parameters: .init(session: parameters.room.mxSession, room: parameters.room, pollEvent: parameters.event, showParticipantButton: BWIBuildSettings.shared.bwiPollParticipantsInHistory), navigationRouter: parameters.navigationRouter)
|
||||
|
||||
let viewModel = PollHistoryDetailViewModel(poll: parameters.poll)
|
||||
let view = PollHistoryDetail(viewModel: viewModel.context, contentPoll: timelinePollCoordinator.toView())
|
||||
|
||||
+23
-6
@@ -26,8 +26,19 @@ struct PollHistoryDetail: View {
|
||||
@ObservedObject var viewModel: PollHistoryDetailViewModel.Context
|
||||
var contentPoll: any View
|
||||
|
||||
// bwi #4484: poi participants in history needs a pushed not presented view: Navigation title looks better this way in that case
|
||||
var body: some View {
|
||||
navigation
|
||||
if BWIBuildSettings.shared.bwiPollParticipantsInHistory {
|
||||
navigation
|
||||
.accentColor(theme.colors.accent)
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
.navigationTitle(navigationTitle)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
} else {
|
||||
navigation
|
||||
.accentColor(theme.colors.accent)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private var navigation: some View {
|
||||
@@ -50,11 +61,17 @@ struct PollHistoryDetail: View {
|
||||
.font(theme.fonts.caption1)
|
||||
.padding([.top])
|
||||
.accessibilityIdentifier("PollHistoryDetail.date")
|
||||
AnyView(contentPoll)
|
||||
.navigationTitle(navigationTitle)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationBarBackButtonHidden(true)
|
||||
.navigationBarItems(leading: backButton, trailing: doneButton)
|
||||
if BWIBuildSettings.shared.bwiPollParticipantsInHistory {
|
||||
AnyView(contentPoll)
|
||||
} else {
|
||||
AnyView(contentPoll)
|
||||
.navigationTitle(navigationTitle)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.navigationBarBackButtonHidden(true)
|
||||
.navigationBarItems(leading: backButton, trailing: doneButton)
|
||||
|
||||
}
|
||||
|
||||
viewInTimeline
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user