From 5e2b31af60e09966c01458e9ed4ae64dee1e1cd1 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Thu, 23 May 2013 17:17:28 -0700 Subject: [PATCH] Add appropriate text for manual case when identity is trusted. --- res/layout/receive_key_activity.xml | 3 +-- res/values/strings.xml | 25 +++++++++++-------- .../securesms/ReceiveKeyActivity.java | 14 +++++++++-- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/res/layout/receive_key_activity.xml b/res/layout/receive_key_activity.xml index d442ff5b6..85638cf6f 100644 --- a/res/layout/receive_key_activity.xml +++ b/res/layout/receive_key_activity.xml @@ -21,8 +21,7 @@ android:id="@+id/description_text" android:layout_width="fill_parent" android:layout_marginBottom="16dip" - android:layout_marginTop="16dip" - android:text="@string/receive_key_activity__the_signature_on_this_key_exchange_is_different"/> + android:layout_marginTop="16dip"/> You have received a Key Exchange message from %s. You have previously initiated a session with this contact, and by accepting this key you will complete the key exchange. Would you like to complete this key exchange? You have initiated a Key Exchange message with %s but have not yet received a reply. You have received a Key Exchange message from %s. You have no existing session with this contact, would you like to complete this key exchange? - + The + signature on this key exchange is different than what you\'ve previously received from this + contact. This could either mean that someone is trying to intercept your communication, or + that this contact simply re-installed TextSecure and now has a new identity key. + + You may wish to verify + this contact. + + The + signature on this key exchange is trusted, but you have the \'automatically complete key + exchanges\' setting disabled. + + + Unable to view corrupted identity key! Delete identity? @@ -317,11 +330,6 @@ Session Identities Complete - The - signature on this key exchange is different than what you\'ve previously received from this - contact. This could either mean that someone is trying to intercept your communication, or - that this contact simply re-installed TextSecure and now has a new identity key. - To @@ -512,11 +520,6 @@ Verified - You may wish to verify - this contact. - - - diff --git a/src/org/thoughtcrime/securesms/ReceiveKeyActivity.java b/src/org/thoughtcrime/securesms/ReceiveKeyActivity.java index 0d53f3681..1c7adf802 100644 --- a/src/org/thoughtcrime/securesms/ReceiveKeyActivity.java +++ b/src/org/thoughtcrime/securesms/ReceiveKeyActivity.java @@ -84,7 +84,16 @@ public class ReceiveKeyActivity extends PassphraseRequiredSherlockActivity { } private void initializeText() { - SpannableString spannableString = new SpannableString(descriptionText.getText() + " " + + if (keyExchangeProcessor.isTrusted(keyExchangeMessage)) initializeTrustedText(); + else initializeUntrustedText(); + } + + private void initializeTrustedText() { + descriptionText.setText(getString(R.string.ReceiveKeyActivity_the_signature_on_this_key_exchange_is_trusted_but)); + } + + private void initializeUntrustedText() { + SpannableString spannableString = new SpannableString(getString(R.string.ReceiveKeyActivity_the_signature_on_this_key_exchange_is_different) + " " + getString(R.string.ReceiveKeyActivity_you_may_wish_to_verify_this_contact)); spannableString.setSpan(new ClickableSpan() { @Override @@ -94,7 +103,8 @@ public class ReceiveKeyActivity extends PassphraseRequiredSherlockActivity { intent.putExtra("master_secret", masterSecret); startActivity(intent); } - }, descriptionText.getText().length()+1, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + }, getString(R.string.ReceiveKeyActivity_the_signature_on_this_key_exchange_is_different).length() +1, + spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); descriptionText.setText(spannableString); descriptionText.setMovementMethod(LinkMovementMethod.getInstance());