Skip to content

Commit

Permalink
Kyc package cleanup (#1689)
Browse files Browse the repository at this point in the history
* Invoice package strings fixed

* Viewmodels fixed

* Cleaned KYC Package

* fixed FinanceScreen errors
  • Loading branch information
AdityaKumdale authored Jul 3, 2024
1 parent d68fe2e commit c154706
Show file tree
Hide file tree
Showing 40 changed files with 257 additions and 2,157 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.mifospay.feature.finance

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.pager.rememberPagerState
Expand All @@ -14,10 +13,12 @@ import org.mifospay.feature.kyc.KYCScreen
import org.mifospay.feature.savedcards.CardsScreen
import org.mifospay.merchants.ui.MerchantScreen

@OptIn(ExperimentalFoundationApi::class)
@Composable
fun FinanceRoute(
onAddBtn: () -> Unit
onAddBtn: () -> Unit,
onLevel1Clicked: () -> Unit,
onLevel2Clicked: () -> Unit,
onLevel3Clicked: () -> Unit
) {
val pagerState = rememberPagerState(
pageCount = { FinanceScreenContents.entries.size }
Expand All @@ -34,7 +35,11 @@ fun FinanceRoute(
MerchantScreen()
},
TabContent(FinanceScreenContents.KYC.name) {
KYCScreen()
KYCScreen(
onLevel1Clicked = onLevel1Clicked,
onLevel2Clicked = onLevel2Clicked,
onLevel3Clicked = onLevel3Clicked
)
}
)

Expand All @@ -53,5 +58,10 @@ enum class FinanceScreenContents {
@Preview(showBackground = true)
@Composable
private fun FinanceScreenPreview() {
FinanceRoute {}
FinanceRoute(
onAddBtn = {},
onLevel1Clicked = {},
onLevel2Clicked = {},
onLevel3Clicked = {}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ fun NavGraphBuilder.financeScreen(
) {
composable(route = FINANCE_ROUTE) {
FinanceRoute(
onAddBtn = onAddBtn
onAddBtn = onAddBtn,
onLevel1Clicked = {},
onLevel2Clicked = {},
onLevel3Clicked = {}
)
}
}
1 change: 0 additions & 1 deletion feature/kyc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ android {

dependencies {
implementation(projects.core.data)
implementation(projects.mifospay)
implementation(libs.compose.material)
implementation(libs.sheets.compose.dialogs.core)
implementation(libs.sheets.compose.dialogs.calender)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,32 @@ import androidx.compose.ui.unit.sp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.mifospay.core.model.entity.kyc.KYCLevel1Details
import org.mifospay.R
import org.mifospay.core.designsystem.component.MifosOverlayLoadingWheel
import org.mifospay.kyc.presenter.KYCDescriptionUiState
import org.mifospay.kyc.presenter.KYCDescriptionViewModel
import org.mifospay.kyc.R

@Composable
fun KYCScreen(viewModel: KYCDescriptionViewModel = hiltViewModel()) {
fun KYCScreen(
viewModel: KYCDescriptionViewModel = hiltViewModel(),
onLevel1Clicked: () -> Unit,
onLevel2Clicked: () -> Unit,
onLevel3Clicked: () -> Unit
) {
val kUiState by viewModel.kycdescriptionState.collectAsState()
val isRefreshing by viewModel.isRefreshing.collectAsStateWithLifecycle()

KYCDescriptionScreen(
kUiState = kUiState,
onLevel1Clicked = {
// Todo
// Todo : Implement onLevel1Clicked flow
onLevel1Clicked.invoke()
},
onLevel2Clicked = {
// Todo
// Todo : Implement onLevel2Clicked flow
onLevel2Clicked.invoke()
},
onLevel3Clicked = {
// Todo
// Todo : Implement onLevel3Clicked flow
onLevel3Clicked.invoke()
},
isRefreshing = isRefreshing,
onRefresh = { viewModel.refresh() }
Expand All @@ -84,7 +90,7 @@ fun KYCDescriptionScreen(
Box(Modifier.pullRefresh(pullRefreshState)) {
when (kUiState) {
KYCDescriptionUiState.Loading -> {
MifosOverlayLoadingWheel(contentDesc = stringResource(R.string.loading))
MifosOverlayLoadingWheel(contentDesc = stringResource(R.string.feature_kyc_loading))
}

is KYCDescriptionUiState.Error -> {
Expand Down Expand Up @@ -128,7 +134,7 @@ fun KYCDescriptionScreen(
verticalArrangement = Arrangement.Top
) {
Text(
text = stringResource(R.string.complete_kyc),
text = stringResource(R.string.feature_kyc_complete_kyc),
modifier = Modifier.padding(top = 40.dp),
fontSize = 19.sp,
textAlign = TextAlign.Center
Expand Down Expand Up @@ -174,7 +180,7 @@ fun KYCLevelButton(
horizontalArrangement = Arrangement.SpaceBetween
) {
ButtonComponent(
stringResource(R.string.level) + "$level",
stringResource(R.string.feature_kyc_level) + "$level",
enabled,
completed,
onClick
Expand Down Expand Up @@ -237,13 +243,13 @@ fun IconComponent(completed: Boolean, modifier: Modifier = Modifier) {
) {
Icon(
Icons.Filled.Check,
contentDescription = stringResource(R.string.check),
contentDescription = stringResource(R.string.feature_kyc_check),
modifier = Modifier
.size(20.dp)
)
Spacer(modifier = Modifier.width(26.dp))
Text(
text = stringResource(R.string.completion)
text = stringResource(R.string.feature_kyc_completion)
)
}
}
Expand Down Expand Up @@ -273,14 +279,14 @@ fun PlaceholderScreen() {
Spacer(modifier = Modifier.height(16.dp))

Text(
text = stringResource(id = R.string.error_oops),
text = stringResource(id = R.string.feature_kyc_error_oops),
style = MaterialTheme.typography.bodyMedium
)

Spacer(modifier = Modifier.height(8.dp))

Text(
text = stringResource(id = R.string.error_kyc_details),
text = stringResource(id = R.string.feature_kyc_error_kyc_details),
style = MaterialTheme.typography.bodyMedium,
textAlign = TextAlign.Center,
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import kotlinx.coroutines.launch
import org.mifospay.core.data.base.UseCase
import org.mifospay.core.data.base.UseCaseHandler
import org.mifospay.core.data.domain.usecase.kyc.FetchKYCLevel1Details
import org.mifospay.data.local.LocalRepository
import org.mifospay.core.data.repository.local.LocalRepository
import javax.inject.Inject

@HiltViewModel
Expand Down

This file was deleted.

Loading

0 comments on commit c154706

Please sign in to comment.