Use full text for notifications

pull/174/head
M66B 5 years ago
parent 28aaf8ee05
commit 9df6a659d3

@ -3173,6 +3173,15 @@ class Core {
} }
if (message.content && notify_preview) { 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 // Wearables
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (!TextUtils.isEmpty(message.subject)) if (!TextUtils.isEmpty(message.subject))
@ -3180,8 +3189,8 @@ class Core {
if (wearable_preview) { if (wearable_preview) {
if (sb.length() != 0) if (sb.length() != 0)
sb.append(" - "); sb.append(" - ");
if (!TextUtils.isEmpty(message.preview)) if (!TextUtils.isEmpty(text))
sb.append(message.preview); sb.append(text);
} }
if (sb.length() > 0) if (sb.length() > 0)
mbuilder.setContentText(sb.toString()); mbuilder.setContentText(sb.toString());
@ -3191,15 +3200,17 @@ class Core {
if (!TextUtils.isEmpty(message.subject)) if (!TextUtils.isEmpty(message.subject))
sbm.append("<em>").append(message.subject).append("</em>").append("<br>"); sbm.append("<em>").append(message.subject).append("</em>").append("<br>");
if (!TextUtils.isEmpty(message.preview)) if (!TextUtils.isEmpty(text))
sbm.append(message.preview); sbm.append(text);
if (sbm.length() > 0) {
NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle() NotificationCompat.BigTextStyle bigText = new NotificationCompat.BigTextStyle()
.bigText(HtmlHelper.fromHtml(sbm.toString())); .bigText(HtmlHelper.fromHtml(sbm.toString()));
if (!TextUtils.isEmpty(message.subject)) if (!TextUtils.isEmpty(message.subject))
bigText.setSummaryText(message.subject); bigText.setSummaryText(message.subject);
mbuilder.setStyle(bigText); mbuilder.setStyle(bigText);
}
} else { } else {
if (!TextUtils.isEmpty(message.subject)) if (!TextUtils.isEmpty(message.subject))
mbuilder.setContentText(message.subject); mbuilder.setContentText(message.subject);

Loading…
Cancel
Save