Search in sources :

Example 1 with RequestUserTwoStepVerificationGetPasswordDetail

use of net.iGap.request.RequestUserTwoStepVerificationGetPasswordDetail in project iGap-Android by KianIranian-STDG.

the class FragmentSecurityViewModel method getInfo.

// ===============================================================================
// ====================================Methods====================================
// ===============================================================================
private void getInfo() {
    if (isFirstArrive) {
        prgWaiting.set(View.VISIBLE);
        new RequestUserTwoStepVerificationGetPasswordDetail().getPasswordDetail(new TwoStepVerificationGetPasswordDetail() {

            @Override
            public void getDetailPassword(String questionOne, String questionTwo, String hint, boolean hasConfirmedRecoveryEmail, String unconfirmedEmailPattern) {
                txtQuestionOne = questionOne;
                txtQuestionTwo = questionTwo;
                txtPatternEmail = unconfirmedEmailPattern;
                isConfirmedRecoveryEmail = hasConfirmedRecoveryEmail;
                mUnconfirmedEmailPattern = unconfirmedEmailPattern;
                G.handler.post(new Runnable() {

                    @Override
                    public void run() {
                        prgWaiting.set(View.GONE);
                        if (questionOne.length() > 0 && questionTwo.length() > 0) {
                            rootSetPassword.set(View.GONE);
                            rootSetAdditionPassword.set(View.GONE);
                            rootChangePassword.set(View.VISIBLE);
                            rootCheckPassword.set(View.VISIBLE);
                            rippleOkVisibility.setValue(View.VISIBLE);
                            edtCheckPasswordHint.set(hint);
                            isFirstSetPassword = false;
                            if (unconfirmedEmailPattern.length() == 0) {
                                setRecoveryEmail.set(View.VISIBLE);
                                setConfirmedEmail.set(View.GONE);
                                lineConfirmView.set(View.GONE);
                                FragmentSecurity.isSetRecoveryEmail = false;
                            } else {
                                setRecoveryEmail.set(View.VISIBLE);
                                viewRecoveryEmail.set(View.VISIBLE);
                                setConfirmedEmail.set(View.VISIBLE);
                                lineConfirmView.set(View.VISIBLE);
                                FragmentSecurity.isSetRecoveryEmail = true;
                            }
                        } else {
                            // دوبار اجرا شده
                            rootSetPassword.set(View.VISIBLE);
                            rootSetAdditionPassword.set(View.VISIBLE);
                            rootChangePassword.set(View.GONE);
                            rootCheckPassword.set(View.GONE);
                            rippleOkVisibility.setValue(View.GONE);
                            isFirstSetPassword = true;
                        }
                    }
                });
            }

            @Override
            public void errorGetPasswordDetail(int majorCode, int minorCode) {
                G.handler.post(new Runnable() {

                    @Override
                    public void run() {
                        if (majorCode == 188 && minorCode == 1) {
                            // USER DON'T SET A PASSWORD
                            setFirstView();
                        } else {
                            // G.fragmentActivity.getSupportFragmentManager().popBackStack();
                            if (FragmentSecurity.onPopBackStackFragment != null) {
                                FragmentSecurity.onPopBackStackFragment.onBack();
                            }
                        }
                    }
                });
            }
        });
    } else {
        if (!isFirstSetPassword) {
            setSecondView();
        } else {
            setFirstView();
        }
    }
    titleToolbar.setValue(G.fragmentActivity.getResources().getString(R.string.two_step_verification_title));
    rippleOkVisibility.setValue(View.GONE);
}
Also used : RequestUserTwoStepVerificationGetPasswordDetail(net.iGap.request.RequestUserTwoStepVerificationGetPasswordDetail) TwoStepVerificationGetPasswordDetail(net.iGap.observers.interfaces.TwoStepVerificationGetPasswordDetail) RequestUserTwoStepVerificationGetPasswordDetail(net.iGap.request.RequestUserTwoStepVerificationGetPasswordDetail) RequestUserTwoStepVerificationChangeHint(net.iGap.request.RequestUserTwoStepVerificationChangeHint)

Aggregations

TwoStepVerificationGetPasswordDetail (net.iGap.observers.interfaces.TwoStepVerificationGetPasswordDetail)1 RequestUserTwoStepVerificationChangeHint (net.iGap.request.RequestUserTwoStepVerificationChangeHint)1 RequestUserTwoStepVerificationGetPasswordDetail (net.iGap.request.RequestUserTwoStepVerificationGetPasswordDetail)1