Search in sources :

Example 1 with RequestedPhoneVerificationCallEvent

use of com.waz.zclient.core.controllers.tracking.events.registration.RequestedPhoneVerificationCallEvent in project wire-android by wireapp.

the class AppEntryStore method triggerVerificationCodeCallToUser.

@Override
public void triggerVerificationCodeCallToUser(final SuccessCallback successCallback, final ErrorCallback errorCallback) {
    final boolean isEntryPointPhoneRegister = entryPoint == AppEntryState.PHONE_REGISTER;
    boolean isEntryPointPhoneSignIn = entryPoint == AppEntryState.PHONE_SIGN_IN;
    KindOfAccess kindOfAccess = KindOfAccess.REGISTRATION;
    if (isEntryPointPhoneSignIn) {
        kindOfAccess = KindOfAccess.LOGIN;
    }
    zMessagingApi.requestPhoneConfirmationCall(countryCode + phone, kindOfAccess, new ZMessagingApi.PhoneConfirmationCodeRequestListener() {

        @Override
        public void onConfirmationCodeSent(KindOfAccess kindOfAccess) {
            if (isEntryPointPhoneRegister) {
                appEntryStateCallback.tagAppEntryEvent(new RequestedPhoneVerificationCallEvent(OutcomeAttribute.SUCCESS, "", getPhoneRegistrationContext()));
            }
            successCallback.onSuccess();
        }

        @Override
        public void onPasswordExists(KindOfAccess kindOfAccess) {
        }

        @Override
        public void onConfirmationCodeSendingFailed(KindOfAccess kindOfAccess, int errorCode, String message, String label) {
            if (isEntryPointPhoneRegister) {
                appEntryStateCallback.tagAppEntryEvent(new RequestedPhoneVerificationCallEvent(OutcomeAttribute.FAIL, "", getPhoneRegistrationContext()));
            }
            if (AppEntryError.PHONE_BUDGET_EXHAUSTED.correspondsTo(errorCode, label)) {
                errorCallback.onError(AppEntryError.PHONE_BUDGET_EXHAUSTED);
            } else {
                errorCallback.onError(AppEntryError.PHONE_REGISTER_GENERIC_ERROR);
            }
        }
    });
}
Also used : ZMessagingApi(com.waz.api.ZMessagingApi) KindOfAccess(com.waz.api.KindOfAccess) RequestedPhoneVerificationCallEvent(com.waz.zclient.core.controllers.tracking.events.registration.RequestedPhoneVerificationCallEvent)

Aggregations

KindOfAccess (com.waz.api.KindOfAccess)1 ZMessagingApi (com.waz.api.ZMessagingApi)1 RequestedPhoneVerificationCallEvent (com.waz.zclient.core.controllers.tracking.events.registration.RequestedPhoneVerificationCallEvent)1