Better UX handling on identity key mismatches.

1) Migrate from GSON to Jackson everywhere.

2) Add support for storing identity key conflicts on message rows.

3) Add limited support for surfacing identity key conflicts in UI.
This commit is contained in:
Moxie Marlinspike
2015-01-15 13:35:35 -08:00
parent 4397b55ceb
commit 00d7b5c284
76 changed files with 2395 additions and 721 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 659 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<corners android:radius="2dp" />
<solid android:color="#FFD32F2F" />
</shape>
</item>
<item>
<shape>
<corners android:radius="2dp" />
<solid android:color="#FFF44336" />
</shape>
</item>
</selector>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<corners android:radius="2dp" />
<solid android:color="#ff145c95" />
</shape>
</item>
<item>
<shape>
<corners android:radius="2dp" />
<solid android:color="#ff2090ea" />
</shape>
</item>
</selector>

View File

@@ -47,7 +47,7 @@
<LinearLayout android:id="@+id/conversation_item_parent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/triangle_tick"
android:background="?conversation_item_received_background"
android:orientation="vertical">
@@ -111,7 +111,7 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:paddingTop="2dip"
android:paddingLeft="8dp"
android:paddingRight="5dp"
@@ -153,7 +153,7 @@
<LinearLayout android:id="@+id/indicators_parent"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:orientation="vertical"
android:gravity="center_vertical"

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<org.thoughtcrime.securesms.ConversationItem
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/conversation_item"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@@ -17,7 +18,7 @@
<LinearLayout android:id="@+id/indicators_parent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="left|center_vertical"
android:layout_marginLeft="6dp"
@@ -28,25 +29,28 @@
android:id="@+id/sms_failed_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_action_warning_red"
android:src="@drawable/ic_error_red_24dp"
tools:visibility="visible"
android:visibility="gone"
android:contentDescription="@string/conversation_item_sent__send_failed_indicator_description"/>
android:contentDescription="@string/conversation_item_sent__send_failed_indicator_description" />
<ImageView
android:id="@+id/pending_approval_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_dialog_info_holo_light"
android:src="@drawable/ic_info_outline_grey600_24dp"
android:visibility="gone"
android:layout_gravity="center_vertical"
android:contentDescription="@string/conversation_item_sent__pending_approval_description"/>
android:contentDescription="@string/conversation_item_sent__pending_approval_description"
tools:visibility="visible" />
</LinearLayout>
<LinearLayout android:id="@+id/conversation_item_parent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="?conversation_item_sent_background"
android:background="?conversation_item_sent_push_background"
android:paddingRight="10dip"
android:paddingLeft="10dip"
android:layout_marginLeft="50dp"
@@ -62,7 +66,8 @@
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?conversation_sent_text_primary_color"
android:textColorLink="?conversation_sent_text_primary_color"
android:textSize="16sp" />
android:textSize="16sp"
tools:text="Lorem ipsum mango dolor coconut papaya" />
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mms_view"
@@ -116,7 +121,7 @@
</LinearLayout>
<LinearLayout android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="0dip"
android:layout_gravity="right">

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout android:id="@+id/item_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?conversation_background"
android:paddingTop="15dp"
android:paddingBottom="15dp"
android:elevation="2dp" />
<ListView android:id="@+id/recipients_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
tools:listitem="@layout/conversation_item_details_item" />
</LinearLayout>

View File

@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow android:id="@+id/sent_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/message_details_table_row_pad">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/message_details_header__sent"
android:gravity="right"
android:textStyle="bold" />
<TextView android:id="@+id/sent_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/message_details_table_row_pad"
tools:text="Jan 18, 9:29AM" />
</TableRow>
<TableRow android:id="@+id/received_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/message_details_table_row_pad">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/message_details_header__received"
android:gravity="right"
android:textStyle="bold" />
<TextView android:id="@+id/received_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/message_details_table_row_pad"
tools:text="Jan 18, 9:31AM" />
</TableRow>
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/message_details_table_row_pad">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/message_details_header__via"
android:gravity="right"
android:textStyle="bold" />
<TextView android:id="@+id/transport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/message_details_table_row_pad"
tools:text="Push (TextSecure)" />
</TableRow>
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/message_details_table_row_pad">
<TextView android:id="@+id/tofrom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="@string/message_details_header__to"
android:textStyle="bold" />
</TableRow>
</TableLayout>

View File

@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<org.thoughtcrime.securesms.MessageRecipientListItem
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:gravity="center_vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.makeramen.RoundedImageView
android:id="@+id/contact_photo_image"
android:foreground="@drawable/contact_photo_background"
app:riv_oval="true"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
android:layout_marginRight="10dp"
android:cropToPadding="true"
android:scaleType="centerCrop"
tools:src="@drawable/ic_contact_picture"
android:contentDescription="@string/SingleContactSelectionActivity_contact_photo" />
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dip"
android:layout_marginBottom="4dip"
android:layout_toRightOf="@id/contact_photo_image"
android:layout_centerVertical="true"
android:orientation="horizontal">
<LinearLayout android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView android:id="@+id/from"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?attr/conversation_list_item_contact_color"
android:singleLine="true"
android:gravity="center_vertical"
android:layout_gravity="center_vertical"
tools:text="Jules Bonnot"
android:ellipsize="marquee" />
<TextView android:id="@+id/error_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFF44336"
android:visibility="gone"
tools:visibility="visible"
tools:text="New identity" />
</LinearLayout>
<Button android:id="@+id/conflict_button"
android:layout_width="60sp"
android:layout_height="38sp"
style="@style/ErrorButton"
android:paddingLeft="10dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:layout_gravity="center_vertical"
android:drawableLeft="@drawable/ic_error_white_18dp"
android:text="FIX" />
<Button android:id="@+id/resend_button"
android:layout_width="85sp"
android:layout_height="38sp"
style="@style/InfoButton"
android:paddingLeft="10dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:layout_gravity="center_vertical"
android:drawableLeft="@drawable/ic_refresh_white_18dp"
android:text="RESEND" />
</LinearLayout>
</org.thoughtcrime.securesms.MessageRecipientListItem>

View File

@@ -17,4 +17,5 @@
<dimen name="conversation_activity_compose_padding">12dp</dimen>
<integer name="media_overview_cols">3</integer>
<dimen name="message_details_table_row_pad">10dp</dimen>
</resources>

View File

@@ -59,10 +59,20 @@
<string name="AttachmentTypeSelectorAdapter_audio">Audio</string>
<string name="AttachmentTypeSelectorAdapter_contact">Contact info</string>
<!-- ConfirmIdentityDialog -->
<string name="ConfirmIdentityDialog_the_signature_on_this_key_exchange_is_different">The
identifying key material for %1$s has changed. This could either mean that someone is trying to
intercept your communication, or that %2$s simply re-installed TextSecure and now has a new
identity key.
</string>
<string name="ConfirmIdentityDialog_you_may_wish_to_verify_this_contact">You may wish to verify
this contact.
</string>
<!-- ConversationItem -->
<string name="ConversationItem_message_size_d_kb">Message size: %d KB</string>
<string name="ConversationItem_expires_s">Expires: %s</string>
<string name="ConversationItem_error_sending_message">Error sending message</string>
<string name="ConversationItem_error_not_delivered">Not delivered</string>
<string name="ConversationItem_view_secure_media_question">View secure media?</string>
<string name="ConversationItem_this_media_has_been_stored_in_an_encrypted_database_external_viewer_warning">This media has been stored in an encrypted database. Unfortunately, to view it with an external content viewer currently requires the data to be temporarily decrypted and written to disk. Are you sure that you would like to do this?</string>
<string name="ConversationItem_error_received_stale_key_exchange_message">Error, received stale key exchange message.</string>
@@ -70,6 +80,7 @@
<string name="ConversationItem_group_action_left">%1$s has left the group.</string>
<string name="ConversationItem_click_to_approve_sms">Tap for SMS fallback</string>
<string name="ConversationItem_click_to_approve_mms">Tap for MMS fallback</string>
<string name="ConversationItem_click_for_details">Tap for details</string>
<string name="ConversationItem_click_to_approve_unencrypted">Tap for unsecured fallback</string>
<string name="ConversationItem_click_to_approve_sms_dialog_title">Fallback to SMS?</string>
<string name="ConversationItem_click_to_approve_mms_dialog_title">Fallback to MMS?</string>
@@ -126,8 +137,8 @@
<string name="ConversationFragment_unable_to_write_to_sd_card_exclamation">Unable to write to storage!</string>
<string name="ConversationFragment_saving_attachment">Saving attachment</string>
<string name="ConversationFragment_saving_attachment_to_sd_card">Saving attachment to storage...</string>
<string name="ConversationFragment_pending">PENDING</string>
<string name="ConversationFragment_push">PUSH</string>
<string name="ConversationFragment_pending">Pending...</string>
<string name="ConversationFragment_push">Data (TextSecure)</string>
<string name="ConversationFragment_mms">MMS</string>
<string name="ConversationFragment_sms">SMS</string>
<string name="ConversationFragment_deleting">Deleting...</string>
@@ -225,6 +236,10 @@
<string name="KeyScanningActivity_install_barcode_Scanner">Install Barcode Scanner?</string>
<string name="KeyScanningActivity_this_application_requires_barcode_scanner_would_you_like_to_install_it">TextSecure needs Barcode Scanner for QR codes.</string>
<!-- MessageDetailsRecipient -->
<string name="MessageDetailsRecipient_failed_to_send">Failed to send</string>
<string name="MessageDetailsRecipient_new_identity">New identity</string>
<!-- MmsDownloader -->
<string name="MmsDownloader_error_storing_mms">Error storing MMS!</string>
<string name="MmsDownloader_error_connecting_to_mms_provider">Error connecting to MMS provider...</string>
@@ -642,6 +657,14 @@
<string name="verify_identity_activity__their_identity_they_read">Their identity (they read):</string>
<string name="verify_identity_activity__your_identity_you_read">Your identity (you read):</string>
<!-- message_details_header -->
<string name="message_details_header__sent">Sent</string>
<string name="message_details_header__received">Received</string>
<string name="message_details_header__via">Via</string>
<string name="message_details_header__to">To:</string>
<string name="message_details_header__from">From:</string>
<string name="message_details_header__with">With:</string>
<!-- AndroidManifest.xml -->
<string name="AndroidManifest__create_passphrase">Create passphrase</string>
<string name="AndroidManifest__enter_passphrase">Enter passphrase</string>

View File

@@ -161,4 +161,19 @@
<item name="android:textColor">#ff999999</item>
</style>
<style name="MaterialButton">
<item name="android:elevation">1dp</item>
<item name="android:translationZ">1dp</item>
<item name="android:textColor">@color/white</item>
<item name="android:textSize">12sp</item>
</style>
<style name="InfoButton" parent="@style/MaterialButton">
<item name="android:background">@drawable/info_round</item>
</style>
<style name="ErrorButton" parent="@style/MaterialButton">
<item name="android:background">@drawable/error_round</item>
</style>
</resources>