From 25ab474fba2abddac6031fd475acab62284b95c6 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Fri, 2 Feb 2024 11:37:52 +0100 Subject: [PATCH] Added button to do ZRTP SAS validation again --- .../ui/call/fragment/ActiveCallFragment.kt | 9 ++++++++ .../ui/call/model/CallMediaEncryptionModel.kt | 9 ++++++++ .../call_media_encryption_stats_menu.xml | 22 ++++++++++++++----- app/src/main/res/values/strings.xml | 1 + 4 files changed, 35 insertions(+), 6 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 4a1f7f552..eb64de6ec 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 @@ -382,5 +382,14 @@ class ActiveCallFragment : GenericCallFragment() { MediaEncryptionStatisticsDialogFragment.TAG ) bottomSheetDialog = modalBottomSheet + + model.showZrtpSasValidationDialogEvent.observe(viewLifecycleOwner) { + it.consume { + callViewModel.showZrtpSasDialogIfPossible() + + modalBottomSheet.dismiss() + bottomSheetDialog = null + } + } } } diff --git a/app/src/main/java/org/linphone/ui/call/model/CallMediaEncryptionModel.kt b/app/src/main/java/org/linphone/ui/call/model/CallMediaEncryptionModel.kt index 81003a79f..b2b644ca0 100644 --- a/app/src/main/java/org/linphone/ui/call/model/CallMediaEncryptionModel.kt +++ b/app/src/main/java/org/linphone/ui/call/model/CallMediaEncryptionModel.kt @@ -26,6 +26,7 @@ import org.linphone.core.Call import org.linphone.core.MediaEncryption import org.linphone.core.StreamType import org.linphone.utils.AppUtils +import org.linphone.utils.Event class CallMediaEncryptionModel @WorkerThread constructor(call: Call) { val mediaEncryption = MutableLiveData() @@ -37,6 +38,10 @@ class CallMediaEncryptionModel @WorkerThread constructor(call: Call) { val zrtpAuthTag = MutableLiveData() val zrtpAuthSas = MutableLiveData() + val showZrtpSasValidationDialogEvent: MutableLiveData> by lazy { + MutableLiveData>() + } + init { isMediaEncryptionZrtp.postValue(false) @@ -104,4 +109,8 @@ class CallMediaEncryptionModel @WorkerThread constructor(call: Call) { } } } + + fun showSasValidationDialog() { + showZrtpSasValidationDialogEvent.value = Event(true) + } } diff --git a/app/src/main/res/layout/call_media_encryption_stats_menu.xml b/app/src/main/res/layout/call_media_encryption_stats_menu.xml index d69c9bc07..a7c73c45c 100644 --- a/app/src/main/res/layout/call_media_encryption_stats_menu.xml +++ b/app/src/main/res/layout/call_media_encryption_stats_menu.xml @@ -11,7 +11,8 @@ + android:orientation="vertical" + android:background="?attr/color_main2_000"> @@ -40,7 +41,7 @@ android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" - android:text="@{model.zrtpKeyAgreement}" + android:text="@{model.zrtpKeyAgreement, default=@string/call_stats_zrtp_key_agreement_algo}" android:textColor="?attr/color_grey_900" android:gravity="center_vertical" android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}" /> @@ -51,7 +52,7 @@ android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" - android:text="@{model.zrtpHash}" + android:text="@{model.zrtpHash, default=@string/call_stats_zrtp_hash_algo}" android:textColor="?attr/color_grey_900" android:gravity="center_vertical" android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}" /> @@ -62,7 +63,7 @@ android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" - android:text="@{model.zrtpAuthTag}" + android:text="@{model.zrtpAuthTag, default=@string/call_stats_zrtp_auth_tag_algo}" android:textColor="?attr/color_grey_900" android:gravity="center_vertical" android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}" /> @@ -73,11 +74,20 @@ android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" - android:text="@{model.zrtpAuthSas}" + android:text="@{model.zrtpAuthSas, default=@string/call_stats_zrtp_sas_algo}" android:textColor="?attr/color_grey_900" android:gravity="center_vertical" android:visibility="@{model.isMediaEncryptionZrtp ? View.VISIBLE : View.GONE}" /> + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index dcf41113e..24bbe0cfd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -516,6 +516,7 @@ Ended End-to-end encrypted by ZRTP End-to-end encrypted by post-quantum ZRTP + Validate ZRTP SAS again Calls list Transfer call to %s is recording