Fixed crash when animations are disabled + crash when creating 1-1 encrypted chat room
This commit is contained in:
parent
1d0cbbcc69
commit
2dd034cfbd
2 changed files with 15 additions and 8 deletions
|
@ -91,7 +91,9 @@ class ChatRoomViewModel(val chatRoom: ChatRoom) : ViewModel(), ContactViewModelI
|
|||
get() = chatRoom.hasCapability(ChatRoomCapabilities.Basic.toInt())
|
||||
|
||||
val peerSipUri: String
|
||||
get() = if (oneToOneChatRoom && !basicChatRoom) chatRoom.participants.first().address.asStringUriOnly()
|
||||
get() = if (oneToOneChatRoom && !basicChatRoom)
|
||||
chatRoom.participants.firstOrNull()?.address?.asStringUriOnly()
|
||||
?: chatRoom.peerAddress.asStringUriOnly()
|
||||
else chatRoom.peerAddress.asStringUriOnly()
|
||||
|
||||
val oneParticipantOneDevice: Boolean
|
||||
|
|
|
@ -26,6 +26,7 @@ import androidx.core.view.doOnPreDraw
|
|||
import androidx.databinding.ViewDataBinding
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import org.linphone.LinphoneApplication
|
||||
import org.linphone.R
|
||||
import org.linphone.activities.main.viewmodels.DialogViewModel
|
||||
import org.linphone.activities.main.viewmodels.ListTopBarViewModel
|
||||
|
@ -91,7 +92,10 @@ abstract class MasterFragment<T : ViewDataBinding, U : SelectionListAdapter<*, *
|
|||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
// Do not use postponeEnterTransition when fragment is recreated from the back stack,
|
||||
// otherwise the previous fragment will be visible until the animation starts
|
||||
val resume = findNavController().currentBackStackEntry?.savedStateHandle?.getLiveData<Boolean>("resume")?.value ?: false
|
||||
if (LinphoneApplication.corePreferences.enableAnimations) {
|
||||
val resume =
|
||||
findNavController().currentBackStackEntry?.savedStateHandle?.getLiveData<Boolean>("resume")?.value
|
||||
?: false
|
||||
if (!resume) {
|
||||
findNavController().currentBackStackEntry?.savedStateHandle?.set("resume", true)
|
||||
// To ensure animation will be smooth,
|
||||
|
@ -99,6 +103,7 @@ abstract class MasterFragment<T : ViewDataBinding, U : SelectionListAdapter<*, *
|
|||
postponeEnterTransition()
|
||||
view.doOnPreDraw { startPostponedEnterTransition() }
|
||||
}
|
||||
}
|
||||
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue