From 5da7fb290e112696e8b0083030e2e01fd933e539 Mon Sep 17 00:00:00 2001 From: Avishek Khan Date: Tue, 31 Oct 2023 18:49:32 +0700 Subject: [PATCH] Use Moko Resources to get shared strings --- .../compose/ui/screens/home/HomeScreen.kt | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/home/HomeScreen.kt b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/home/HomeScreen.kt index a9c632a35..a34897ec9 100644 --- a/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/home/HomeScreen.kt +++ b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/home/HomeScreen.kt @@ -1,4 +1,4 @@ -package co.nimblehq.template.compose.ui.screens.home +package co.nimblehq.kmm.template.ui.screens.home import androidx.compose.foundation.layout.* import androidx.compose.material.Text @@ -10,13 +10,16 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.lifecycle.compose.collectAsStateWithLifecycle -import co.nimblehq.template.compose.R -import co.nimblehq.template.compose.extensions.collectAsEffect -import co.nimblehq.template.compose.ui.AppDestination -import co.nimblehq.template.compose.ui.models.UiModel -import co.nimblehq.template.compose.ui.showToast -import co.nimblehq.template.compose.ui.theme.AppTheme.dimensions -import co.nimblehq.template.compose.ui.theme.ComposeTheme +import co.nimblehq.kmm.template.R +import co.nimblehq.kmm.template.Strings +import co.nimblehq.kmm.template.extensions.collectAsEffect +import co.nimblehq.kmm.template.getPlatform +import co.nimblehq.kmm.template.sharedres.SharedRes +import co.nimblehq.kmm.template.ui.AppDestination +import co.nimblehq.kmm.template.ui.models.UiModel +import co.nimblehq.kmm.template.ui.showToast +import co.nimblehq.kmm.template.ui.theme.AppTheme.dimensions +import co.nimblehq.kmm.template.ui.theme.ComposeTheme import org.koin.androidx.compose.getViewModel import timber.log.Timber @@ -32,7 +35,10 @@ fun HomeScreen( val uiModels: List by viewModel.uiModels.collectAsStateWithLifecycle() HomeScreenContent( - title = stringResource(id = R.string.app_name), + title = Strings(LocalContext.current).get( + id = SharedRes.strings.greeting, + args = listOf(getPlatform().name) + ), uiModels = uiModels ) } @@ -40,7 +46,7 @@ fun HomeScreen( @Composable private fun HomeScreenContent( title: String, - uiModels: List + uiModels: List, ) { Column( modifier = Modifier.fillMaxSize(),