1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 22:57:29 +00:00

Uncomment code, which was commented for testing

This commit is contained in:
Ammar Githam 2021-03-15 22:53:28 +09:00
parent faee351a11
commit 4bb77abb33

View File

@ -883,74 +883,71 @@ public final class ThreadManager {
public LiveData<Resource<Object>> acceptRequest() { public LiveData<Resource<Object>> acceptRequest() {
final MutableLiveData<Resource<Object>> data = new MutableLiveData<>(); final MutableLiveData<Resource<Object>> data = new MutableLiveData<>();
data.postValue(Resource.success(new Object())); final Call<String> request = service.approveRequest(threadId);
// final Call<String> request = service.approveRequest(threadId); request.enqueue(new Callback<String>() {
// request.enqueue(new Callback<String>() { @Override
// @Override public void onResponse(@NonNull final Call<String> call,
// public void onResponse(@NonNull final Call<String> call, @NonNull final Response<String> response) {
// @NonNull final Response<String> response) { if (!response.isSuccessful()) {
// if (!response.isSuccessful()) { try {
// try { final String string = response.errorBody() != null ? response.errorBody().string() : "";
// final String string = response.errorBody() != null ? response.errorBody().string() : ""; final String msg = String.format(Locale.US,
// final String msg = String.format(Locale.US, "onResponse: url: %s, responseCode: %d, errorBody: %s",
// "onResponse: url: %s, responseCode: %d, errorBody: %s", call.request().url().toString(),
// call.request().url().toString(), response.code(),
// response.code(), string);
// string); Log.e(TAG, msg);
// Log.e(TAG, msg); data.postValue(Resource.error(msg, null));
// data.postValue(Resource.error(msg, null)); return;
// return; } catch (IOException e) {
// } catch (IOException e) { Log.e(TAG, "onResponse: ", e);
// Log.e(TAG, "onResponse: ", e); }
// } return;
// return; }
// } data.postValue(Resource.success(new Object()));
// data.postValue(Resource.success(new Object())); }
// // refreshChats();
// } @Override
// public void onFailure(@NonNull final Call<String> call, @NonNull final Throwable t) {
// @Override Log.e(TAG, "onFailure: ", t);
// public void onFailure(@NonNull final Call<String> call, @NonNull final Throwable t) { data.postValue(Resource.error(t.getMessage(), null));
// Log.e(TAG, "onFailure: ", t); }
// data.postValue(Resource.error(t.getMessage(), null)); });
// }
// });
return data; return data;
} }
public LiveData<Resource<Object>> declineRequest() { public LiveData<Resource<Object>> declineRequest() {
final MutableLiveData<Resource<Object>> data = new MutableLiveData<>(); final MutableLiveData<Resource<Object>> data = new MutableLiveData<>();
data.postValue(Resource.success(new Object())); final Call<String> request = service.declineRequest(threadId);
// final Call<String> request = service.declineRequest(threadId); request.enqueue(new Callback<String>() {
// request.enqueue(new Callback<String>() { @Override
// @Override public void onResponse(@NonNull final Call<String> call,
// public void onResponse(@NonNull final Call<String> call, @NonNull final Response<String> response) {
// @NonNull final Response<String> response) { if (!response.isSuccessful()) {
// if (!response.isSuccessful()) { try {
// try { final String string = response.errorBody() != null ? response.errorBody().string() : "";
// final String string = response.errorBody() != null ? response.errorBody().string() : ""; final String msg = String.format(Locale.US,
// final String msg = String.format(Locale.US, "onResponse: url: %s, responseCode: %d, errorBody: %s",
// "onResponse: url: %s, responseCode: %d, errorBody: %s", call.request().url().toString(),
// call.request().url().toString(), response.code(),
// response.code(), string);
// string); Log.e(TAG, msg);
// Log.e(TAG, msg); data.postValue(Resource.error(msg, null));
// data.postValue(Resource.error(msg, null)); return;
// return; } catch (IOException e) {
// } catch (IOException e) { Log.e(TAG, "onResponse: ", e);
// Log.e(TAG, "onResponse: ", e); }
// } return;
// return; }
// } data.postValue(Resource.success(new Object()));
// data.postValue(Resource.success(new Object())); }
// }
// @Override
// @Override public void onFailure(@NonNull final Call<String> call, @NonNull final Throwable t) {
// public void onFailure(@NonNull final Call<String> call, @NonNull final Throwable t) { Log.e(TAG, "onFailure: ", t);
// Log.e(TAG, "onFailure: ", t); data.postValue(Resource.error(t.getMessage(), null));
// data.postValue(Resource.error(t.getMessage(), null)); }
// } });
// });
return data; return data;
} }