Minor code fixes

This commit is contained in:
Balazs Toldi 2023-07-28 21:26:56 +02:00
parent d926fabe09
commit 2ed15f3d5c
No known key found for this signature in database
GPG Key ID: 6C7D440036F99D58
2 changed files with 3 additions and 6 deletions

View File

@ -64,7 +64,6 @@ import eu.toldi.infinityforlemmy.utils.Utils;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
public class InboxActivity extends BaseActivity implements ActivityToolbarInterface, RecyclerViewContentScrollingInterface {
@ -93,9 +92,6 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
@Named("base")
RetrofitHolder mRetrofit;
@Inject
@Named("oauth")
Retrofit mOauthRetrofit;
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@Inject
@ -307,7 +303,7 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf
} else if (item.getItemId() == R.id.action_read_all_messages_inbox_activity) {
if (mAccessToken != null) {
Toast.makeText(this, R.string.please_wait, Toast.LENGTH_SHORT).show();
mOauthRetrofit.create(RedditAPI.class).readAllMessages(APIUtils.getOAuthHeader(mAccessToken))
mRetrofit.getRetrofit().create(RedditAPI.class).readAllMessages(APIUtils.getOAuthHeader(mAccessToken))
.enqueue(new Callback<>() {
@Override
public void onResponse(@NonNull Call<String> call, @NonNull Response<String> response) {

View File

@ -209,6 +209,7 @@ public class LoginActivity extends BaseActivity {
try {
String errorBody = response.errorBody().string();
Log.e("LoginActivity", "Error body: " + errorBody.trim());
JSONObject responseObject = new JSONObject(errorBody.trim());
if (responseObject.has("error")) {
if (responseObject.getString("error").equals("incorrect_login")) {
@ -225,7 +226,7 @@ public class LoginActivity extends BaseActivity {
Toast.makeText(LoginActivity.this, R.string.cannot_fetch_user_info, Toast.LENGTH_SHORT).show();
}
Log.e("LoginActivity", "Failed to get access token: " + response.code() + " " + response.message() + " " + response.errorBody());
Log.e("LoginActivity", "Failed to get access token: " + response.code() + " " + response.message());
}