mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-24 13:19:12 +00:00
Fix notifications for media messages without text.
They now read 'media message' in italics. Closes #2649
This commit is contained in:
committed by
Moxie Marlinspike
parent
96896bf8f1
commit
2011391e65
@@ -51,6 +51,7 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.service.KeyCachingService;
|
||||
import org.thoughtcrime.securesms.util.SpanUtil;
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||
import org.whispersystems.textsecure.api.messages.TextSecureEnvelope;
|
||||
|
||||
@@ -339,7 +340,7 @@ public class MessageNotifier {
|
||||
Recipient recipient = record.getIndividualRecipient();
|
||||
Recipients recipients = record.getRecipients();
|
||||
long threadId = record.getThreadId();
|
||||
SpannableString body = record.getDisplayBody();
|
||||
CharSequence body = record.getDisplayBody();
|
||||
Uri image = null;
|
||||
Recipients threadRecipients = null;
|
||||
|
||||
@@ -348,8 +349,13 @@ public class MessageNotifier {
|
||||
}
|
||||
|
||||
if (SmsDatabase.Types.isDecryptInProgressType(record.getType()) || !record.getBody().isPlaintext()) {
|
||||
body = new SpannableString(context.getString(R.string.MessageNotifier_encrypted_message));
|
||||
body.setSpan(new StyleSpan(android.graphics.Typeface.ITALIC), 0, body.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
body = SpanUtil.italic(context.getString(R.string.MessageNotifier_encrypted_message));
|
||||
} else if (record.isMms() && TextUtils.isEmpty(body)) {
|
||||
body = SpanUtil.italic(context.getString(R.string.MessageNotifier_media_message));
|
||||
} else if (record.isMms()) {
|
||||
String message = context.getString(R.string.MessageNotifier_media_message_with_text, body);
|
||||
int italicLength = message.length() - body.length();
|
||||
body = SpanUtil.italic(message, italicLength);
|
||||
}
|
||||
|
||||
notificationState.addNotification(new NotificationItem(recipient, recipients, threadRecipients, threadId, body, image));
|
||||
|
||||
Reference in New Issue
Block a user