Ios,web,dev testing (#1830)

This commit is contained in:
kapmaurya 2024-12-08 01:23:07 +05:30 committed by GitHub
parent c6b889db6e
commit e8272092f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 80 additions and 93 deletions

View File

@ -73,11 +73,11 @@ internal class AddEditBeneficiaryViewModel(
started = SharingStarted.WhileSubscribed(5_000),
)
init {
stateFlow
.onEach { savedStateHandle[KEY] = it }
.launchIn(viewModelScope)
}
// init {
// stateFlow
// .onEach { savedStateHandle[KEY] = it }
// .launchIn(viewModelScope)
// }
override fun handleAction(action: AEBAction) {
when (action) {

View File

@ -62,9 +62,9 @@ internal class AddEditSavingViewModel(
)
init {
stateFlow
.onEach { savedStateHandle[KEY] = it }
.launchIn(viewModelScope)
// stateFlow
// .onEach { savedStateHandle[KEY] = it }
// .launchIn(viewModelScope)
repository.getSavingAccountTemplate(state.clientId).onEach {
sendAction(HandleSavingTemplateResult(it))

View File

@ -32,9 +32,9 @@ class MobileVerificationViewModel(
initialState = savedStateHandle[KEY_STATE] ?: MobileVerificationState.VerifyPhoneState(),
) {
init {
stateFlow.onEach { savedStateHandle[KEY_STATE] = it }.launchIn(viewModelScope)
}
// init {
// stateFlow.onEach { savedStateHandle[KEY_STATE] = it }.launchIn(viewModelScope)
// }
override fun handleAction(action: MobileVerificationAction) {
when (action) {

View File

@ -17,6 +17,7 @@ import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import org.mifospay.core.common.DataState
import org.mifospay.core.common.IgnoredOnParcel
import org.mifospay.core.common.Parcelable
import org.mifospay.core.common.Parcelize
import org.mifospay.core.common.utils.isValidEmail
@ -48,9 +49,9 @@ class SignupViewModel(
private var passwordStrengthJob: Job = Job().apply { complete() }
init {
stateFlow
.onEach { savedStateHandle[KEY_STATE] = it }
.launchIn(viewModelScope)
// stateFlow
// .onEach { savedStateHandle[KEY_STATE] = it }
// .launchIn(viewModelScope)
savedStateHandle.get<String>("mobileNumber")?.let {
viewModelScope.launch {
@ -511,6 +512,7 @@ data class SignUpState(
val dialogState: SignUpDialog? = null,
val passwordStrengthState: PasswordStrengthState = PasswordStrengthState.NONE,
) : Parcelable {
@IgnoredOnParcel
val isPasswordStrong: Boolean
get() = when (passwordStrengthState) {
PasswordStrengthState.NONE,
@ -525,25 +527,9 @@ data class SignUpState(
-> true
}
@IgnoredOnParcel
val isPasswordMatch: Boolean
get() = passwordInput == confirmPasswordInput
val isSubmitEnabled: Boolean
get() = firstNameInput.isNotEmpty() &&
lastNameInput.isNotEmpty() &&
emailInput.isNotEmpty() &&
userNameInput.isNotEmpty() &&
addressLine1Input.isNotEmpty() &&
addressLine2Input.isNotEmpty() &&
pinCodeInput.isNotEmpty() &&
mobileNumberInput.isNotEmpty() &&
passwordInput.isNotEmpty() &&
confirmPasswordInput.isNotEmpty() &&
stateInput.isNotEmpty() &&
countryInput.isNotEmpty() &&
passwordInput.length >= MIN_PASSWORD_LENGTH &&
isPasswordStrong && isPasswordMatch &&
savingsProductId != 0
}
sealed interface SignUpDialog : Parcelable {

View File

@ -50,11 +50,11 @@ internal class EditPasswordViewModel(
private var passwordStrengthJob: Job = Job().apply { complete() }
init {
stateFlow
.onEach { savedStateHandle[KEY_STATE] = it }
.launchIn(viewModelScope)
}
// init {
// stateFlow
// .onEach { savedStateHandle[KEY_STATE] = it }
// .launchIn(viewModelScope)
// }
override fun handleAction(action: EditPasswordAction) {
when (action) {

View File

@ -39,11 +39,11 @@ class InvoicesViewModel(
InvoiceState(clientId = clientId)
},
) {
init {
stateFlow
.onEach { savedStateHandle[KEY_STATE] = it }
.launchIn(viewModelScope)
}
// init {
// stateFlow
// .onEach { savedStateHandle[KEY_STATE] = it }
// .launchIn(viewModelScope)
// }
val invoiceUiState = invoiceRepository.getInvoices(state.clientId).mapLatest { result ->
when (result) {

View File

@ -45,9 +45,9 @@ internal class InvoiceDetailViewModel(
) {
init {
stateFlow
.onEach { savedStateHandle[KEY_STATE] = it }
.launchIn(viewModelScope)
// stateFlow
// .onEach { savedStateHandle[KEY_STATE] = it }
// .launchIn(viewModelScope)
repository.getInvoice(state.clientId, state.invoiceId).onEach {
sendAction(InvoiceDetailResultReceived(it))

View File

@ -63,11 +63,11 @@ class KYCDescriptionViewModel(
initialValue = KYCDescriptionUiState.Loading,
)
init {
stateFlow
.onEach { savedStateHandle[KEY_STATE] = it }
.launchIn(viewModelScope)
}
// init {
// stateFlow
// .onEach { savedStateHandle[KEY_STATE] = it }
// .launchIn(viewModelScope)
// }
override fun handleAction(action: KycAction) {
when (action) {

View File

@ -45,9 +45,9 @@ internal class KYCLevel1ViewModel(
) {
init {
stateFlow
.onEach { savedStateHandle[KEY_STATE] = it }
.launchIn(viewModelScope)
// stateFlow
// .onEach { savedStateHandle[KEY_STATE] = it }
// .launchIn(viewModelScope)
kycLevelRepository.fetchKYCLevel1Details(state.clientId)
.takeUntilResultSuccess()

View File

@ -43,11 +43,11 @@ internal class KYCLevel2ViewModel(
},
) {
init {
stateFlow
.onEach { savedStateHandle[KEY_STATE] = it }
.launchIn(viewModelScope)
}
// init {
// stateFlow
// .onEach { savedStateHandle[KEY_STATE] = it }
// .launchIn(viewModelScope)
// }
override fun handleAction(action: KycLevel2Action) {
when (action) {

View File

@ -11,4 +11,5 @@ package org.mifospay.feature.kyc
import androidx.lifecycle.ViewModel
// TODO: Implement KYC Level3 View Model
class KYCLevel3ViewModel : ViewModel()

View File

@ -78,11 +78,11 @@ internal class MakeTransferViewModel(
initialValue = ViewState.Loading,
)
init {
stateFlow.onEach { state ->
savedStateHandle[KEY_STATE] = state
}.launchIn(viewModelScope)
}
// init {
// stateFlow.onEach { state ->
// savedStateHandle[KEY_STATE] = state
// }.launchIn(viewModelScope)
// }
override fun handleAction(action: MakeTransferAction) {
when (action) {

View File

@ -34,9 +34,9 @@ class TransferViewModel(
},
) {
init {
stateFlow
.onEach { savedStateHandle[KEY] = it }
.launchIn(viewModelScope)
// stateFlow
// .onEach { savedStateHandle[KEY] = it }
// .launchIn(viewModelScope)
}
override fun handleAction(action: TransferAction) {

View File

@ -51,9 +51,9 @@ internal class EditProfileViewModel(
},
) {
init {
stateFlow
.onEach { savedStateHandle[KEY] = it }
.launchIn(viewModelScope)
// stateFlow
// .onEach { savedStateHandle[KEY] = it }
// .launchIn(viewModelScope)
trySendAction(LoadClientImage(state.clientId))
}

View File

@ -74,9 +74,9 @@ class ShowQrViewModel(
)
init {
stateFlow.onEach {
savedStateHandle[KEY_STATE] = it
}.launchIn(viewModelScope)
// stateFlow.onEach {
// savedStateHandle[KEY_STATE] = it
// }.launchIn(viewModelScope)
viewModelScope.launch {
sendAction(ShowQrAction.Internal.GenerateQr)

View File

@ -53,9 +53,9 @@ internal class AddEditCardViewModel(
) {
init {
stateFlow
.onEach { savedStateHandle[KEY] = it }
.launchIn(viewModelScope)
// stateFlow
// .onEach { savedStateHandle[KEY] = it }
// .launchIn(viewModelScope)
if (state.type is CardAddEditType.EditItem) {
repository.getSavedCard(state.clientId, state.type.savedCardId!!).onEach {

View File

@ -57,11 +57,11 @@ internal class CardDetailViewModel(
initialValue = ViewState.Loading,
)
init {
stateFlow
.onEach { savedStateHandle[KEY_STATE] = it }
.launchIn(viewModelScope)
}
// init {
// stateFlow
// .onEach { savedStateHandle[KEY_STATE] = it }
// .launchIn(viewModelScope)
// }
override fun handleAction(action: CardDetailAction) {
when (action) {

View File

@ -74,9 +74,9 @@ class SendMoneyViewModel(
)
init {
stateFlow.onEach {
savedStateHandle[KEY_STATE] = it
}.launchIn(viewModelScope)
// stateFlow.onEach {
// savedStateHandle[KEY_STATE] = it
// }.launchIn(viewModelScope)
savedStateHandle.get<String>("requestData")?.let {
trySendAction(HandleRequestData(it))

View File

@ -67,11 +67,11 @@ class StandingInstructionViewModel(
initialValue = SIViewState.Loading,
)
init {
stateFlow
.onEach { savedStateHandle[KEY_STATE] = it }
.launchIn(viewModelScope)
}
// init {
// stateFlow
// .onEach { savedStateHandle[KEY_STATE] = it }
// .launchIn(viewModelScope)
// }
override fun handleAction(action: SIAction) {
when (action) {

View File

@ -72,9 +72,9 @@ internal class AddEditSIViewModel(
val toClientAccounts = _toClientAccounts.asStateFlow()
init {
stateFlow
.onEach { savedStateHandle[KEY_STATE] = it }
.launchIn(viewModelScope)
// stateFlow
// .onEach { savedStateHandle[KEY_STATE] = it }
// .launchIn(viewModelScope)
repository.getStandingInstructionTemplate(
fromOfficeId = state.client.officeId,

View File

@ -31,9 +31,9 @@ internal class SIDetailViewModel(
) {
init {
stateFlow
.onEach { savedStateHandle[KEY_STATE] = it }
.launchIn(viewModelScope)
// stateFlow
// .onEach { savedStateHandle[KEY_STATE] = it }
// .launchIn(viewModelScope)
val instructionId = requireNotNull(savedStateHandle.get<Long>("instructionId"))