Commit a0a4dcac authored by Varun Patil's avatar Varun Patil

Refactor MainActivity to use EmptyCallback

parent bd840c83
......@@ -171,7 +171,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
private void fetchNotifications() {
RetrofitInterface retrofitInterface = getRetrofitInterface();
retrofitInterface.getNotifications(getSessionIDHeader()).enqueue(new Callback<List<Notification>>() {
retrofitInterface.getNotifications(getSessionIDHeader()).enqueue(new EmptyCallback<List<Notification>>() {
@Override
public void onResponse(Call<List<Notification>> call, Response<List<Notification>> response) {
if (response.isSuccessful()) {
......@@ -183,10 +183,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
}
}
}
@Override
public void onFailure(Call<List<Notification>> call, Throwable t) {
}
});
}
......@@ -347,7 +343,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
/** Open the event fragment from the provided id */
private void openEventFragment(String id) {
RetrofitInterface retrofitInterface = getRetrofitInterface();
retrofitInterface.getEvent(getSessionIDHeader(), id).enqueue(new Callback<Event>() {
retrofitInterface.getEvent(getSessionIDHeader(), id).enqueue(new EmptyCallback<Event>() {
@Override
public void onResponse(Call<Event> call, Response<Event> response) {
EventFragment eventFragment = new EventFragment();
......@@ -356,9 +352,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
eventFragment.setArguments(bundle);
updateFragment(eventFragment);
}
@Override
public void onFailure(Call<Event> call, Throwable t) {}
});
}
......@@ -408,7 +401,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
final String fcmId = instanceIdResult.getToken();
RetrofitInterface retrofitInterface = getRetrofitInterface();
retrofitInterface.patchUserMe(getSessionIDHeader(), new UserFCMPatchRequest(fcmId, getCurrentVersion())).enqueue(new Callback<User>() {
retrofitInterface.patchUserMe(getSessionIDHeader(), new UserFCMPatchRequest(fcmId, getCurrentVersion())).enqueue(new EmptyCallback<User>() {
@Override
public void onResponse(Call<User> call, Response<User> response) {
if (response.isSuccessful()) {
......@@ -420,9 +413,6 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
Toast.makeText(MainActivity.this, "Your session has expired!", Toast.LENGTH_LONG).show();
}
}
@Override
public void onFailure(Call<User> call, Throwable t) {}
});
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment