Fix issue #237 - CW not filtered

This commit is contained in:
Thomas 2022-07-10 17:45:56 +02:00
parent 938c2a6a9f
commit 425d19f2d6
1 changed files with 24 additions and 0 deletions

View File

@ -107,6 +107,18 @@ public class TimelineHelper {
Matcher m = p.matcher(content);
if (m.find()) {
statusesToRemove.add(status);
continue;
}
if (status.spoiler_text != null) {
String spoilerText;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
spoilerText = Html.fromHtml(status.spoiler_text, Html.FROM_HTML_MODE_LEGACY).toString();
else
spoilerText = Html.fromHtml(status.spoiler_text).toString();
Matcher ms = p.matcher(spoilerText);
if (ms.find()) {
statusesToRemove.add(status);
}
}
}
} else {
@ -118,6 +130,18 @@ public class TimelineHelper {
content = Html.fromHtml(status.content).toString();
if (content.contains(filter.phrase)) {
statusesToRemove.add(status);
continue;
}
if (status.spoiler_text != null) {
String spoilerText;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
spoilerText = Html.fromHtml(status.spoiler_text, Html.FROM_HTML_MODE_LEGACY).toString();
else
spoilerText = Html.fromHtml(status.spoiler_text).toString();
if (spoilerText.contains(filter.phrase)) {
statusesToRemove.add(status);
}
}
}
}