mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-04 07:25:25 +01:00
Slight cleanup for ConfirmIdentityDialog change.
Closes #3225 // FREEBIE
This commit is contained in:
@@ -55,6 +55,7 @@ import org.thoughtcrime.securesms.mms.Slide;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.DateUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -369,22 +370,17 @@ public class ConversationItem extends LinearLayout {
|
||||
contactPhoto.setAvatar(recipient, true);
|
||||
contactPhoto.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private IdentityKeyMismatch getKeyMismatch(final MessageRecord record) {
|
||||
if (record.isIdentityMismatchFailure()) {
|
||||
for (final IdentityKeyMismatch mismatch : record.getIdentityKeyMismatches()) {
|
||||
if (mismatch.getRecipientId() == record.getIndividualRecipient().getRecipientId()) {
|
||||
return mismatch;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/// Event handlers
|
||||
|
||||
private void handleKeyExchangeClicked() {
|
||||
new ConfirmIdentityDialog(context, masterSecret, messageRecord, getKeyMismatch(messageRecord)).show();
|
||||
private void handleApproveIdentity() {
|
||||
List<IdentityKeyMismatch> mismatches = messageRecord.getIdentityKeyMismatches();
|
||||
|
||||
if (mismatches.size() != 1) {
|
||||
throw new AssertionError("Identity mismatch count: " + mismatches.size());
|
||||
}
|
||||
|
||||
new ConfirmIdentityDialog(context, masterSecret, messageRecord, mismatches.get(0)).show();
|
||||
}
|
||||
|
||||
private class ThumbnailClickListener implements ThumbnailView.ThumbnailClickListener {
|
||||
@@ -462,12 +458,8 @@ public class ConversationItem extends LinearLayout {
|
||||
intent.putExtra(MessageDetailsActivity.TYPE_EXTRA, messageRecord.isMms() ? MmsSmsDatabase.MMS_TRANSPORT : MmsSmsDatabase.SMS_TRANSPORT);
|
||||
intent.putExtra(MessageDetailsActivity.IS_PUSH_GROUP_EXTRA, groupThread && pushDestination);
|
||||
context.startActivity(intent);
|
||||
} else if (messageRecord.isKeyExchange() &&
|
||||
!messageRecord.isOutgoing() &&
|
||||
!messageRecord.isProcessedKeyExchange() &&
|
||||
!messageRecord.isStaleKeyExchange())
|
||||
{
|
||||
handleKeyExchangeClicked();
|
||||
} else if (!messageRecord.isOutgoing() && messageRecord.isIdentityMismatchFailure()) {
|
||||
handleApproveIdentity();
|
||||
} else if (messageRecord.isPendingInsecureSmsFallback()) {
|
||||
handleMessageApproval();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user