use of com.waz.zclient.core.controllers.tracking.events.registration.ResentPhoneVerificationEvent in project wire-android by wireapp.
the class AppEntryStore method resendPhone.
@Override
public void resendPhone(final SuccessCallback successCallback, final ErrorCallback errorCallback) {
boolean isEntryPointPhoneSignIn = entryPoint == AppEntryState.PHONE_SIGN_IN;
final boolean isEntryPointPhoneRegister = entryPoint == AppEntryState.PHONE_REGISTER;
boolean isEntryPointEmailSignIn = entryPoint == AppEntryState.EMAIL_SIGN_IN;
if (isEntryPointPhoneSignIn) {
zMessagingApi.requestPhoneConfirmationCode(countryCode + phone, KindOfAccess.LOGIN, new ZMessagingApi.PhoneConfirmationCodeRequestListener() {
@Override
public void onConfirmationCodeSent(KindOfAccess kindOfAccess) {
appEntryStateCallback.tagAppEntryEvent(PhoneVerification.resent(PhoneVerification.Context.SIGN_IN));
successCallback.onSuccess();
}
@Override
public void onPasswordExists(KindOfAccess kindOfAccess) {
}
@Override
public void onConfirmationCodeSendingFailed(KindOfAccess kindOfAccess, int errorCode, String message, String label) {
if (AppEntryError.PHONE_PENDING_LOGIN.correspondsTo(errorCode, label)) {
errorCallback.onError(AppEntryError.PHONE_PENDING_LOGIN);
} else if (AppEntryError.PHONE_BUDGET_EXHAUSTED.correspondsTo(errorCode, label)) {
errorCallback.onError(AppEntryError.PHONE_BUDGET_EXHAUSTED);
} else {
errorCallback.onError(AppEntryError.PHONE_REGISTER_GENERIC_ERROR);
}
}
});
} else if (isEntryPointPhoneRegister || isEntryPointEmailSignIn) {
zMessagingApi.requestPhoneConfirmationCode(countryCode + phone, KindOfAccess.REGISTRATION, new ZMessagingApi.PhoneConfirmationCodeRequestListener() {
@Override
public void onConfirmationCodeSent(KindOfAccess kindOfAccess) {
if (isEntryPointPhoneRegister) {
appEntryStateCallback.tagAppEntryEvent(new ResentPhoneVerificationEvent(OutcomeAttribute.SUCCESS, "", getPhoneRegistrationContext()));
} else {
appEntryStateCallback.tagAppEntryEvent(PhoneVerification.resent(PhoneVerification.Context.POST_LOGIN));
}
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 ResentPhoneVerificationEvent(OutcomeAttribute.FAIL, String.valueOf(errorCode), registrationEventContext));
} else {
appEntryStateCallback.tagAppEntryEvent(PhoneVerification.codeRequestErrorSignIn());
}
if (AppEntryError.PHONE_BUDGET_EXHAUSTED.correspondsTo(errorCode, label)) {
errorCallback.onError(AppEntryError.PHONE_BUDGET_EXHAUSTED);
} else {
errorCallback.onError(AppEntryError.PHONE_REGISTER_GENERIC_ERROR);
}
}
});
}
}
Aggregations