Skip to content

Commit

Permalink
confirm session abort handler in ConversationItem
Browse files Browse the repository at this point in the history
// FREEBIE
  • Loading branch information
mcginty committed Feb 20, 2014
1 parent 28b9620 commit a0cbbd2
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/org/thoughtcrime/securesms/ConversationItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.thoughtcrime.securesms.util.DateUtils;
import org.thoughtcrime.securesms.util.Emoji;
import org.whispersystems.textsecure.crypto.MasterSecret;
import org.whispersystems.textsecure.storage.Session;
import org.whispersystems.textsecure.util.FutureTaskListener;
import org.whispersystems.textsecure.util.ListenableFutureTask;

Expand Down Expand Up @@ -134,6 +135,8 @@ protected void onFinishInflate() {
public void set(MasterSecret masterSecret, MessageRecord messageRecord,
Handler failedIconHandler, boolean groupThread)
{


this.messageRecord = messageRecord;
this.masterSecret = masterSecret;
this.failedIconHandler = failedIconHandler;
Expand Down Expand Up @@ -549,4 +552,24 @@ public void onClick(View v) {
}
}

private void handleAbortSecureSession() {
if (!messageRecord.isSecure()) return;

AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.ConversationActivity_abort_secure_session_confirmation);
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setCancelable(true);
builder.setMessage(R.string.ConversationActivity_are_you_sure_that_you_want_to_abort_this_secure_session_question);
builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (messageRecord.getRecipients().isSingleRecipient()) {
Recipient recipient = messageRecord.getRecipients().getPrimaryRecipient();
Session.abortSessionFor(context, recipient);
}
}
});
builder.setNegativeButton(R.string.no, null);
builder.show();
}
}

0 comments on commit a0cbbd2

Please sign in to comment.