Preyea Regmi
4 years ago
22 changed files with 133 additions and 827 deletions
-
18app/src/main/java/com/swifttech/remit/android/base/BaseActivity.java
-
2app/src/main/java/com/swifttech/remit/android/common/customwidgets/RemitLoaderDialog.java
-
190app/src/main/java/com/swifttech/remit/android/features/customersupport/view/CustomerSupportFragment.java
-
2app/src/main/java/com/swifttech/remit/android/features/home/view/HomeActivityV2.java
-
2app/src/main/java/com/swifttech/remit/android/features/kyc/view/KYCV3Activity.java
-
14app/src/main/java/com/swifttech/remit/android/features/login/presenter/LoginV2Presenter.java
-
128app/src/main/java/com/swifttech/remit/android/features/security/RemitAuthManager.java
-
10app/src/main/java/com/swifttech/remit/android/features/security/auth/RemitTxnOTPRequestBottomSheetDialog.java
-
317app/src/main/java/com/swifttech/remit/android/features/security/auth/profilescreen/RemitUserProfileChangeOTPRequestBottomSheetDialog.java
-
42app/src/main/java/com/swifttech/remit/android/features/security/model/GMEScreenBasedParam.java
-
6app/src/main/java/com/swifttech/remit/android/features/security/model/RemitAuthFailedResult.java
-
6app/src/main/java/com/swifttech/remit/android/features/security/model/RemitAuthSuccessResult.java
-
4app/src/main/java/com/swifttech/remit/android/features/security/model/RemitBiometricEncryptionDTO.java
-
24app/src/main/java/com/swifttech/remit/android/features/security/model/RemitTxnParam.java
-
36app/src/main/java/com/swifttech/remit/android/features/sendmoney/presenter/SendMoneyV2Presenter.java
-
12app/src/main/java/com/swifttech/remit/android/features/settings/view/FingerprintEnablePromptActivity.java
-
16app/src/main/java/com/swifttech/remit/android/features/settings/view/SettingsView.java
-
32app/src/main/java/com/swifttech/remit/android/features/splashscreen/gateway/SplashScreenGateway.java
-
2app/src/main/java/com/swifttech/remit/android/features/termsandcondition/view/TermsAndConditionAcitivity.java
-
8app/src/main/java/com/swifttech/remit/android/features/webbrowser/WebBrowserFragmentV2.java
-
8app/src/main/java/com/swifttech/remit/android/features/webbrowser/WebBrowserV2Activity.java
-
81app/src/main/res/layout/fragment_customer_support.xml
@ -1,317 +0,0 @@ |
|||
package com.swifttech.remit.android.features.security.auth.profilescreen; |
|||
|
|||
import android.app.Dialog; |
|||
import android.content.DialogInterface; |
|||
import android.content.SharedPreferences; |
|||
import android.content.res.Resources; |
|||
import android.os.Bundle; |
|||
import android.os.CountDownTimer; |
|||
import android.text.Spannable; |
|||
import android.text.SpannableString; |
|||
import android.text.style.ForegroundColorSpan; |
|||
import android.util.Log; |
|||
import android.view.LayoutInflater; |
|||
import android.view.View; |
|||
import android.view.ViewGroup; |
|||
import android.widget.FrameLayout; |
|||
import android.widget.RelativeLayout; |
|||
import android.widget.TextView; |
|||
|
|||
import androidx.annotation.NonNull; |
|||
import androidx.core.content.ContextCompat; |
|||
|
|||
import com.swifttech.remit.android.RemitApplication; |
|||
import com.swifttech.remit.android.R; |
|||
import com.swifttech.remit.android.base.BaseActivity; |
|||
import com.swifttech.remit.android.base.PrefKeys; |
|||
import com.swifttech.remit.android.common.customwidgets.CustomAlertDialog; |
|||
import com.swifttech.remit.android.features.security.RemitAuthManager; |
|||
import com.swifttech.remit.android.utils.Constants; |
|||
import com.swifttech.remit.android.utils.https.GenericApiObserverResponseV2; |
|||
import com.swifttech.remit.android.utils.https.GenericResponseDataModel; |
|||
import com.swifttech.remit.android.utils.https.HttpClientV2; |
|||
import com.swifttech.remit.android.utils.https.MessageResponseDataModel; |
|||
import com.google.android.material.bottomsheet.BottomSheetBehavior; |
|||
import com.google.android.material.bottomsheet.BottomSheetDialog; |
|||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment; |
|||
import com.google.gson.JsonObject; |
|||
|
|||
import java.util.Locale; |
|||
|
|||
import butterknife.BindView; |
|||
import butterknife.ButterKnife; |
|||
import butterknife.OnClick; |
|||
import io.reactivex.android.schedulers.AndroidSchedulers; |
|||
import io.reactivex.schedulers.Schedulers; |
|||
|
|||
public class RemitUserProfileChangeOTPRequestBottomSheetDialog extends BottomSheetDialogFragment implements View.OnClickListener { |
|||
|
|||
private static final String BUNDLE_TARGET_VALUE = "bundleKeyTargetValue"; |
|||
private static final String BUNDLE_INITIAL_REQUEST = "bundleKeyInitiallyRequestOTP"; |
|||
private static final String BUNDLE_COUNTDOWN_VAL = "bundleKeyCurrentCountDownVal"; |
|||
private GMEUserProfileChangeOTPRequestListener listener; |
|||
|
|||
|
|||
|
|||
|
|||
@BindView(R.id.keypadContainer) |
|||
FrameLayout keypadContainer; |
|||
|
|||
@BindView(R.id.keypadBallon) |
|||
RelativeLayout ballonView; |
|||
|
|||
@BindView(R.id.title) |
|||
TextView title; |
|||
|
|||
@BindView(R.id.resend_request) |
|||
TextView resendRequest; |
|||
|
|||
private boolean initiallyRequestOTP; |
|||
|
|||
private CountDownTimer countDownTimer; |
|||
private long currentCountDownVal; |
|||
private String targetValue; |
|||
|
|||
public static Bundle constructParam(String targetValue,boolean initiallyRequestOTP,long currentCountDownVal) { |
|||
Bundle bundle = new Bundle(); |
|||
bundle.putString(BUNDLE_TARGET_VALUE, targetValue); |
|||
bundle.putBoolean(BUNDLE_INITIAL_REQUEST, initiallyRequestOTP); |
|||
bundle.putLong(BUNDLE_COUNTDOWN_VAL, currentCountDownVal); |
|||
return bundle; |
|||
} |
|||
|
|||
public static RemitUserProfileChangeOTPRequestBottomSheetDialog showPromptView(Bundle param, GMEUserProfileChangeOTPRequestListener listener) { |
|||
RemitUserProfileChangeOTPRequestBottomSheetDialog gmeUserPasswordPromptBottomSheetDialog = new RemitUserProfileChangeOTPRequestBottomSheetDialog(); |
|||
gmeUserPasswordPromptBottomSheetDialog.setListener(listener); |
|||
gmeUserPasswordPromptBottomSheetDialog.setParam(param); |
|||
return gmeUserPasswordPromptBottomSheetDialog; |
|||
} |
|||
|
|||
|
|||
|
|||
private void setParam(Bundle param) { |
|||
if (param != null) { |
|||
this.targetValue = param.getString(BUNDLE_TARGET_VALUE, ""); |
|||
setCurrentCountDownValue(param.getLong(BUNDLE_COUNTDOWN_VAL)); |
|||
setRequestOTPInitially(param.getBoolean(BUNDLE_INITIAL_REQUEST,false)); |
|||
} |
|||
else |
|||
throw new IllegalArgumentException("Provide 'targetValue' as param for requesting this authentication"); |
|||
} |
|||
|
|||
private void setCurrentCountDownValue(long currentCountDownVal) { |
|||
if (currentCountDownVal > 0) |
|||
this.currentCountDownVal = currentCountDownVal; |
|||
else |
|||
this.currentCountDownVal = 120000; |
|||
} |
|||
|
|||
private void setRequestOTPInitially(boolean intiallyRequestOTP) { |
|||
this.initiallyRequestOTP = intiallyRequestOTP; |
|||
} |
|||
|
|||
private void setListener(GMEUserProfileChangeOTPRequestListener listener) { |
|||
this.listener = listener; |
|||
} |
|||
|
|||
@Override |
|||
public void onCreate(Bundle savedInstanceState) { |
|||
super.onCreate(savedInstanceState); |
|||
setStyle(STYLE_NORMAL, R.style.AppBottomSheetDialogThemeWithInset); |
|||
} |
|||
|
|||
@Override |
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container, |
|||
Bundle savedInstanceState) { |
|||
View v = inflater.inflate(R.layout.gme_user_pwd_prompt_modal, container, false); |
|||
ButterKnife.bind(this, v); |
|||
init(); |
|||
return v; |
|||
} |
|||
|
|||
@Override |
|||
public Dialog onCreateDialog(Bundle savedInstanceState) { |
|||
BottomSheetDialog bottomSheetDialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState); |
|||
bottomSheetDialog.setOnShowListener(dialog -> { |
|||
BottomSheetDialog dialogc = (BottomSheetDialog) dialog; |
|||
FrameLayout bottomSheet = dialogc.findViewById(com.google.android.material.R.id.design_bottom_sheet); |
|||
BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.from(bottomSheet); |
|||
int bottomSheetHeight = Resources.getSystem().getDisplayMetrics().heightPixels; |
|||
bottomSheetBehavior.setPeekHeight(bottomSheetHeight); |
|||
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); |
|||
}); |
|||
performDefaultAction(); |
|||
return bottomSheetDialog; |
|||
} |
|||
|
|||
private void performDefaultAction() { |
|||
Log.d(RemitAuthManager.TAG, "USER PROFILE OTP SCREEN: requestOTP Initially=>" + initiallyRequestOTP); |
|||
startCountdownView(currentCountDownVal); |
|||
} |
|||
|
|||
@OnClick(R.id.img_close) |
|||
public void onClose() |
|||
{ |
|||
dismiss(); |
|||
} |
|||
|
|||
public void startCountdownView(long durationMillisecond) { |
|||
resetCountDown(); |
|||
countDownTimer = new CountDownTimer(durationMillisecond, 1000) { |
|||
|
|||
int redColor = ContextCompat.getColor(getActivity(), R.color.colorPrimary); |
|||
int grayColor = ContextCompat.getColor(getActivity(), R.color.darkgray2); |
|||
|
|||
@Override |
|||
public void onTick(long millisUntilFinished) { |
|||
currentCountDownVal = millisUntilFinished; |
|||
int seconds = (int) (millisUntilFinished / 1000); |
|||
|
|||
int hours = seconds / (60 * 60); |
|||
int tempMint = (seconds - (hours * 60 * 60)); |
|||
int minutes = tempMint / 60; |
|||
seconds = tempMint - (minutes * 60); |
|||
|
|||
String timeRemaining = String.format(Locale.US, "%02d", minutes) |
|||
+ ":" + String.format(Locale.US, "%02d", seconds); |
|||
|
|||
Spannable tryInText = new SpannableString(getString(R.string.resend_code_text)); |
|||
tryInText.setSpan(new ForegroundColorSpan(grayColor), 0, tryInText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |
|||
resendRequest.setText(tryInText); |
|||
|
|||
Spannable timeText = new SpannableString(" " + timeRemaining); |
|||
timeText.setSpan(new ForegroundColorSpan(redColor), 0, timeText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |
|||
|
|||
resendRequest.append(timeText); |
|||
} |
|||
|
|||
@Override |
|||
public void onFinish() { |
|||
showResendRequestView(true); |
|||
currentCountDownVal = -1; |
|||
} |
|||
|
|||
|
|||
}; |
|||
countDownTimer.start(); |
|||
} |
|||
|
|||
private void resetCountDown() { |
|||
if (countDownTimer != null) |
|||
countDownTimer.cancel(); |
|||
} |
|||
|
|||
@Override |
|||
public void onDismiss(@NonNull DialogInterface dialog) { |
|||
if (countDownTimer != null) |
|||
countDownTimer.cancel(); |
|||
super.onDismiss(dialog); |
|||
} |
|||
|
|||
public void showResendRequestView(boolean action) { |
|||
if (resendRequest.getVisibility() != View.VISIBLE) |
|||
resendRequest.setVisibility(View.VISIBLE); |
|||
if (action) { |
|||
if (countDownTimer != null) |
|||
countDownTimer.cancel(); |
|||
currentCountDownVal = -1; |
|||
resendRequest.setText(getString(R.string.resend_request_text)); |
|||
resendRequest.setOnClickListener(this); |
|||
|
|||
} else { |
|||
resendRequest.setText(""); |
|||
resendRequest.setOnClickListener(null); |
|||
} |
|||
} |
|||
|
|||
private void init() { |
|||
resendRequest.setVisibility(View.VISIBLE); |
|||
|
|||
|
|||
} |
|||
|
|||
@Override |
|||
public void onClick(View v) { |
|||
switch (v.getId()) { |
|||
case R.id.resend_request: |
|||
resendOTPRequest(); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
private void resendOTPRequest() { |
|||
|
|||
SharedPreferences sharedPreferences = RemitApplication.getStorage(); |
|||
String auth = "Bearer " + sharedPreferences.getString(PrefKeys.USER_ACCESS_CODE, ""); |
|||
String senderId = sharedPreferences.getString(PrefKeys.USER_ID_NUMBER, ""); |
|||
|
|||
JsonObject jsonObject = new JsonObject(); |
|||
jsonObject.addProperty("userId", senderId); |
|||
jsonObject.addProperty("tempValue", targetValue); |
|||
HttpClientV2.getInstance().profileOTPResend(auth, jsonObject) |
|||
.doOnSubscribe(subs -> showProgressBar(true)) |
|||
.subscribeOn(Schedulers.io()) |
|||
.observeOn(AndroidSchedulers.mainThread()) |
|||
.doFinally(() -> showProgressBar(false)) |
|||
.subscribe(new OTPResendObserver()); |
|||
|
|||
} |
|||
|
|||
|
|||
private void showPopUpMessage(String message, CustomAlertDialog.AlertType alertType, CustomAlertDialog.CustomDialogActionListener listener) { |
|||
|
|||
((BaseActivity) getActivity()).showPopUpMessage(message, alertType, listener); |
|||
} |
|||
|
|||
|
|||
private void showProgressBar(boolean action) { |
|||
((BaseActivity) getActivity()).showProgressBar(action, ""); |
|||
} |
|||
|
|||
|
|||
public class OTPResendObserver extends GenericApiObserverResponseV2<MessageResponseDataModel> { |
|||
|
|||
@Override |
|||
protected void onSuccess(GenericResponseDataModel<MessageResponseDataModel> t) { |
|||
if (t.getErrorCode().equalsIgnoreCase(Constants.SUCCESS_CODE_V2)) { |
|||
showPopUpMessage(getString(R.string.new_otp_number_has_sent_text), CustomAlertDialog.AlertType.SUCCESS, alertType -> { |
|||
}); |
|||
|
|||
} else { |
|||
showPopUpMessage(t.getMsg(), CustomAlertDialog.AlertType.FAILED, alertType -> { |
|||
|
|||
}); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public void onFailed(String message) { |
|||
showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, alertType -> { |
|||
|
|||
}); |
|||
} |
|||
|
|||
@Override |
|||
protected void onConnectionNotEstablished(String message) { |
|||
showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, alertType -> { |
|||
|
|||
}); |
|||
} |
|||
|
|||
@Override |
|||
protected void unauthorizedAccess(String message) { |
|||
showPopUpMessage(message, CustomAlertDialog.AlertType.FAILED, alertType -> { |
|||
dismiss(); |
|||
}); |
|||
} |
|||
} |
|||
|
|||
public interface GMEUserProfileChangeOTPRequestListener { |
|||
void onOTPSubmittedSucessfully(String secret); |
|||
|
|||
void onOTPRequestFailed(); |
|||
|
|||
} |
|||
} |
@ -1,42 +0,0 @@ |
|||
package com.swifttech.remit.android.features.security.model; |
|||
|
|||
import android.os.Bundle; |
|||
|
|||
import com.swifttech.remit.android.features.security.auth.profilescreen.RemitUserProfileChangeOTPRequestBottomSheetDialog; |
|||
|
|||
public class GMEScreenBasedParam |
|||
{ |
|||
private GMEScreenBasedAuthType gmeScreenBasedAuthType; |
|||
private Bundle param; |
|||
|
|||
private GMEScreenBasedParam(GMEScreenBasedAuthType gmeScreenBasedAuthType, Bundle param) { |
|||
this.gmeScreenBasedAuthType = gmeScreenBasedAuthType; |
|||
this.param = param; |
|||
} |
|||
|
|||
public GMEScreenBasedAuthType getGmeScreenBasedAuthType() { |
|||
return gmeScreenBasedAuthType; |
|||
} |
|||
|
|||
public Bundle getParam() { |
|||
return param; |
|||
} |
|||
|
|||
public static GMEScreenBasedParam forPasswordUserProfile() |
|||
{ |
|||
return new GMEScreenBasedParam(GMEScreenBasedAuthType.PASSWORD_USER_PROFILE,null); |
|||
} |
|||
|
|||
public static GMEScreenBasedParam forOTPRequestUserProfile(String targetValue, long countdownValue) |
|||
{ |
|||
return new GMEScreenBasedParam(GMEScreenBasedAuthType.OTP_REQUEST_PROFILE, RemitUserProfileChangeOTPRequestBottomSheetDialog.constructParam(targetValue,true,countdownValue)); |
|||
} |
|||
public static GMEScreenBasedParam forOTPSubmitUserProfile(String targetValue, long countdownValue) |
|||
{ |
|||
return new GMEScreenBasedParam(GMEScreenBasedAuthType.OTP_REQUEST_PROFILE, RemitUserProfileChangeOTPRequestBottomSheetDialog.constructParam(targetValue,false,countdownValue)); |
|||
} |
|||
|
|||
public enum GMEScreenBasedAuthType { |
|||
PASSWORD_USER_PROFILE, OTP_REQUEST_PROFILE, OTP_SUBMIT_PROFILE |
|||
} |
|||
} |
@ -1,16 +1,16 @@ |
|||
package com.swifttech.remit.android.features.security.model; |
|||
|
|||
public class GMEAuthFailedResult { |
|||
public class RemitAuthFailedResult { |
|||
|
|||
private String failedReason; |
|||
private boolean isRecoverable; |
|||
|
|||
public GMEAuthFailedResult(String failedReason) { |
|||
public RemitAuthFailedResult(String failedReason) { |
|||
this.failedReason = failedReason; |
|||
isRecoverable=false; |
|||
} |
|||
|
|||
public GMEAuthFailedResult(String failedReason,boolean isRecoverable) { |
|||
public RemitAuthFailedResult(String failedReason, boolean isRecoverable) { |
|||
this.failedReason = failedReason; |
|||
this.isRecoverable=isRecoverable; |
|||
} |
@ -1,17 +1,17 @@ |
|||
package com.swifttech.remit.android.features.security.model; |
|||
|
|||
public class GMEAuthSuccessResult { |
|||
public class RemitAuthSuccessResult { |
|||
|
|||
private String result; |
|||
private boolean isBiometricUsed; |
|||
|
|||
public GMEAuthSuccessResult(String result) |
|||
public RemitAuthSuccessResult(String result) |
|||
{ |
|||
this.result=result; |
|||
this.isBiometricUsed=false; |
|||
|
|||
} |
|||
public GMEAuthSuccessResult(String result, boolean isBiometricUsed) |
|||
public RemitAuthSuccessResult(String result, boolean isBiometricUsed) |
|||
{ |
|||
this.result=result; |
|||
this.isBiometricUsed=isBiometricUsed; |
@ -1,12 +1,12 @@ |
|||
package com.swifttech.remit.android.features.security.model; |
|||
|
|||
public class GMEBiometricEncryptionDTO { |
|||
public class RemitBiometricEncryptionDTO { |
|||
|
|||
String userId; |
|||
String encPwd; |
|||
String encKey; |
|||
|
|||
public GMEBiometricEncryptionDTO(String userId, String encPwd, String encKey) { |
|||
public RemitBiometricEncryptionDTO(String userId, String encPwd, String encKey) { |
|||
this.userId = userId; |
|||
this.encPwd = encPwd; |
|||
this.encKey = encKey; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue