mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
This addresses two types of introduction corner cases:
* force decline when two of our own identities are introduced to each other * throw away introduction requests to the same identity (impossible to trigger from UI) Closes #284
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
android:layout_marginTop="@dimen/message_bubble_timestamp_margin"
|
||||
android:layout_alignEnd="@+id/introductionText"
|
||||
android:layout_alignRight="@+id/introductionText"
|
||||
android:layout_below="@+id/acceptButton"
|
||||
android:layout_below="@+id/declineButton"
|
||||
android:textColor="@color/private_message_date"
|
||||
android:textSize="@dimen/text_size_tiny"
|
||||
tools:text="Dec 24, 13:37"/>
|
||||
@@ -46,7 +46,6 @@
|
||||
style="@style/BriarButtonFlat.Positive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="-15dp"
|
||||
android:layout_alignEnd="@+id/introductionText"
|
||||
android:layout_alignRight="@+id/introductionText"
|
||||
android:layout_below="@+id/introductionText"
|
||||
@@ -57,6 +56,7 @@
|
||||
style="@style/BriarButtonFlat.Negative"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="-15dp"
|
||||
android:layout_below="@+id/introductionText"
|
||||
android:layout_toLeftOf="@+id/acceptButton"
|
||||
android:layout_toStartOf="@+id/acceptButton"
|
||||
|
||||
@@ -155,6 +155,7 @@
|
||||
<string name="introduction_request_sent">You have asked to introduce %1$s to %2$s.</string>
|
||||
<string name="introduction_request_received">%1$s has asked to introduce you to %2$s. Do you want to add %2$s to your contact list?</string>
|
||||
<string name="introduction_request_exists_received">%1$s has asked to introduce you to %2$s, but %2$s is already in your contact list. Since %1$s might not know that, you can still respond:</string>
|
||||
<string name="introduction_request_for_our_identity_received">%1$s has asked to introduce you to %2$s, but %2$s is one of your other identities. For that reason you cannot accept the introduction:</string>
|
||||
<string name="introduction_request_answered_received">%1$s has asked to introduce you to %2$s.</string>
|
||||
<string name="introduction_response_accepted_sent">You accepted the introduction to %1$s.</string>
|
||||
<string name="introduction_response_declined_sent">You declined the introduction to %1$s.</string>
|
||||
|
||||
@@ -261,15 +261,23 @@ class ConversationAdapter extends RecyclerView.Adapter {
|
||||
contactName, ir.getName()));
|
||||
}
|
||||
|
||||
ui.acceptButton.setVisibility(View.VISIBLE);
|
||||
ui.acceptButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
intro.respondToIntroduction(ir.getSessionId(), true);
|
||||
item.setAnswered(true);
|
||||
notifyItemChanged(position);
|
||||
}
|
||||
});
|
||||
if (item.getIntroductionRequest().doesIntroduceOtherIdentity()) {
|
||||
// don't allow accept when one of our identities is introduced
|
||||
ui.acceptButton.setVisibility(View.GONE);
|
||||
ui.text.setText(ctx.getString(
|
||||
R.string.introduction_request_for_our_identity_received,
|
||||
contactName, ir.getName()));
|
||||
} else {
|
||||
ui.acceptButton.setVisibility(View.VISIBLE);
|
||||
ui.acceptButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
intro.respondToIntroduction(ir.getSessionId(), true);
|
||||
item.setAnswered(true);
|
||||
notifyItemChanged(position);
|
||||
}
|
||||
});
|
||||
}
|
||||
ui.declineButton.setVisibility(View.VISIBLE);
|
||||
ui.declineButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user