Another attempt to fix blank chat screen
This commit is contained in:
parent
05a167110b
commit
1f3c17b818
1 changed files with 16 additions and 3 deletions
|
@ -108,6 +108,16 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onSaveInstanceState(outState: Bundle) {
|
||||||
|
val chatRoom = sharedViewModel.selectedChatRoom.value
|
||||||
|
if (chatRoom != null) {
|
||||||
|
outState.putString("LocalSipUri", chatRoom.localAddress.asStringUriOnly())
|
||||||
|
outState.putString("RemoteSipUri", chatRoom.peerAddress.asStringUriOnly())
|
||||||
|
Log.i("[Chat Room] Saving current chat room local & remote addresses in save instance state")
|
||||||
|
}
|
||||||
|
super.onSaveInstanceState(outState)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
|
@ -120,15 +130,18 @@ class DetailChatRoomFragment : MasterFragment<ChatRoomDetailFragmentBinding, Cha
|
||||||
|
|
||||||
useMaterialSharedAxisXForwardAnimation = sharedViewModel.isSlidingPaneSlideable.value == false
|
useMaterialSharedAxisXForwardAnimation = sharedViewModel.isSlidingPaneSlideable.value == false
|
||||||
|
|
||||||
val localSipUri = arguments?.getString("LocalSipUri")
|
val localSipUri = arguments?.getString("LocalSipUri") ?: savedInstanceState?.getString("LocalSipUri")
|
||||||
val remoteSipUri = arguments?.getString("RemoteSipUri")
|
val remoteSipUri = arguments?.getString("RemoteSipUri") ?: savedInstanceState?.getString("RemoteSipUri")
|
||||||
|
|
||||||
val textToShare = arguments?.getString("TextToShare")
|
val textToShare = arguments?.getString("TextToShare")
|
||||||
val filesToShare = arguments?.getStringArrayList("FilesToShare")
|
val filesToShare = arguments?.getStringArrayList("FilesToShare")
|
||||||
|
|
||||||
|
if (remoteSipUri != null && arguments?.getString("RemoteSipUri") == null) {
|
||||||
|
Log.w("[Chat Room] Chat room will be restored from saved instance state")
|
||||||
|
}
|
||||||
arguments?.clear()
|
arguments?.clear()
|
||||||
if (localSipUri != null && remoteSipUri != null) {
|
if (localSipUri != null && remoteSipUri != null) {
|
||||||
Log.i("[Chat Room] Found local [$localSipUri] & remote [$remoteSipUri] addresses in arguments")
|
Log.i("[Chat Room] Found local [$localSipUri] & remote [$remoteSipUri] addresses in arguments or saved instance state")
|
||||||
|
|
||||||
val localAddress = Factory.instance().createAddress(localSipUri)
|
val localAddress = Factory.instance().createAddress(localSipUri)
|
||||||
val remoteSipAddress = Factory.instance().createAddress(remoteSipUri)
|
val remoteSipAddress = Factory.instance().createAddress(remoteSipUri)
|
||||||
|
|
Loading…
Reference in a new issue