Browse Source

Pin change feature added api integration due

new_design
Preyea Regmi 4 years ago
parent
commit
0b8adb95aa
  1. BIN
      .idea/caches/build_file_checksums.ser
  2. 214
      app/src/main/AndroidManifest.xml
  3. 2
      app/src/main/java/com/swifttech/remit/android/features/changepassword/presenter/ChangePasswordV2Presenter.java
  4. 28
      app/src/main/java/com/swifttech/remit/android/features/changetxnpin/ChangePinViewModelFactory.java
  5. 28
      app/src/main/java/com/swifttech/remit/android/features/changetxnpin/gateway/ChangePinGateway.java
  6. 52
      app/src/main/java/com/swifttech/remit/android/features/changetxnpin/model/ChangePinV2APIResponse.java
  7. 19
      app/src/main/java/com/swifttech/remit/android/features/changetxnpin/model/ChangeSuccessModel.java
  8. 80
      app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinLiveData.java
  9. 20
      app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinV2InteractorInterface.java
  10. 183
      app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinV2Presenter.java
  11. 22
      app/src/main/java/com/swifttech/remit/android/features/changetxnpin/presenter/ChangePinV2PresenterInterface.java
  12. 146
      app/src/main/java/com/swifttech/remit/android/features/changetxnpin/view/ChangeTxnPinActivity.java
  13. 7
      app/src/main/java/com/swifttech/remit/android/features/settings/view/SettingsView.java
  14. 86
      app/src/main/res/layout/activity_change_txn_pin.xml
  15. 50
      app/src/main/res/layout/activity_settings.xml

BIN
.idea/caches/build_file_checksums.ser

214
app/src/main/AndroidManifest.xml

@ -15,7 +15,7 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:name="com.swifttech.remit.android.RemitApplication"
android:name=".RemitApplication"
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
@ -27,122 +27,133 @@
android:usesCleartextTraffic="true"
tools:ignore="GoogleAppIndexingWarning"
tools:replace="android:allowBackup,android:supportsRtl">
<activity android:name=".features.withdraw.view.WithdrawActivity"
<activity android:name=".features.changetxnpin.view.ChangeTxnPinActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden"/>
<activity
android:name=".features.withdraw.view.WithdrawActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden">
<!-- <intent-filter>-->
<!-- <action android:name="HOME" />-->
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- </intent-filter>-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<!-- <intent-filter> -->
<!-- <action android:name="HOME" /> -->
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
<!-- <category android:name="android.intent.category.DEFAULT" /> -->
<!-- </intent-filter> -->
<!-- <intent-filter> -->
<!-- <action android:name="android.intent.action.MAIN" /> -->
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
<!-- </intent-filter> -->
</activity>
<activity android:name=".features.cashpickuptowallet.view.CashPickupToWalletActivity"
<activity
android:name=".features.cashpickuptowallet.view.CashPickupToWalletActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden">
<!-- <intent-filter>-->
<!-- <action android:name="HOME" />-->
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- </intent-filter>-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<!-- <intent-filter> -->
<!-- <action android:name="HOME" /> -->
<!-- <category android:name="android.intent.category.DEFAULT" /> -->
<!-- </intent-filter> -->
<!-- <intent-filter> -->
<!-- <action android:name="android.intent.action.MAIN" /> -->
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
<!-- </intent-filter> -->
</activity>
<activity
android:name=".features.otpverification.view.OTPVerificationActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity android:name=".features.balancesend.view.BalanceSendActivity"
<activity
android:name=".features.balancesend.view.BalanceSendActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden">
<!-- <intent-filter>-->
<!-- <action android:name="HOME" />-->
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- </intent-filter>-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<!-- <intent-filter> -->
<!-- <action android:name="HOME" /> -->
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
<!-- <category android:name="android.intent.category.DEFAULT" /> -->
<!-- </intent-filter> -->
<!-- <intent-filter> -->
<!-- <action android:name="android.intent.action.MAIN" /> -->
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
<!-- </intent-filter> -->
</activity>
<activity android:name=".features.balancerequest.view.BalanceRequestActivity"
<activity
android:name=".features.balancerequest.view.BalanceRequestActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden">
<!-- <intent-filter>-->
<!-- <action android:name="HOME" />-->
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- </intent-filter>-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<!-- <intent-filter> -->
<!-- <action android:name="HOME" /> -->
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
<!-- <category android:name="android.intent.category.DEFAULT" /> -->
<!-- </intent-filter> -->
<!-- <intent-filter> -->
<!-- <action android:name="android.intent.action.MAIN" /> -->
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
<!-- </intent-filter> -->
</activity>
<activity
android:name="com.swifttech.remit.android.features.termsandcondition.view.TermsAndConditionAcitivity"
android:name=".features.termsandcondition.view.TermsAndConditionAcitivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.swifttech.remit.android.features.kyc.view.KYCV3Activity"
android:name=".features.kyc.view.KYCV3Activity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden">
<intent-filter>
<action android:name="HOME" />
<!-- <intent-filter>-->
<!-- <action android:name="HOME" />-->
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- </intent-filter>-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
</activity>
<activity
android:name="com.swifttech.remit.android.features.inboundreceipt.view.InboundRemitReceiptActivity"
android:name=".features.inboundreceipt.view.InboundRemitReceiptActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden|adjustPan" />
<activity
android:name="com.swifttech.remit.android.features.exrate.view.ExchangeRateActivity"
android:name=".features.exrate.view.ExchangeRateActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.swifttech.remit.android.features.recipientmanagement.view.recipientaddeditV3.RecipientAddEditV3Activity"
android:name=".features.recipientmanagement.view.recipientaddeditV3.RecipientAddEditV3Activity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.swifttech.remit.android.features.recipientmanagement.view.recipientlistingV3.RecipientListingV3Activity"
android:name=".features.recipientmanagement.view.recipientlistingV3.RecipientListingV3Activity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${fileProvider}"
@ -155,30 +166,26 @@
</provider>
<activity
android:name="com.swifttech.remit.android.features.splashscreen.view.SplashScreen"
android:name=".features.splashscreen.view.SplashScreen"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.Launcher"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden">
<!-- <intent-filter>-->
<!-- <action android:name="HOME" />-->
<intent-filter>
<action android:name="HOME" />
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- </intent-filter>-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.swifttech.remit.android.features.aboutscreen.view.AboutFastRemit"
android:name=".features.aboutscreen.view.AboutFastRemit"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateHidden" /> <!-- <activity -->
@ -186,104 +193,99 @@
<!-- android:screenOrientation="portrait" -->
<!-- android:theme="@style/AppTheme.NoActionBar" -->
<!-- android:windowSoftInputMode="stateHidden" /> -->
<activity
android:name="com.swifttech.remit.android.features.settings.view.SettingsView"
android:name=".features.settings.view.SettingsView"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="com.swifttech.remit.android.features.userprofile.view.ProfileActivity"
android:name=".features.userprofile.view.ProfileActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />
<meta-data
android:name="io.fabric.ApiKey"
android:value="b575c94baafadc63651a9c5ec62f0b5f468a4093" />
<activity
android:name="com.swifttech.remit.android.features.agentslisting.view.AgentListV2Activity"
android:name=".features.agentslisting.view.AgentListV2Activity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.swifttech.remit.android.features.sendmoney.view.SendMoneyV2Activity"
android:name=".features.sendmoney.view.SendMoneyV2Activity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.swifttech.remit.android.features.sendmoney.view.SendMoneyV2TransactionCompleteActivity"
android:name=".features.sendmoney.view.SendMoneyV2TransactionCompleteActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.swifttech.remit.android.features.login.view.LoginV2Activity"
android:name=".features.login.view.LoginV2Activity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustResize">
<!-- <intent-filter>-->
<!-- <action android:name="HOME" />-->
<!-- <category android:name="android.intent.category.DEFAULT" />-->
<!-- </intent-filter>-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<!-- <intent-filter> -->
<!-- <action android:name="HOME" /> -->
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
<!-- <category android:name="android.intent.category.DEFAULT" /> -->
<!-- </intent-filter> -->
<!-- <intent-filter> -->
<!-- <action android:name="android.intent.action.MAIN" /> -->
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
<!-- </intent-filter> -->
</activity>
<activity
android:name="com.swifttech.remit.android.features.register.view.RegisterV2Activity"
android:name=".features.register.view.RegisterV2Activity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustResize|stateAlwaysHidden" />
<activity
android:name="com.swifttech.remit.android.features.resetpassword.view.ResetPassV2Activity"
android:name=".features.resetpassword.view.ResetPassV2Activity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.swifttech.remit.android.features.home.view.HomeActivityV2"
android:name=".features.home.view.HomeActivityV2"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.swifttech.remit.android.features.support.view.SupportActivityV2"
android:name=".features.support.view.SupportActivityV2"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.swifttech.remit.android.features.walletstatement.view.WalletStatementV2Activity"
android:name=".features.walletstatement.view.WalletStatementV2Activity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.swifttech.remit.android.features.changepassword.view.UserPasswordChangeV2Activity"
android:name=".features.changepassword.view.UserPasswordChangeV2Activity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden"/>
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:theme="@style/Base.Theme.AppCompat" />
<activity
android:name="com.swifttech.remit.android.features.appupdate.AppUpdateActivity"
android:name=".features.appupdate.AppUpdateActivity"
android:screenOrientation="portrait"
android:theme="@style/AppFullScreenTheme"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.swifttech.remit.android.features.sendmoney.view.verification.TermsAndConditionV2BrowserActivity"
android:name=".features.sendmoney.view.verification.TermsAndConditionV2BrowserActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden" />
<activity
android:name="com.swifttech.remit.android.features.settings.view.FingerprintEnablePromptActivity"
android:name=".features.settings.view.FingerprintEnablePromptActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden" />

2
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;
}

28
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 extends ViewModel> T create(@NonNull Class<T> modelClass) {
return (T) new ChangePinV2Presenter(view,new ChangePinGateway());
}
}

28
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<ChangePasswordActivityV2APIResponse> 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);
}
}

52
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;
}
}

19
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;
}
}

80
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<FormInputStateDTO<String>> currentPinInputLiveData;
private MutableLiveData<FormInputStateDTO<String>> newPinInputLiveData;
private MutableLiveData<FormInputStateDTO<String>> confirmPinInputLiveData;
private MutableLiveData<FormInputStateDTO> allFormValidLiveData;
public ChangePinLiveData() {
currentPinInputLiveData = new MutableLiveData<>();
newPinInputLiveData = new MutableLiveData<>();
confirmPinInputLiveData = new MutableLiveData<>();
allFormValidLiveData = new MutableLiveData<>();
}
public LiveData<FormInputStateDTO<String>> getCurrentPinInputLiveData() {
return currentPinInputLiveData;
}
public void setCurrentPinInputLiveData(FormInputStateDTO<String> currentPinInputLiveData) {
this.currentPinInputLiveData.setValue(currentPinInputLiveData);
}
public LiveData<FormInputStateDTO<String>> getNewPinInputLiveData() {
return newPinInputLiveData;
}
public void setNewPinInputLiveData(FormInputStateDTO<String> newPinInputLiveData) {
this.newPinInputLiveData.setValue(newPinInputLiveData);
}
public LiveData<FormInputStateDTO<String>> getConfirmPinInputLiveData() {
return confirmPinInputLiveData;
}
public void setConfirmPinInputLiveData(FormInputStateDTO<String> confirmPinInputLiveData) {
this.confirmPinInputLiveData.setValue(confirmPinInputLiveData);
}
public LiveData<FormInputStateDTO> getAllFormValidLiveData() {
return allFormValidLiveData;
}
public void setAllFormValidLiveData(FormInputStateDTO allFormValidLiveData) {
this.allFormValidLiveData.setValue(allFormValidLiveData);
}
public static class ChangePinViewBindings {
private Observable<CharSequence> currentPinInputLiveData;
private Observable<CharSequence> newPinInputLiveData;
private Observable<CharSequence> confirmPinInputLiveData;
public ChangePinViewBindings(Observable<CharSequence> currentPasswordInputLiveData, Observable<CharSequence> newPasswordInputLiveData, Observable<CharSequence> confirmPasswordInputLiveData) {
this.currentPinInputLiveData = currentPasswordInputLiveData;
this.newPinInputLiveData = newPasswordInputLiveData;
this.confirmPinInputLiveData = confirmPasswordInputLiveData;
}
public Observable<CharSequence> getCurrentPinInputLiveData() {
return currentPinInputLiveData;
}
public Observable<CharSequence> getNewPinInputLiveData() {
return newPinInputLiveData;
}
public Observable<CharSequence> getConfirmPinInputLiveData() {
return confirmPinInputLiveData;
}
}
}

20
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<ChangePasswordActivityV2APIResponse> performChangePassRequest(String auth, String userId, String oldPass, String newPass,String confirmPass);
void persistUserPwdForBiometric(String encrypted);
void turnOffFingerprintAuth(boolean b);
}
}

183
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<Boolean>() {
@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<ChangePasswordActivityV2APIResponse> {
@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());
}
}
}

22
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
{
}
}

146
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<String> 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<String> 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<String> 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();
}
}

7
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;
}
}

86
app/src/main/res/layout/activity_change_txn_pin.xml

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/background_gray">
<include layout="@layout/layout_sendmoney_toolbar"/>
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<LinearLayout
style="@style/MFormBoundWithCornerRadius"
android:orientation="vertical">
<com.swifttech.remit.android.common.view.MTextInputLayout
android:id="@+id/currentPin_TxtInputLayout"
app:errorEnabled="true"
style="@style/MTextInputLayoutForm"
app:endIconMode="password_toggle"
android:hint="Current Pin"
app:startIconDrawable="@drawable/vd_lock"
>
<com.swifttech.remit.android.common.view.MTextInputEditText
android:inputType="numberPassword"
android:maxLength="5"
android:id="@+id/currentPin_edTxt"
style="@style/MTextInputEditText"/>
</com.swifttech.remit.android.common.view.MTextInputLayout>
<com.swifttech.remit.android.common.view.MTextInputLayout
android:id="@+id/newPin_TxtInputLayout"
app:errorEnabled="true"
style="@style/MTextInputLayoutForm"
app:endIconMode="password_toggle"
android:hint="New Pin"
app:startIconDrawable="@drawable/vd_lock"
>
<com.swifttech.remit.android.common.view.MTextInputEditText
android:inputType="numberPassword"
android:maxLength="5"
android:id="@+id/newPin_edTxt"
style="@style/MTextInputEditText"/>
</com.swifttech.remit.android.common.view.MTextInputLayout>
<com.swifttech.remit.android.common.view.MTextInputLayout
android:id="@+id/confirmPin_TxtInputLayout"
app:errorEnabled="true"
style="@style/MTextInputLayoutForm"
app:endIconMode="password_toggle"
android:hint="Confirm New Pin"
app:startIconDrawable="@drawable/vd_lock"
>
<com.swifttech.remit.android.common.view.MTextInputEditText
android:inputType="numberPassword"
android:maxLength="5"
android:id="@+id/confirmPin_edTxt"
style="@style/MTextInputEditText"/>
</com.swifttech.remit.android.common.view.MTextInputLayout>
<com.swifttech.remit.android.common.customwidgets.GmeButton
style="@style/MButton"
android:id="@+id/btn_submit"
android:text="@string/save_password_text"
android:layout_gravity="center"
android:layout_marginTop="20dp"/>
</LinearLayout>
</ScrollView>
</LinearLayout>

50
app/src/main/res/layout/activity_settings.xml

@ -57,35 +57,7 @@
android:paddingStart="52dp"
android:paddingTop="14dp">
<!--<LinearLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:orientation="horizontal">-->
<!--<com.gmeremit.online.gmeremittance_native.common.customwidgets.GmeTextView-->
<!--android:id="@+id/view_general_enquiry"-->
<!--android:layout_width="0dp"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_weight="1"-->
<!--android:paddingBottom="15dp"-->
<!--android:paddingLeft="21dp"-->
<!--android:paddingStart="21dp"-->
<!--android:paddingTop="16dp"-->
<!--android:text="@string/app_lock"-->
<!--android:textColor="@color/darkgray"-->
<!--android:textSize="14sp" />-->
<!--<Switch-->
<!--android:id="@+id/switch_app_lock"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_marginRight="12dp" />-->
<!--</LinearLayout>-->
<!--<View-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="1dp"-->
<!--android:background="@color/divider_dark" />-->
<com.swifttech.remit.android.common.customwidgets.GmeTextView
android:id="@+id/view_change_password"
@ -103,6 +75,26 @@
android:layout_height="1dp"
android:background="@color/divider_dark" />
<com.swifttech.remit.android.common.customwidgets.GmeTextView
android:id="@+id/view_change_pin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="15dp"
android:paddingLeft="21dp"
android:paddingStart="21dp"
android:paddingTop="16dp"
android:layout_marginTop="14dp"
android:text="Change Pin"
android:textColor="@color/darkgray"
android:textSize="14sp" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/divider_dark" />
<com.swifttech.remit.android.common.customwidgets.GmeTextView
android:layout_marginTop="14dp"
android:id="@+id/view_language"

Loading…
Cancel
Save