diff --git a/app/src/main/java/eu/faircode/email/EntityRule.java b/app/src/main/java/eu/faircode/email/EntityRule.java index 6a9bd255f1..c081ec1d01 100644 --- a/app/src/main/java/eu/faircode/email/EntityRule.java +++ b/app/src/main/java/eu/faircode/email/EntityRule.java @@ -520,7 +520,13 @@ public class EntityRule { return true; } - private boolean onActionTts(Context context, EntityMessage message, JSONObject jargs) { + private boolean onActionTts(Context context, EntityMessage message, JSONObject jargs) throws IOException { + if (!message.content) { + EntityOperation.queue(context, message, EntityOperation.BODY); + EntityOperation.queue(context, message, EntityOperation.RULE, this.id); + return true; + } + Locale locale = (message.language == null ? Locale.getDefault() : new Locale(message.language)); Configuration configuration = new Configuration(context.getResources().getConfiguration()); @@ -538,6 +544,12 @@ public class EntityRule { sb.append(res.getString(R.string.title_rule_tts_subject)) .append(' ').append(message.subject).append(". "); + String body = Helper.readText(message.getFile(context)); + String preview = HtmlHelper.getPreview(body); + if (!TextUtils.isEmpty(preview)) + sb.append(res.getString(R.string.title_rule_tts_content)) + .append(' ').append(preview); + TTSHelper.speak(context, "rule:" + message.id, sb.toString(), locale); return true; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4917c22fa5..4652dce68e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1117,6 +1117,7 @@ New message From Subject + Text Synchronize Folders