diff --git a/feature/home/src/commonMain/composeResources/values/strings.xml b/feature/home/src/commonMain/composeResources/values/strings.xml
index b0dcebb7..9120231b 100644
--- a/feature/home/src/commonMain/composeResources/values/strings.xml
+++ b/feature/home/src/commonMain/composeResources/values/strings.xml
@@ -12,4 +12,22 @@
Loading
Start sending money tax free!
Mifos Pay is the best place for users to receive and send money. Start saving money now!
+
+ /* HomeScreen.kt */
+ Wallet Balance
+ arrow_up
+ View More
+ Mark as Default
+ Request
+ Request Money
+ Send
+ Send Money
+ Coin
+ Account type
+
+
+ /* HomeScreenViewModel */
+ Account marked as default
+ Error marking account as default
+ "No accounts found"
\ No newline at end of file
diff --git a/feature/home/src/commonMain/kotlin/org/mifospay/feature/home/HomeScreen.kt b/feature/home/src/commonMain/kotlin/org/mifospay/feature/home/HomeScreen.kt
index b264db11..ef3608b1 100644
--- a/feature/home/src/commonMain/kotlin/org/mifospay/feature/home/HomeScreen.kt
+++ b/feature/home/src/commonMain/kotlin/org/mifospay/feature/home/HomeScreen.kt
@@ -75,11 +75,21 @@ import androidx.compose.ui.unit.sp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import kotlinx.coroutines.launch
import mobile_wallet.feature.home.generated.resources.Res
+import mobile_wallet.feature.home.generated.resources.account_type
import mobile_wallet.feature.home.generated.resources.arrow_backward
+import mobile_wallet.feature.home.generated.resources.arrow_up
import mobile_wallet.feature.home.generated.resources.coin_image
import mobile_wallet.feature.home.generated.resources.feature_home_desc
import mobile_wallet.feature.home.generated.resources.feature_home_loading
+import mobile_wallet.feature.home.generated.resources.mark_default
+import mobile_wallet.feature.home.generated.resources.request
+import mobile_wallet.feature.home.generated.resources.request_money
+import mobile_wallet.feature.home.generated.resources.send
+import mobile_wallet.feature.home.generated.resources.send_money
import mobile_wallet.feature.home.generated.resources.start_sending_your_money_tax_free
+import mobile_wallet.feature.home.generated.resources.view_more
+import mobile_wallet.feature.home.generated.resources.wallet_balance
+import org.jetbrains.compose.resources.getString
import org.jetbrains.compose.resources.painterResource
import org.jetbrains.compose.resources.stringResource
import org.jetbrains.compose.resources.vectorResource
@@ -138,7 +148,7 @@ internal fun HomeScreen(
is HomeEvent.NavigateToTransactionScreen -> {}
is HomeEvent.ShowToast -> {
scope.launch {
- snackbarState.showSnackbar(event.message)
+ snackbarState.showSnackbar(getString(event.message))
}
}
@@ -371,7 +381,7 @@ private fun AccountCard(
) {
Column {
Text(
- text = "Account Type",
+ text = stringResource(Res.string.account_type),
fontWeight = FontWeight(300),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.surface,
@@ -423,7 +433,7 @@ private fun AccountCard(
) {
Column {
Text(
- text = "Wallet Balance",
+ text = stringResource(Res.string.wallet_balance),
fontWeight = FontWeight(300),
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.surface,
@@ -447,7 +457,7 @@ private fun AccountCard(
.graphicsLayer(rotationZ = 90f)
.padding(4.dp),
imageVector = Icons.Filled.KeyboardArrowUp,
- contentDescription = "arrow",
+ contentDescription = stringResource(Res.string.arrow_up),
tint = MaterialTheme.colorScheme.surface,
)
}
@@ -473,7 +483,7 @@ fun CardDropdownBox(
) {
Icon(
imageVector = MifosIcons.MoreVert,
- contentDescription = "View More",
+ contentDescription = stringResource(Res.string.view_more),
)
}
@@ -482,7 +492,7 @@ fun CardDropdownBox(
onDismissRequest = { showDropdown = false },
) {
DropdownMenuItem(
- text = { Text("Mark as Default") },
+ text = { Text(stringResource(Res.string.mark_default)) },
onClick = {
onClickDefault()
showDropdown = false
@@ -506,7 +516,7 @@ private fun PayRequestScreen(
modifier = Modifier
.weight(1f)
.height(55.dp),
- text = "Request",
+ text = stringResource(Res.string.request),
onClick = onRequest,
leadingIcon = {
Icon(
@@ -515,7 +525,7 @@ private fun PayRequestScreen(
imageVector = vectorResource(
Res.drawable.arrow_backward,
),
- contentDescription = "request money",
+ contentDescription = stringResource(Res.string.request_money),
)
},
)
@@ -526,7 +536,7 @@ private fun PayRequestScreen(
modifier = Modifier
.weight(1f)
.height(55.dp),
- text = "Send",
+ text = stringResource(Res.string.send),
onClick = onSend,
leadingIcon = {
Icon(
@@ -534,7 +544,7 @@ private fun PayRequestScreen(
.size(26.dp)
.graphicsLayer(rotationZ = 180f),
imageVector = vectorResource(Res.drawable.arrow_backward),
- contentDescription = "Send money",
+ contentDescription = stringResource(Res.string.send_money),
)
},
)
@@ -578,7 +588,7 @@ private fun MifosSendMoneyFreeCard(
modifier = Modifier.weight(2.5f),
contentScale = ContentScale.Fit,
painter = painterResource(Res.drawable.coin_image),
- contentDescription = "coin Image",
+ contentDescription = stringResource(Res.string.coin_image),
)
}
}
diff --git a/feature/home/src/commonMain/kotlin/org/mifospay/feature/home/HomeViewModel.kt b/feature/home/src/commonMain/kotlin/org/mifospay/feature/home/HomeViewModel.kt
index dfec9a55..bef04b4b 100644
--- a/feature/home/src/commonMain/kotlin/org/mifospay/feature/home/HomeViewModel.kt
+++ b/feature/home/src/commonMain/kotlin/org/mifospay/feature/home/HomeViewModel.kt
@@ -18,6 +18,11 @@ import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import kotlinx.serialization.Serializable
+import mobile_wallet.feature.home.generated.resources.Res
+import mobile_wallet.feature.home.generated.resources.account_error
+import mobile_wallet.feature.home.generated.resources.account_success
+import mobile_wallet.feature.home.generated.resources.no_account
+import org.jetbrains.compose.resources.StringResource
import org.mifospay.core.common.DataState
import org.mifospay.core.data.repository.SelfServiceRepository
import org.mifospay.core.datastore.UserPreferencesRepository
@@ -72,7 +77,7 @@ class HomeViewModel(
mutableStateFlow.update {
it.copy(isRefreshing = false)
}
- ViewState.Error("No accounts found")
+ ViewState.Error(Res.string.no_account)
}
is DataState.Loading -> ViewState.Loading
@@ -155,14 +160,14 @@ class HomeViewModel(
when (result) {
is DataState.Loading -> {}
is DataState.Error -> {
- sendEvent(HomeEvent.ShowToast("Error marking account as default"))
+ sendEvent(HomeEvent.ShowToast(Res.string.account_error))
}
is DataState.Success -> {
mutableStateFlow.update {
it.copy(defaultAccountId = action.accountId)
}
- sendEvent(HomeEvent.ShowToast("Account marked as default"))
+ sendEvent(HomeEvent.ShowToast(Res.string.account_success))
}
}
}
@@ -202,7 +207,7 @@ data class HomeState(
sealed interface ViewState {
data object Loading : ViewState
- data class Error(val message: String) : ViewState
+ data class Error(val message: StringResource) : ViewState
data class Content(
val accounts: List,
@@ -219,7 +224,7 @@ sealed interface HomeEvent {
data class NavigateToTransactionDetail(val accountId: Long, val transactionId: Long) : HomeEvent
data class NavigateToAccountDetail(val accountId: Long) : HomeEvent
- data class ShowToast(val message: String) : HomeEvent
+ data class ShowToast(val message: StringResource) : HomeEvent
}
sealed interface HomeAction {