Skip to content

Commit

Permalink
Use Moko Resources to get shared strings
Browse files Browse the repository at this point in the history
  • Loading branch information
AVI5HEK committed Oct 31, 2023
1 parent 7f0a2f6 commit 5da7fb2
Showing 1 changed file with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand All @@ -32,15 +35,18 @@ fun HomeScreen(
val uiModels: List<UiModel> 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
)
}

@Composable
private fun HomeScreenContent(
title: String,
uiModels: List<UiModel>
uiModels: List<UiModel>,
) {
Column(
modifier = Modifier.fillMaxSize(),
Expand Down

0 comments on commit 5da7fb2

Please sign in to comment.