use of com.waz.zclient.core.controllers.tracking.events.registration.SucceededWithRegistrationEvent 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;
}
}
use of com.waz.zclient.core.controllers.tracking.events.registration.SucceededWithRegistrationEvent in project wire-android by wireapp.
the class AppEntryStore method acceptPhoneInvitation.
@Override
public void acceptPhoneInvitation(AccentColor accentColor) {
Credentials credentials = CredentialsFactory.phoneInvitationCredentials(invitationPhone, invitationToken);
zMessagingApi.register(credentials, invitationName, accentColor, new ZMessagingApi.RegistrationListener() {
@Override
public void onRegistered(Self self) {
bindSelf(self);
setState(AppEntryState.PHONE_SET_PICTURE);
appEntryStateCallback.onInvitationSuccess();
appEntryStateCallback.tagAppEntryEvent(new SucceededWithRegistrationEvent(RegistrationEventContext.PERSONAL_INVITE_PHONE));
}
@Override
public void onRegistrationFailed(int i, String s, String s1) {
Timber.e("Email invitation registration failed");
appEntryStateCallback.onInvitationFailed();
if (LayoutSpec.isPhone(context)) {
setState(AppEntryState.PHONE_REGISTER);
} else {
setState(AppEntryState.EMAIL_WELCOME);
}
}
});
}
use of com.waz.zclient.core.controllers.tracking.events.registration.SucceededWithRegistrationEvent in project wire-android by wireapp.
the class AppEntryStore method acceptEmailInvitation.
@Override
public void acceptEmailInvitation(String password, AccentColor accentColor) {
Credentials credentials = CredentialsFactory.emailInvitationCredentials(invitationEmail, password, invitationToken);
zMessagingApi.register(credentials, invitationName, accentColor, new ZMessagingApi.RegistrationListener() {
@Override
public void onRegistered(Self self) {
bindSelf(self);
setState(AppEntryState.EMAIL_SET_PICTURE);
appEntryStateCallback.onInvitationSuccess();
appEntryStateCallback.tagAppEntryEvent(new SucceededWithRegistrationEvent(RegistrationEventContext.PERSONAL_INVITE_EMAIL));
}
@Override
public void onRegistrationFailed(int code, String message, String label) {
Timber.e("Email invitation registration failed");
appEntryStateCallback.onInvitationFailed();
if (LayoutSpec.isPhone(context)) {
setState(AppEntryState.PHONE_REGISTER);
} else {
setState(AppEntryState.EMAIL_WELCOME);
}
}
});
}
use of com.waz.zclient.core.controllers.tracking.events.registration.SucceededWithRegistrationEvent 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);
}
}
Aggregations