aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin')
-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