I have problem with Retrofit and duplicate checking. I have to check every time response status code or type!
I need a wrapper for request method that check there this duplicate works. (duplicate works includes: showLoading(),response.code(),onFailure() handle...).
I need a GenericMethod for this:
UserService service = RetrofitInstance.getRetrofitInstance().create(UserService.class);
service.RequestVerification(token, mobileNumber).enqueue(new Callback<ClientData<User>>() {
@Override
public void onResponse(@NonNull Call<ClientData<User>> call, @NonNull Response<ClientData<User>> response) {
doAction();//Action must passed to this method.
GeneralTools.hideLoading();
}
@Override
public void onFailure(@NonNull Call<ClientData<User>> call, @NonNull Throwable t) {
GeneralTools.hideLoading();
dialogError.show();
}
});
Aucun commentaire:
Enregistrer un commentaire