Search in sources :

Example 1 with VerifiedEmailEvent

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

the class AppEntryStore method onSelfUpdated.

// Here we handle email verification click on a different device
private void onSelfUpdated() {
    if (otherOtrClients == null || otherOtrClients.size() == 0) {
        if (otherOtrClients != null) {
            otherOtrClients.removeUpdateListener(otrClientsUpdateListender);
        }
        otherOtrClients = self.getOtherOtrClients();
        otherOtrClients.addUpdateListener(otrClientsUpdateListender);
    }
    if (ignoreSelfUpdates || appEntryStateCallback == null) {
        return;
    }
    if (currentState == AppEntryState.PHONE_EMAIL_PASSWORD) {
        return;
    }
    if (entryPoint == AppEntryState.PHONE_SIGN_IN && self.accountActivated()) {
        appEntryStateCallback.tagAppEntryEvent(EmailVerification.success(EmailVerification.Context.POST_LOGIN));
        if (self.getPicture().isEmpty()) {
            setState(AppEntryState.PHONE_SET_PICTURE);
            return;
        }
        setState(AppEntryState.LOGGED_IN);
        return;
    }
    if (entryPoint == AppEntryState.EMAIL_REGISTER && self.accountActivated()) {
        if (currentState == AppEntryState.EMAIL_VERIFY_EMAIL) {
            // Check state so following registration events are triggered only once
            appEntryStateCallback.tagAppEntryEvent(new VerifiedEmailEvent(OutcomeAttribute.SUCCESS, "", getEmailRegistrationContext()));
            appEntryStateCallback.tagAppEntryEvent(new SucceededWithRegistrationEvent(getEmailRegistrationContext()));
        }
        if (self.getPicture().isEmpty()) {
            setState(AppEntryState.EMAIL_SET_PICTURE);
            return;
        }
        setState(AppEntryState.LOGGED_IN);
        return;
    }
}
Also used : SucceededWithRegistrationEvent(com.waz.zclient.core.controllers.tracking.events.registration.SucceededWithRegistrationEvent) VerifiedEmailEvent(com.waz.zclient.core.controllers.tracking.events.registration.VerifiedEmailEvent)

Example 2 with VerifiedEmailEvent

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

the class AppEntryStore method resumeAppEntry.

public void resumeAppEntry(Self self, String personalInvitationToken) {
    if (!bindSelf(self)) {
        return;
    }
    if (!TextUtils.isEmpty(personalInvitationToken)) {
        invitationToken = InvitationTokenFactory.personalTokenFromCode(personalInvitationToken);
        zMessagingApi.getInvitations().retrieveInvitationDetails(invitationToken, new Invitations.InvitationDetailsCallback() {

            @Override
            public void onEmailAdressRetrieved(String name, String email) {
                invitationName = name;
                invitationEmail = email;
                setState(AppEntryState.EMAIL_INVITATION);
            }

            @Override
            public void onPhoneNumberRetrieved(String name, String phone) {
                invitationName = name;
                invitationPhone = phone;
                setState(AppEntryState.PHONE_INVITATION);
            }

            @Override
            public void onRetrievalFailed(ErrorResponse errorResponse) {
                if (LayoutSpec.isPhone(context)) {
                    setState(AppEntryState.PHONE_REGISTER);
                } else {
                    setState(AppEntryState.EMAIL_WELCOME);
                }
            }
        });
        return;
    }
    // Resume phone registration
    if (entryPoint == AppEntryState.PHONE_REGISTER && self.isLoggedIn()) {
        if (self.getPicture().isEmpty()) {
            setState(AppEntryState.PHONE_SET_PICTURE);
            return;
        }
        setState(AppEntryState.LOGGED_IN);
        return;
    }
    //Resume at phone set name
    if (entryPoint == AppEntryState.PHONE_SET_NAME && self.isLoggedIn()) {
        setState(AppEntryState.PHONE_SET_NAME);
        return;
    }
    // Resume phone sign-in
    if (entryPoint == AppEntryState.PHONE_SIGN_IN && self.isLoggedIn()) {
        setState(AppEntryState.PHONE_SIGNED_IN_RESUMING);
        return;
    }
    // Resume email registration
    if (entryPoint == AppEntryState.EMAIL_REGISTER) {
        if (self.isLoggedIn() && !self.accountActivated()) {
            setState(AppEntryState.EMAIL_VERIFY_EMAIL);
            return;
        }
        if (self.accountActivated() && self.getPicture().isEmpty()) {
            setState(AppEntryState.EMAIL_SET_PICTURE);
            return;
        }
        if (self.accountActivated()) {
            appEntryStateCallback.tagAppEntryEvent(new VerifiedEmailEvent(OutcomeAttribute.SUCCESS, "", getEmailRegistrationContext()));
            appEntryStateCallback.tagAppEntryEvent(new SucceededWithRegistrationEvent(getEmailRegistrationContext()));
            setState(AppEntryState.LOGGED_IN);
            return;
        }
    }
    // Resume email sign-in
    if (entryPoint == AppEntryState.EMAIL_SIGN_IN && self.isLoggedIn()) {
        setState(AppEntryState.EMAIL_SIGNED_IN);
        return;
    }
    // Start registration
    if (LayoutSpec.isPhone(context)) {
        setState(AppEntryState.PHONE_REGISTER);
    } else {
        setState(AppEntryState.EMAIL_WELCOME);
    }
}
Also used : Invitations(com.waz.api.Invitations) SucceededWithRegistrationEvent(com.waz.zclient.core.controllers.tracking.events.registration.SucceededWithRegistrationEvent) VerifiedEmailEvent(com.waz.zclient.core.controllers.tracking.events.registration.VerifiedEmailEvent) ErrorResponse(com.waz.api.ErrorResponse)

Aggregations

SucceededWithRegistrationEvent (com.waz.zclient.core.controllers.tracking.events.registration.SucceededWithRegistrationEvent)2 VerifiedEmailEvent (com.waz.zclient.core.controllers.tracking.events.registration.VerifiedEmailEvent)2 ErrorResponse (com.waz.api.ErrorResponse)1 Invitations (com.waz.api.Invitations)1