From 6883c5652648adc9cf7fc9e4512b4295a62d4aba Mon Sep 17 00:00:00 2001 From: Santosh Bhandary Date: Wed, 26 Aug 2020 14:01:35 +0545 Subject: [PATCH] added prefix of Mobile Number to "+81" and lenght to 14 including mobile prefix. --- app/build.gradle | 3 ++ .../customwidgets/CustomProgressDialog.java | 2 +- .../features/home/gateway/HomeV2Gateway.java | 1 + .../model/ExistingPersonalInfoDTO.java | 3 +- .../ExistingCustomerDetailFragment.java | 27 +++++++++++++++++ .../newCustomer/model/PersonalInfoDTO.java | 2 +- .../view/personal/CustomerDetailFragment.java | 27 +++++++++++++++++ .../presenter/OTPVerificationPresenter.java | 2 +- .../view/OTPRequestFragment.java | 28 ++++++++++++++++++ .../ExistingCustomerRegisterV2Presenter.java | 2 +- ...ngCustomerRegistrationRequestFragment.java | 29 ++++++++++++++++++- .../gateway/UserProfileGateway.java | 1 + .../userprofile/model/UserProfile.java | 4 +++ ...existing_customer_registration_request.xml | 2 +- ..._existing_customer_registration_submit.xml | 2 +- .../fragment_existing_kyc_customer_detail.xml | 2 +- .../layout/fragment_kyc_customer_detail.xml | 2 +- .../main/res/layout/fragment_otp_request.xml | 4 +-- 18 files changed, 129 insertions(+), 14 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index e932d811..4c9314a1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -167,4 +167,7 @@ dependencies { testImplementation "org.mockito:mockito-core:3.0.0" implementation project(path: ':rxbiometric') + debugImplementation 'com.readystatesoftware.chuck:library:1.1.0' + releaseImplementation 'com.readystatesoftware.chuck:library-no-op:1.1.0' + } diff --git a/app/src/main/java/com/swifttech/remit/android/common/customwidgets/CustomProgressDialog.java b/app/src/main/java/com/swifttech/remit/android/common/customwidgets/CustomProgressDialog.java index 45d50fc5..da0bef94 100644 --- a/app/src/main/java/com/swifttech/remit/android/common/customwidgets/CustomProgressDialog.java +++ b/app/src/main/java/com/swifttech/remit/android/common/customwidgets/CustomProgressDialog.java @@ -62,6 +62,6 @@ public class CustomProgressDialog extends DialogFragment { public void updateMessage(String message) { -// progressBarTxt.setText(message); + progressBarTxt.setText(message); } } diff --git a/app/src/main/java/com/swifttech/remit/android/features/home/gateway/HomeV2Gateway.java b/app/src/main/java/com/swifttech/remit/android/features/home/gateway/HomeV2Gateway.java index f8439763..861597a9 100644 --- a/app/src/main/java/com/swifttech/remit/android/features/home/gateway/HomeV2Gateway.java +++ b/app/src/main/java/com/swifttech/remit/android/features/home/gateway/HomeV2Gateway.java @@ -197,6 +197,7 @@ public class HomeV2Gateway extends PrivilegedGateway implements HomeV2Interactor userInfoModelV2.setWalletNumber(sharedPreferenceEditor.getString(PrefKeys.USER_WALLET_NUMBER, "")); userInfoModelV2.setYearlyLimit(sharedPreferenceEditor.getString(PrefKeys.USER_YEARLY_REMAINING_LIMIT, "")); userInfoModelV2.setCustomerEmail(sharedPreferenceEditor.getString(PrefKeys.USER_CUSTOMER_EMAIL, "")); + userInfoModelV2.setExistingCustomer(sharedPreferenceEditor.getBoolean(PrefKeys.IS_EXISTING_USER, false)); userStateCache = new UserCachedState(userInfoModelV2.getKyc(), userInfoModelV2.isVerified(), userInfoModelV2.getEmail(), userInfoModelV2.getUserDob()); diff --git a/app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/model/ExistingPersonalInfoDTO.java b/app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/model/ExistingPersonalInfoDTO.java index 59393645..699b7a6f 100644 --- a/app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/model/ExistingPersonalInfoDTO.java +++ b/app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/model/ExistingPersonalInfoDTO.java @@ -218,10 +218,9 @@ public class ExistingPersonalInfoDTO { } public boolean isMobileNumberValid() { - return Utils.isStringNotNullOrEmpty(this.mobile)&&this.mobile.length()>6&&this.mobile.length()<16; + return Utils.isStringNotNullOrEmpty(this.mobile)&&this.mobile.startsWith("+81")&&this.mobile.length()>6&&this.mobile.length()<15; } - public boolean isEmailValid() { return Utils.isValidEmail(this.email); } diff --git a/app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/view/personal/ExistingCustomerDetailFragment.java b/app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/view/personal/ExistingCustomerDetailFragment.java index 06976c50..326152c8 100644 --- a/app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/view/personal/ExistingCustomerDetailFragment.java +++ b/app/src/main/java/com/swifttech/remit/android/features/kyc/existingCustomer/view/personal/ExistingCustomerDetailFragment.java @@ -2,6 +2,9 @@ package com.swifttech.remit.android.features.kyc.existingCustomer.view.personal; import android.annotation.SuppressLint; import android.os.Bundle; +import android.text.Editable; +import android.text.Selection; +import android.text.TextWatcher; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -147,6 +150,30 @@ public class ExistingCustomerDetailFragment extends BaseFragment implements Exis visaStatusSelectionSubject ); + ed_mobileNumber.setText("+81"); + ed_mobileNumber.addTextChangedListener(new TextWatcher() { + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, + int after) { + + } + + @Override + public void afterTextChanged(Editable s) { + if(!s.toString().startsWith("+81")){ + ed_mobileNumber.setText("+81"); + Selection.setSelection(ed_mobileNumber.getText(), ed_mobileNumber.getText().length()); + + } + + } + }); } diff --git a/app/src/main/java/com/swifttech/remit/android/features/kyc/newCustomer/model/PersonalInfoDTO.java b/app/src/main/java/com/swifttech/remit/android/features/kyc/newCustomer/model/PersonalInfoDTO.java index 40359c95..2b1a6f2e 100644 --- a/app/src/main/java/com/swifttech/remit/android/features/kyc/newCustomer/model/PersonalInfoDTO.java +++ b/app/src/main/java/com/swifttech/remit/android/features/kyc/newCustomer/model/PersonalInfoDTO.java @@ -200,7 +200,7 @@ public class PersonalInfoDTO { } public boolean isMobileNumberValid() { - return Utils.isStringNotNullOrEmpty(this.mobile)&&this.mobile.length()>6&&this.mobile.length()<16; + return Utils.isStringNotNullOrEmpty(this.mobile)&&this.mobile.startsWith("+81")&&this.mobile.length()>6&&this.mobile.length()<15; } diff --git a/app/src/main/java/com/swifttech/remit/android/features/kyc/newCustomer/view/personal/CustomerDetailFragment.java b/app/src/main/java/com/swifttech/remit/android/features/kyc/newCustomer/view/personal/CustomerDetailFragment.java index c4e9e352..2e34087e 100644 --- a/app/src/main/java/com/swifttech/remit/android/features/kyc/newCustomer/view/personal/CustomerDetailFragment.java +++ b/app/src/main/java/com/swifttech/remit/android/features/kyc/newCustomer/view/personal/CustomerDetailFragment.java @@ -2,6 +2,9 @@ package com.swifttech.remit.android.features.kyc.newCustomer.view.personal; import android.annotation.SuppressLint; import android.os.Bundle; +import android.text.Editable; +import android.text.Selection; +import android.text.TextWatcher; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -149,6 +152,30 @@ public class CustomerDetailFragment extends BaseFragment implements KYCV3Present additionalIdTypeSelectSubject ); + ed_mobileNumber.setText("+81"); + ed_mobileNumber.addTextChangedListener(new TextWatcher() { + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, + int after) { + + } + + @Override + public void afterTextChanged(Editable s) { + if(!s.toString().startsWith("+81")){ + ed_mobileNumber.setText("+81"); + Selection.setSelection(ed_mobileNumber.getText(), ed_mobileNumber.getText().length()); + + } + + } + }); } diff --git a/app/src/main/java/com/swifttech/remit/android/features/otpverification/presenter/OTPVerificationPresenter.java b/app/src/main/java/com/swifttech/remit/android/features/otpverification/presenter/OTPVerificationPresenter.java index 46e05963..0bcee732 100644 --- a/app/src/main/java/com/swifttech/remit/android/features/otpverification/presenter/OTPVerificationPresenter.java +++ b/app/src/main/java/com/swifttech/remit/android/features/otpverification/presenter/OTPVerificationPresenter.java @@ -81,7 +81,7 @@ public class OTPVerificationPresenter extends BaseViewModel implements OTPVerifi } private boolean validateMobileNoForOTPRequest(CharSequence mobileNumber) { - if(mobileNumber!=null&&mobileNumber.length()>0) { + if( mobileNumber.toString().startsWith("+81")&&mobileNumber!=null&&mobileNumber.length()>6) { this.selectedMobileNumber = mobileNumber.toString(); return true; } diff --git a/app/src/main/java/com/swifttech/remit/android/features/otpverification/view/OTPRequestFragment.java b/app/src/main/java/com/swifttech/remit/android/features/otpverification/view/OTPRequestFragment.java index 453d3991..70c31d0b 100644 --- a/app/src/main/java/com/swifttech/remit/android/features/otpverification/view/OTPRequestFragment.java +++ b/app/src/main/java/com/swifttech/remit/android/features/otpverification/view/OTPRequestFragment.java @@ -1,6 +1,9 @@ package com.swifttech.remit.android.features.otpverification.view; import android.os.Bundle; +import android.text.Editable; +import android.text.Selection; +import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -46,12 +49,37 @@ public class OTPRequestFragment extends BaseFragment { private void performDefaultAction(Bundle savedInstanceState) { viewModel.subscribeToMobileNumberValidationEvent(RxTextView.textChanges(mobileEditText).skipInitialValue()).observe(getViewLifecycleOwner(),btnSubmit::setEnabled); + mobileEditText.setText("+81"); + mobileEditText.addTextChangedListener(new TextWatcher() { + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, + int after) { + + } + + @Override + public void afterTextChanged(Editable s) { + if(!s.toString().startsWith("+81")){ + mobileEditText.setText("+81"); + Selection.setSelection(mobileEditText.getText(), mobileEditText.getText().length()); + + } + + } + }); } private void init() { viewModel=new ViewModelProvider(requireActivity()).get(OTPVerificationPresenter.class); + } diff --git a/app/src/main/java/com/swifttech/remit/android/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterV2Presenter.java b/app/src/main/java/com/swifttech/remit/android/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterV2Presenter.java index 83bc1f88..60ae14ba 100644 --- a/app/src/main/java/com/swifttech/remit/android/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterV2Presenter.java +++ b/app/src/main/java/com/swifttech/remit/android/features/registerv2/existingcustomer/presenter/ExistingCustomerRegisterV2Presenter.java @@ -284,7 +284,7 @@ public class ExistingCustomerRegisterV2Presenter extends BaseViewModel implement this.mobileNumber = null; return false; } - else if ( mobileNumber.toString().trim().length() < 6||mobileNumber.toString().trim().length()>15) { + else if ( !mobileNumber.toString().startsWith("+81")||mobileNumber.toString().trim().length() < 6||mobileNumber.toString().trim().length()>14) { existingRegisterRequestViewLiveData.setMobileNoInputLiveData(new FormInputStateDTO<>(false, "Invalid mobile number")); this.mobileNumber = null; return false; diff --git a/app/src/main/java/com/swifttech/remit/android/features/registerv2/existingcustomer/view/ExistingCustomerRegistrationRequestFragment.java b/app/src/main/java/com/swifttech/remit/android/features/registerv2/existingcustomer/view/ExistingCustomerRegistrationRequestFragment.java index 978e5b55..675b73ea 100644 --- a/app/src/main/java/com/swifttech/remit/android/features/registerv2/existingcustomer/view/ExistingCustomerRegistrationRequestFragment.java +++ b/app/src/main/java/com/swifttech/remit/android/features/registerv2/existingcustomer/view/ExistingCustomerRegistrationRequestFragment.java @@ -1,6 +1,9 @@ package com.swifttech.remit.android.features.registerv2.existingcustomer.view; import android.os.Bundle; +import android.text.Editable; +import android.text.Selection; +import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -90,12 +93,36 @@ public class ExistingCustomerRegistrationRequestFragment extends BaseFragment { dobSelectionSubject ) ); - existingCustomerRegistrationRequestLiveData.getDobInputLiveData().observe(getViewLifecycleOwner(),this::onDOBStateChanged); existingCustomerRegistrationRequestLiveData.getMobileNoInputLiveData().observe(getViewLifecycleOwner(),this::onMobileNoStateChanged); existingCustomerRegistrationRequestLiveData.getIdNumberInputLiveData().observe(getViewLifecycleOwner(),this::onIdNoStateChanged); existingCustomerRegistrationRequestLiveData.getAllFormValidLiveData().observe(getViewLifecycleOwner(),this::onAllFieldValid); + mobile_edTxt.setText("+81"); + mobile_edTxt.addTextChangedListener(new TextWatcher() { + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void beforeTextChanged(CharSequence s, int start, int count, + int after) { + + } + + @Override + public void afterTextChanged(Editable s) { + if(!s.toString().startsWith("+81")){ + mobile_edTxt.setText("+81"); + Selection.setSelection(mobile_edTxt.getText(), mobile_edTxt.getText().length()); + + } + + } + }); + } private void onAllFieldValid(FormInputStateDTO formInputStateDTO) { diff --git a/app/src/main/java/com/swifttech/remit/android/features/userprofile/gateway/UserProfileGateway.java b/app/src/main/java/com/swifttech/remit/android/features/userprofile/gateway/UserProfileGateway.java index 660af9e8..c968982f 100644 --- a/app/src/main/java/com/swifttech/remit/android/features/userprofile/gateway/UserProfileGateway.java +++ b/app/src/main/java/com/swifttech/remit/android/features/userprofile/gateway/UserProfileGateway.java @@ -24,6 +24,7 @@ public class UserProfileGateway extends PrivilegedGateway implements UserProfile userProfile.verified = storage.getBoolean(PrefKeys.USER_KYC_VERIFIED, false); userProfile.yearlyLimit = storage.getString(PrefKeys.USER_YEARLY_REMAINING_LIMIT, ""); userProfile.referral = storage.getString(PrefKeys.USER_REFERRAL_CODE, ""); + userProfile.isExistingCustomer = storage.getBoolean(PrefKeys.IS_EXISTING_USER, false); return userProfile; } diff --git a/app/src/main/java/com/swifttech/remit/android/features/userprofile/model/UserProfile.java b/app/src/main/java/com/swifttech/remit/android/features/userprofile/model/UserProfile.java index 363900cb..51ba4864 100644 --- a/app/src/main/java/com/swifttech/remit/android/features/userprofile/model/UserProfile.java +++ b/app/src/main/java/com/swifttech/remit/android/features/userprofile/model/UserProfile.java @@ -85,6 +85,10 @@ public class UserProfile { @Expose public String referral; + @SerializedName("isExistingCustomer") + @Expose + public Boolean isExistingCustomer; + public UserProfile() { this.availableBalance="0"; diff --git a/app/src/main/res/layout/fragment_existing_customer_registration_request.xml b/app/src/main/res/layout/fragment_existing_customer_registration_request.xml index ea3503d5..2bfb13fd 100644 --- a/app/src/main/res/layout/fragment_existing_customer_registration_request.xml +++ b/app/src/main/res/layout/fragment_existing_customer_registration_request.xml @@ -53,7 +53,7 @@ style="@style/MTextInputEditText" android:inputType="phone" android:imeOptions="actionDone" - android:maxLength="15" + android:maxLength="14" android:digits="0123456789" /> diff --git a/app/src/main/res/layout/fragment_existing_customer_registration_submit.xml b/app/src/main/res/layout/fragment_existing_customer_registration_submit.xml index 1eab4876..3d3f21ed 100644 --- a/app/src/main/res/layout/fragment_existing_customer_registration_submit.xml +++ b/app/src/main/res/layout/fragment_existing_customer_registration_submit.xml @@ -36,7 +36,7 @@ app:endIconMode="clear_text" android:hint="@string/userid_title_text" > - + diff --git a/app/src/main/res/layout/fragment_kyc_customer_detail.xml b/app/src/main/res/layout/fragment_kyc_customer_detail.xml index ffae289b..60633980 100644 --- a/app/src/main/res/layout/fragment_kyc_customer_detail.xml +++ b/app/src/main/res/layout/fragment_kyc_customer_detail.xml @@ -103,7 +103,7 @@ style="@style/MTextInputEditText" android:inputType="phone" android:digits="0123456789" - android:maxLength="15" + android:maxLength="14" android:imeOptions="actionNext" /> diff --git a/app/src/main/res/layout/fragment_otp_request.xml b/app/src/main/res/layout/fragment_otp_request.xml index d30635e4..a595590e 100644 --- a/app/src/main/res/layout/fragment_otp_request.xml +++ b/app/src/main/res/layout/fragment_otp_request.xml @@ -35,11 +35,9 @@ style="@style/MTextInputEditText" android:inputType="phone" android:imeOptions="actionDone" - android:maxLength="15" + android:maxLength="14" android:digits="0123456789" /> - -