Splash color on select

This commit is contained in:
Christian Pauly 2020-02-09 16:26:24 +01:00
commit 5451216695
3 changed files with 66 additions and 116 deletions

View file

@ -12,7 +12,7 @@ extension LocalizedBody on Event {
MessageTypes.None,
};
getLocalizedBody(BuildContext context,
String getLocalizedBody(BuildContext context,
{bool withSenderNamePrefix = false, bool hideQuotes = false}) {
if (this.redacted) {
return I18n.of(context)
@ -204,6 +204,13 @@ extension LocalizedBody on Event {
localizedBody = I18n.of(context).unknownEvent(this.typeKey);
}
// Hide quotes
if (hideQuotes) {
List<String> lines = localizedBody.split("\n");
lines.removeWhere((s) => s.startsWith("> ") || s.isEmpty);
localizedBody = lines.join("\n");
}
// Add the sender name prefix
if (withSenderNamePrefix &&
this.type == EventTypes.Message &&
@ -214,13 +221,6 @@ extension LocalizedBody on Event {
localizedBody = "$senderNameOrYou: $localizedBody";
}
// Hide quotes
if (hideQuotes) {
List<String> lines = localizedBody.split("\n");
lines.removeWhere((s) => s.startsWith("> "));
localizedBody = lines.join("\n");
}
return localizedBody;
}
}