aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-03-30 22:59:57 -0400
committerAllan Wang <me@allanwang.ca>2019-03-30 22:59:57 -0400
commit5b470546fd478a322b121ec60a1f4c05d4d61ff6 (patch)
tree190868e11a4859362121f40f0fb48c6c1ee5f18c /app
parent5831c6bd1b1ffa90510ebc5146a62e50758f25fb (diff)
downloadfrost-5b470546fd478a322b121ec60a1f4c05d4d61ff6.tar.gz
frost-5b470546fd478a322b121ec60a1f4c05d4d61ff6.tar.bz2
frost-5b470546fd478a322b121ec60a1f4c05d4d61ff6.zip
Filter notif titles as well from settings, resolves #1333
Diffstat (limited to 'app')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt14
1 files changed, 12 insertions, 2 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt
index f66f77e2..54a9f8ae 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt
@@ -126,9 +126,19 @@ enum class NotificationType(
L.v { "$name notification data not found" }
return -1
}
+
+ /**
+ * Checks that the text doesn't contain any blacklisted keywords
+ */
+ fun validText(text: String?): Boolean {
+ val t = text ?: return true
+ return Prefs.notificationKeywords.none {
+ t.contains(it, true)
+ }
+ }
+
val notifContents = response.data.getUnreadNotifications(data).filter { notif ->
- val text = notif.text
- Prefs.notificationKeywords.none { text.contains(it, true) }
+ validText(notif.title) && validText(notif.text)
}
if (notifContents.isEmpty()) return 0
val userId = data.id