From e19e9bfdc77e978859a740c3a73b856360c0ecfc Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 2 Feb 2024 11:06:45 +0100 Subject: [PATCH] Only show 'call can be trusted' toast when SAS is validated --- .../ui/call/fragment/ActiveCallFragment.kt | 18 ++++++++---------- .../ui/call/viewmodel/CurrentCallViewModel.kt | 5 ----- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/org/linphone/ui/call/fragment/ActiveCallFragment.kt b/app/src/main/java/org/linphone/ui/call/fragment/ActiveCallFragment.kt index 1ceba113b..4a1f7f552 100644 --- a/app/src/main/java/org/linphone/ui/call/fragment/ActiveCallFragment.kt +++ b/app/src/main/java/org/linphone/ui/call/fragment/ActiveCallFragment.kt @@ -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 + ) + } } } diff --git a/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt b/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt index dd00f4488..e2285880e 100644 --- a/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt +++ b/app/src/main/java/org/linphone/ui/call/viewmodel/CurrentCallViewModel.kt @@ -131,8 +131,6 @@ class CurrentCallViewModel @UiThread constructor() : ViewModel() { // ZRTP related - val isRemoteDeviceTrusted = MutableLiveData() - val showZrtpSasDialogEvent: MutableLiveData>> by lazy { MutableLiveData>>() } @@ -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) {