mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 20:09:04 +00:00
Add "end poll" confirmation dialog (#1799)
* Add poll end confirmation dialog * Fix button role in CreatePollScreenViewModel
This commit is contained in:
@@ -125,6 +125,9 @@ struct RoomScreenViewStateBindings {
|
||||
/// Information describing the currently displayed alert.
|
||||
var alertInfo: AlertInfo<RoomScreenErrorType>?
|
||||
|
||||
/// An alert info for confirmation actions (e.g. ending a poll)
|
||||
var confirmationAlertInfo: AlertInfo<UUID>?
|
||||
|
||||
var debugInfo: TimelineItemDebugInfo?
|
||||
|
||||
var actionMenuInfo: TimelineItemActionMenuInfo?
|
||||
|
||||
@@ -155,7 +155,11 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
case .disableLongPress(let itemID):
|
||||
state.longPressDisabledItemID = itemID
|
||||
case let .endPoll(pollStartID):
|
||||
endPoll(pollStartID: pollStartID)
|
||||
state.bindings.confirmationAlertInfo = .init(id: .init(),
|
||||
title: L10n.actionEndPoll,
|
||||
message: L10n.commonPollEndConfirmation,
|
||||
primaryButton: .init(title: L10n.actionCancel, role: .cancel, action: nil),
|
||||
secondaryButton: .init(title: L10n.actionOk, action: { self.endPoll(pollStartID: pollStartID) }))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ struct RoomScreen: View {
|
||||
.toolbarBackground(.visible, for: .navigationBar) // Fix the toolbar's background.
|
||||
.overlay { loadingIndicator }
|
||||
.alert(item: $context.alertInfo)
|
||||
.alert(item: $context.confirmationAlertInfo)
|
||||
.sheet(item: $context.debugInfo) { TimelineItemDebugView(info: $0) }
|
||||
.sheet(item: $context.actionMenuInfo) { info in
|
||||
context.viewState.timelineItemMenuActionProvider?(info.item.id).map { actions in
|
||||
|
||||
Reference in New Issue
Block a user