Add confirmation dialog when ending poll from the bottom sheet.
This commit is contained in:
parent
53ce85872b
commit
847766eb33
1 changed files with 23 additions and 1 deletions
|
|
@ -31,6 +31,7 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableIntStateOf
|
import androidx.compose.runtime.mutableIntStateOf
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
|
|
@ -341,9 +342,30 @@ fun MessagesView(
|
||||||
maxBottomSheetContentHeight = maxComposerHeightPx.toDp(),
|
maxBottomSheetContentHeight = maxComposerHeightPx.toDp(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var endPollConfirmingEvent: TimelineItem.Event? by remember { mutableStateOf(null) }
|
||||||
|
|
||||||
|
if (endPollConfirmingEvent != null) {
|
||||||
|
ConfirmationDialog(
|
||||||
|
content = stringResource(id = CommonStrings.common_poll_end_confirmation),
|
||||||
|
onSubmitClick = {
|
||||||
|
endPollConfirmingEvent?.let { event ->
|
||||||
|
onActionSelected(TimelineItemAction.EndPoll, event)
|
||||||
|
}
|
||||||
|
endPollConfirmingEvent = null
|
||||||
|
},
|
||||||
|
onDismiss = { endPollConfirmingEvent = null },
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
ActionListView(
|
ActionListView(
|
||||||
state = state.actionListState,
|
state = state.actionListState,
|
||||||
onSelectAction = ::onActionSelected,
|
onSelectAction = { action: TimelineItemAction, event: TimelineItem.Event ->
|
||||||
|
if (action == TimelineItemAction.EndPoll) {
|
||||||
|
endPollConfirmingEvent = event
|
||||||
|
} else {
|
||||||
|
onActionSelected(action, event)
|
||||||
|
}
|
||||||
|
},
|
||||||
onCustomReactionClick = { event ->
|
onCustomReactionClick = { event ->
|
||||||
state.customReactionState.eventSink(CustomReactionEvents.ShowCustomReactionSheet(event))
|
state.customReactionState.eventSink(CustomReactionEvents.ShowCustomReactionSheet(event))
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue