mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Adapt Conflicts UI to work with single-recipient failures.
This commit is contained in:
parent
00d7b5c284
commit
3f93731300
@ -1,5 +1,6 @@
|
|||||||
-keepattributes **
|
-keepattributes **
|
||||||
-keep class !android.support.v7.internal.view.menu.**,!org.spongycastle.asn1.**,!org.spongycastle.crypto.ec.**,!org.spongycastle.x509.**,** {*;}
|
|
||||||
|
-keep class !org.spongycastle.crypto.tls.**,!com.doomonafireball.betterpickers.**,!org.w3c.**,!android.support.v7.internal.view.menu.**,!org.spongycastle.asn1.**,!org.spongycastle.crypto.ec.**,!org.spongycastle.x509.**,!org.spongycastle.crypto.agreement.**,!org.spongycastle.crypto.ec.**,!org.spongycastle.math.**,!org.spongycastle.pqc.**,!org.spongycastle.jcajce.provider.asymmetric.**,!org.apache.http.**,** {*;}
|
||||||
-dontpreverify
|
-dontpreverify
|
||||||
-dontoptimize
|
-dontoptimize
|
||||||
-dontwarn **
|
-dontwarn **
|
||||||
|
@ -67,7 +67,8 @@
|
|||||||
android:paddingBottom="5dp"
|
android:paddingBottom="5dp"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:drawableLeft="@drawable/ic_error_white_18dp"
|
android:drawableLeft="@drawable/ic_error_white_18dp"
|
||||||
android:text="FIX" />
|
android:text="FIX"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
<Button android:id="@+id/resend_button"
|
<Button android:id="@+id/resend_button"
|
||||||
android:layout_width="85sp"
|
android:layout_width="85sp"
|
||||||
@ -79,7 +80,8 @@
|
|||||||
android:paddingBottom="5dp"
|
android:paddingBottom="5dp"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:drawableLeft="@drawable/ic_refresh_white_18dp"
|
android:drawableLeft="@drawable/ic_refresh_white_18dp"
|
||||||
android:text="RESEND" />
|
android:text="RESEND"
|
||||||
|
android:visibility="gone"/>
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -332,9 +332,8 @@ public class ConversationItem extends LinearLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setEvents(MessageRecord messageRecord) {
|
private void setEvents(MessageRecord messageRecord) {
|
||||||
setClickable(messageRecord.isPendingSmsFallback() ||
|
setClickable(messageRecord.isFailed()||
|
||||||
messageRecord.hasNetworkFailures() ||
|
messageRecord.isPendingSmsFallback() ||
|
||||||
messageRecord.isIdentityMismatchFailure() ||
|
|
||||||
(messageRecord.isKeyExchange() &&
|
(messageRecord.isKeyExchange() &&
|
||||||
!messageRecord.isCorruptedKeyExchange() &&
|
!messageRecord.isCorruptedKeyExchange() &&
|
||||||
!messageRecord.isOutgoing()));
|
!messageRecord.isOutgoing()));
|
||||||
@ -573,12 +572,12 @@ public class ConversationItem extends LinearLayout {
|
|||||||
|
|
||||||
private class ClickListener implements View.OnClickListener {
|
private class ClickListener implements View.OnClickListener {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (messageRecord.isIdentityMismatchFailure() || messageRecord.hasNetworkFailures()) {
|
if (messageRecord.isFailed()) {
|
||||||
Intent intent = new Intent(context, MessageDetailsActivity.class);
|
Intent intent = new Intent(context, MessageDetailsActivity.class);
|
||||||
intent.putExtra(MessageDetailsActivity.MASTER_SECRET_EXTRA, masterSecret);
|
intent.putExtra(MessageDetailsActivity.MASTER_SECRET_EXTRA, masterSecret);
|
||||||
intent.putExtra(MessageDetailsActivity.MESSAGE_ID_EXTRA, messageRecord.getId());
|
intent.putExtra(MessageDetailsActivity.MESSAGE_ID_EXTRA, messageRecord.getId());
|
||||||
intent.putExtra(MessageDetailsActivity.TYPE_EXTRA, messageRecord.isMms() ? MmsSmsDatabase.MMS_TRANSPORT : MmsSmsDatabase.SMS_TRANSPORT);
|
intent.putExtra(MessageDetailsActivity.TYPE_EXTRA, messageRecord.isMms() ? MmsSmsDatabase.MMS_TRANSPORT : MmsSmsDatabase.SMS_TRANSPORT);
|
||||||
intent.putExtra(MessageDetailsActivity.PUSH_EXTRA, pushDestination);
|
intent.putExtra(MessageDetailsActivity.IS_PUSH_GROUP_EXTRA, groupThread && pushDestination);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
} else if (messageRecord.isKeyExchange() &&
|
} else if (messageRecord.isKeyExchange() &&
|
||||||
!messageRecord.isOutgoing() &&
|
!messageRecord.isOutgoing() &&
|
||||||
|
@ -55,10 +55,11 @@ public class MessageDetailsActivity extends PassphraseRequiredActionBarActivity
|
|||||||
|
|
||||||
public final static String MASTER_SECRET_EXTRA = "master_secret";
|
public final static String MASTER_SECRET_EXTRA = "master_secret";
|
||||||
public final static String MESSAGE_ID_EXTRA = "message_id";
|
public final static String MESSAGE_ID_EXTRA = "message_id";
|
||||||
|
public final static String IS_PUSH_GROUP_EXTRA = "is_push_group";
|
||||||
public final static String TYPE_EXTRA = "type";
|
public final static String TYPE_EXTRA = "type";
|
||||||
public final static String PUSH_EXTRA = "push";
|
|
||||||
|
|
||||||
private MasterSecret masterSecret;
|
private MasterSecret masterSecret;
|
||||||
|
private boolean isPushGroup;
|
||||||
private ConversationItem conversationItem;
|
private ConversationItem conversationItem;
|
||||||
private ViewGroup itemParent;
|
private ViewGroup itemParent;
|
||||||
private TextView sentDate;
|
private TextView sentDate;
|
||||||
@ -84,6 +85,7 @@ public class MessageDetailsActivity extends PassphraseRequiredActionBarActivity
|
|||||||
View header = inflater.inflate(R.layout.message_details_header, recipientsList, false);
|
View header = inflater.inflate(R.layout.message_details_header, recipientsList, false);
|
||||||
|
|
||||||
masterSecret = getIntent().getParcelableExtra(MASTER_SECRET_EXTRA);
|
masterSecret = getIntent().getParcelableExtra(MASTER_SECRET_EXTRA);
|
||||||
|
isPushGroup = getIntent().getBooleanExtra(IS_PUSH_GROUP_EXTRA, false);
|
||||||
itemParent = (ViewGroup) findViewById(R.id.item_container );
|
itemParent = (ViewGroup) findViewById(R.id.item_container );
|
||||||
recipientsList = (ListView ) findViewById(R.id.recipients_list);
|
recipientsList = (ListView ) findViewById(R.id.recipients_list);
|
||||||
sentDate = (TextView ) header.findViewById(R.id.sent_time);
|
sentDate = (TextView ) header.findViewById(R.id.sent_time);
|
||||||
@ -142,7 +144,8 @@ public class MessageDetailsActivity extends PassphraseRequiredActionBarActivity
|
|||||||
conversationItem.set(masterSecret, messageRecord, new HashSet<MessageRecord>(), null,
|
conversationItem.set(masterSecret, messageRecord, new HashSet<MessageRecord>(), null,
|
||||||
recipients != messageRecord.getRecipients(),
|
recipients != messageRecord.getRecipients(),
|
||||||
DirectoryHelper.isPushDestination(this, recipients));
|
DirectoryHelper.isPushDestination(this, recipients));
|
||||||
recipientsList.setAdapter(new MessageDetailsRecipientAdapter(this, masterSecret, messageRecord, recipients));
|
recipientsList.setAdapter(new MessageDetailsRecipientAdapter(this, masterSecret, messageRecord,
|
||||||
|
recipients, isPushGroup));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void inflateMessageViewIfAbsent(MessageRecord messageRecord) {
|
private void inflateMessageViewIfAbsent(MessageRecord messageRecord) {
|
||||||
|
@ -9,20 +9,26 @@ import android.widget.BaseAdapter;
|
|||||||
|
|
||||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||||
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
||||||
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||||
|
|
||||||
public class MessageDetailsRecipientAdapter extends BaseAdapter implements AbsListView.RecyclerListener {
|
public class MessageDetailsRecipientAdapter extends BaseAdapter implements AbsListView.RecyclerListener {
|
||||||
|
|
||||||
private Context context;
|
private final Context context;
|
||||||
private MasterSecret masterSecret;
|
private final MasterSecret masterSecret;
|
||||||
private MessageRecord record;
|
private final MessageRecord record;
|
||||||
private Recipients recipients;
|
private final Recipients recipients;
|
||||||
|
private final boolean isPushGroup;
|
||||||
|
|
||||||
public MessageDetailsRecipientAdapter(Context context, MasterSecret masterSecret, MessageRecord record, Recipients recipients) {
|
public MessageDetailsRecipientAdapter(Context context, MasterSecret masterSecret,
|
||||||
|
MessageRecord record, Recipients recipients,
|
||||||
|
boolean isPushGroup)
|
||||||
|
{
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.masterSecret = masterSecret;
|
this.masterSecret = masterSecret;
|
||||||
this.record = record;
|
this.record = record;
|
||||||
this.recipients = recipients;
|
this.recipients = recipients;
|
||||||
|
this.isPushGroup = isPushGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -46,7 +52,8 @@ public class MessageDetailsRecipientAdapter extends BaseAdapter implements AbsLi
|
|||||||
convertView = LayoutInflater.from(context).inflate(R.layout.message_details_recipient, parent, false);
|
convertView = LayoutInflater.from(context).inflate(R.layout.message_details_recipient, parent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
((MessageRecipientListItem)convertView).set(masterSecret, record, recipients, position);
|
Recipient recipient = recipients.getRecipientsList().get(position);
|
||||||
|
((MessageRecipientListItem)convertView).set(masterSecret, record, recipient, isPushGroup);
|
||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,6 @@ import org.thoughtcrime.securesms.database.documents.IdentityKeyMismatch;
|
|||||||
import org.thoughtcrime.securesms.database.documents.NetworkFailure;
|
import org.thoughtcrime.securesms.database.documents.NetworkFailure;
|
||||||
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
import org.thoughtcrime.securesms.database.model.MessageRecord;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
|
||||||
import org.thoughtcrime.securesms.sms.MessageSender;
|
import org.thoughtcrime.securesms.sms.MessageSender;
|
||||||
import org.thoughtcrime.securesms.util.RecipientViewUtil;
|
import org.thoughtcrime.securesms.util.RecipientViewUtil;
|
||||||
|
|
||||||
@ -74,29 +73,33 @@ public class MessageRecipientListItem extends RelativeLayout
|
|||||||
this.resendButton = (Button) findViewById(R.id.resend_button);
|
this.resendButton = (Button) findViewById(R.id.resend_button);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(final MasterSecret masterSecret, final MessageRecord record, final Recipients recipients, final int position) {
|
public void set(final MasterSecret masterSecret,
|
||||||
recipient = recipients.getRecipientsList().get(position);
|
final MessageRecord record,
|
||||||
|
final Recipient recipient,
|
||||||
|
final boolean isPushGroup)
|
||||||
|
{
|
||||||
|
this.recipient = recipient;
|
||||||
|
|
||||||
recipient.addListener(this);
|
recipient.addListener(this);
|
||||||
fromView.setText(RecipientViewUtil.formatFrom(getContext(), recipient));
|
fromView.setText(RecipientViewUtil.formatFrom(getContext(), recipient));
|
||||||
|
|
||||||
RecipientViewUtil.setContactPhoto(getContext(), contactPhotoImage, recipient, false);
|
RecipientViewUtil.setContactPhoto(getContext(), contactPhotoImage, recipient, false);
|
||||||
setIssueIndicators(masterSecret, record);
|
setIssueIndicators(masterSecret, record, isPushGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setIssueIndicators(final MasterSecret masterSecret, final MessageRecord record) {
|
private void setIssueIndicators(final MasterSecret masterSecret,
|
||||||
|
final MessageRecord record,
|
||||||
|
final boolean isPushGroup)
|
||||||
|
{
|
||||||
final NetworkFailure networkFailure = getNetworkFailure(record);
|
final NetworkFailure networkFailure = getNetworkFailure(record);
|
||||||
final IdentityKeyMismatch keyMismatch = networkFailure == null ? getKeyMismatch(record) : null;
|
final IdentityKeyMismatch keyMismatch = networkFailure == null ? getKeyMismatch(record) : null;
|
||||||
|
|
||||||
String errorText = "";
|
String errorText = "";
|
||||||
if (networkFailure != null) {
|
|
||||||
errorText = getContext().getString(R.string.MessageDetailsRecipient_failed_to_send);
|
if (keyMismatch != null) {
|
||||||
resendButton.setOnClickListener(new OnClickListener() {
|
resendButton.setVisibility(View.GONE);
|
||||||
@Override
|
conflictButton.setVisibility(View.VISIBLE);
|
||||||
public void onClick(View v) {
|
|
||||||
new ResendAsyncTask(masterSecret, record, networkFailure).execute();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (keyMismatch != null) {
|
|
||||||
errorText = getContext().getString(R.string.MessageDetailsRecipient_new_identity);
|
errorText = getContext().getString(R.string.MessageDetailsRecipient_new_identity);
|
||||||
conflictButton.setOnClickListener(new OnClickListener() {
|
conflictButton.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -104,12 +107,24 @@ public class MessageRecipientListItem extends RelativeLayout
|
|||||||
new ConfirmIdentityDialog(getContext(), masterSecret, record, keyMismatch).show();
|
new ConfirmIdentityDialog(getContext(), masterSecret, record, keyMismatch).show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if (networkFailure != null || (!isPushGroup && record.isFailed())) {
|
||||||
|
resendButton.setVisibility(View.VISIBLE);
|
||||||
|
conflictButton.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
errorText = getContext().getString(R.string.MessageDetailsRecipient_failed_to_send);
|
||||||
|
resendButton.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
new ResendAsyncTask(masterSecret, record, networkFailure).execute();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
resendButton.setVisibility(View.GONE);
|
||||||
|
conflictButton.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
errorDescription.setText(errorText);
|
errorDescription.setText(errorText);
|
||||||
errorDescription.setVisibility(TextUtils.isEmpty(errorText) ? View.GONE : View.VISIBLE);
|
errorDescription.setVisibility(TextUtils.isEmpty(errorText) ? View.GONE : View.VISIBLE);
|
||||||
resendButton.setVisibility(networkFailure != null ? View.VISIBLE : View.GONE);
|
|
||||||
conflictButton.setVisibility(keyMismatch != null ? View.VISIBLE : View.GONE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private NetworkFailure getNetworkFailure(final MessageRecord record) {
|
private NetworkFailure getNetworkFailure(final MessageRecord record) {
|
||||||
|
Loading…
Reference in New Issue
Block a user