aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-05-01 16:05:19 -0700
committerAllan Wang <me@allanwang.ca>2019-05-01 16:05:19 -0700
commit58f4f9298b09081b3c937227828824849057a835 (patch)
tree18d2bf44637b52c9f68817253fc37d4ca699daef /app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt
parent576cc1a451a16f2d82ee1e41e83c420a85ded47e (diff)
parentda93672c2ed6b54e0e7119a6b55715185112df3e (diff)
downloadfrost-58f4f9298b09081b3c937227828824849057a835.tar.gz
frost-58f4f9298b09081b3c937227828824849057a835.tar.bz2
frost-58f4f9298b09081b3c937227828824849057a835.zip
Merge dev
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt
index f05c42e9..00a1432f 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt
@@ -16,7 +16,7 @@
*/
package com.pitchedapps.frost.facebook.parsers
-import com.pitchedapps.frost.dbflow.CookieModel
+import com.pitchedapps.frost.db.CookieEntity
import com.pitchedapps.frost.facebook.FB_EPOCH_MATCHER
import com.pitchedapps.frost.facebook.FB_MESSAGE_NOTIF_ID_MATCHER
import com.pitchedapps.frost.facebook.FbItem
@@ -46,6 +46,10 @@ data class FrostMessages(
val seeMore: FrostLink?,
val extraLinks: List<FrostLink>
) : ParseNotification {
+
+ override val isEmpty: Boolean
+ get() = threads.isEmpty()
+
override fun toString() = StringBuilder().apply {
append("FrostMessages {\n")
append(threads.toJsonString("threads", 1))
@@ -54,7 +58,7 @@ data class FrostMessages(
append("}")
}.toString()
- override fun getUnreadNotifications(data: CookieModel) =
+ override fun getUnreadNotifications(data: CookieEntity) =
threads.asSequence().filter(FrostThread::unread).map {
with(it) {
NotificationContent(
@@ -64,7 +68,8 @@ data class FrostMessages(
title = title,
text = content ?: "",
timestamp = time,
- profileUrl = img
+ profileUrl = img,
+ unread = unread
)
}
}.toList()