Use full text for notifications

This commit is contained in:
M66B 2020-02-05 11:18:01 +01:00
parent 28aaf8ee05
commit 9df6a659d3
1 changed files with 22 additions and 11 deletions

View File

@ -3173,6 +3173,15 @@ class Core {
}
if (message.content && notify_preview) {
// Android will truncate the text
String text = null;
try {
String html = Helper.readText(message.getFile(context));
text = HtmlHelper.getText(html);
} catch (Throwable ex) {
Log.e(ex);
}
// Wearables
StringBuilder sb = new StringBuilder();
if (!TextUtils.isEmpty(message.subject))
@ -3180,8 +3189,8 @@ class Core {
if (wearable_preview) {
if (sb.length() != 0)
sb.append(" - ");
if (!TextUtils.isEmpty(message.preview))
sb.append(message.preview);
if (!TextUtils.isEmpty(text))
sb.append(text);
}
if (sb.length() > 0)
mbuilder.setContentText(sb.toString());
@ -3191,15 +3200,17 @@ class Core {
if (!TextUtils.isEmpty(message.subject))
sbm.append("<em>").append(message.subject).append("</em>").append("<br>");
if (!TextUtils.isEmpty(message.preview))
sbm.append(message.preview);
if (!TextUtils.isEmpty(text))
sbm.append(text);
if (sbm.length() > 0) {
NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle()
.bigText(HtmlHelper.fromHtml(sbm.toString()));
if (!TextUtils.isEmpty(message.subject))
bigText.setSummaryText(message.subject);
mbuilder.setStyle(bigText);
}
} else {
if (!TextUtils.isEmpty(message.subject))
mbuilder.setContentText(message.subject);