Browse Source

Change password flow fixes

master
Preyea Regmi 4 years ago
parent
commit
f564d1e6da
  1. BIN
      .idea/caches/build_file_checksums.ser
  2. 31
      app/src/main/AndroidManifest.xml
  3. 1
      app/src/main/java/com/gmeremit/online/gmeremittance_native/homeV2/presenter/HomeV2Presenter.java
  4. 12
      app/src/main/java/com/gmeremit/online/gmeremittance_native/loginV2/presenter/LoginV2Presenter.java
  5. 1
      app/src/main/java/com/gmeremit/online/gmeremittance_native/loginV2/presenter/LoginV2PresenterInterface.java
  6. 4
      app/src/main/java/com/gmeremit/online/gmeremittance_native/loginV2/presenter/LoginViewLiveData.java
  7. 12
      app/src/main/java/com/gmeremit/online/gmeremittance_native/profile/presenter/profilechange/ChangePasswordV2Presenter.java
  8. 2
      app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/https/ApiEndpoints.java

BIN
.idea/caches/build_file_checksums.ser

31
app/src/main/AndroidManifest.xml

@ -329,16 +329,16 @@
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustResize" >
<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=".registerV2.view.RegisterV2Activity"
@ -374,7 +374,20 @@
android:name=".profile.view.profilechange.UserPasswordChangeV2Activity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="stateAlwaysHidden" />
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" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:theme="@style/Base.Theme.AppCompat" />

1
app/src/main/java/com/gmeremit/online/gmeremittance_native/homeV2/presenter/HomeV2Presenter.java

@ -124,6 +124,7 @@ public class HomeV2Presenter extends BasePresenter implements HomeV2PresenterInt
String pennyTestStatus = gateway.getPennyTestStatus();
if (!gateway.hasUserSubmittedKYC())
resultMessage = getStringfromStringId(R.string.complete_your_registration_text);
//TODO mocking pennyTest success
else if (pennyTestStatus != null && pennyTestStatus.length() > 0 && !pennyTestStatus.equalsIgnoreCase("2"))
resultMessage = getStringfromStringId(R.string.complete_penny_test);
else if (!gateway.isUserKYCVerified())

12
app/src/main/java/com/gmeremit/online/gmeremittance_native/loginV2/presenter/LoginV2Presenter.java

@ -72,10 +72,17 @@ public class LoginV2Presenter extends BaseViewModel implements LoginV2PresenterI
@Override
public LoginViewLiveData getLoginRelatedViewEvents(LoginViewLiveData.LoginViewBindings viewBindings) {
bindView(viewBindings);
getLastLoginIfAvailable();
// getLastLoginIfAvailable();
//TODO mock valid user
mockValidUserLogin();
return loginViewLiveData;
}
private void mockValidUserLogin() {
loginViewLiveData.setUserIdInputLiveData(new FormInputStateDTO<>(true,null,"testsender@nepal.com"));
loginViewLiveData.setPasswordInputLiveData(new FormInputStateDTO<>(true,null,"7697882"));
}
private void bindView(LoginViewLiveData.LoginViewBindings viewBindings) {
this.viewEventCompositeDisposable.add(
Observable.combineLatest(
@ -152,8 +159,7 @@ public class LoginV2Presenter extends BaseViewModel implements LoginV2PresenterI
this.gateway.setSession("HOME");
}
@Override
public void getLastLoginIfAvailable() {
private void getLastLoginIfAvailable() {
String userID = gateway.getUserID();
if (userID != null && userID.length() > 0)
loginViewLiveData.setUserIdInputLiveData(new FormInputStateDTO<>(true, "", userID));

1
app/src/main/java/com/gmeremit/online/gmeremittance_native/loginV2/presenter/LoginV2PresenterInterface.java

@ -21,7 +21,6 @@ public interface LoginV2PresenterInterface extends BasePresenterInterface {
void setSessionEnabled();
void getLastLoginIfAvailable();
interface LoginV2ContractInterface extends BaseContractInterface {

4
app/src/main/java/com/gmeremit/online/gmeremittance_native/loginV2/presenter/LoginViewLiveData.java

@ -23,7 +23,7 @@ public class LoginViewLiveData {
return userIdInputLiveData;
}
public void setUserIdInputLiveData(FormInputStateDTO userIdInputLiveData) {
public void setUserIdInputLiveData(FormInputStateDTO<String> userIdInputLiveData) {
this.userIdInputLiveData.setValue(userIdInputLiveData);
}
@ -31,7 +31,7 @@ public class LoginViewLiveData {
return passwordInputLiveData;
}
public void setPasswordInputLiveData(FormInputStateDTO passwordInputLiveData) {
public void setPasswordInputLiveData(FormInputStateDTO<String> passwordInputLiveData) {
this.passwordInputLiveData.setValue( passwordInputLiveData);
}

12
app/src/main/java/com/gmeremit/online/gmeremittance_native/profile/presenter/profilechange/ChangePasswordV2Presenter.java

@ -87,6 +87,7 @@ public class ChangePasswordV2Presenter extends BaseViewModel implements ChangePa
@Override
public void changePassword() {
if (changePasswordValidator.doesConfirmPasswordMatchWithNewPassword()) {
useCaseCompositeDisposable.add(
this.gateway.performChangePassRequest(this.gateway.getAuth(), this.gateway.getUserID(), this.changePasswordValidator.currentPassword, this.changePasswordValidator.newPassword, this.changePasswordValidator.confirmPassword)
.doOnSubscribe(d -> view.showProgressBar(true, getStringfromStringId(R.string.processing_request_text)))
@ -95,6 +96,7 @@ public class ChangePasswordV2Presenter extends BaseViewModel implements ChangePa
.doFinally(() -> view.showProgressBar(false, ""))
.subscribeWith(new ChangePasswordObserver(this.changePasswordValidator.newPassword)));
}
}
private class ChangePasswordValidator {
@ -130,12 +132,19 @@ public class ChangePasswordV2Presenter extends BaseViewModel implements ChangePa
}
public boolean doesConfirmPasswordMatchWithNewPassword() {
boolean result = (confirmPassword != null && confirmPassword.equalsIgnoreCase(newPassword));
changePasswordLiveData.setConfirmPasswordInputLiveData(new FormInputStateDTO<>(result, getStringfromStringId(R.string.confirm_password_mismatch_error)));
return result;
}
boolean isConfirmPasswordValid(CharSequence password) {
if (password != null && password.length() > 0) {
this.confirmPassword = password.toString();
changePasswordLiveData.setConfirmPasswordInputLiveData(new FormInputStateDTO<>(true, null));
return true;
} else {
this.currentPassword = null;
changePasswordLiveData.setConfirmPasswordInputLiveData(new FormInputStateDTO<>(false, getStringfromStringId(R.string.password_empty_error)));
@ -212,7 +221,4 @@ public class ChangePasswordV2Presenter extends BaseViewModel implements ChangePa
}
}

2
app/src/main/java/com/gmeremit/online/gmeremittance_native/utils/https/ApiEndpoints.java

@ -258,7 +258,7 @@ public interface ApiEndpoints {
@Headers("Content-Type: application/json")
Observable<ResponseBody> getCountryRelatedSericesV3(@Header("Authorization") String token, @Path("senderId") String senderId);
@POST(API_URL.DYNAMIC_FIELDS)
@GET(API_URL.DYNAMIC_FIELDS)
@Headers("Content-Type: application/json")
Observable<ResponseBody> getDynamicFields(@Header("Authorization") String token, @Path("senderId") String senderId,@Query("countryId") String countryId,@Query("serviceType") String serviceType);
// Observable<ResponseBody> getDynamicFields(@Header("Authorization") String token, @Path("senderId") String senderId,@Body() JsonObject json);

Loading…
Cancel
Save