diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 3f796adfa7..248e27f7e0 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -146,8 +146,8 @@
android:exported="false"
android:name="org.mifos.mobile.utils.fcm.RegistrationIntentService">
-
+
\ No newline at end of file
diff --git a/app/src/main/java/org/mifos/mobile/ui/activities/TransferVerificationActivity.java b/app/src/main/java/org/mifos/mobile/ui/activities/TransferVerificationActivity.java
new file mode 100644
index 0000000000..2b1ee6b303
--- /dev/null
+++ b/app/src/main/java/org/mifos/mobile/ui/activities/TransferVerificationActivity.java
@@ -0,0 +1,178 @@
+package com.mifos.mobile.passcode;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.mifos.mobile.passcode.utils.PasscodePreferencesHelper;
+import com.mifos.mobile.passcode.utils.EncryptionUtil;
+
+import org.mifos.mobile.utils.Toaster;
+
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.AppCompatButton;
+import androidx.core.content.ContextCompat;
+import androidx.core.widget.NestedScrollView;
+
+
+public class TransferVerificationActivity extends
+ AppCompatActivity implements
+ MifosPassCodeView.
+ PassCodeListener {
+
+ NestedScrollView clRootview;
+ AppCompatButton btnForgotPasscode;
+ MifosPassCodeView mifosPassCodeView;
+ AppCompatButton btnSkip;
+ AppCompatButton btnSave;
+ TextView tvPasscodeIntro;
+ ImageView ivVisibility;
+ ImageView ivLogo;
+
+ private PasscodePreferencesHelper passcodePreferencesHelper;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_pass_code);
+
+ clRootview = findViewById(R.id.cl_rootview);
+ btnForgotPasscode = findViewById(R.id.btn_forgot_passcode);
+ mifosPassCodeView = findViewById(R.id.pv_passcode);
+ btnSkip = findViewById(R.id.btn_skip);
+ btnSkip.setText(getString(org.mifos.mobile.R.string.cancel_transaction));
+ btnSave = findViewById(R.id.btn_save);
+ btnSave.setText(getString(org.mifos.mobile.R.string.transfer));
+ tvPasscodeIntro = findViewById(R.id.tv_passcode);
+ tvPasscodeIntro.setText(getString(org.mifos.mobile.R.string.transfer_verify_passcode));
+ ivVisibility = findViewById(R.id.iv_visibility);
+ ivLogo = findViewById(R.id.iv_logo);
+ ivLogo.setImageResource(org.mifos.mobile.R.drawable.mifos_logo);
+
+ passcodePreferencesHelper = new PasscodePreferencesHelper(this);
+
+ }
+
+ private String encryptPassCode(String passCode) {
+ String encryptedPassCode = EncryptionUtil.getMobileBankingHash(passCode);
+ return encryptedPassCode;
+ }
+
+
+ public void savePassCode(View view) {
+ if (isPassCodeLengthCorrect()) {
+ if (encryptPassCode(mifosPassCodeView.getPasscode())
+ .equals(passcodePreferencesHelper
+ .getPassCode())
+ ) {
+ Intent resultIntent = new Intent();
+ setResult(Activity.RESULT_OK, resultIntent);
+ finish();
+ } else {
+ Toaster.show(view,org.mifos.mobile.R.string.incorrect_passcode);
+
+ }
+ } else {
+ Toaster.show(view,org.mifos.mobile.R.string.incorrect_passcode);
+ }
+ }
+
+ @Override
+ public void passCodeEntered(String passcode) {
+
+ }
+
+ public void clickedOne(View v) {
+ mifosPassCodeView.enterCode(getString(R.string.one));
+ }
+
+ public void clickedTwo(View v) {
+ mifosPassCodeView.enterCode(getString(R.string.two));
+ }
+
+ public void clickedThree(View v) {
+ mifosPassCodeView.enterCode(getString(R.string.three));
+ }
+
+ public void clickedFour(View v) {
+ mifosPassCodeView.enterCode(getString(R.string.four));
+ }
+
+ public void clickedFive(View v) {
+ mifosPassCodeView.enterCode(getString(R.string.five));
+ }
+
+ public void clickedSix(View v) {
+ mifosPassCodeView.enterCode(getString(R.string.six));
+ }
+
+ public void clickedSeven(View v) {
+ mifosPassCodeView.enterCode(getString(R.string.seven));
+ }
+
+ public void clickedEight(View v) {
+ mifosPassCodeView.enterCode(getString(R.string.eight));
+ }
+
+ public void clickedNine(View v) {
+ mifosPassCodeView.enterCode(getString(R.string.nine));
+ }
+
+ public void clickedZero(View v) {
+ mifosPassCodeView.enterCode(getString(R.string.zero));
+ }
+
+ public void clickedBackSpace(View v) {
+ mifosPassCodeView.backSpace();
+ }
+
+ public void skip(View v) {
+ finish();
+ }
+
+ /**
+ * @param view PasscodeView that changes to text if it was hidden and vice a versa
+ */
+ public void visibilityChange(View view) {
+ mifosPassCodeView.revertPassCodeVisibility();
+ if (!mifosPassCodeView.passcodeVisible()) {
+ ivVisibility.setColorFilter(
+ ContextCompat.getColor(
+ TransferVerificationActivity.this,
+ R.color.light_grey));
+ } else {
+ ivVisibility.setColorFilter(
+ ContextCompat.getColor(
+ TransferVerificationActivity.this,
+ R.color.gray_dark));
+ }
+ }
+
+ /**
+ * Checks whether passcode entered is of correct length
+ *
+ * @return Returns true if passcode lenght is 4 else shows message
+ */
+ private boolean isPassCodeLengthCorrect() {
+ if (mifosPassCodeView.getPasscode().length() == 4) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void onBackPressed() {
+
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/mifos/mobile/ui/fragments/TransferProcessFragment.java b/app/src/main/java/org/mifos/mobile/ui/fragments/TransferProcessFragment.java
index 3aad65f2b8..2a9b9cfa3b 100644
--- a/app/src/main/java/org/mifos/mobile/ui/fragments/TransferProcessFragment.java
+++ b/app/src/main/java/org/mifos/mobile/ui/fragments/TransferProcessFragment.java
@@ -1,5 +1,6 @@
package org.mifos.mobile.ui.fragments;
+import android.content.Intent;
import android.graphics.drawable.Animatable;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -10,6 +11,7 @@
import android.widget.TextView;
import com.google.android.material.snackbar.Snackbar;
+import com.mifos.mobile.passcode.TransferVerificationActivity;
import org.mifos.mobile.R;
import org.mifos.mobile.models.payload.TransferPayload;
@@ -124,11 +126,8 @@ public void startTransfer() {
Toaster.show(rootView, getString(R.string.internet_not_connected));
return;
}
- if (transferType == TransferType.SELF) {
- presenter.makeSavingsTransfer(payload);
- } else if (transferType == TransferType.TPT) {
- presenter.makeTPTTransfer(payload);
- }
+ Intent i = new Intent(getActivity(), TransferVerificationActivity.class);
+ startActivityForResult(i,Constants.VERIFICATION_REQUEST);
}
/**
@@ -193,4 +192,21 @@ public void onDestroyView() {
super.onDestroyView();
presenter.detachView();
}
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ switch(requestCode) {
+ case (Constants.VERIFICATION_REQUEST) : {
+ if (resultCode == getActivity().RESULT_OK) {
+ if (transferType == TransferType.SELF) {
+ presenter.makeSavingsTransfer(payload);
+ } else if (transferType == TransferType.TPT) {
+ presenter.makeTPTTransfer(payload);
+ }
+ }
+ break;
+ }
+ }
+ }
}
diff --git a/app/src/main/java/org/mifos/mobile/utils/Constants.java b/app/src/main/java/org/mifos/mobile/utils/Constants.java
index 2291ee0703..663e1224bb 100644
--- a/app/src/main/java/org/mifos/mobile/utils/Constants.java
+++ b/app/src/main/java/org/mifos/mobile/utils/Constants.java
@@ -126,4 +126,6 @@ public class Constants {
public static final String OUTSTANDING_BALANCE = "outstanding_balance";
public static final String LOAN_REPAYMENT = "loan_repayment";
+
+ public static final int VERIFICATION_REQUEST = 299;
}
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index f008951e99..0dda64948f 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -567,6 +567,9 @@
Savings Account Transaction
Transaction Period
Transaction Type
+ Enter your passcode
+ Cancel
+ TransferType
- English