Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable-20.0] Messages are no longer lost in between lifecycle events #4105

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_INTERNAL_USER_ID
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_BREAKOUT_ROOM
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_IS_MODERATOR
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_RECORDING_STATE
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_ID
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_ROOM_TOKEN
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_START_CALL_AFTER_ROOM_SWITCH
import com.nextcloud.talk.utils.bundle.BundleKeys.KEY_SWITCH_TO_ROOM
Expand All @@ -187,7 +186,6 @@ import kotlinx.coroutines.withContext
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import retrofit2.HttpException
import retrofit2.Response
import java.io.File
import java.io.IOException
import java.net.HttpURLConnection
Expand Down Expand Up @@ -333,6 +331,8 @@ class ChatActivity :
}
}

private lateinit var messageInputFragment: MessageInputFragment

val typingParticipants = HashMap<String, TypingParticipant>()

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

messageInputFragment = MessageInputFragment()

conversationUser = currentUserProvider.currentUser.blockingGet()

handleIntent(intent)
Expand Down Expand Up @@ -580,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
Loading