From af1a48d918a670a97054d91402c9bd193828a64f Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 12 Jun 2019 15:43:32 +0200 Subject: [PATCH] SAS: fix issue on emoji rendering --- .../SASVerificationIncomingFragment.kt | 11 +++++---- .../VectorSettingsPreferencesFragment.kt | 8 +++++++ ...fragment_sas_verification_display_code.xml | 23 ++++++++++++++----- .../src/main/res/layout/item_emoji_verif.xml | 4 ++++ .../src/main/res/values-w480dp/integers.xml | 6 ----- vector/src/main/res/values/integers.xml | 2 -- 6 files changed, 36 insertions(+), 18 deletions(-) delete mode 100644 vector/src/main/res/values-w480dp/integers.xml diff --git a/vector/src/main/java/im/vector/riotredesign/features/crypto/verification/SASVerificationIncomingFragment.kt b/vector/src/main/java/im/vector/riotredesign/features/crypto/verification/SASVerificationIncomingFragment.kt index 9b479eb967..35ef1acc35 100644 --- a/vector/src/main/java/im/vector/riotredesign/features/crypto/verification/SASVerificationIncomingFragment.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/crypto/verification/SASVerificationIncomingFragment.kt @@ -62,26 +62,29 @@ class SASVerificationIncomingFragment : VectorBaseFragment() { viewModel.otherUser?.let { AvatarRenderer.render(it, avatarImageView) + } ?: run { + // Fallback to what we know + AvatarRenderer.render(null, viewModel.otherUserId ?: "", viewModel.otherUserId, avatarImageView) } viewModel.transactionState.observe(this, Observer { val uxState = (viewModel.transaction as? IncomingSasVerificationTransaction)?.uxState when (uxState) { - IncomingSasVerificationTransaction.UxState.SHOW_ACCEPT -> { + IncomingSasVerificationTransaction.UxState.SHOW_ACCEPT -> { viewModel.loadingLiveEvent.value = null } IncomingSasVerificationTransaction.UxState.WAIT_FOR_KEY_AGREEMENT -> { viewModel.loadingLiveEvent.value = R.string.sas_waiting_for_partner } - IncomingSasVerificationTransaction.UxState.SHOW_SAS -> { + IncomingSasVerificationTransaction.UxState.SHOW_SAS -> { viewModel.shortCodeReady() } IncomingSasVerificationTransaction.UxState.CANCELLED_BY_ME, - IncomingSasVerificationTransaction.UxState.CANCELLED_BY_OTHER -> { + IncomingSasVerificationTransaction.UxState.CANCELLED_BY_OTHER -> { viewModel.loadingLiveEvent.value = null viewModel.navigateCancel() } - else -> Unit + else -> Unit } }) diff --git a/vector/src/main/java/im/vector/riotredesign/features/settings/VectorSettingsPreferencesFragment.kt b/vector/src/main/java/im/vector/riotredesign/features/settings/VectorSettingsPreferencesFragment.kt index 06455f35a6..fc325f6c72 100755 --- a/vector/src/main/java/im/vector/riotredesign/features/settings/VectorSettingsPreferencesFragment.kt +++ b/vector/src/main/java/im/vector/riotredesign/features/settings/VectorSettingsPreferencesFragment.kt @@ -2267,6 +2267,10 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref mSession.getDevicesList(object : MatrixCallback { override fun onSuccess(data: DevicesListResponse) { + if (!isAdded) { + return + } + if (data.devices?.isEmpty() == true) { removeDevicesPreference() } else { @@ -2275,6 +2279,10 @@ class VectorSettingsPreferencesFragment : VectorPreferenceFragment(), SharedPref } override fun onFailure(failure: Throwable) { + if (!isAdded) { + return + } + removeDevicesPreference() onCommonDone(failure.message) } diff --git a/vector/src/main/res/layout/fragment_sas_verification_display_code.xml b/vector/src/main/res/layout/fragment_sas_verification_display_code.xml index 6a0aef65c9..197e92c5e6 100644 --- a/vector/src/main/res/layout/fragment_sas_verification_display_code.xml +++ b/vector/src/main/res/layout/fragment_sas_verification_display_code.xml @@ -54,15 +54,13 @@ tools:text="1234-4320-3905" tools:visibility="visible" /> - - + + + @@ -23,6 +24,9 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginTop="4dp" + android:gravity="center" + android:minWidth="60sp" + android:textColor="?riotx_text_primary" tools:text="@string/verification_emoji_cactus" /> diff --git a/vector/src/main/res/values-w480dp/integers.xml b/vector/src/main/res/values-w480dp/integers.xml deleted file mode 100644 index 1ef5298e30..0000000000 --- a/vector/src/main/res/values-w480dp/integers.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - 7 - - \ No newline at end of file diff --git a/vector/src/main/res/values/integers.xml b/vector/src/main/res/values/integers.xml index 9568a9b132..59c1327f30 100644 --- a/vector/src/main/res/values/integers.xml +++ b/vector/src/main/res/values/integers.xml @@ -7,6 +7,4 @@ 750 - 4 - \ No newline at end of file