Browse Source

In memory user state maanaged for kyc submitted and verified

master
preyearegmi 6 years ago
parent
commit
c096c0ac22
  1. 47
      app/src/main/java/com/gmeremit/online/gmeremittance_native/homeV2/presenter/HomeV2Presenter.java

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

@ -25,6 +25,7 @@ public class HomeV2Presenter extends BasePresenter implements HomeV2PresenterInt
private final HomeV2ContractInterface view; private final HomeV2ContractInterface view;
private final HomeV2GatewayInterface gateway; private final HomeV2GatewayInterface gateway;
private final CompositeDisposable compositeDisposable; private final CompositeDisposable compositeDisposable;
private UserState userState=null;
public HomeV2Presenter(HomeV2PresenterInterface.HomeV2ContractInterface view) { public HomeV2Presenter(HomeV2PresenterInterface.HomeV2ContractInterface view) {
this.view = view; this.view = view;
@ -72,12 +73,19 @@ public class HomeV2Presenter extends BasePresenter implements HomeV2PresenterInt
@Override @Override
public String checkIfUserVerified() { public String checkIfUserVerified() {
String resultMessage=null; String resultMessage=null;
if(!gateway.hasUserSubmittedKYC())
resultMessage="Kindly complete your kyc registration process with us to start using GME services";
else if(!gateway.isUserKYCVerified())
resultMessage="Your registration request is in approval process. You will soon be able to use GME services";
if(userState==null) {
if (!gateway.hasUserSubmittedKYC())
resultMessage = "Kindly complete your kyc registration process with us to start using GME services";
else if (!gateway.isUserKYCVerified())
resultMessage = "Your registration request is in approval process. You will soon be able to use GME services";
}
else
{
if (!userState.hasSubmittedKyc())
resultMessage = "Kindly complete your kyc registration process with us to start using GME services";
else if (!userState.isVerifiedUser())
resultMessage = "Your registration request is in approval process. You will soon be able to use GME services";
}
return resultMessage; return resultMessage;
} }
@ -103,7 +111,6 @@ public class HomeV2Presenter extends BasePresenter implements HomeV2PresenterInt
super.onViewDestroyed(); super.onViewDestroyed();
if (compositeDisposable != null && !compositeDisposable.isDisposed()) if (compositeDisposable != null && !compositeDisposable.isDisposed())
compositeDisposable.clear(); compositeDisposable.clear();
} }
@ -124,8 +131,8 @@ public class HomeV2Presenter extends BasePresenter implements HomeV2PresenterInt
String message=""; String message="";
String title=""; String title="";
// userInfoModelV2.setKyc(false);
// userInfoModelV2.setVerified(false);
userState=new UserState(userInfoModelV2.getKyc(),userInfoModelV2.getVerified());
boolean disableKYCViewClick=userInfoModelV2.getKyc()&&!userInfoModelV2.getVerified(); boolean disableKYCViewClick=userInfoModelV2.getKyc()&&!userInfoModelV2.getVerified();
boolean shouldShowKYCView=false; boolean shouldShowKYCView=false;
@ -165,6 +172,28 @@ public class HomeV2Presenter extends BasePresenter implements HomeV2PresenterInt
} }
} }
private class UserState
{
private boolean hasSubmittedKyc;
private boolean isVerifiedUser;
public UserState(boolean hasSubmittedKyc, boolean isVerifiedUser) {
this.hasSubmittedKyc = hasSubmittedKyc;
this.isVerifiedUser = isVerifiedUser;
}
boolean hasSubmittedKyc() {
return hasSubmittedKyc;
}
boolean isVerifiedUser() {
return isVerifiedUser;
}
}

Loading…
Cancel
Save