Skip to content

Commit

Permalink
Ios,web,dev testing (#1830)
Browse files Browse the repository at this point in the history
  • Loading branch information
kapmaurya authored Dec 7, 2024
1 parent c6b889d commit e827209
Show file tree
Hide file tree
Showing 22 changed files with 80 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ package org.mifospay.feature.kyc

import androidx.lifecycle.ViewModel

// TODO: Implement KYC Level3 View Model
class KYCLevel3ViewModel : ViewModel()
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"))

Expand Down
Binary file not shown.

0 comments on commit e827209

Please sign in to comment.