Commit 47bbafe5 authored by Samer Alabi's avatar Samer Alabi

Fixed Fragment Replacement Issue

parent b042c314
...@@ -86,11 +86,13 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector { ...@@ -86,11 +86,13 @@ class ChatRoomActivity : AppCompatActivity(), HasSupportFragmentInjector {
isChatRoomSubscribed = intent.getBooleanExtra(INTENT_CHAT_IS_SUBSCRIBED, true) isChatRoomSubscribed = intent.getBooleanExtra(INTENT_CHAT_IS_SUBSCRIBED, true)
if (supportFragmentManager.findFragmentByTag("ChatRoomFragment") == null) {
addFragment("ChatRoomFragment", R.id.fragment_container) { addFragment("ChatRoomFragment", R.id.fragment_container) {
newInstance(chatRoomId, chatRoomName, chatRoomType, isChatRoomReadOnly, chatRoomLastSeen, newInstance(chatRoomId, chatRoomName, chatRoomType, isChatRoomReadOnly, chatRoomLastSeen,
isChatRoomSubscribed) isChatRoomSubscribed)
} }
} }
}
override fun onBackPressed() { override fun onBackPressed() {
finishActivity() finishActivity()
......
...@@ -13,8 +13,8 @@ class CancelStrategy @Inject constructor(owner: LifecycleOwner, val jobs: Job) : ...@@ -13,8 +13,8 @@ class CancelStrategy @Inject constructor(owner: LifecycleOwner, val jobs: Job) :
owner.lifecycle.addObserver(this) owner.lifecycle.addObserver(this)
} }
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
fun onDestroy() { fun onStop() {
jobs.cancel() jobs.cancel()
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment