Skip to content

Commit

Permalink
Merge pull request #4105 from nextcloud/backport/4095/stable-20.0
Browse files Browse the repository at this point in the history
[stable-20.0] Messages are no longer lost in between lifecycle events
  • Loading branch information
rapterjet2004 authored Aug 22, 2024
2 parents 8ec675b + 8f35704 commit d37e21b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ class ChatActivity :
}
}

private lateinit var messageInputFragment: MessageInputFragment

val typingParticipants = HashMap<String, TypingParticipant>()

var callStarted = false
Expand Down Expand Up @@ -397,6 +399,8 @@ class ChatActivity :
setContentView(binding.root)
setupSystemColors()

messageInputFragment = MessageInputFragment()

conversationUser = currentUserProvider.currentUser.blockingGet()

handleIntent(intent)
Expand Down Expand Up @@ -578,7 +582,7 @@ class ChatActivity :

supportFragmentManager.commit {
setReorderingAllowed(true) // optimizes out redundant replace operations
replace(R.id.fragment_container_activity_chat, MessageInputFragment())
replace(R.id.fragment_container_activity_chat, messageInputFragment)
}

joinRoomWithPassword()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,13 @@ class MessageInputFragment : Fragment() {
return binding.root
}

override fun onPause() {
super.onPause()
saveState()
}

override fun onDestroyView() {
super.onDestroyView()
saveState()
if (mentionAutocomplete != null && mentionAutocomplete!!.isPopupShowing) {
mentionAutocomplete?.dismissPopup()
}
Expand Down

0 comments on commit d37e21b

Please sign in to comment.