use of cl.smartcities.isci.transportinspector.gamification.socialAccount.SocialAccountLoader in project androidApp by InspectorIncognito.
the class SocialAccountLoaderManager method loadAccount.
public void loadAccount(final LoaderInterface loaderInterface) {
String accountType = preferences.getString(accountTypeKey, accountTypeKeyNull);
CredentialsListener listener = new CredentialsListener() {
@Override
public void onSuccess(SocialMediaAccount account) {
String nickname = TranSappApplication.getAppSharedPreferences().getString(SAVED_NICKNAME, "");
loaderInterface.onLoad(account, nickname);
}
@Override
public void onError(ServerStatusCode error) {
loaderInterface.onError();
}
};
switch(accountType) {
case SocialMediaAccount.FACEBOOK_ACCOUNT:
SocialAccountLoader facebookAccountLoader = new FacebookAccountLoader();
facebookAccountLoader.load(listener);
break;
case SocialMediaAccount.GOOGLE_ACCOUNT:
SocialAccountLoader googleAccountLoader = new GoogleAccountLoader();
googleAccountLoader.load(listener);
break;
default:
loaderInterface.onError();
}
}
Aggregations