-Add listener to the class PatternRequestActivity to reuse the on success or fail password event

-Add listener to the class PinRequestActivity to reuse the on success or fail password event
This commit is contained in:
dtvv 2018-10-25 02:24:15 -05:00
parent 0bb428a658
commit 71c26c0ddf

View file

@ -16,6 +16,8 @@ import java.util.List;
import cy.agorise.crystalwallet.activities.PatternRequestActivity; import cy.agorise.crystalwallet.activities.PatternRequestActivity;
import cy.agorise.crystalwallet.activities.PinRequestActivity; import cy.agorise.crystalwallet.activities.PinRequestActivity;
import cy.agorise.crystalwallet.activities.PocketRequestActivity; import cy.agorise.crystalwallet.activities.PocketRequestActivity;
import cy.agorise.crystalwallet.fragments.PatternSecurityFragment;
import cy.agorise.crystalwallet.interfaces.OnResponse;
import cy.agorise.crystalwallet.models.GeneralSetting; import cy.agorise.crystalwallet.models.GeneralSetting;
import cy.agorise.crystalwallet.notifiers.CrystalWalletNotifier; import cy.agorise.crystalwallet.notifiers.CrystalWalletNotifier;
import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel; import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel;
@ -129,7 +131,7 @@ public class CrystalSecurityMonitor implements Application.ActivityLifecycleCall
public void onActivityStarted(Activity activity) { public void onActivityStarted(Activity activity) {
if (numStarted == 0) { if (numStarted == 0) {
if (!actualSecurity().equals("")){ if (!actualSecurity().equals("")){
callPasswordRequest(activity); callPasswordRequest(activity,null);
} }
} }
numStarted++; numStarted++;
@ -140,17 +142,33 @@ public class CrystalSecurityMonitor implements Application.ActivityLifecycleCall
numStarted--; numStarted--;
if (numStarted == 0) { if (numStarted == 0) {
if (!actualSecurity().equals("")){ if (!actualSecurity().equals("")){
callPasswordRequest(activity); callPasswordRequest(activity,null);
} }
} }
} }
public void callPasswordRequest(Activity activity){ public void callPasswordRequest(Activity activity, final OnResponse onResponsePattern){
if ((!activity.getIntent().hasExtra("ACTIVITY_TYPE")) || (!activity.getIntent().getStringExtra("ACTIVITY_TYPE").equals("PASSWORD_REQUEST"))) { if ((!activity.getIntent().hasExtra("ACTIVITY_TYPE")) || (!activity.getIntent().getStringExtra("ACTIVITY_TYPE").equals("PASSWORD_REQUEST"))) {
Intent intent = null; Intent intent = null;
if ((this.passwordEncrypted != null) && (!this.passwordEncrypted.equals(""))) { if ((this.passwordEncrypted != null) && (!this.passwordEncrypted.equals(""))) {
intent = new Intent(activity, PinRequestActivity.class); intent = new Intent(activity, PinRequestActivity.class);
/*
* Connect error and success listeners
* */
if(onResponsePattern != null){
PinRequestActivity.setOnResponse(onResponsePattern);
}
} else if ((this.patternEncrypted != null) && (!this.patternEncrypted.equals(""))) { } else if ((this.patternEncrypted != null) && (!this.patternEncrypted.equals(""))) {
/*
* Connect error and success listeners
* */
if(onResponsePattern != null){
PatternRequestActivity.setOnResponse(onResponsePattern);
}
intent = new Intent(activity, PatternRequestActivity.class); intent = new Intent(activity, PatternRequestActivity.class);
} }
if (intent != null) { if (intent != null) {