diff options
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/db/FbTabsDb.kt | 20 |
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 |