mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-26 11:21:55 +00:00
committed by
Moxie Marlinspike
parent
66c9fd44df
commit
3506f2db12
@@ -25,8 +25,8 @@ import android.text.style.StyleSpan;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.database.MmsSmsColumns;
|
||||
import org.thoughtcrime.securesms.database.SmsDatabase;
|
||||
import org.thoughtcrime.securesms.database.documents.NetworkFailure;
|
||||
import org.thoughtcrime.securesms.database.documents.IdentityKeyMismatch;
|
||||
import org.thoughtcrime.securesms.database.documents.NetworkFailure;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.util.ExpirationUtil;
|
||||
@@ -93,9 +93,9 @@ public abstract class MessageRecord extends DisplayRecord {
|
||||
@Override
|
||||
public SpannableString getDisplayBody() {
|
||||
if (isGroupUpdate() && isOutgoing()) {
|
||||
return emphasisAdded(context.getString(R.string.MessageRecord_updated_group));
|
||||
return emphasisAdded(context.getString(R.string.MessageRecord_you_updated_group));
|
||||
} else if (isGroupUpdate()) {
|
||||
return emphasisAdded(GroupUtil.getDescription(context, getBody().getBody()).toString());
|
||||
return emphasisAdded(GroupUtil.getDescription(context, getBody().getBody()).toString(getIndividualRecipient()));
|
||||
} else if (isGroupQuit() && isOutgoing()) {
|
||||
return emphasisAdded(context.getString(R.string.MessageRecord_left_group));
|
||||
} else if (isGroupQuit()) {
|
||||
|
||||
@@ -28,10 +28,8 @@ import android.text.style.StyleSpan;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.database.MmsSmsColumns;
|
||||
import org.thoughtcrime.securesms.database.SmsDatabase;
|
||||
import org.thoughtcrime.securesms.database.ThreadDatabase;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.util.ExpirationUtil;
|
||||
import org.thoughtcrime.securesms.util.GroupUtil;
|
||||
|
||||
/**
|
||||
* The message record model which represents thread heading messages.
|
||||
@@ -75,7 +73,7 @@ public class ThreadRecord extends DisplayRecord {
|
||||
if (SmsDatabase.Types.isDecryptInProgressType(type)) {
|
||||
return emphasisAdded(context.getString(R.string.MessageDisplayHelper_decrypting_please_wait));
|
||||
} else if (isGroupUpdate()) {
|
||||
return emphasisAdded(GroupUtil.getDescription(context, getBody().getBody()).toString());
|
||||
return emphasisAdded(context.getString(R.string.ThreadRecord_group_updated));
|
||||
} else if (isGroupQuit()) {
|
||||
return emphasisAdded(context.getString(R.string.ThreadRecord_left_the_group));
|
||||
} else if (isKeyExchange()) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
|
||||
@@ -61,33 +62,33 @@ public class GroupUtil {
|
||||
if (groupContext == null || groupContext.getMembersList().isEmpty()) {
|
||||
this.members = null;
|
||||
} else {
|
||||
this.members = RecipientFactory.getRecipientsFromString(context, Util.join(groupContext.getMembersList(), ", "), true);
|
||||
this.members = RecipientFactory.getRecipientsFromStrings(context, groupContext.getMembersList(), true);
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
public String toString(Recipient sender) {
|
||||
StringBuilder description = new StringBuilder();
|
||||
description.append(context.getString(R.string.MessageRecord_s_updated_group, sender.toShortString()));
|
||||
|
||||
if (groupContext == null) {
|
||||
return context.getString(R.string.GroupUtil_group_updated);
|
||||
return description.toString();
|
||||
}
|
||||
|
||||
StringBuilder description = new StringBuilder();
|
||||
String title = groupContext.getName();
|
||||
String title = groupContext.getName();
|
||||
|
||||
if (members != null) {
|
||||
description.append("\n");
|
||||
description.append(context.getResources().getQuantityString(R.plurals.GroupUtil_joined_the_group,
|
||||
members.getRecipientsList().size(), members.toShortString()));
|
||||
}
|
||||
|
||||
if (title != null && !title.trim().isEmpty()) {
|
||||
if (description.length() > 0) description.append(" ");
|
||||
if (members != null) description.append(" ");
|
||||
else description.append("\n");
|
||||
description.append(context.getString(R.string.GroupUtil_group_name_is_now, title));
|
||||
}
|
||||
|
||||
if (description.length() > 0) {
|
||||
return description.toString();
|
||||
} else {
|
||||
return context.getString(R.string.GroupUtil_group_updated);
|
||||
}
|
||||
return description.toString();
|
||||
}
|
||||
|
||||
public void addListener(Recipients.RecipientsModifiedListener listener) {
|
||||
|
||||
Reference in New Issue
Block a user