use of org.eyeseetea.malariacare.domain.usecase.LogoutUseCase in project pictureapp by EyeSeeTea.
the class LoginActivityStrategy method checkCredentials.
@Override
public void checkCredentials(Credentials credentials, final Callback callback) {
ICredentialsRepository credentialsLocalDataSource = new CredentialsLocalDataSource();
Credentials savedCredentials = credentialsLocalDataSource.getOrganisationCredentials();
if (savedCredentials == null || savedCredentials.isEmpty() || savedCredentials.getUsername().equals(credentials.getUsername()) && (!savedCredentials.getPassword().equals(credentials.getPassword()) || !savedCredentials.getServerURL().equals(credentials.getServerURL()))) {
callback.onSuccessDoLogin();
} else if (savedCredentials.getUsername().equals(credentials.getUsername()) && savedCredentials.getPassword().equals(credentials.getPassword()) && savedCredentials.getServerURL().equals(credentials.getServerURL())) {
callback.onSuccess();
} else {
IAuthenticationManager iAuthenticationManager = new AuthenticationManager(loginActivity);
LogoutUseCase logoutUseCase = new LogoutUseCase(iAuthenticationManager);
AlarmPushReceiver.cancelPushAlarm(loginActivity);
logoutUseCase.execute(new LogoutUseCase.Callback() {
@Override
public void onLogoutSuccess() {
callback.onSuccessDoLogin();
}
@Override
public void onLogoutError(String message) {
callback.onError();
}
});
}
}
use of org.eyeseetea.malariacare.domain.usecase.LogoutUseCase in project pictureapp by EyeSeeTea.
the class BaseActivityStrategy method onCreate.
@Override
public void onCreate() {
mAuthenticationManager = new AuthenticationManager(mBaseActivity);
mLogoutUseCase = new LogoutUseCase(mAuthenticationManager);
}
Aggregations