1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-10 04:52:38 +01:00

Filter notif titles as well from settings, resolves #1333

This commit is contained in:
Allan Wang 2019-03-30 22:59:57 -04:00
parent 5831c6bd1b
commit 5b470546fd
No known key found for this signature in database
GPG Key ID: C93E3F9C679D7A56

View File

@ -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