Delete all logs.

This commit is contained in:
Alex Ning 2019-09-04 16:53:34 +08:00
parent ad497aa504
commit 8be2a9ae18
21 changed files with 13 additions and 104 deletions

View File

@ -1,7 +1,5 @@
package ml.docilealligator.infinityforreddit; package ml.docilealligator.infinityforreddit;
import android.util.Log;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -73,7 +71,6 @@ class AccessTokenAuthenticator implements Authenticator {
String newAccessToken = jsonObject.getString(RedditUtils.ACCESS_TOKEN_KEY); String newAccessToken = jsonObject.getString(RedditUtils.ACCESS_TOKEN_KEY);
mRedditDataRoomDatabase.accountDao().changeAccessToken(account.getUsername(), newAccessToken); mRedditDataRoomDatabase.accountDao().changeAccessToken(account.getUsername(), newAccessToken);
Log.i("access token", newAccessToken);
return newAccessToken; return newAccessToken;
} }
return ""; return "";

View File

@ -88,19 +88,16 @@ public class CommentDataSource extends PageKeyedDataSource<String, CommentData>
@Override @Override
public void parseFailed() { public void parseFailed() {
Log.i("Comments fetch error", "Error parsing data");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data")); initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
} }
}).execute(); }).execute();
} else { } else {
Log.i("Comments fetch error", "Error parsing data");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data")); initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
} }
} }
@Override @Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
Log.i("Comments fetch error", "Error parsing data");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data")); initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
} }
}); });
@ -137,19 +134,16 @@ public class CommentDataSource extends PageKeyedDataSource<String, CommentData>
@Override @Override
public void parseFailed() { public void parseFailed() {
Log.i("Comments fetch error", "Error parsing data");
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data")); paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
} }
}).execute(); }).execute();
} else { } else {
Log.i("Comments fetch error", "Error fetching data");
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error fetching data")); paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error fetching data"));
} }
} }
@Override @Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
Log.i("Comments fetch error", "Error fetchin data");
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error fetching data")); paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error fetching data"));
} }
}); });

View File

@ -1,7 +1,5 @@
package ml.docilealligator.infinityforreddit; package ml.docilealligator.infinityforreddit;
import android.util.Log;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.ArrayList; import java.util.ArrayList;
@ -47,19 +45,16 @@ class FetchComment {
@Override @Override
public void onParseCommentFailed() { public void onParseCommentFailed() {
Log.i("parse failed", "parse failed");
fetchCommentListener.onFetchCommentFailed(); fetchCommentListener.onFetchCommentFailed();
} }
}); });
} else { } else {
Log.i("call failed", response.message());
fetchCommentListener.onFetchCommentFailed(); fetchCommentListener.onFetchCommentFailed();
} }
} }
@Override @Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
Log.i("call failed", t.getMessage());
fetchCommentListener.onFetchCommentFailed(); fetchCommentListener.onFetchCommentFailed();
} }
}); });
@ -100,18 +95,15 @@ class FetchComment {
@Override @Override
public void onParseCommentFailed() { public void onParseCommentFailed() {
fetchMoreCommentListener.onFetchMoreCommentFailed(); fetchMoreCommentListener.onFetchMoreCommentFailed();
Log.i("comment parse failed", "comment parse failed");
} }
}); });
} else { } else {
Log.i("more comment failed", response.message());
fetchMoreCommentListener.onFetchMoreCommentFailed(); fetchMoreCommentListener.onFetchMoreCommentFailed();
} }
} }
@Override @Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
Log.i("more comment failed", t.getMessage());
fetchMoreCommentListener.onFetchMoreCommentFailed(); fetchMoreCommentListener.onFetchMoreCommentFailed();
} }
}); });

View File

@ -26,14 +26,12 @@ class FetchMyInfo {
if(response.isSuccessful()) { if(response.isSuccessful()) {
fetchUserMyListener.onFetchMyInfoSuccess(response.body()); fetchUserMyListener.onFetchMyInfoSuccess(response.body());
} else { } else {
Log.i("call failed", response.message());
fetchUserMyListener.onFetchMyInfoFail(); fetchUserMyListener.onFetchMyInfoFail();
} }
} }
@Override @Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
Log.i("call failed", t.getMessage());
fetchUserMyListener.onFetchMyInfoFail(); fetchUserMyListener.onFetchMyInfoFail();
} }
}); });

View File

@ -1,7 +1,5 @@
package ml.docilealligator.infinityforreddit; package ml.docilealligator.infinityforreddit;
import android.util.Log;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.Locale; import java.util.Locale;
@ -37,19 +35,16 @@ class FetchPost {
@Override @Override
public void onParsePostFail() { public void onParsePostFail() {
fetchPostListener.fetchPostFailed(); fetchPostListener.fetchPostFailed();
Log.i("error", "fetch post failed");
} }
}); });
} else { } else {
fetchPostListener.fetchPostFailed(); fetchPostListener.fetchPostFailed();
Log.i("call failed", Integer.toString(response.code()));
} }
} }
@Override @Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
fetchPostListener.fetchPostFailed(); fetchPostListener.fetchPostFailed();
Log.i("call failed", t.getMessage());
} }
}); });
} }

View File

@ -39,19 +39,16 @@ class FetchSubredditData {
@Override @Override
public void onParseSubredditDataFail() { public void onParseSubredditDataFail() {
Log.i("parse failed", "true");
fetchSubredditDataListener.onFetchSubredditDataFail(); fetchSubredditDataListener.onFetchSubredditDataFail();
} }
}); });
} else { } else {
Log.i("call failed", response.message());
fetchSubredditDataListener.onFetchSubredditDataFail(); fetchSubredditDataListener.onFetchSubredditDataFail();
} }
} }
@Override @Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
Log.i("call failed", "message " + t.getMessage());
fetchSubredditDataListener.onFetchSubredditDataFail(); fetchSubredditDataListener.onFetchSubredditDataFail();
} }
}); });
@ -74,19 +71,16 @@ class FetchSubredditData {
@Override @Override
public void onParseSubredditListingDataFail() { public void onParseSubredditListingDataFail() {
Log.i("parse failed", "true");
fetchSubredditListingDataListener.onFetchSubredditListingDataFail(); fetchSubredditListingDataListener.onFetchSubredditListingDataFail();
} }
}); });
} else { } else {
Log.i("call failed", response.message());
fetchSubredditListingDataListener.onFetchSubredditListingDataFail(); fetchSubredditListingDataListener.onFetchSubredditListingDataFail();
} }
} }
@Override @Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
Log.i("call failed", "message " + t.getMessage());
fetchSubredditListingDataListener.onFetchSubredditListingDataFail(); fetchSubredditListingDataListener.onFetchSubredditListingDataFail();
} }
}); });

View File

@ -59,14 +59,12 @@ class FetchSubscribedThing {
} }
}); });
} else { } else {
Log.i("call failed", response.message());
fetchSubscribedThingListener.onFetchSubscribedThingFail(); fetchSubscribedThingListener.onFetchSubscribedThingFail();
} }
} }
@Override @Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
Log.i("call failed", t.getMessage());
fetchSubscribedThingListener.onFetchSubscribedThingFail(); fetchSubscribedThingListener.onFetchSubscribedThingFail();
} }
}); });

View File

@ -42,14 +42,12 @@ public class FetchUserData {
} }
}); });
} else { } else {
Log.i("call failed", response.message());
fetchUserDataListener.onFetchUserDataFailed(); fetchUserDataListener.onFetchUserDataFailed();
} }
} }
@Override @Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
Log.i("call failed", "message " + t.getMessage());
fetchUserDataListener.onFetchUserDataFailed(); fetchUserDataListener.onFetchUserDataFailed();
} }
}); });
@ -76,14 +74,12 @@ public class FetchUserData {
} }
}); });
} else { } else {
Log.i("call failed", response.message());
fetchUserListingDataListener.onFetchUserListingDataFailed(); fetchUserListingDataListener.onFetchUserListingDataFailed();
} }
} }
@Override @Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
Log.i("call failed", "message " + t.getMessage());
fetchUserListingDataListener.onFetchUserListingDataFailed(); fetchUserListingDataListener.onFetchUserListingDataFailed();
} }
}); });

View File

@ -74,7 +74,6 @@ class MessageDataSource extends PageKeyedDataSource<String, Message> {
@Override @Override
public void fetchFailed() { public void fetchFailed() {
Log.i("Messages fetch error", "Error fetch messages");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error fetch messages")); initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error fetch messages"));
} }
}); });
@ -106,7 +105,6 @@ class MessageDataSource extends PageKeyedDataSource<String, Message> {
@Override @Override
public void fetchFailed() { public void fetchFailed() {
Log.i("Comments fetch error", "Error parsing data");
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error fetching data")); paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error fetching data"));
} }
}); });

View File

@ -2,7 +2,6 @@ package ml.docilealligator.infinityforreddit;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.text.Html; import android.text.Html;
import android.util.Log;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
@ -37,7 +36,6 @@ class ParseAndSaveAccountInfo {
this.parseAndSaveAccountInfoListener = parseAndSaveAccountInfoListener; this.parseAndSaveAccountInfoListener = parseAndSaveAccountInfoListener;
parseFailed = false; parseFailed = false;
} catch (JSONException e) { } catch (JSONException e) {
Log.i("user info json error", "message: " + e.getMessage());
parseAndSaveAccountInfoListener.onParseMyInfoFail(); parseAndSaveAccountInfoListener.onParseMyInfoFail();
} }
} }
@ -57,7 +55,6 @@ class ParseAndSaveAccountInfo {
redditDataRoomDatabase.accountDao().updateAccountInfo(name, profileImageUrl, bannerImageUrl, karma); redditDataRoomDatabase.accountDao().updateAccountInfo(name, profileImageUrl, bannerImageUrl, karma);
} catch (JSONException e) { } catch (JSONException e) {
parseFailed = true; parseFailed = true;
Log.i("parse comment error", "message: " + e.getMessage());
} }
return null; return null;
} }

View File

@ -38,9 +38,6 @@ class ParseComment {
new ParseCommentAsyncTask(childrenArray, commentData, locale, parentId, 0, parseCommentListener).execute(); new ParseCommentAsyncTask(childrenArray, commentData, locale, parentId, 0, parseCommentListener).execute();
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
if(e.getMessage() != null) {
Log.i("comment json error", e.getMessage());
}
parseCommentListener.onParseCommentFailed(); parseCommentListener.onParseCommentFailed();
} }
} }

View File

@ -2,7 +2,6 @@ package ml.docilealligator.infinityforreddit;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.text.Html; import android.text.Html;
import android.util.Log;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
@ -100,7 +99,7 @@ class ParsePost {
JSONObject data = allData.getJSONObject(0).getJSONObject(JSONUtils.DATA_KEY); JSONObject data = allData.getJSONObject(0).getJSONObject(JSONUtils.DATA_KEY);
post = parseBasicData(data, locale); post = parseBasicData(data, locale);
} catch (JSONException e) { } catch (JSONException e) {
Log.e("parsing post error", "message: " + e.getMessage()); e.printStackTrace();
parseFailed = true; parseFailed = true;
} }
} else { } else {
@ -128,7 +127,7 @@ class ParsePost {
} }
} }
} catch (JSONException e) { } catch (JSONException e) {
Log.e("parsing post error", "message: " + e.getMessage()); e.printStackTrace();
} }
} }
} }

View File

@ -1,7 +1,6 @@
package ml.docilealligator.infinityforreddit; package ml.docilealligator.infinityforreddit;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.util.Log;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
@ -43,7 +42,7 @@ class ParseSubredditData {
jsonResponse = new JSONObject(response); jsonResponse = new JSONObject(response);
parseFailed = false; parseFailed = false;
} catch (JSONException e) { } catch (JSONException e) {
Log.i("subreddit json error", "message: " + e.getMessage()); e.printStackTrace();
parseSubredditDataListener.onParseSubredditDataFail(); parseSubredditDataListener.onParseSubredditDataFail();
} }
} }
@ -56,7 +55,7 @@ class ParseSubredditData {
subredditData = parseSubredditData(data); subredditData = parseSubredditData(data);
} catch (JSONException e) { } catch (JSONException e) {
parseFailed = true; parseFailed = true;
Log.i("parse", "SubredditData error"); e.printStackTrace();
} }
return null; return null;
} }
@ -85,7 +84,7 @@ class ParseSubredditData {
parseFailed = false; parseFailed = false;
subredditListingData = new ArrayList<>(); subredditListingData = new ArrayList<>();
} catch (JSONException e) { } catch (JSONException e) {
Log.i("subreddit json error", "message: " + e.getMessage()); e.printStackTrace();
parseFailed = true; parseFailed = true;
} }
} }
@ -104,8 +103,8 @@ class ParseSubredditData {
after = jsonResponse.getJSONObject(JSONUtils.DATA_KEY).getString(JSONUtils.AFTER_KEY); after = jsonResponse.getJSONObject(JSONUtils.DATA_KEY).getString(JSONUtils.AFTER_KEY);
} }
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace();
parseFailed = true; parseFailed = true;
Log.i("parse", "SubredditDataListing error");
parseSubredditListingDataListener.onParseSubredditListingDataFail(); parseSubredditListingDataListener.onParseSubredditListingDataFail();
} }
return null; return null;

View File

@ -1,7 +1,6 @@
package ml.docilealligator.infinityforreddit; package ml.docilealligator.infinityforreddit;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.util.Log;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
@ -60,7 +59,7 @@ class ParseSubscribedThing {
newSubredditData = new ArrayList<>(); newSubredditData = new ArrayList<>();
this.parseSubscribedSubredditsListener = parseSubscribedSubredditsListener; this.parseSubscribedSubredditsListener = parseSubscribedSubredditsListener;
} catch (JSONException e) { } catch (JSONException e) {
Log.i("user info json error", e.getMessage()); e.printStackTrace();
parseSubscribedSubredditsListener.onParseSubscribedSubredditsFail(); parseSubscribedSubredditsListener.onParseSubscribedSubredditsFail();
} }
} }
@ -109,7 +108,7 @@ class ParseSubscribedThing {
lastItem = jsonResponse.getJSONObject(JSONUtils.DATA_KEY).getString(JSONUtils.AFTER_KEY); lastItem = jsonResponse.getJSONObject(JSONUtils.DATA_KEY).getString(JSONUtils.AFTER_KEY);
} catch (JSONException e) { } catch (JSONException e) {
parseFailed = true; parseFailed = true;
Log.i("parse subscribed error", e.getMessage()); e.printStackTrace();
} }
return null; return null;
} }

View File

@ -1,7 +1,6 @@
package ml.docilealligator.infinityforreddit; package ml.docilealligator.infinityforreddit;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.util.Log;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
@ -43,7 +42,7 @@ public class ParseUserData {
this.parseUserDataListener = parseUserDataListener; this.parseUserDataListener = parseUserDataListener;
parseFailed = false; parseFailed = false;
} catch (JSONException e) { } catch (JSONException e) {
Log.i("userdata json error", "error: " + e.getMessage()); e.printStackTrace();
parseUserDataListener.onParseUserDataFailed(); parseUserDataListener.onParseUserDataFailed();
} }
} }
@ -54,7 +53,7 @@ public class ParseUserData {
userData = parseUserDataBase(jsonResponse); userData = parseUserDataBase(jsonResponse);
} catch (JSONException e) { } catch (JSONException e) {
parseFailed = true; parseFailed = true;
Log.i("parse user data error", "error: " + e.getMessage()); e.printStackTrace();
} }
return null; return null;
} }
@ -86,7 +85,7 @@ public class ParseUserData {
parseFailed = false; parseFailed = false;
userDataArrayList = new ArrayList<>(); userDataArrayList = new ArrayList<>();
} catch (JSONException e) { } catch (JSONException e) {
Log.i("userdata json error", "error: " + e.getMessage()); e.printStackTrace();
parseFailed = true; parseFailed = true;
} }
} }
@ -103,7 +102,7 @@ public class ParseUserData {
} }
} catch (JSONException e) { } catch (JSONException e) {
parseFailed = true; parseFailed = true;
Log.i("parse user data error", "error: " + e.getMessage()); e.printStackTrace();
} }
return null; return null;
} }

View File

@ -201,7 +201,6 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override @Override
public void onParsePostFail() { public void onParsePostFail() {
Log.i("Post fetch error", "Error parsing data");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data")); initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
} }
}); });
@ -232,13 +231,11 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override @Override
public void onParsePostsListingFail() { public void onParsePostsListingFail() {
Log.i("Post fetch error", "Error parsing data");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data")); initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
} }
}); });
} }
} else { } else {
Log.i("Post fetch error", response.message());
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message())); initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message()));
} }
} }
@ -275,12 +272,10 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override @Override
public void onParsePostsListingFail() { public void onParsePostsListingFail() {
Log.i("Best post", "Error parsing data");
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data")); paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
} }
}); });
} else { } else {
Log.i("best post", response.message());
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message())); paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message()));
} }
} }
@ -319,7 +314,6 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override @Override
public void onParsePostFail() { public void onParsePostFail() {
Log.i("Post fetch error", "Error parsing data");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data")); initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
} }
}); });
@ -350,13 +344,11 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override @Override
public void onParsePostsListingFail() { public void onParsePostsListingFail() {
Log.i("Post fetch error", "Error parsing data");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data")); initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
} }
}); });
} }
} else { } else {
Log.i("Post fetch error", response.message());
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message())); initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message()));
} }
} }
@ -399,12 +391,10 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override @Override
public void onParsePostsListingFail() { public void onParsePostsListingFail() {
Log.i("Best post", "Error parsing data");
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data")); paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
} }
}); });
} else { } else {
Log.i("Best post", response.message());
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message())); paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message()));
} }
} }
@ -457,12 +447,10 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override @Override
public void onParsePostsListingFail() { public void onParsePostsListingFail() {
Log.i("Post fetch error", "Error parsing data");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data")); initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
} }
}); });
} else { } else {
Log.i("Post fetch error", response.message());
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message())); initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message()));
} }
} }
@ -505,12 +493,10 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override @Override
public void onParsePostsListingFail() { public void onParsePostsListingFail() {
Log.i("User posts", "Error parsing data");
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data")); paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
} }
}); });
} else { } else {
Log.i("User posts", response.message());
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message())); paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message()));
} }
} }
@ -572,12 +558,10 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override @Override
public void onParsePostsListingFail() { public void onParsePostsListingFail() {
Log.i("Post fetch error", "Error parsing data");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data")); initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
} }
}); });
} else { } else {
Log.i("Post fetch error", response.message());
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message())); initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message()));
} }
} }
@ -629,12 +613,10 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override @Override
public void onParsePostsListingFail() { public void onParsePostsListingFail() {
Log.i("Search post", "Error parsing data");
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data")); paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
} }
}); });
} else { } else {
Log.i("Search post", response.message());
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message())); paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message()));
} }
} }

View File

@ -5,7 +5,6 @@ import android.content.Intent;
import android.graphics.ColorFilter; import android.graphics.ColorFilter;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -132,9 +131,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder, int position) { public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder, int position) {
if(holder instanceof DataViewHolder) { if(holder instanceof DataViewHolder) {
Post post = getItem(position); Post post = getItem(position);
if(post == null) { if(post != null) {
Log.i("is null", Integer.toString(holder.getAdapterPosition()));
} else {
final String id = post.getFullName(); final String id = post.getFullName();
final String subredditNamePrefixed = post.getSubredditNamePrefixed(); final String subredditNamePrefixed = post.getSubredditNamePrefixed();
String subredditName = subredditNamePrefixed.substring(2); String subredditName = subredditNamePrefixed.substring(2);

View File

@ -4,7 +4,6 @@ import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.util.Log;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
@ -54,10 +53,7 @@ public class PullNotificationWorker extends Worker {
@NonNull @NonNull
@Override @Override
public Result doWork() { public Result doWork() {
Log.i("workmanager", "do");
try { try {
Log.i("workmanager", "before response");
List<Account> accounts = redditDataRoomDatabase.accountDao().getAllAccounts(); List<Account> accounts = redditDataRoomDatabase.accountDao().getAllAccounts();
for(int accountIndex = 0; accountIndex < accounts.size(); accountIndex++) { for(int accountIndex = 0; accountIndex < accounts.size(); accountIndex++) {
Account account = accounts.get(accountIndex); Account account = accounts.get(accountIndex);
@ -67,7 +63,6 @@ public class PullNotificationWorker extends Worker {
Response<String> response = fetchMessages(account, 1); Response<String> response = fetchMessages(account, 1);
if(response != null && response.isSuccessful()) { if(response != null && response.isSuccessful()) {
Log.i("workmanager", "has response");
String responseBody = response.body(); String responseBody = response.body();
ArrayList<Message> messages = FetchMessages.parseMessage(responseBody, context.getResources().getConfiguration().locale); ArrayList<Message> messages = FetchMessages.parseMessage(responseBody, context.getResources().getConfiguration().locale);
@ -165,30 +160,20 @@ public class PullNotificationWorker extends Worker {
summaryBuilder.setContentIntent(summaryPendingIntent); summaryBuilder.setContentIntent(summaryPendingIntent);
notificationManager.notify(NotificationUtils.getSummaryIdUnreadMessage(accountIndex), summaryBuilder.build()); notificationManager.notify(NotificationUtils.getSummaryIdUnreadMessage(accountIndex), summaryBuilder.build());
Log.i("workmanager", "message size " + messages.size());
} else { } else {
Log.i("workmanager", "no message");
return Result.success(); return Result.success();
} }
} else { } else {
if(response != null) {
Log.i("workmanager", "retry1 " + response.code());
}
return Result.retry(); return Result.retry();
} }
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
Log.i("workmanager", "retry2");
return Result.retry(); return Result.retry();
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
Log.i("workmanager", "json failure");
return Result.failure(); return Result.failure();
} }
Log.i("workmanager", "success");
return Result.success(); return Result.success();
} }
@ -234,8 +219,6 @@ public class PullNotificationWorker extends Worker {
JSONObject jsonObject = new JSONObject(response.body().toString()); JSONObject jsonObject = new JSONObject(response.body().toString());
String newAccessToken = jsonObject.getString(RedditUtils.ACCESS_TOKEN_KEY); String newAccessToken = jsonObject.getString(RedditUtils.ACCESS_TOKEN_KEY);
redditDataRoomDatabase.accountDao().changeAccessToken(account.getUsername(), newAccessToken); redditDataRoomDatabase.accountDao().changeAccessToken(account.getUsername(), newAccessToken);
Log.i("access token", newAccessToken);
return newAccessToken; return newAccessToken;
} }
return ""; return "";

View File

@ -204,7 +204,6 @@ class SubmitPost {
@Override @Override
public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) { public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) {
if(response.isSuccessful()) { if(response.isSuccessful()) {
Log.i("afasdfadsfasdfasdfasdf", "a " + response.body());
try { try {
getSubmittedPost(response.body(), kind, oauthRetrofit, accessToken, getSubmittedPost(response.body(), kind, oauthRetrofit, accessToken,
locale, submitPostListener); locale, submitPostListener);

View File

@ -68,14 +68,12 @@ class UserFollowing {
} }
userFollowingListener.onUserFollowingSuccess(); userFollowingListener.onUserFollowingSuccess();
} else { } else {
Log.i("call failed", Integer.toString(response.code()));
userFollowingListener.onUserFollowingFail(); userFollowingListener.onUserFollowingFail();
} }
} }
@Override @Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
Log.i("call failed", t.getMessage());
userFollowingListener.onUserFollowingFail(); userFollowingListener.onUserFollowingFail();
} }
}); });

View File

@ -50,7 +50,6 @@ class VoteThing {
@Override @Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
Log.i("call failed", t.getMessage());
voteThingListener.onVoteThingFail(position); voteThingListener.onVoteThingFail(position);
} }
}); });
@ -79,7 +78,6 @@ class VoteThing {
@Override @Override
public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) { public void onFailure(@NonNull Call<String> call, @NonNull Throwable t) {
Log.i("call failed", t.getMessage());
voteThingWithoutPositionListener.onVoteThingFail(); voteThingWithoutPositionListener.onVoteThingFail();
} }
}); });