From 775fd06a0e084af8cfd23bca1a06e82cf23a22a0 Mon Sep 17 00:00:00 2001 From: harish Date: Sun, 1 Oct 2023 19:03:16 +0530 Subject: [PATCH] CC link OTP check key changed to HIP ID --- .../ui/main/fragment/CCVerifyOtpFragment.kt | 19 +++++++++++-------- .../abha/viewmodel/CareContextViewModel.kt | 7 +------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/org/commcare/dalvik/abha/ui/main/fragment/CCVerifyOtpFragment.kt b/app/src/main/java/org/commcare/dalvik/abha/ui/main/fragment/CCVerifyOtpFragment.kt index ce1b05b..3d24618 100644 --- a/app/src/main/java/org/commcare/dalvik/abha/ui/main/fragment/CCVerifyOtpFragment.kt +++ b/app/src/main/java/org/commcare/dalvik/abha/ui/main/fragment/CCVerifyOtpFragment.kt @@ -70,17 +70,20 @@ class CCVerifyOtpFragment : BaseFragment(GenerateCCOtpBind private fun requestOtp() { lifecycleScope.launch { - viewModel.checkForBlockedState(CareContextViewModel.CC_OTP_KEY).collect { - when (it) { - OtpCallState.OtpReqAvailable -> { - viewModel.generateCareContextOtp() - } + viewModel.linkCareContextModel.hipId.let {hipId -> + viewModel.checkForBlockedState(hipId).collect { + when (it) { + OtpCallState.OtpReqAvailable -> { + viewModel.generateCareContextOtp() + } - is OtpCallState.OtpReqBlocked -> { - viewModel.otpRequestBlocked.value = it.otpRequestCallModel - binding.resendCCOtp.isEnabled = false + is OtpCallState.OtpReqBlocked -> { + viewModel.otpRequestBlocked.value = it.otpRequestCallModel + binding.resendCCOtp.isEnabled = false + } } } + } } diff --git a/app/src/main/java/org/commcare/dalvik/abha/viewmodel/CareContextViewModel.kt b/app/src/main/java/org/commcare/dalvik/abha/viewmodel/CareContextViewModel.kt index b7eea3a..6ec9171 100644 --- a/app/src/main/java/org/commcare/dalvik/abha/viewmodel/CareContextViewModel.kt +++ b/app/src/main/java/org/commcare/dalvik/abha/viewmodel/CareContextViewModel.kt @@ -40,11 +40,6 @@ class CareContextViewModel @Inject constructor( lateinit var selectedAuthMethod: String lateinit var confirmAuthModel: ConfirmAuthModel - companion object{ - val CC_OTP_KEY ="cc_otp_key" - } - - fun init(model: LinkCareContextModel) { linkCareContextModel = model @@ -104,7 +99,7 @@ class CareContextViewModel @Inject constructor( selectedAuthMethod.let { authMethod -> linkCareContextModel.getAuthModesRequestModel(authMethod)?.let { ccAuthReqModel -> //save otp req call count - saveOtpRequestCallCount(CC_OTP_KEY) + saveOtpRequestCallCount(linkCareContextModel.hipId) generateCareContextOtpUsecase.execute(ccAuthReqModel).collect { hqRespModel -> when (hqRespModel) {