use of com.waz.api.Credentials 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.api.Credentials in project wire-android by wireapp.
the class OTREmailSignInFragment method signIn.
private void signIn() {
getContainer().enableProgress(true);
KeyboardUtils.hideKeyboard(getActivity());
Credentials credentials = CredentialsFactory.emailCredentials(guidedEditTextEmail.getText(), guidedEditTextPassword.getText());
getStoreFactory().getZMessagingApiStore().getApi().login(credentials, new LoginListener() {
@Override
public void onSuccess(Self user) {
if (getContainer() == null) {
return;
}
getContainer().startMain();
}
@Override
public void onFailed(int code, String message, String label) {
if (getContainer() == null) {
return;
}
getContainer().enableProgress(false);
AppEntryUtil.showErrorDialog(OTREmailSignInFragment.this.getActivity(), AppEntryError.EMAIL_REGISTER_GENERIC_ERROR, new AppEntryUtil.ErrorDialogCallback() {
@Override
public void onOk() {
KeyboardUtils.showKeyboard(getActivity());
}
});
}
});
}
use of com.waz.api.Credentials 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);
}
}
});
}
Aggregations