Add necessary dependencies and fix compilation errors

pull/1323/head
lihenggui 2 years ago
parent ebfc988fd5
commit fdf29ab32e

@ -61,10 +61,9 @@ kotlin {
implementation(devNpm("copy-webpack-plugin", "9.1.0"))
}
}
val commonTest by getting {
dependencies {
implementation(libs.kotlin.test)
}
commonTest.dependencies {
implementation(libs.kotlin.test)
implementation(libs.kotlinx.coroutines.test)
}
}
}

@ -23,6 +23,7 @@ import com.google.samples.apps.nowinandroid.core.database.NiaDatabase
import com.google.samples.apps.nowinandroid.core.database.model.NewsResourceFtsEntity
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
/**
* DAO for [NewsResourceFtsEntity] access.
@ -45,9 +46,10 @@ class NewsResourceFtsDao(db: NiaDatabase, private val dispatcher: CoroutineDispa
.mapToList(dispatcher)
}
fun getCount(): Flow<Long> {
fun getCount(): Flow<Int> {
return dbQuery.getCount()
.asFlow()
.mapToOneNotNull(dispatcher)
.map { it.toInt() }
}
}

@ -24,7 +24,6 @@ import app.cash.sqldelight.driver.native.NativeSqliteDriver
import me.tatarka.inject.annotations.Component
import me.tatarka.inject.annotations.Provides
@Component
actual class DriverModule {
@Provides

Loading…
Cancel
Save