aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/db/NotificationDb.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-08-06 00:49:58 -0700
committerAllan Wang <me@allanwang.ca>2019-08-06 00:49:58 -0700
commit55bf3e4b5b4af5baa3c230ca82f74988608971a3 (patch)
tree3db856e037b70257aaef19e34db6b0856bda6412 /app/src/main/kotlin/com/pitchedapps/frost/db/NotificationDb.kt
parent99953f087f2c363dad05ae3f86b5bcba22484e43 (diff)
downloadfrost-55bf3e4b5b4af5baa3c230ca82f74988608971a3.tar.gz
frost-55bf3e4b5b4af5baa3c230ca82f74988608971a3.tar.bz2
frost-55bf3e4b5b4af5baa3c230ca82f74988608971a3.zip
Format kotlin
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/db/NotificationDb.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/db/NotificationDb.kt16
1 files changed, 13 insertions, 3 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/db/NotificationDb.kt b/app/src/main/kotlin/com/pitchedapps/frost/db/NotificationDb.kt
index 813c39a3..e89bf46d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/db/NotificationDb.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/db/NotificationDb.kt
@@ -140,14 +140,20 @@ suspend fun NotificationDao.deleteAll() = dao { _deleteAll() }
fun NotificationDao.selectNotificationsSync(userId: Long, type: String): List<NotificationContent> =
_selectNotifications(userId, type).map { it.toNotifContent() }
-suspend fun NotificationDao.selectNotifications(userId: Long, type: String): List<NotificationContent> = dao {
+suspend fun NotificationDao.selectNotifications(
+ userId: Long,
+ type: String
+): List<NotificationContent> = dao {
selectNotificationsSync(userId, type)
}
/**
* Returns true if successful, given that there are constraints to the insertion
*/
-suspend fun NotificationDao.saveNotifications(type: String, notifs: List<NotificationContent>): Boolean = dao {
+suspend fun NotificationDao.saveNotifications(
+ type: String,
+ notifs: List<NotificationContent>
+): Boolean = dao {
try {
_saveNotifications(type, notifs)
true
@@ -187,7 +193,11 @@ class NotificationMigration2(modelClass: Class<NotificationModel>) :
}
}
-@Table(database = NotificationDb::class, allFields = true, primaryKeyConflict = ConflictAction.REPLACE)
+@Table(
+ database = NotificationDb::class,
+ allFields = true,
+ primaryKeyConflict = ConflictAction.REPLACE
+)
data class NotificationModel(
@PrimaryKey var id: Long = -1L,
var epoch: Long = -1L,