diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser
index 1fb20e00..5b3d8f59 100644
Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 95ec36ae..0a57c15f 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -15,7 +15,7 @@
-
+
-
-
-
-
-
-
+
+
+
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
+
+
+
-
-
-
-
-
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
-
-
-
+
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
-
@@ -186,104 +193,99 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+ android:windowSoftInputMode="stateAlwaysHidden" />
-
-
-
diff --git a/app/src/main/java/com/swifttech/remit/android/features/changepassword/presenter/ChangePasswordV2Presenter.java b/app/src/main/java/com/swifttech/remit/android/features/changepassword/presenter/ChangePasswordV2Presenter.java
index a5741640..f39cb659 100644
--- a/app/src/main/java/com/swifttech/remit/android/features/changepassword/presenter/ChangePasswordV2Presenter.java
+++ b/app/src/main/java/com/swifttech/remit/android/features/changepassword/presenter/ChangePasswordV2Presenter.java
@@ -143,7 +143,7 @@ public class ChangePasswordV2Presenter extends BaseViewModel implements ChangePa
return true;
} else {
- this.currentPassword = null;
+ this.confirmPassword = null;
changePasswordLiveData.setConfirmPasswordInputLiveData(new FormInputStateDTO<>(false, getStringfromStringId(R.string.password_empty_error)));
return false;
}
diff --git a/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/ChangePinViewModelFactory.java b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/ChangePinViewModelFactory.java
new file mode 100644
index 00000000..46e6b347
--- /dev/null
+++ b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/ChangePinViewModelFactory.java
@@ -0,0 +1,28 @@
+package com.swifttech.remit.android.features.changetxnpin;
+
+import androidx.annotation.NonNull;
+import androidx.lifecycle.ViewModel;
+import androidx.lifecycle.ViewModelProvider;
+
+import com.swifttech.remit.android.features.changepassword.gateway.ChangePasswordV2Gateway;
+import com.swifttech.remit.android.features.changepassword.presenter.ChangePasswordV2Presenter;
+import com.swifttech.remit.android.features.changepassword.presenter.ChangePasswordV2PresenterInterface;
+import com.swifttech.remit.android.features.changetxnpin.gateway.ChangePinGateway;
+import com.swifttech.remit.android.features.changetxnpin.presenter.ChangePinV2Presenter;
+import com.swifttech.remit.android.features.changetxnpin.presenter.ChangePinV2PresenterInterface;
+
+public class ChangePinViewModelFactory implements ViewModelProvider.Factory {
+
+ private final ChangePinV2PresenterInterface.ChangePinV2ContractInterface view;
+
+ public ChangePinViewModelFactory(ChangePinV2PresenterInterface.ChangePinV2ContractInterface view) {
+ this.view=view;
+ }
+
+ @SuppressWarnings("unchecked")
+ @NonNull
+ @Override
+ public T create(@NonNull Class modelClass) {
+ return (T) new ChangePinV2Presenter(view,new ChangePinGateway());
+ }
+}
diff --git a/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/gateway/ChangePinGateway.java b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/gateway/ChangePinGateway.java
new file mode 100644
index 00000000..b9880ace
--- /dev/null
+++ b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/gateway/ChangePinGateway.java
@@ -0,0 +1,28 @@
+package com.swifttech.remit.android.features.changetxnpin.gateway;
+
+import com.swifttech.remit.android.base.PrivilegedGateway;
+import com.swifttech.remit.android.features.changepassword.model.ChangePasswordActivityV2APIResponse;
+import com.swifttech.remit.android.features.changepassword.presenter.ChangePasswordV2InteractorInterface;
+import com.swifttech.remit.android.features.changetxnpin.presenter.ChangePinV2InteractorInterface;
+import com.swifttech.remit.android.utils.https.HttpClientV2;
+import com.google.gson.JsonObject;
+
+import io.reactivex.Observable;
+
+public class ChangePinGateway extends PrivilegedGateway implements ChangePinV2InteractorInterface.ChangePinV2GatewayInterface {
+
+
+
+ @Override
+ public Observable performChangePassRequest(String auth, String userId, String oldPass, String newPass,String confirmPass) {
+ JsonObject jsonObject=new JsonObject();
+
+ jsonObject.addProperty("UserId",userId);
+ jsonObject.addProperty("OldPassword",oldPass);
+ jsonObject.addProperty("NewPassword",newPass);
+ jsonObject.addProperty("ConfirmPassword",confirmPass);
+ return HttpClientV2.getInstance().performChangePasswordV2(auth,jsonObject);
+
+ }
+
+}
diff --git a/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/model/ChangePinV2APIResponse.java b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/model/ChangePinV2APIResponse.java
new file mode 100644
index 00000000..1d352db7
--- /dev/null
+++ b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/model/ChangePinV2APIResponse.java
@@ -0,0 +1,52 @@
+package com.swifttech.remit.android.features.changetxnpin.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class ChangePinV2APIResponse {
+
+ @SerializedName("ErrorCode")
+ @Expose
+ private String errorCode;
+ @SerializedName("Msg")
+ @Expose
+ private String msg;
+ @SerializedName("Id")
+ @Expose
+ private String id;
+ @SerializedName("Data")
+ @Expose
+ private ChangeSuccessModel data;
+
+ public String getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(String errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ public String getMsg() {
+ return msg;
+ }
+
+ public void setMsg(String msg) {
+ this.msg = msg;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public ChangeSuccessModel getData() {
+ return data;
+ }
+
+ public void setData(ChangeSuccessModel data) {
+ this.data = data;
+ }
+}
diff --git a/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/model/ChangeSuccessModel.java b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/model/ChangeSuccessModel.java
new file mode 100644
index 00000000..fd7c55fb
--- /dev/null
+++ b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/model/ChangeSuccessModel.java
@@ -0,0 +1,19 @@
+package com.swifttech.remit.android.features.changetxnpin.model;
+
+import com.google.gson.annotations.Expose;
+import com.google.gson.annotations.SerializedName;
+
+public class ChangeSuccessModel {
+
+ @Expose
+ @SerializedName("Message")
+ private String message;
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+}
diff --git a/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinLiveData.java b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinLiveData.java
new file mode 100644
index 00000000..c95fdf81
--- /dev/null
+++ b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinLiveData.java
@@ -0,0 +1,80 @@
+package com.swifttech.remit.android.features.changetxnpin.presenter;
+
+import androidx.lifecycle.LiveData;
+import androidx.lifecycle.MutableLiveData;
+
+import com.swifttech.remit.android.common.model.FormInputStateDTO;
+
+import io.reactivex.Observable;
+
+public class ChangePinLiveData {
+
+ private MutableLiveData> currentPinInputLiveData;
+ private MutableLiveData> newPinInputLiveData;
+ private MutableLiveData> confirmPinInputLiveData;
+ private MutableLiveData allFormValidLiveData;
+
+ public ChangePinLiveData() {
+ currentPinInputLiveData = new MutableLiveData<>();
+ newPinInputLiveData = new MutableLiveData<>();
+ confirmPinInputLiveData = new MutableLiveData<>();
+ allFormValidLiveData = new MutableLiveData<>();
+ }
+
+
+ public LiveData> getCurrentPinInputLiveData() {
+ return currentPinInputLiveData;
+ }
+
+ public void setCurrentPinInputLiveData(FormInputStateDTO currentPinInputLiveData) {
+ this.currentPinInputLiveData.setValue(currentPinInputLiveData);
+ }
+
+ public LiveData> getNewPinInputLiveData() {
+ return newPinInputLiveData;
+ }
+
+ public void setNewPinInputLiveData(FormInputStateDTO newPinInputLiveData) {
+ this.newPinInputLiveData.setValue(newPinInputLiveData);
+ }
+
+ public LiveData> getConfirmPinInputLiveData() {
+ return confirmPinInputLiveData;
+ }
+
+ public void setConfirmPinInputLiveData(FormInputStateDTO confirmPinInputLiveData) {
+ this.confirmPinInputLiveData.setValue(confirmPinInputLiveData);
+ }
+
+ public LiveData getAllFormValidLiveData() {
+ return allFormValidLiveData;
+ }
+
+ public void setAllFormValidLiveData(FormInputStateDTO allFormValidLiveData) {
+ this.allFormValidLiveData.setValue(allFormValidLiveData);
+ }
+
+ public static class ChangePinViewBindings {
+ private Observable currentPinInputLiveData;
+ private Observable newPinInputLiveData;
+ private Observable confirmPinInputLiveData;
+
+ public ChangePinViewBindings(Observable currentPasswordInputLiveData, Observable newPasswordInputLiveData, Observable confirmPasswordInputLiveData) {
+ this.currentPinInputLiveData = currentPasswordInputLiveData;
+ this.newPinInputLiveData = newPasswordInputLiveData;
+ this.confirmPinInputLiveData = confirmPasswordInputLiveData;
+ }
+
+ public Observable getCurrentPinInputLiveData() {
+ return currentPinInputLiveData;
+ }
+
+ public Observable getNewPinInputLiveData() {
+ return newPinInputLiveData;
+ }
+
+ public Observable getConfirmPinInputLiveData() {
+ return confirmPinInputLiveData;
+ }
+ }
+}
diff --git a/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinV2InteractorInterface.java b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinV2InteractorInterface.java
new file mode 100644
index 00000000..1da4279b
--- /dev/null
+++ b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinV2InteractorInterface.java
@@ -0,0 +1,20 @@
+package com.swifttech.remit.android.features.changetxnpin.presenter;
+
+import com.swifttech.remit.android.base.BaseInteractorInterface;
+import com.swifttech.remit.android.base.PrivilegedGatewayInterface;
+import com.swifttech.remit.android.features.changepassword.model.ChangePasswordActivityV2APIResponse;
+
+import io.reactivex.Observable;
+
+public interface ChangePinV2InteractorInterface extends BaseInteractorInterface {
+
+
+ interface ChangePinV2GatewayInterface extends PrivilegedGatewayInterface
+ {
+ Observable performChangePassRequest(String auth, String userId, String oldPass, String newPass,String confirmPass);
+
+ void persistUserPwdForBiometric(String encrypted);
+
+ void turnOffFingerprintAuth(boolean b);
+ }
+}
diff --git a/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinV2Presenter.java b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinV2Presenter.java
new file mode 100644
index 00000000..1067d143
--- /dev/null
+++ b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinV2Presenter.java
@@ -0,0 +1,183 @@
+package com.swifttech.remit.android.features.changetxnpin.presenter;
+
+import com.swifttech.remit.android.R;
+import com.swifttech.remit.android.base.BaseViewModel;
+import com.swifttech.remit.android.common.customwidgets.CustomAlertDialog;
+import com.swifttech.remit.android.common.model.FormInputStateDTO;
+import com.swifttech.remit.android.features.changepassword.model.ChangePasswordActivityV2APIResponse;
+import com.swifttech.remit.android.utils.Constants;
+import com.swifttech.remit.android.utils.https.GenericApiObserverResponse;
+
+import io.reactivex.Observable;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.disposables.CompositeDisposable;
+import io.reactivex.observers.DisposableObserver;
+import io.reactivex.schedulers.Schedulers;
+
+public class ChangePinV2Presenter extends BaseViewModel implements ChangePinV2InteractorInterface, ChangePinV2PresenterInterface {
+
+ private static final int PIN_LENGTH = 5;
+ private final ChangePinV2ContractInterface view;
+ private final ChangePinV2GatewayInterface gateway;
+
+ private final ChangePinLiveData changePinLiveData;
+ private final CompositeDisposable useCaseCompositeDisposable;
+ private final CompositeDisposable viewEventCompositeDisposable;
+ private final ChangePinValidator changePinValidator;
+
+ public ChangePinV2Presenter(ChangePinV2ContractInterface view, ChangePinV2InteractorInterface.ChangePinV2GatewayInterface gateway) {
+ this.view = view;
+ this.gateway = gateway;
+ this.changePinValidator = new ChangePinValidator();
+ changePinLiveData = new ChangePinLiveData();
+ useCaseCompositeDisposable = new CompositeDisposable();
+ viewEventCompositeDisposable = new CompositeDisposable();
+ }
+
+ @Override
+ public ChangePinLiveData getChangePasswordRelatedViewEvents(ChangePinLiveData.ChangePinViewBindings viewBindings) {
+ bindView(viewBindings);
+ return changePinLiveData;
+ }
+
+ private void bindView(ChangePinLiveData.ChangePinViewBindings viewBindings) {
+ viewEventCompositeDisposable.add(
+ Observable.combineLatest(
+ viewBindings.getCurrentPinInputLiveData().map(this.changePinValidator::isCurrentPasswordValid),
+ viewBindings.getNewPinInputLiveData().map(this.changePinValidator::isNewPasswordValid),
+ viewBindings.getConfirmPinInputLiveData().map(this.changePinValidator::isConfirmPasswordValid),
+ (isCurrentPassValid, isNewPasswordValid, isConfirmPasswordValid) ->
+ isCurrentPassValid && isNewPasswordValid && isConfirmPasswordValid)
+ .subscribeWith(new DisposableObserver() {
+ @Override
+ public void onNext(Boolean result) {
+ changePinLiveData.setAllFormValidLiveData(new FormInputStateDTO(result, ""));
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ changePinLiveData.setAllFormValidLiveData(new FormInputStateDTO(false, ""));
+ }
+
+ @Override
+ public void onComplete() {
+
+ }
+ }));
+ }
+
+ @Override
+ public void onViewReady() {
+
+ }
+
+ @Override
+ public void onViewNotReady() {
+
+ }
+
+
+ @Override
+ public void changePin() {
+ if (changePinValidator.doesConfirmPasswordMatchWithNewPassword()) {
+ useCaseCompositeDisposable.add(
+ this.gateway.performChangePassRequest(this.gateway.getAuth(), this.gateway.getUserID(), this.changePinValidator.currentPin, this.changePinValidator.newPin, this.changePinValidator.confirmPin)
+ .doOnSubscribe(d -> view.showProgressBar(true, getStringfromStringId(R.string.processing_request_text)))
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .doFinally(() -> view.showProgressBar(false, ""))
+ .subscribeWith(new ChangePinObserver()));
+ }
+ }
+
+
+ private class ChangePinValidator {
+
+ private String currentPin;
+ private String newPin;
+ private String confirmPin;
+
+ boolean isCurrentPasswordValid(CharSequence password) {
+ if (password != null && password.length() ==PIN_LENGTH) {
+ this.currentPin = password.toString();
+ changePinLiveData.setCurrentPinInputLiveData(new FormInputStateDTO<>(true, null));
+ return true;
+ } else {
+ this.currentPin = null;
+ changePinLiveData.setCurrentPinInputLiveData(new FormInputStateDTO<>(false, "Pin must be of 5 digit"));
+ return false;
+ }
+
+ }
+
+
+ boolean isNewPasswordValid(CharSequence password) {
+ if (password != null && password.length() ==PIN_LENGTH) {
+ this.newPin = password.toString();
+ changePinLiveData.setNewPinInputLiveData(new FormInputStateDTO<>(true, null));
+ return true;
+ } else {
+ this.newPin = null;
+ changePinLiveData.setNewPinInputLiveData(new FormInputStateDTO<>(false, "Pin must be of 5 digit"));
+ return false;
+ }
+
+ }
+
+ public boolean doesConfirmPasswordMatchWithNewPassword() {
+ boolean result = (confirmPin != null && confirmPin.equalsIgnoreCase(newPin));
+ changePinLiveData.setConfirmPinInputLiveData(new FormInputStateDTO<>(result, "Confirmed pin doesn't match with entered pin"));
+ return result;
+ }
+
+
+ boolean isConfirmPasswordValid(CharSequence password) {
+ if (password != null && password.length() ==PIN_LENGTH) {
+ this.confirmPin = password.toString();
+ changePinLiveData.setConfirmPinInputLiveData(new FormInputStateDTO<>(true, null));
+ return true;
+
+ } else {
+ this.confirmPin = null;
+ changePinLiveData.setConfirmPinInputLiveData(new FormInputStateDTO<>(false, "Pin must be of 5 digit"));
+ return false;
+ }
+
+ }
+
+
+ }
+
+
+ public class ChangePinObserver extends GenericApiObserverResponse {
+
+
+ @Override
+ protected void onSuccess(ChangePasswordActivityV2APIResponse changePasswordActivityV2APIResponse) {
+ if (changePasswordActivityV2APIResponse.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) {
+ view.showPopUpMessage(changePasswordActivityV2APIResponse.getMsg(), CustomAlertDialog.AlertType.SUCCESS, alertType -> view.exitView());
+ } else
+ view.showPopUpMessage(changePasswordActivityV2APIResponse.getMsg(), CustomAlertDialog.AlertType.FAILED, null);
+ }
+
+
+ @Override
+ public void onFailed(String message) {
+ view.showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, null);
+ }
+
+ @Override
+ protected void onConnectionNotEstablished(String message) {
+ view.showPopUpMessage(message, CustomAlertDialog.AlertType.NO_INTERNET, null);
+ }
+
+ @Override
+ protected void unauthorizedAccess(String message) {
+ gateway.clearAllUserData();
+ view.showPopUpMessage(message, CustomAlertDialog.AlertType.ALERT, alertType -> view.logout());
+
+ }
+ }
+
+
+}
diff --git a/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinV2PresenterInterface.java b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinV2PresenterInterface.java
new file mode 100644
index 00000000..94530c16
--- /dev/null
+++ b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinV2PresenterInterface.java
@@ -0,0 +1,22 @@
+package com.swifttech.remit.android.features.changetxnpin.presenter;
+
+import com.swifttech.remit.android.base.BaseContractInterface;
+import com.swifttech.remit.android.base.BasePresenterInterface;
+
+
+public interface ChangePinV2PresenterInterface extends BasePresenterInterface {
+
+
+
+
+ void changePin();
+
+ ChangePinLiveData getChangePasswordRelatedViewEvents(ChangePinLiveData.ChangePinViewBindings viewBindings);
+
+
+ interface ChangePinV2ContractInterface extends BaseContractInterface
+ {
+
+
+ }
+}
diff --git a/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/view/ChangeTxnPinActivity.java b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/view/ChangeTxnPinActivity.java
new file mode 100644
index 00000000..34803100
--- /dev/null
+++ b/app/src/main/java/com/swifttech/remit/android/features/changetxnpin/view/ChangeTxnPinActivity.java
@@ -0,0 +1,146 @@
+package com.swifttech.remit.android.features.changetxnpin.view;
+
+import androidx.lifecycle.ViewModelProvider;
+
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+
+import com.google.android.material.textfield.TextInputEditText;
+import com.google.android.material.textfield.TextInputLayout;
+import com.jakewharton.rxbinding3.widget.RxTextView;
+import com.swifttech.remit.android.R;
+import com.swifttech.remit.android.base.BaseActivity;
+import com.swifttech.remit.android.common.model.FormInputStateDTO;
+import com.swifttech.remit.android.features.changetxnpin.ChangePinViewModelFactory;
+import com.swifttech.remit.android.features.changetxnpin.presenter.ChangePinLiveData;
+import com.swifttech.remit.android.features.changetxnpin.presenter.ChangePinV2Presenter;
+import com.swifttech.remit.android.features.changetxnpin.presenter.ChangePinV2PresenterInterface;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+
+public class ChangeTxnPinActivity extends BaseActivity implements ChangePinV2PresenterInterface.ChangePinV2ContractInterface {
+
+
+ @BindView(R.id.toolbar_title)
+ TextView toolbarTitle;
+
+ @BindView(R.id.iv_cancel)
+ View iv_cancel;
+ @BindView(R.id.iv_back)
+ View iv_back;
+
+ @BindView(R.id.currentPin_edTxt)
+ TextInputEditText currentPin_edTxt;
+
+ @BindView(R.id.currentPin_TxtInputLayout)
+ TextInputLayout currentPin_TxtInputLayout;
+
+ @BindView(R.id.newPin_edTxt)
+ TextInputEditText newPin_edTxt;
+
+ @BindView(R.id.newPin_TxtInputLayout)
+ TextInputLayout newPin_TxtInputLayout;
+
+ @BindView(R.id.confirmPin_edTxt)
+ TextInputEditText confirmPin_edTxt;
+
+ @BindView(R.id.confirmPin_TxtInputLayout)
+ TextInputLayout confirmPin_TxtInputLayout;
+
+ @BindView(R.id.btn_submit)
+ Button btn_submit;
+
+ private ChangePinV2Presenter viewModel;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_change_txn_pin);
+ ButterKnife.bind(this);
+ initialize();
+ performDefaultAction(savedInstanceState);
+ }
+
+
+
+ private void initialize() {
+ this.viewModel=new ViewModelProvider(this,new ChangePinViewModelFactory(this)).get(ChangePinV2Presenter.class);
+
+ ChangePinLiveData changePinLiveData = viewModel.getChangePasswordRelatedViewEvents(new ChangePinLiveData.ChangePinViewBindings(
+ RxTextView.textChanges(currentPin_edTxt).skipInitialValue(),
+ RxTextView.textChanges(newPin_edTxt).skipInitialValue(),
+ RxTextView.textChanges(confirmPin_edTxt).skipInitialValue()
+ ));
+
+ changePinLiveData.getCurrentPinInputLiveData().observe(this,this::onCurrentPasswordStateChanged);
+ changePinLiveData.getNewPinInputLiveData().observe(this,this::onNewPasswordStateChanged);
+ changePinLiveData.getConfirmPinInputLiveData().observe(this,this::onConfirmPasswordStateChanged);
+ changePinLiveData.getAllFormValidLiveData().observe(this, result->btn_submit.setEnabled(result.isValid()));
+ }
+
+ private void onConfirmPasswordStateChanged(FormInputStateDTO state) {
+ if(state.isValid())
+ {
+ confirmPin_TxtInputLayout.setError(null);
+ if(state.hasData())
+ {
+ confirmPin_edTxt.setText(state.getData());
+ }
+ }
+ else
+ confirmPin_TxtInputLayout.setError(state.getErrorMessage());
+ }
+
+ private void onNewPasswordStateChanged(FormInputStateDTO state) {
+ if(state.isValid())
+ {
+ newPin_TxtInputLayout.setError(null);
+ if(state.hasData())
+ {
+ newPin_edTxt.setText(state.getData());
+ }
+ }
+ else
+ newPin_TxtInputLayout.setError(state.getErrorMessage());
+ }
+
+ private void onCurrentPasswordStateChanged(FormInputStateDTO state) {
+ if(state.isValid())
+ {
+ currentPin_TxtInputLayout.setError(null);
+ if(state.hasData())
+ {
+ currentPin_edTxt.setText(state.getData());
+ }
+ }
+ else
+ currentPin_TxtInputLayout.setError(state.getErrorMessage());
+ }
+
+ private void performDefaultAction(Bundle savedInstanceState) {
+ if(savedInstanceState==null)
+ {
+ toolbarTitle.setText("Change Pin");
+ iv_cancel.setVisibility(View.INVISIBLE);
+ }
+ }
+
+ @OnClick(R.id.iv_back)
+ public void onBackButtonClicked(View v)
+ {
+ onBackPressed();
+ }
+
+
+
+ @OnClick(R.id.btn_submit)
+ public void onBtnSubmitClicked()
+ {
+ viewModel.changePin();
+ }
+
+}
diff --git a/app/src/main/java/com/swifttech/remit/android/features/settings/view/SettingsView.java b/app/src/main/java/com/swifttech/remit/android/features/settings/view/SettingsView.java
index 7948a8ce..3f7e34ac 100644
--- a/app/src/main/java/com/swifttech/remit/android/features/settings/view/SettingsView.java
+++ b/app/src/main/java/com/swifttech/remit/android/features/settings/view/SettingsView.java
@@ -13,6 +13,7 @@ import com.swifttech.remit.android.R;
import com.swifttech.remit.android.base.BaseActivity;
import com.swifttech.remit.android.features.changepassword.view.UserPasswordChangeV2Activity;
import com.swifttech.remit.android.common.customwidgets.CustomAlertDialog;
+import com.swifttech.remit.android.features.changetxnpin.view.ChangeTxnPinActivity;
import com.swifttech.remit.android.features.security.RemitAuthManager;
import com.swifttech.remit.android.features.security.model.RemitAuthFailedResult;
import com.swifttech.remit.android.features.security.model.RemitAuthSuccessResult;
@@ -65,7 +66,7 @@ public class SettingsView extends BaseActivity implements CompoundButton.OnCheck
- @OnClick({R.id.view_change_password, R.id.iv_back, R.id.view_language, R.id.view_fingerprint})
+ @OnClick({R.id.view_change_password, R.id.iv_back, R.id.view_language, R.id.view_fingerprint,R.id.view_change_pin})
public void onClick(View view) {
switch (view.getId()) {
@@ -81,6 +82,10 @@ public class SettingsView extends BaseActivity implements CompoundButton.OnCheck
promptLanguageSelectionDialog();
break;
+ case R.id.view_change_pin:
+ startActivity(new Intent(this, ChangeTxnPinActivity.class));
+ break;
+
}
}
diff --git a/app/src/main/res/layout/activity_change_txn_pin.xml b/app/src/main/res/layout/activity_change_txn_pin.xml
new file mode 100644
index 00000000..5bec9cac
--- /dev/null
+++ b/app/src/main/res/layout/activity_change_txn_pin.xml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index a0566a75..02553a41 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -57,35 +57,7 @@
android:paddingStart="52dp"
android:paddingTop="14dp">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+