Only show 'call can be trusted' toast when SAS is validated

This commit is contained in:
Sylvain Berfini 2024-02-02 11:06:45 +01:00
parent 523b762cac
commit e19e9bfdc7
2 changed files with 8 additions and 15 deletions

View file

@ -207,16 +207,6 @@ class ActiveCallFragment : GenericCallFragment() {
numpadBottomSheetBehavior.state = BottomSheetBehavior.STATE_HIDDEN
}
callViewModel.isRemoteDeviceTrusted.observe(viewLifecycleOwner) { trusted ->
if (trusted) {
(requireActivity() as CallActivity).showBlueToast(
getString(R.string.toast_call_can_be_trusted),
R.drawable.trusted,
doNotTint = true
)
}
}
callViewModel.showZrtpSasDialogEvent.observe(viewLifecycleOwner) {
it.consume { pair ->
val model = ZrtpSasConfirmationDialogModel(pair.first, pair.second)
@ -232,6 +222,14 @@ class ActiveCallFragment : GenericCallFragment() {
event.consume { verified ->
callViewModel.updateZrtpSas(verified)
dialog.dismiss()
if (verified) {
(requireActivity() as CallActivity).showBlueToast(
getString(R.string.toast_call_can_be_trusted),
R.drawable.trusted,
doNotTint = true
)
}
}
}

View file

@ -131,8 +131,6 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
// ZRTP related
val isRemoteDeviceTrusted = MutableLiveData<Boolean>()
val showZrtpSasDialogEvent: MutableLiveData<Event<Pair<String, String>>> by lazy {
MutableLiveData<Event<Pair<String, String>>>()
}
@ -699,9 +697,6 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() {
Log.i(
"$TAG Current call media encryption is ZRTP, auth token is ${if (isDeviceTrusted) "trusted" else "not trusted yet"}"
)
if (isDeviceTrusted != isRemoteDeviceTrusted.value) {
isRemoteDeviceTrusted.postValue(isDeviceTrusted)
}
val securityLevel = if (isDeviceTrusted) SecurityLevel.Safe else SecurityLevel.Encrypted
val avatarModel = contact.value
if (avatarModel != null) {