Skip to content

Commit

Permalink
Update Room integration
Browse files Browse the repository at this point in the history
  • Loading branch information
kirich1409 committed Oct 6, 2024
1 parent 8d8cb13 commit d930a99
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package dev.androidbroadcast.news.database

import androidx.room.ConstructedBy
import androidx.room.Database
import androidx.room.RoomDatabase
import androidx.room.RoomDatabaseConstructor
import androidx.room.TypeConverters
import dev.androidbroadcast.news.database.dao.ArticleDao
import dev.androidbroadcast.news.database.models.ArticleDBO
Expand All @@ -17,10 +19,17 @@ class NewsDatabase internal constructor(private val database: NewsRoomDatabase)

@Database(entities = [ArticleDBO::class], version = 2)
@TypeConverters(Converters::class)
@ConstructedBy(NewsRoomDatabaseConstructor::class)
abstract class NewsRoomDatabase : RoomDatabase() {
abstract fun articlesDao(): ArticleDao
}

// The Room compiler generates the `actual` implementations.
@Suppress("NO_ACTUAL_FOR_EXPECT")
expect object NewsRoomDatabaseConstructor : RoomDatabaseConstructor<NewsRoomDatabase> {
override fun initialize(): NewsRoomDatabase
}

fun NewsDatabase(
databaseBuilder: RoomDatabase.Builder<NewsRoomDatabase>,
dispatcher: CoroutineDispatcher = Dispatchers.IO,
Expand Down
4 changes: 2 additions & 2 deletions desktop/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ plugins {
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

dependencies {
Expand Down
15 changes: 3 additions & 12 deletions features/news-main/ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {
kotlin {
androidTarget {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
jvmTarget.set(JvmTarget.JVM_21)
}
}

Expand Down Expand Up @@ -64,8 +64,8 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

buildFeatures {
Expand All @@ -78,19 +78,10 @@ android {
}

composeCompiler {
enableStrongSkippingMode = true
reportsDestination = layout.buildDirectory.dir("compose_compiler")
}

dependencies {
debugImplementation(libs.androidx.compose.ui.tooling)
debugImplementation(libs.androidx.compose.ui.tooling.preview)
}

compose {
resources {
publicResClass = false
packageOfResClass = "dev.androidbroadcast.news.main.ui"
generateResClass = always
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.Card
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -25,9 +24,6 @@ import androidx.compose.ui.unit.dp
import coil3.compose.AsyncImage
import coil3.compose.AsyncImagePainter
import dev.androidbroadcast.news.NewsTheme
import dev.androidbroadcast.news.main.ui.Res
import dev.androidbroadcast.news.main.ui.content_desc_item_article_image
import org.jetbrains.compose.resources.stringResource

@Composable
internal fun ArticleList(
Expand Down Expand Up @@ -74,7 +70,7 @@ internal fun Article(
isImageVisible = false
}
},
contentDescription = stringResource(Res.string.content_desc_item_article_image),
contentDescription = "",
contentScale = ContentScale.Crop,
modifier = Modifier.size(150.dp)
)
Expand Down
14 changes: 7 additions & 7 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ junitVersion = "1.2.1"
espressoCore = "3.6.1"
androidx-lifecycle = "2.8.6"
activityCompose = "1.9.2"
composeBom = "2024.09.02"
androidx-compose-runtime = "1.7.2"
composeBom = "2024.09.03"
androidx-compose-runtime = "1.7.3"
kotlinx-coroutines = "1.9.0"
appcompat = "1.7.0"
material = "1.12.0"
room = "2.7.0-alpha08"
room = "2.7.0-alpha09"
ksp = "2.0.20-1.0.25"
okhttp = "4.12.0"
coil = "3.0.0-alpha06"
detekt = "1.23.6"
uiautomator = "2.3.0"
benchmarkMacroJunit4 = "1.3.1"
baselineprofile = "1.3.1"
profileinstaller = "1.4.0"
benchmarkMacroJunit4 = "1.3.2"
baselineprofile = "1.3.2"
profileinstaller = "1.4.1"
androidSdk-target = "33"
androidSdk-min = "24"
androidSdk-compile = "34"
Expand All @@ -33,7 +33,7 @@ compose-plugin = "1.6.11"
ktor = "2.3.11"
koin = "3.6.0-Beta4"
koin-compose = "1.2.0-Beta4"
sqlite = "2.5.0-alpha08"
sqlite = "2.5.0-alpha09"

[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
Expand Down

0 comments on commit d930a99

Please sign in to comment.