aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-03-05 18:46:42 -0500
committerAllan Wang <me@allanwang.ca>2019-03-05 18:46:42 -0500
commite82b74a687f5b5bff6f7cc16e1ba504583a8db32 (patch)
tree7c85510ed01ff9867b4bebf46af6c8e870562aba /app/src/main/kotlin/com/pitchedapps
parentee9a9a696420d5da05b4f306898fff29e9abe1a4 (diff)
downloadfrost-e82b74a687f5b5bff6f7cc16e1ba504583a8db32.tar.gz
frost-e82b74a687f5b5bff6f7cc16e1ba504583a8db32.tar.bz2
frost-e82b74a687f5b5bff6f7cc16e1ba504583a8db32.zip
Move helper functions outside of interface
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/db/FbTabsDb.kt20
1 files changed, 10 insertions, 10 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/db/FbTabsDb.kt b/app/src/main/kotlin/com/pitchedapps/frost/db/FbTabsDb.kt
index ab01e025..4fc38ec9 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/db/FbTabsDb.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/db/FbTabsDb.kt
@@ -58,19 +58,19 @@ interface FbTabDao {
_deleteAll()
_insertAll(items)
}
+}
-// suspend fun save(items: List<FbItem>) {
-// _save((items.takeIf { it.isNotEmpty() } ?: defaultTabs()).mapIndexed { index, fbItem ->
-// FbTabEntity(
-// index,
-// fbItem
-// )
-// })
-// }
-//
-// suspend fun selectAll(): List<FbItem> = _selectAll().map { it.tab }.takeIf { it.isNotEmpty() } ?: defaultTabs()
+suspend fun FbTabDao.save(items: List<FbItem>) {
+ _save((items.takeIf { it.isNotEmpty() } ?: defaultTabs()).mapIndexed { index, fbItem ->
+ FbTabEntity(
+ index,
+ fbItem
+ )
+ })
}
+suspend fun FbTabDao.selectAll(): List<FbItem> = _selectAll().map { it.tab }.takeIf { it.isNotEmpty() } ?: defaultTabs()
+
object FbItemConverter {
@androidx.room.TypeConverter
@JvmStatic