mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-04 10:19:15 +02:00
mark overridden names by a "~" in the bubbles
this is just a very simple approach to move forward.
to mark overridden names, a "~" is prefixed.
the idea with using a dedicated color for these names:
as we do not really know
if the address is a generic sender address or belongs to the user,
it makes sense to keep the color used for the name and do not use a
dedicated grey or so.
i think, it is not even worth to detect that better:
it is pretty nice to have senders in mailinglist marked nicely,
all the time.
currently, the "~" is only added to the bubbles - it is not there
in the chatlist-summary (that would needed to be done in core)
and also not in forwarded by, notifications, clipboard etc. i'd say currently,
this is not needed, however, with the current approach it would be doable
(if we mark possible impersonation by colors or icons that may be
much more complicated)
adaption on other uis would also be pretty simple with this approach,
and imho, this `~Max Mustermann` looks pretty nicely
and even intuitive in a way.
drawback of the approach is that user may user `~`
as the first character of their names, we could target that by
adapting dc_msg_get_displayname() in the core, if we want to keep this approach,
however, maybe it is also not worth, the "~" is more a flaw than a feature,
also that would result to "~~Name" in the bubbles.
i do not see how that can be used to trick users when beeing added.
names as "foo 🔒" might be more dangerous here, when it comes to trick users.
This commit is contained in:
parent
7003fcb018
commit
95b605e331
6 changed files with 10 additions and 10 deletions
|
@ -131,10 +131,10 @@ public class DcMsg {
|
||||||
public native String getError ();
|
public native String getError ();
|
||||||
private native @Nullable String getOverrideSenderName();
|
private native @Nullable String getOverrideSenderName();
|
||||||
|
|
||||||
public @NonNull String getSenderName(@NonNull DcContact dcContact) {
|
public @NonNull String getSenderName(@NonNull DcContact dcContact, boolean markOverride) {
|
||||||
String overrideName = getOverrideSenderName();
|
String overrideName = getOverrideSenderName();
|
||||||
if (overrideName != null) {
|
if (overrideName != null) {
|
||||||
return overrideName;
|
return (markOverride ? "~" : "") + overrideName;
|
||||||
} else {
|
} else {
|
||||||
return dcContact.getDisplayName();
|
return dcContact.getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
|
@ -428,7 +428,7 @@ public class ConversationFragment extends Fragment
|
||||||
|
|
||||||
if (msg.getFromId() != prevMsg.getFromId() && !singleMsg) {
|
if (msg.getFromId() != prevMsg.getFromId() && !singleMsg) {
|
||||||
DcContact contact = dcContext.getContact(msg.getFromId());
|
DcContact contact = dcContext.getContact(msg.getFromId());
|
||||||
result.append(msg.getSenderName(contact)).append(":\n");
|
result.append(msg.getSenderName(contact, false)).append(":\n");
|
||||||
}
|
}
|
||||||
if (msg.getType() == DcMsg.DC_MSG_TEXT || (singleMsg && !msg.getText().isEmpty())) {
|
if (msg.getType() == DcMsg.DC_MSG_TEXT || (singleMsg && !msg.getText().isEmpty())) {
|
||||||
result.append(msg.getText());
|
result.append(msg.getText());
|
||||||
|
|
|
@ -655,14 +655,14 @@ public class ConversationItem extends LinearLayout
|
||||||
private void setGroupMessageStatus() {
|
private void setGroupMessageStatus() {
|
||||||
if (messageRecord.isForwarded()) {
|
if (messageRecord.isForwarded()) {
|
||||||
if (groupThread && !messageRecord.isOutgoing() && dcContact !=null) {
|
if (groupThread && !messageRecord.isOutgoing() && dcContact !=null) {
|
||||||
this.groupSender.setText(context.getString(R.string.forwarded_by, messageRecord.getSenderName(dcContact)));
|
this.groupSender.setText(context.getString(R.string.forwarded_by, messageRecord.getSenderName(dcContact, false)));
|
||||||
} else {
|
} else {
|
||||||
this.groupSender.setText(context.getString(R.string.forwarded_message));
|
this.groupSender.setText(context.getString(R.string.forwarded_message));
|
||||||
}
|
}
|
||||||
this.groupSender.setTextColor(context.getResources().getColor(R.color.unknown_sender));
|
this.groupSender.setTextColor(context.getResources().getColor(R.color.unknown_sender));
|
||||||
}
|
}
|
||||||
else if (groupThread && !messageRecord.isOutgoing() && dcContact !=null) {
|
else if (groupThread && !messageRecord.isOutgoing() && dcContact !=null) {
|
||||||
this.groupSender.setText(messageRecord.getSenderName(dcContact));
|
this.groupSender.setText(messageRecord.getSenderName(dcContact, true));
|
||||||
this.groupSender.setTextColor(dcContact.getArgbColor());
|
this.groupSender.setTextColor(dcContact.getArgbColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -490,7 +490,7 @@ public class ConversationListFragment extends Fragment
|
||||||
answerBlock = context.getString(R.string.block);
|
answerBlock = context.getString(R.string.block);
|
||||||
} else {
|
} else {
|
||||||
DcContact dcContact = dcContext.getContact(dcMsg.getFromId());
|
DcContact dcContact = dcContext.getContact(dcMsg.getFromId());
|
||||||
question = context.getString(R.string.ask_start_chat_with, dcMsg.getSenderName(dcContact));
|
question = context.getString(R.string.ask_start_chat_with, dcMsg.getSenderName(dcContact, false));
|
||||||
answerBlock = context.getString(R.string.menu_block_contact);
|
answerBlock = context.getString(R.string.menu_block_contact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,7 +148,7 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
|
||||||
if (contact == null) {
|
if (contact == null) {
|
||||||
authorView.setText(getContext().getString(R.string.forwarded_message));
|
authorView.setText(getContext().getString(R.string.forwarded_message));
|
||||||
} else {
|
} else {
|
||||||
authorView.setText(getContext().getString(R.string.forwarded_by, quotedMsg.getSenderName(contact)));
|
authorView.setText(getContext().getString(R.string.forwarded_by, quotedMsg.getSenderName(contact, false)));
|
||||||
}
|
}
|
||||||
authorView.setTextColor(getForwardedColor());
|
authorView.setTextColor(getForwardedColor());
|
||||||
quoteBarView.setBackgroundColor(getForwardedColor());
|
quoteBarView.setBackgroundColor(getForwardedColor());
|
||||||
|
@ -159,7 +159,7 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
|
||||||
quoteBarView.setBackgroundColor(getForwardedColor());
|
quoteBarView.setBackgroundColor(getForwardedColor());
|
||||||
} else {
|
} else {
|
||||||
authorView.setVisibility(VISIBLE);
|
authorView.setVisibility(VISIBLE);
|
||||||
authorView.setText(quotedMsg.getSenderName(contact));
|
authorView.setText(quotedMsg.getSenderName(contact, false));
|
||||||
authorView.setTextColor(contact.getArgbColor());
|
authorView.setTextColor(contact.getArgbColor());
|
||||||
quoteBarView.setBackgroundColor(contact.getArgbColor());
|
quoteBarView.setBackgroundColor(contact.getArgbColor());
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,7 +331,7 @@ public class NotificationCenter {
|
||||||
DcMsg dcMsg = dcContext.getMsg(msgId);
|
DcMsg dcMsg = dcContext.getMsg(msgId);
|
||||||
String line = privacy.isDisplayMessage()? dcMsg.getSummarytext(2000) : context.getString(R.string.notify_new_message);
|
String line = privacy.isDisplayMessage()? dcMsg.getSummarytext(2000) : context.getString(R.string.notify_new_message);
|
||||||
if (dcChat.isGroup() && privacy.isDisplayContact()) {
|
if (dcChat.isGroup() && privacy.isDisplayContact()) {
|
||||||
line = dcMsg.getSenderName(dcContext.getContact(dcMsg.getFromId())) + ": " + line;
|
line = dcMsg.getSenderName(dcContext.getContact(dcMsg.getFromId()), false) + ": " + line;
|
||||||
}
|
}
|
||||||
|
|
||||||
// play signal?
|
// play signal?
|
||||||
|
@ -368,7 +368,7 @@ public class NotificationCenter {
|
||||||
// prepend the sender in the ticker also for one-to-one chats (for group-chats, this is already done)
|
// prepend the sender in the ticker also for one-to-one chats (for group-chats, this is already done)
|
||||||
String tickerLine = line;
|
String tickerLine = line;
|
||||||
if (!dcChat.isGroup() && privacy.isDisplayContact()) {
|
if (!dcChat.isGroup() && privacy.isDisplayContact()) {
|
||||||
line = dcMsg.getSenderName(dcContext.getContact(dcMsg.getFromId())) + ": " + line;
|
line = dcMsg.getSenderName(dcContext.getContact(dcMsg.getFromId()), false) + ": " + line;
|
||||||
}
|
}
|
||||||
builder.setTicker(tickerLine);
|
builder.setTicker(tickerLine);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue