mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 14:47:29 +00:00
Uncomment code, which was commented for testing
This commit is contained in:
parent
faee351a11
commit
4bb77abb33
@ -883,74 +883,71 @@ public final class ThreadManager {
|
||||
|
||||
public LiveData<Resource<Object>> acceptRequest() {
|
||||
final MutableLiveData<Resource<Object>> data = new MutableLiveData<>();
|
||||
final Call<String> request = service.approveRequest(threadId);
|
||||
request.enqueue(new Callback<String>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull final Call<String> call,
|
||||
@NonNull final Response<String> response) {
|
||||
if (!response.isSuccessful()) {
|
||||
try {
|
||||
final String string = response.errorBody() != null ? response.errorBody().string() : "";
|
||||
final String msg = String.format(Locale.US,
|
||||
"onResponse: url: %s, responseCode: %d, errorBody: %s",
|
||||
call.request().url().toString(),
|
||||
response.code(),
|
||||
string);
|
||||
Log.e(TAG, msg);
|
||||
data.postValue(Resource.error(msg, null));
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "onResponse: ", e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
data.postValue(Resource.success(new Object()));
|
||||
// final Call<String> request = service.approveRequest(threadId);
|
||||
// request.enqueue(new Callback<String>() {
|
||||
// @Override
|
||||
// public void onResponse(@NonNull final Call<String> call,
|
||||
// @NonNull final Response<String> response) {
|
||||
// if (!response.isSuccessful()) {
|
||||
// try {
|
||||
// final String string = response.errorBody() != null ? response.errorBody().string() : "";
|
||||
// final String msg = String.format(Locale.US,
|
||||
// "onResponse: url: %s, responseCode: %d, errorBody: %s",
|
||||
// call.request().url().toString(),
|
||||
// response.code(),
|
||||
// string);
|
||||
// Log.e(TAG, msg);
|
||||
// data.postValue(Resource.error(msg, null));
|
||||
// return;
|
||||
// } catch (IOException e) {
|
||||
// Log.e(TAG, "onResponse: ", e);
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
// data.postValue(Resource.success(new Object()));
|
||||
// // refreshChats();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFailure(@NonNull final Call<String> call, @NonNull final Throwable t) {
|
||||
// Log.e(TAG, "onFailure: ", t);
|
||||
// data.postValue(Resource.error(t.getMessage(), null));
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull final Call<String> call, @NonNull final Throwable t) {
|
||||
Log.e(TAG, "onFailure: ", t);
|
||||
data.postValue(Resource.error(t.getMessage(), null));
|
||||
}
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
public LiveData<Resource<Object>> declineRequest() {
|
||||
final MutableLiveData<Resource<Object>> data = new MutableLiveData<>();
|
||||
final Call<String> request = service.declineRequest(threadId);
|
||||
request.enqueue(new Callback<String>() {
|
||||
@Override
|
||||
public void onResponse(@NonNull final Call<String> call,
|
||||
@NonNull final Response<String> response) {
|
||||
if (!response.isSuccessful()) {
|
||||
try {
|
||||
final String string = response.errorBody() != null ? response.errorBody().string() : "";
|
||||
final String msg = String.format(Locale.US,
|
||||
"onResponse: url: %s, responseCode: %d, errorBody: %s",
|
||||
call.request().url().toString(),
|
||||
response.code(),
|
||||
string);
|
||||
Log.e(TAG, msg);
|
||||
data.postValue(Resource.error(msg, null));
|
||||
return;
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "onResponse: ", e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
data.postValue(Resource.success(new Object()));
|
||||
// final Call<String> request = service.declineRequest(threadId);
|
||||
// request.enqueue(new Callback<String>() {
|
||||
// @Override
|
||||
// public void onResponse(@NonNull final Call<String> call,
|
||||
// @NonNull final Response<String> response) {
|
||||
// if (!response.isSuccessful()) {
|
||||
// try {
|
||||
// final String string = response.errorBody() != null ? response.errorBody().string() : "";
|
||||
// final String msg = String.format(Locale.US,
|
||||
// "onResponse: url: %s, responseCode: %d, errorBody: %s",
|
||||
// call.request().url().toString(),
|
||||
// response.code(),
|
||||
// string);
|
||||
// Log.e(TAG, msg);
|
||||
// data.postValue(Resource.error(msg, null));
|
||||
// return;
|
||||
// } catch (IOException e) {
|
||||
// Log.e(TAG, "onResponse: ", e);
|
||||
// }
|
||||
// return;
|
||||
// }
|
||||
// data.postValue(Resource.success(new Object()));
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFailure(@NonNull final Call<String> call, @NonNull final Throwable t) {
|
||||
// Log.e(TAG, "onFailure: ", t);
|
||||
// data.postValue(Resource.error(t.getMessage(), null));
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NonNull final Call<String> call, @NonNull final Throwable t) {
|
||||
Log.e(TAG, "onFailure: ", t);
|
||||
data.postValue(Resource.error(t.getMessage(), null));
|
||||
}
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user