mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-02 00:17:41 +01:00
Fix back navigation stuck in conversation after activity recreation.
Co-authored-by: Greyson Parrelli <greyson@signal.org>
This commit is contained in:
@@ -650,6 +650,7 @@ class ConversationFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
viewModel.resetBackPressedState()
|
||||||
binding.toolbar.isBackInvokedCallbackEnabled = false
|
binding.toolbar.isBackInvokedCallbackEnabled = false
|
||||||
binding.root.setUseWindowTypes(args.conversationScreenType == ConversationScreenType.NORMAL && !resources.getWindowSizeClass().isSplitPane())
|
binding.root.setUseWindowTypes(args.conversationScreenType == ConversationScreenType.NORMAL && !resources.getWindowSizeClass().isSplitPane())
|
||||||
if (args.conversationScreenType == ConversationScreenType.BUBBLE) {
|
if (args.conversationScreenType == ConversationScreenType.BUBBLE) {
|
||||||
@@ -1042,7 +1043,14 @@ class ConversationFragment :
|
|||||||
|
|
||||||
state.isInActionMode -> finishActionMode()
|
state.isInActionMode -> finishActionMode()
|
||||||
|
|
||||||
state.isMediaKeyboardShowing -> container.hideInput()
|
state.isMediaKeyboardShowing -> {
|
||||||
|
if (container.isInputShowing) {
|
||||||
|
container.hideInput()
|
||||||
|
} else {
|
||||||
|
Log.d(TAG, "handleBackPressed() - media keyboard state was stale, clearing")
|
||||||
|
viewModel.setIsMediaKeyboardShowing(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
// State has changed since the back handler was enabled. Let the back press proceed
|
// State has changed since the back handler was enabled. Let the back press proceed
|
||||||
|
|||||||
@@ -733,6 +733,10 @@ class ConversationViewModel(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun resetBackPressedState() {
|
||||||
|
internalBackPressedState.value = BackPressedState()
|
||||||
|
}
|
||||||
|
|
||||||
fun toggleVote(poll: PollRecord, pollOption: PollOption, isChecked: Boolean) {
|
fun toggleVote(poll: PollRecord, pollOption: PollOption, isChecked: Boolean) {
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val voteCount = if (isChecked) {
|
val voteCount = if (isChecked) {
|
||||||
|
|||||||
Reference in New Issue
Block a user