From 1e383e9374dd475273ea4b0da3735dc3fbf85c43 Mon Sep 17 00:00:00 2001 From: Jerry Okafor Date: Thu, 13 Jun 2024 11:58:42 -0600 Subject: [PATCH] fix : finally got room working --- .gitignore | 1 + README.md | 5 +- composeApp/build.gradle.kts | 2 +- .../com.jerryokafor.smshare/MainActivity.kt | 5 +- .../kotlin/com.jerryokafor.smshare/App.kt | 107 +++++++++++------- .../com.jerryokafor.smshare/AppViewModel.kt | 52 ++++++--- .../injection/Injection.kt | 7 +- .../screens/navigation/SideNav.kt | 15 ++- .../com.jerryokafor.smshare/Injection.jvm.kt | 16 --- .../injection/Injection.jvm.kt | 44 +++++++ .../kotlin/com.jerryokafor.smshare/main.kt | 1 + .../injection/Injection.ios.kt | 6 +- core/database/build.gradle.kts | 40 +++---- .../core/database/Database.android.kt | 8 +- .../com/jerryokafor/core/database/Costants.kt | 2 +- gradle.properties | 8 +- gradle/libs.versions.toml | 20 ++-- 17 files changed, 221 insertions(+), 118 deletions(-) delete mode 100644 composeApp/src/desktopMain/kotlin/com.jerryokafor.smshare/Injection.jvm.kt create mode 100644 composeApp/src/desktopMain/kotlin/com.jerryokafor.smshare/injection/Injection.jvm.kt diff --git a/.gitignore b/.gitignore index e2f652d..c789f57 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ *.iml .kotlin +.kotlintest .gradle **/build/ xcuserdata diff --git a/README.md b/README.md index cefeca8..df95cbf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # SM Share +![kotlin-version](https://img.shields.io/badge/kotlin-2.0.0-blue?logo=kotlin) + This is a Kotlin Multiplatform project targeting Android, iOS, Web, Desktop. * `/composeApp` is for code that will be shared across your Compose Multiplatform applications. @@ -33,4 +35,5 @@ on [GitHub](https://github.com/JetBrains/compose-multiplatform/issues). [FantasyPremierLeague](https://github.com/joreilly/FantasyPremierLeague/tree/main) [Tivi](https://github.com/chrisbanes/tivi) [Compose Custom Window frame](https://github.com/amir1376/compose-custom-window-frame) -[Targeting Android in KMP](https://medium.com/kodein-koders/targeting-android-in-a-kotlin-multiplatform-mobile-library-b6ab75469287) \ No newline at end of file +[Targeting Android in KMP](https://medium.com/kodein-koders/targeting-android-in-a-kotlin-multiplatform-mobile-library-b6ab75469287) +[Understanding and Configuring your Kotlin Multiplatform Mobile Test Suite](https://touchlab.co/understanding-and-configuring-your-kmm-test-suite) \ No newline at end of file diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index ec6a999..f2e097b 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -60,9 +60,9 @@ kotlin { } commonMain.dependencies { + implementation(projects.core.database) implementation(projects.core.domain) implementation(projects.core.datastore) - implementation(projects.core.database) implementation(projects.core.config) implementation(compose.runtime) diff --git a/composeApp/src/androidMain/kotlin/com.jerryokafor.smshare/MainActivity.kt b/composeApp/src/androidMain/kotlin/com.jerryokafor.smshare/MainActivity.kt index bc04691..27e990b 100644 --- a/composeApp/src/androidMain/kotlin/com.jerryokafor.smshare/MainActivity.kt +++ b/composeApp/src/androidMain/kotlin/com.jerryokafor.smshare/MainActivity.kt @@ -39,9 +39,6 @@ import androidx.compose.runtime.DisposableEffect import androidx.compose.ui.tooling.preview.Preview import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen import androidx.core.util.Consumer -import androidx.lifecycle.lifecycleScope -import com.jerryokafor.smshare.channel.ChannelAuthManager -import kotlinx.coroutines.launch import org.koin.android.ext.android.inject class MainActivity : ComponentActivity() { @@ -85,7 +82,7 @@ class MainActivity : ComponentActivity() { // create session id here val code = data.getQueryParameter("code")!! val state = data.getQueryParameter("state") - appViewModel.authenticateChannel(code,state) + appViewModel.authenticateChannel(code, state) } } } diff --git a/composeApp/src/commonMain/kotlin/com.jerryokafor.smshare/App.kt b/composeApp/src/commonMain/kotlin/com.jerryokafor.smshare/App.kt index f96b015..17e4205 100644 --- a/composeApp/src/commonMain/kotlin/com.jerryokafor.smshare/App.kt +++ b/composeApp/src/commonMain/kotlin/com.jerryokafor.smshare/App.kt @@ -119,9 +119,14 @@ import com.jerryokafor.smshare.screens.settings.settingsScreen import com.jerryokafor.smshare.tags.navigateToTags import com.jerryokafor.smshare.tags.tagsScreen import org.jetbrains.compose.resources.painterResource +import org.jetbrains.compose.resources.stringResource import smshare.composeapp.generated.resources.Res import smshare.composeapp.generated.resources.avatar6 import smshare.composeapp.generated.resources.ic_twitter +import smshare.composeapp.generated.resources.main_nav_title_analytics +import smshare.composeapp.generated.resources.main_nav_title_drafts +import smshare.composeapp.generated.resources.main_nav_title_posts +import smshare.composeapp.generated.resources.main_nav_title_settings expect val DEV_SERVER_HOST: String @@ -240,6 +245,7 @@ fun Home( val appUiState by viewModel.userData.collectAsState() val isOnline by viewModel.isOnLine.collectAsState() val accounts by viewModel.accounts.collectAsState() + val currentAccount by viewModel.currentAccounts.collectAsState() val currentOnNetChange by rememberUpdatedState(onNetChange) LaunchedEffect(viewModel, isOnline) { @@ -275,6 +281,16 @@ fun Home( } } + val navBackStackEntry by navController.currentBackStackEntryAsState() + val title = when (navBackStackEntry?.destination?.route) { + NavItem.Posts().route() -> stringResource(Res.string.main_nav_title_posts) + NavItem.Drafts().route() -> stringResource(Res.string.main_nav_title_drafts) + NavItem.Analytics().route() -> stringResource(Res.string.main_nav_title_analytics) + NavItem.Settings().route() -> stringResource(Res.string.main_nav_title_settings) + else -> "currentRoute" + } + + val mainTopAppBar: @Composable (() -> Unit) = { CenterAlignedTopAppBar( title = { @@ -283,46 +299,50 @@ fun Home( Box( modifier = Modifier.wrapContentSize(Alignment.TopStart) ) { - TextButton(onClick = { expanded = true }) { - ChannelWithName( - modifier = Modifier.wrapContentSize(), - name = "Jerry Okafor", - avatarSize = 38.dp, - avatar = painterResource(Res.drawable.avatar6), - indicator = painterResource(Res.drawable.ic_twitter), - ) - } + if (currentAccount != null) { + TextButton(onClick = { expanded = true }) { + ChannelWithName( + modifier = Modifier.wrapContentSize(), + name = currentAccount!!.name, + avatarSize = 38.dp, + avatar = painterResource(Res.drawable.avatar6), + indicator = painterResource(Res.drawable.ic_twitter), + ) + } - DropdownMenu( - modifier = Modifier.background(MaterialTheme.colorScheme.surface), - expanded = expanded, - onDismissRequest = { expanded = false }, - scrollState = scrollState - ) { - accounts.fastForEach { account -> - DropdownMenuItem( - modifier = Modifier.background(MaterialTheme.colorScheme.surface), - colors = MenuDefaults.itemColors(), - text = { - ChannelWithName( - modifier = Modifier.padding( - horizontal = 8.dp, - vertical = 4.dp - ), - name = account.name, - avatarSize = 38.dp, - avatar = painterResource(Res.drawable.avatar6), - indicator = iconIndicatorForAccountType(account.type), - ) - }, - onClick = { expanded = false }) + DropdownMenu( + modifier = Modifier.background(MaterialTheme.colorScheme.surface), + expanded = expanded, + onDismissRequest = { expanded = false }, + scrollState = scrollState + ) { + accounts.fastForEach { account -> + DropdownMenuItem( + modifier = Modifier.background(MaterialTheme.colorScheme.surface), + colors = MenuDefaults.itemColors(), + text = { + ChannelWithName( + modifier = Modifier.padding( + horizontal = 8.dp, + vertical = 4.dp + ), + name = account.name, + avatarSize = 38.dp, + avatar = painterResource(Res.drawable.avatar6), + indicator = iconIndicatorForAccountType(account.type), + ) + }, + onClick = { expanded = false }) + } } - } - LaunchedEffect(expanded) { - if (expanded) { - // Scroll to show the bottom menu items. - scrollState.scrollTo(scrollState.maxValue) + LaunchedEffect(expanded) { + if (expanded) { + // Scroll to show the bottom menu items. + scrollState.scrollTo(scrollState.maxValue) + } } + } else { + Text(text = title) } } @@ -619,7 +639,18 @@ fun Home( }, floatingActionButton = { AnimatedVisibility(appState.currentTopLevelDestination != null) { - ExtendedFloatingActionButton(onClick = { navController.navigateToCompose() }) { + ExtendedFloatingActionButton(onClick = { + if (accounts.isEmpty() && currentAccount == null) { + scope.launch { + onShowSnackbar( + "No account added, please add account to continue", + "" + ) + } + } else { + navController.navigateToCompose() + } + }) { Row( modifier = Modifier, verticalAlignment = Alignment.CenterVertically, diff --git a/composeApp/src/commonMain/kotlin/com.jerryokafor.smshare/AppViewModel.kt b/composeApp/src/commonMain/kotlin/com.jerryokafor.smshare/AppViewModel.kt index 10fdf14..67749d8 100644 --- a/composeApp/src/commonMain/kotlin/com.jerryokafor.smshare/AppViewModel.kt +++ b/composeApp/src/commonMain/kotlin/com.jerryokafor.smshare/AppViewModel.kt @@ -3,6 +3,7 @@ package com.jerryokafor.smshare import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import co.touchlab.kermit.Logger +import com.jerryokafor.core.database.AppDatabase import com.jerryokafor.core.datastore.UserData import com.jerryokafor.core.datastore.UserDataStore import com.jerryokafor.smshare.channel.ChannelAuthManager @@ -26,6 +27,7 @@ import org.koin.core.component.KoinComponent import org.koin.core.component.inject open class AppViewModel : ViewModel(), KoinComponent { + private val database: AppDatabase by inject() private val userDataStore: UserDataStore by inject() private val supportedChannels: List by inject() private val networkMonitor: NetworkMonitor by inject() @@ -54,18 +56,27 @@ open class AppViewModel : ViewModel(), KoinComponent { initialValue = false, ) - private val _accounts = MutableStateFlow>(emptyList()) - val accounts = _accounts.asStateFlow() - - init { - _accounts.update { - listOf( - Account(name = "Jerry Okafor", type = AccountType.FACEBOOK), - Account(name = "Jerry Okafor", type = AccountType.LINKEDIN), - Account(name = "Jerry Okafor", type = AccountType.TWITTER_X), - ) + val accounts = database.getAccountDao().getAllAsFlow() + .map { + it.mapIndexed { index, entity -> + Account( + type = AccountType.TWITTER_X, + name = entity.name, + description = entity.description, + isSelected = index == 0, + avatarUrl = entity.avatarUrl, + postsCount = 0 + ) + } } - } + .stateIn( + scope = viewModelScope, + started = SharingStarted.Eagerly, + initialValue = emptyList(), + ) + + private val _currentAccounts = MutableStateFlow(null) + val currentAccounts = _currentAccounts.asStateFlow() fun logout() { viewModelScope.launch { @@ -77,13 +88,26 @@ open class AppViewModel : ViewModel(), KoinComponent { Logger.d("Fetching Token: $code | $state") viewModelScope.launch { try { - val tokenResponse = - channelConfigAuthManager.currentChannelConfig?.requestAccessToken( + val currentChannelConfig = channelConfigAuthManager.currentChannelConfig + val tokenResponse = currentChannelConfig?.requestAccessToken( code = code, redirectUrl = SMShareConfig.redirectUrl ) - Logger.d("access Token: $tokenResponse") +// val accountDao = database.getAccountDao() +// val accountEntity = AccountEntity( +// name = currentChannelConfig?.name ?: "", +// description = currentChannelConfig?.description ?: "", +// avatarUrl = tokenResponse?.accessToken ?: "", +// accessToken = tokenResponse?.accessToken ?: "", +// expiresInt = tokenResponse?.expiresIn ?: 0, +// scope = tokenResponse?.scope ?: "", +// created = "" +// ) +// +// accountDao.insert(accountEntity) + +// Logger.d("access Token: $tokenResponse -> $accountEntity") } catch (e: Exception) { Logger.w(e.message ?: "Error creating access token") } diff --git a/composeApp/src/commonMain/kotlin/com.jerryokafor.smshare/injection/Injection.kt b/composeApp/src/commonMain/kotlin/com.jerryokafor.smshare/injection/Injection.kt index bf648ca..0843748 100644 --- a/composeApp/src/commonMain/kotlin/com.jerryokafor.smshare/injection/Injection.kt +++ b/composeApp/src/commonMain/kotlin/com.jerryokafor.smshare/injection/Injection.kt @@ -20,7 +20,12 @@ import screens.login.LoginViewModel fun initKoin(appDeclaration: KoinAppDeclaration = {}): KoinApplication { return startKoin { appDeclaration() - modules(commonModule(), domainModule(), commonNetworkModule(), commonDatabaseModules()) + modules( + commonModule(), + domainModule(), + commonNetworkModule(), + commonDatabaseModules() + ) } } diff --git a/composeApp/src/commonMain/kotlin/com.jerryokafor.smshare/screens/navigation/SideNav.kt b/composeApp/src/commonMain/kotlin/com.jerryokafor.smshare/screens/navigation/SideNav.kt index 0c28ecf..c160dab 100644 --- a/composeApp/src/commonMain/kotlin/com.jerryokafor.smshare/screens/navigation/SideNav.kt +++ b/composeApp/src/commonMain/kotlin/com.jerryokafor.smshare/screens/navigation/SideNav.kt @@ -180,13 +180,20 @@ fun SideNav( HorizontalDivider( modifier = Modifier .height(0.5.dp) - .padding( - start = 80.dp, - end = 8.dp - ), + .padding(start = 80.dp, end = 8.dp) ) } } + + if (accounts.isEmpty()) { + Row( + modifier = Modifier.padding( + vertical = 8.dp, + horizontal = 16.dp + ).fillParentMaxWidth(), + horizontalArrangement = Arrangement.Center + ) { Text("No Account", color = MaterialTheme.colorScheme.error) } + } } } diff --git a/composeApp/src/desktopMain/kotlin/com.jerryokafor.smshare/Injection.jvm.kt b/composeApp/src/desktopMain/kotlin/com.jerryokafor.smshare/Injection.jvm.kt deleted file mode 100644 index 22cf67d..0000000 --- a/composeApp/src/desktopMain/kotlin/com.jerryokafor.smshare/Injection.jvm.kt +++ /dev/null @@ -1,16 +0,0 @@ -package com.jerryokafor.smshare - -import com.jerryokafor.core.database.jvmDBModule -import com.jerryokafor.core.datastore.jvmDataStoreModule -import com.jerryokafor.smshare.DesktopChannelAuthManager -import com.jerryokafor.smshare.channel.ChannelAuthManager -import com.jerryokafor.smshare.core.network.injection.jvmNetworkModule -import com.jerryokafor.smshare.platform.Platform -import org.koin.dsl.module - -fun desktopModule() = module { - includes(jvmDataStoreModule(), jvmDBModule(), jvmNetworkModule()) - single { DesktopChannelAuthManager() } - - single { Platform() } -} diff --git a/composeApp/src/desktopMain/kotlin/com.jerryokafor.smshare/injection/Injection.jvm.kt b/composeApp/src/desktopMain/kotlin/com.jerryokafor.smshare/injection/Injection.jvm.kt new file mode 100644 index 0000000..9c8cea9 --- /dev/null +++ b/composeApp/src/desktopMain/kotlin/com.jerryokafor.smshare/injection/Injection.jvm.kt @@ -0,0 +1,44 @@ +/* + * MIT License + * + * Copyright (c) 2024 SM Share Project + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.jerryokafor.smshare.injection + +import com.jerryokafor.core.database.jvmDBModule +import com.jerryokafor.core.datastore.jvmDataStoreModule +import com.jerryokafor.smshare.DesktopChannelAuthManager +import com.jerryokafor.smshare.channel.ChannelAuthManager +import com.jerryokafor.smshare.core.network.injection.jvmNetworkModule +import com.jerryokafor.smshare.platform.Platform +import org.koin.dsl.module + +fun desktopModule() = module { + includes( + jvmDataStoreModule(), + jvmDBModule(), + jvmNetworkModule() + ) + single { DesktopChannelAuthManager() } + + single { Platform() } +} diff --git a/composeApp/src/desktopMain/kotlin/com.jerryokafor.smshare/main.kt b/composeApp/src/desktopMain/kotlin/com.jerryokafor.smshare/main.kt index 2f3d4a9..e9f07cc 100644 --- a/composeApp/src/desktopMain/kotlin/com.jerryokafor.smshare/main.kt +++ b/composeApp/src/desktopMain/kotlin/com.jerryokafor.smshare/main.kt @@ -27,6 +27,7 @@ package com.jerryokafor.smshare import androidx.compose.ui.window.Window import androidx.compose.ui.window.application import androidx.compose.ui.window.rememberWindowState +import com.jerryokafor.smshare.injection.desktopModule import com.jerryokafor.smshare.injection.initKoin diff --git a/composeApp/src/iosMain/kotlin/com.jerryokafor.smshare/injection/Injection.ios.kt b/composeApp/src/iosMain/kotlin/com.jerryokafor.smshare/injection/Injection.ios.kt index 057fa0f..cfb3610 100644 --- a/composeApp/src/iosMain/kotlin/com.jerryokafor.smshare/injection/Injection.ios.kt +++ b/composeApp/src/iosMain/kotlin/com.jerryokafor.smshare/injection/Injection.ios.kt @@ -12,7 +12,11 @@ import org.koin.core.component.inject import org.koin.dsl.module fun iOSModules() = module { - includes(nativeDBModule(), nativeUserDatastoreModule(), iosNetworkModules()) + includes( + nativeDBModule(), + nativeUserDatastoreModule(), + iosNetworkModules() + ) single { Platform() } single { IOSChannelAuthManager() } diff --git a/core/database/build.gradle.kts b/core/database/build.gradle.kts index d3e7ac7..e72627f 100644 --- a/core/database/build.gradle.kts +++ b/core/database/build.gradle.kts @@ -1,12 +1,20 @@ plugins { id("com.jerryokafor.smshare.android.library") id("com.jerryokafor.smshare.multiplatform") - alias(libs.plugins.ksp) alias(libs.plugins.androidx.room) alias(libs.plugins.kotlinx.serialization) + alias(libs.plugins.ksp) } kotlin { + sourceSets.commonMain { + kotlin.srcDir("build/generated/ksp/metadata") + } + sourceSets.all { + languageSettings.optIn("kotlin.experimental.ExperimentalObjCName") + languageSettings.optIn("kotlinx.cinterop.ExperimentalForeignApi") + } + sourceSets { androidUnitTest.dependencies { implementation(libs.junit) @@ -19,16 +27,21 @@ kotlin { implementation(libs.androidx.espresso.core) implementation(libs.google.truth) } + + androidMain { + dependencies { + implementation(libs.androidx.room.runtime.android) + } + } commonMain.dependencies { - implementation(libs.kotlinx.coroutines.test) - implementation(libs.androidx.room.runtime) + api(libs.androidx.room.runtime) implementation(libs.androidx.sqlite.bundled) implementation(libs.koin.core) - implementation(libs.kotlinx.datetime) } commonTest.dependencies { + implementation(libs.kotlinx.coroutines.test) implementation(libs.kotlin.test) implementation(libs.kotlin.test.common) implementation(libs.kotlin.test.annotations.common) @@ -36,7 +49,7 @@ kotlin { jvmTest.dependencies { implementation(libs.kotlin.test) - implementation(libs.kotlin.test.junit5) +// implementation(libs.kotlin.test.junit5) implementation("io.kotlintest:kotlintest-runner-junit5:3.3.2") implementation("org.junit.jupiter:junit-jupiter-engine:5.5.2") implementation("org.junit.jupiter:junit-jupiter-api:5.5.2") @@ -45,11 +58,6 @@ kotlin { } } -tasks.jvmTest{ - useJUnitPlatform() -} - - android { namespace = "com.jerryokafor.core.database" @@ -59,14 +67,13 @@ android { } } -kotlin.sourceSets.iosMain { - kotlin.srcDir("build/generated/ksp/metadata") -} - //More info: https://github.com/google/ksp/blob/00862a18967eed6832b28e081212e5f3250eb191/examples/multiplatform/workload/build.gradle.kts#L43 dependencies { add("kspCommonMainMetadata", libs.androidx.room.compiler) add("kspAndroid", libs.androidx.room.compiler) + add("kspIosSimulatorArm64", libs.androidx.room.compiler) + add("kspIosX64", libs.androidx.room.compiler) + add("kspIosArm64", libs.androidx.room.compiler) add("kspJvm", libs.androidx.room.compiler) } @@ -74,8 +81,3 @@ room { schemaDirectory("$projectDir/schemas") } -tasks.withType>().configureEach { - if (name != "kspCommonMainKotlinMetadata") { - dependsOn("kspCommonMainKotlinMetadata") - } -} diff --git a/core/database/src/androidMain/kotlin/com/jerryokafor/core/database/Database.android.kt b/core/database/src/androidMain/kotlin/com/jerryokafor/core/database/Database.android.kt index 61a9c73..10bf152 100644 --- a/core/database/src/androidMain/kotlin/com/jerryokafor/core/database/Database.android.kt +++ b/core/database/src/androidMain/kotlin/com/jerryokafor/core/database/Database.android.kt @@ -1,19 +1,15 @@ package com.jerryokafor.core.database import android.app.Application -import androidx.room.ExperimentalRoomApi import androidx.room.Room import androidx.room.RoomDatabase -import androidx.sqlite.driver.bundled.BundledSQLiteDriver -import kotlinx.coroutines.Dispatchers fun createRoomDatabase(app: Application): RoomDatabase.Builder { - val appContext = app.applicationContext - val dbFile = appContext.getDatabasePath(DB_NAME) + val dbFile = app.getDatabasePath(DB_NAME) return Room.databaseBuilder( - context = appContext, + context = app, name = dbFile.absolutePath ).enableMultiInstanceInvalidation() // .setAutoCloseTimeout() diff --git a/core/database/src/commonMain/kotlin/com/jerryokafor/core/database/Costants.kt b/core/database/src/commonMain/kotlin/com/jerryokafor/core/database/Costants.kt index 6c201fa..7d0a9c1 100644 --- a/core/database/src/commonMain/kotlin/com/jerryokafor/core/database/Costants.kt +++ b/core/database/src/commonMain/kotlin/com/jerryokafor/core/database/Costants.kt @@ -1,3 +1,3 @@ package com.jerryokafor.core.database -internal const val DB_NAME = "/sm_share.db" +internal const val DB_NAME = "sm_share.db" diff --git a/gradle.properties b/gradle.properties index 3f33ffd..7432e0f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,11 @@ android.useAndroidX=true #Ktor io.ktor.development=true -#MPP +#KMP kotlin.mpp.androidSourceSetLayoutVersion=2 kotlin.mpp.enableCInteropCommonization=true -kotlin.native.disableCompilerDaemon = true \ No newline at end of file +kotlin.mpp.androidGradlePluginCompatibility.nowarn=true + +# Disabled due to https://youtrack.jetbrains.com/issue/KT-65761 +kotlin.native.disableCompilerDaemon=true +ksp.useKSP2=true \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f386f69..67a2542 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,13 +11,13 @@ composeMultiplatform = "1.6.11" #https://androidx.dev/storage/compose-compiler/repository kotlinCompilerPlugin = "1.5.14" navigationCompose = "2.7.0-alpha07" -uiToolingPreviewAndroid = "1.7.0-beta02" +uiToolingPreviewAndroid = "1.7.0-beta03" dev-chrisbanes-windowSizeClass = "0.5.0" # Room -room = "2.7.0-alpha03" +room = "2.7.0-alpha04" datastore = "1.1.1" -sqlite = "2.5.0-alpha03" +sqlite = "2.5.0-alpha04" atomicfu = "0.24.0" okio = "3.9.0" @@ -47,7 +47,8 @@ androidx-test-junit = "1.1.5" browser = "1.8.0" junit = "4.13.2" ktor = "2.3.11" -commonsCodec = "1.15" +skie = "0.6.2" +commonsCodec = "1.16.1" logback = "1.5.6" kotlinx-serialization-json = "1.6.3" dateTime = "0.6.0" @@ -55,11 +56,11 @@ coroutines = "1.8.1" kotlinx-rpc = "0.1.0" activityKtx = "1.9.0" splashscreen = "1.0.1" -lifecycleViewModel = "2.8.1" +lifecycleViewModel = "2.8.2" esugaJdkLibs = "2.0.4" cacheFix = "3.0.1" material3Android = "1.2.1" -googleTruth = "1.0.1" +googleTruth = "1.1.5" archCoreTesting = "2.2.0" [libraries] @@ -103,6 +104,7 @@ navigation-compose = { module = "org.jetbrains.androidx.navigation:navigation-co #Room androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" } androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" } +androidx-room-runtime-android = { module = "androidx.room:room-runtime-android", version.ref = "room" } androidx-sqlite-bundled = { module = "androidx.sqlite:sqlite-bundled", version.ref = "sqlite" } # Datastore @@ -123,6 +125,7 @@ kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" } commons-codec = { module = "commons-codec:commons-codec", version.ref = "commonsCodec" } +skie-annotations = { module = "co.touchlab.skie:configuration-annotations", version.ref = "skie" } # ktor ktor-server-core = { module = "io.ktor:ktor-server-core-jvm", version.ref = "ktor" } @@ -188,13 +191,10 @@ kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } kotlinJvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } - kotlinx-rpc = { id = "org.jetbrains.kotlinx.rpc.plugin", version.ref = "kotlinx-rpc" } kotlinx-rpc-platform = { id = "org.jetbrains.kotlinx.rpc.platform", version.ref = "kotlinx-rpc" } - ktor = { id = "io.ktor.plugin", version.ref = "ktor" } +skie = { id = "co.touchlab.skie", version.ref = "skie" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } - androidx-room = { id = "androidx.room", version.ref = "room" } - buildKonfig = { id = "com.codingfeline.buildkonfig", version.ref = "buildKonfig" } \ No newline at end of file