use of in.ac.iitb.gymkhana.iitbapp.api.model.LoginResponse in project IITB-App by wncc.
the class LoginActivity method login.
private void login(String authorizationCode, final String redirectURI, String gcmID) {
RetrofitInterface retrofitInterface = ServiceGenerator.createService(RetrofitInterface.class);
retrofitInterface.login(authorizationCode, redirectURI, gcmID).enqueue(new Callback<LoginResponse>() {
@Override
public void onResponse(Call<LoginResponse> call, Response<LoginResponse> response) {
if (response.isSuccessful()) {
Log.d(TAG, "Login request successful");
session.createLoginSession(redirectURI, response.body().getUser(), response.body().getSessionID());
Intent i = new Intent(mContext, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
// Save credentials in AccountManager to keep user logged in
// Go to MainActivity
}
// Server error
}
@Override
public void onFailure(Call<LoginResponse> call, Throwable t) {
// Network Error
}
});
}
Aggregations