package org.mian.gitnex.helpers; import androidx.annotation.NonNull; import java.util.Optional; import org.mian.gitnex.fragments.NotificationsFragment; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; /** * @author opyale */ public interface SimpleCallback extends Callback { void onFinished(@NonNull Call call, @NonNull Optional> optionalResponse); default void onResponse(@NonNull Call call, @NonNull Response response) { onFinished(call, Optional.of(response)); } default void onFailure(@NonNull Call call, @NonNull Throwable throwable) { onFinished(call, Optional.empty()); NotificationsFragment.emptyErrorResponse = throwable.getMessage(); } }