diff --git a/cmp-navigation/build.gradle.kts b/cmp-navigation/build.gradle.kts index b19482933..911eabc43 100644 --- a/cmp-navigation/build.gradle.kts +++ b/cmp-navigation/build.gradle.kts @@ -40,6 +40,11 @@ kotlin { implementation(libs.koin.compose) implementation(libs.koin.compose.viewmodel) } + androidMain.dependencies { + implementation(libs.androidx.core.ktx) + implementation(libs.androidx.tracing.ktx) + implementation(libs.koin.android) + } } } diff --git a/cmp-navigation/src/androidMain/kotlin/cmp/navigation/Helpline.android.kt b/cmp-navigation/src/androidMain/kotlin/cmp/navigation/Helpline.android.kt index 827e9c596..0adc631da 100644 --- a/cmp-navigation/src/androidMain/kotlin/cmp/navigation/Helpline.android.kt +++ b/cmp-navigation/src/androidMain/kotlin/cmp/navigation/Helpline.android.kt @@ -19,6 +19,7 @@ import org.koin.core.context.GlobalContext actual fun callHelpline() { val context: Context = GlobalContext.get().get() +// val context = androidContext() val intent = Intent(Intent.ACTION_DIAL).apply { data = Uri.parse("tel:8000000000") addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) diff --git a/cmp-navigation/src/commonMain/kotlin/cmp/navigation/navigation/FeatureNavHost.kt b/cmp-navigation/src/commonMain/kotlin/cmp/navigation/navigation/FeatureNavHost.kt index d853853b7..62d7effe0 100644 --- a/cmp-navigation/src/commonMain/kotlin/cmp/navigation/navigation/FeatureNavHost.kt +++ b/cmp-navigation/src/commonMain/kotlin/cmp/navigation/navigation/FeatureNavHost.kt @@ -39,7 +39,6 @@ internal fun FeatureNavHost( ) { homeNavGraph( onNavigate = { handleHomeNavigation(appState.navController, it, onClickLogout) }, -// onNavigate = { handleHomeNavigation(it, onClickLogout) }, callHelpline = { callHelpline() }, mailHelpline = { mailHelpline() }, ) diff --git a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosScaffold.kt b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosScaffold.kt index f3910b295..c3bfb959d 100644 --- a/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosScaffold.kt +++ b/core/designsystem/src/commonMain/kotlin/org/mifos/mobile/core/designsystem/component/MifosScaffold.kt @@ -66,7 +66,7 @@ fun MifosScaffold( } }, snackbarHost = snackbarHost, - containerColor = Color.Transparent, + containerColor = MaterialTheme.colorScheme.background, content = { paddingValues -> val internalPullToRefreshState = rememberPullToRefreshState() Box( @@ -105,7 +105,7 @@ fun MifosScaffold( snackbarHostState: SnackbarHostState = remember { SnackbarHostState() }, pullToRefreshState: MifosPullToRefreshState = rememberMifosPullToRefreshState(), floatingActionButtonPosition: FabPosition = FabPosition.End, - containerColor: Color = Color.Transparent, + containerColor: Color = MaterialTheme.colorScheme.background, contentColor: Color = MaterialTheme.colorScheme.onSurface, contentWindowInsets: WindowInsets = ScaffoldDefaults.contentWindowInsets, content: @Composable (PaddingValues) -> Unit, diff --git a/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/components/HomeNavigationDrawer.kt b/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/components/HomeNavigationDrawer.kt index 8988ae343..63f7145b4 100644 --- a/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/components/HomeNavigationDrawer.kt +++ b/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/components/HomeNavigationDrawer.kt @@ -9,10 +9,11 @@ */ package org.mifos.mobile.feature.home.components +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width @@ -51,7 +52,10 @@ internal fun HomeNavigationDrawer( modifier = modifier, drawerContent = { ModalDrawerSheet { - LazyColumn { + LazyColumn( + modifier = Modifier.fillMaxSize(), + verticalArrangement = Arrangement.spacedBy(12.dp), + ) { item { MifosUserImage( modifier = Modifier @@ -63,19 +67,15 @@ internal fun HomeNavigationDrawer( Text( text = username, style = MaterialTheme.typography.headlineSmall, - color = MaterialTheme.colorScheme.onSurface, modifier = Modifier .padding(horizontal = 20.dp) .fillMaxWidth(1f), ) - - Spacer(modifier = Modifier.height(20.dp)) } items( items = HomeNavigationItems.entries.toTypedArray(), itemContent = { item -> - Spacer(modifier = Modifier.height(12.dp)) NavigationDrawerItem( modifier = Modifier.padding(horizontal = 20.dp), label = { @@ -92,7 +92,6 @@ internal fun HomeNavigationDrawer( selected = item == HomeNavigationItems.Home, onClick = { navigateItem(item) }, ) - Spacer(modifier = Modifier.height(12.dp)) if (item == HomeNavigationItems.ManageBeneficiaries) { HorizontalDivider( modifier = Modifier.padding(horizontal = 20.dp), diff --git a/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/components/HomeTopBar.kt b/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/components/HomeTopBar.kt index f34386605..543d28c20 100644 --- a/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/components/HomeTopBar.kt +++ b/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/components/HomeTopBar.kt @@ -9,7 +9,6 @@ */ package org.mifos.mobile.feature.home.components -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size @@ -23,7 +22,6 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip -import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import mifos_mobile.feature.home.generated.resources.Res @@ -63,14 +61,12 @@ internal fun HomeTopBar( Box( modifier = Modifier .clip(CircleShape) - .background(Color.Red) .padding(2.dp) .size(8.dp), contentAlignment = Alignment.Center, ) { Text( text = notificationCount.toString(), - color = Color.White, fontSize = 6.sp, ) } diff --git a/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/components/TransferDialog.kt b/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/components/TransferDialog.kt index 00ba2ff6a..d6432365b 100644 --- a/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/components/TransferDialog.kt +++ b/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/components/TransferDialog.kt @@ -10,10 +10,9 @@ package org.mifos.mobile.feature.home.components import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.material3.BasicAlertDialog import androidx.compose.material3.Card @@ -47,6 +46,7 @@ internal fun TransferDialog( modifier = Modifier .fillMaxWidth() .padding(all = 20.dp), + verticalArrangement = Arrangement.spacedBy(8.dp), ) { Text( text = stringResource(Res.string.transfer), @@ -56,9 +56,7 @@ internal fun TransferDialog( navigateToTransfer() }, ) - Spacer(modifier = Modifier.height(20.dp)) HorizontalDivider() - Spacer(modifier = Modifier.height(20.dp)) Text( text = stringResource(Res.string.third_party_transfer), modifier = Modifier diff --git a/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/screens/HomeContent.kt b/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/screens/HomeContent.kt index 643dd9d19..88bb26ead 100644 --- a/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/screens/HomeContent.kt +++ b/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/screens/HomeContent.kt @@ -16,16 +16,13 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.FlowRow import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Card -import androidx.compose.material3.CardDefaults import androidx.compose.material3.DrawerValue import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon @@ -61,6 +58,7 @@ import org.jetbrains.compose.resources.StringResource import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview import org.mifos.mobile.core.common.CurrencyFormatter +import org.mifos.mobile.core.designsystem.component.MifosCard import org.mifos.mobile.core.designsystem.component.MifosScaffold import org.mifos.mobile.core.designsystem.theme.MifosMobileTheme import org.mifos.mobile.core.ui.component.MifosHiddenTextRow @@ -132,6 +130,7 @@ private fun HomeScreenContent( .fillMaxSize() .padding(horizontal = 16.dp) .verticalScroll(scrollState), + verticalArrangement = Arrangement.spacedBy(8.dp), ) { UserDetailsRow( username = state.username, @@ -139,8 +138,6 @@ private fun HomeScreenContent( userProfile = { onAction(HomeAction.OnNavigate(HomeDestinations.PROFILE)) }, ) - Spacer(modifier = Modifier.height(8.dp)) - AccountOverviewCard( totalLoanAmount = state.loanAmount, totalSavingsAmount = state.savingsAmount, @@ -148,8 +145,6 @@ private fun HomeScreenContent( totalSavings = { onAction(HomeAction.OnNavigate(HomeDestinations.SAVINGS_ACCOUNT)) }, ) - Spacer(modifier = Modifier.height(8.dp)) - state.homeCardItems?.let { HomeCards( homeCards = it, @@ -234,7 +229,6 @@ private fun UserDetailsRow( Text( text = stringResource(Res.string.hello_client, username), style = MaterialTheme.typography.headlineSmall, - color = MaterialTheme.colorScheme.onSurface, modifier = Modifier .padding(horizontal = 20.dp) .fillMaxWidth(1f), @@ -264,13 +258,11 @@ private fun HomeCard( imageVector = imageVector, contentDescription = null, modifier = Modifier.size(48.dp), - tint = MaterialTheme.colorScheme.primary, ) Text( text = stringResource(titleId), textAlign = TextAlign.Center, style = MaterialTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurface, ) } } @@ -286,20 +278,19 @@ private fun AccountOverviewCard( val isInPreview = LocalInspectionMode.current Row { - Card( + MifosCard( modifier = Modifier .fillMaxWidth(), - colors = CardDefaults.cardColors(), ) { Column( modifier = Modifier .fillMaxWidth() .padding(20.dp), + verticalArrangement = Arrangement.spacedBy(8.dp), ) { Text( text = stringResource(Res.string.accounts_overview), style = MaterialTheme.typography.bodyMedium, - color = MaterialTheme.colorScheme.onSurface, ) HorizontalDivider(modifier = Modifier.padding(top = 8.dp, bottom = 4.dp)) @@ -322,8 +313,6 @@ private fun AccountOverviewCard( onClick = totalSavings, ) - Spacer(modifier = Modifier.height(8.dp)) - MifosHiddenTextRow( title = stringResource(Res.string.total_loan), hiddenText = if (isInPreview) { @@ -360,7 +349,6 @@ private fun ContactUsRow( Text( text = stringResource(Res.string.need_help), modifier = Modifier.weight(1f), - color = MaterialTheme.colorScheme.onSurface, style = MaterialTheme.typography.bodyMedium, ) diff --git a/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/screens/HomeScreen.kt b/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/screens/HomeScreen.kt index e8b26cdac..e8457130f 100644 --- a/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/screens/HomeScreen.kt +++ b/feature/home/src/commonMain/kotlin/org/mifos/mobile/feature/home/screens/HomeScreen.kt @@ -84,7 +84,6 @@ private fun HomeScreenDialog( is HomeState.DialogState.Loading -> MifosProgressIndicator(modifier = Modifier.fillMaxSize()) - null -> Unit is HomeState.DialogState.LogoutConfirmationDialog -> { MifosAlertDialog( onDismissRequest = { onAction(HomeAction.OnDismissDialog) }, @@ -95,6 +94,7 @@ private fun HomeScreenDialog( dialogText = "", ) } + null -> Unit } }