use of org.thoughtcrime.securesms.database.documents.IdentityKeyMismatch in project Signal-Android by WhisperSystems.
the class MessagingDatabase method setMismatchedIdentity.
public void setMismatchedIdentity(long messageId, final long recipientId, final IdentityKey identityKey) {
List<IdentityKeyMismatch> items = new ArrayList<IdentityKeyMismatch>() {
{
add(new IdentityKeyMismatch(recipientId, identityKey));
}
};
IdentityKeyMismatchList document = new IdentityKeyMismatchList(items);
SQLiteDatabase database = databaseHelper.getWritableDatabase();
database.beginTransaction();
try {
setDocument(database, messageId, MISMATCHED_IDENTITIES, document);
database.setTransactionSuccessful();
} catch (IOException ioe) {
Log.w(TAG, ioe);
} finally {
database.endTransaction();
}
}
use of org.thoughtcrime.securesms.database.documents.IdentityKeyMismatch in project Signal-Android by WhisperSystems.
the class MessageRecipientListItem method setIssueIndicators.
private void setIssueIndicators(final MasterSecret masterSecret, final MessageRecord record, final boolean isPushGroup) {
final NetworkFailure networkFailure = getNetworkFailure(record);
final IdentityKeyMismatch keyMismatch = networkFailure == null ? getKeyMismatch(record) : null;
String errorText = "";
if (keyMismatch != null) {
resendButton.setVisibility(View.GONE);
conflictButton.setVisibility(View.VISIBLE);
errorText = getContext().getString(R.string.MessageDetailsRecipient_new_safety_number);
conflictButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
new ConfirmIdentityDialog(getContext(), masterSecret, record, keyMismatch).show();
}
});
} else if (networkFailure != null || (!isPushGroup && record.isFailed())) {
resendButton.setVisibility(View.VISIBLE);
resendButton.setEnabled(true);
resendButton.requestFocus();
conflictButton.setVisibility(View.GONE);
errorText = getContext().getString(R.string.MessageDetailsRecipient_failed_to_send);
resendButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
resendButton.setVisibility(View.GONE);
errorDescription.setVisibility(View.GONE);
actionDescription.setVisibility(View.VISIBLE);
actionDescription.setText(R.string.message_recipients_list_item__resending);
new ResendAsyncTask(masterSecret, record, networkFailure).execute();
}
});
} else {
resendButton.setVisibility(View.GONE);
conflictButton.setVisibility(View.GONE);
}
errorDescription.setText(errorText);
errorDescription.setVisibility(TextUtils.isEmpty(errorText) ? View.GONE : View.VISIBLE);
}
Aggregations