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;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@ -73,7 +71,6 @@ class AccessTokenAuthenticator implements Authenticator {
String newAccessToken = jsonObject.getString(RedditUtils.ACCESS_TOKEN_KEY);
mRedditDataRoomDatabase.accountDao().changeAccessToken(account.getUsername(), newAccessToken);
Log.i("access token", newAccessToken);
return newAccessToken;
}
return "";

View File

@ -88,19 +88,16 @@ public class CommentDataSource extends PageKeyedDataSource<String, CommentData>
@Override
public void parseFailed() {
Log.i("Comments fetch error", "Error parsing data");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
}
}).execute();
} else {
Log.i("Comments fetch error", "Error parsing data");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
}
}
@Override
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"));
}
});
@ -137,19 +134,16 @@ public class CommentDataSource extends PageKeyedDataSource<String, CommentData>
@Override
public void parseFailed() {
Log.i("Comments fetch error", "Error parsing data");
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
}
}).execute();
} else {
Log.i("Comments fetch error", "Error fetching data");
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error fetching data"));
}
}
@Override
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"));
}
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -74,7 +74,6 @@ class MessageDataSource extends PageKeyedDataSource<String, Message> {
@Override
public void fetchFailed() {
Log.i("Messages fetch error", "Error fetch messages");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error fetch messages"));
}
});
@ -106,7 +105,6 @@ class MessageDataSource extends PageKeyedDataSource<String, Message> {
@Override
public void fetchFailed() {
Log.i("Comments fetch error", "Error parsing 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.text.Html;
import android.util.Log;
import org.json.JSONException;
import org.json.JSONObject;
@ -37,7 +36,6 @@ class ParseAndSaveAccountInfo {
this.parseAndSaveAccountInfoListener = parseAndSaveAccountInfoListener;
parseFailed = false;
} catch (JSONException e) {
Log.i("user info json error", "message: " + e.getMessage());
parseAndSaveAccountInfoListener.onParseMyInfoFail();
}
}
@ -57,7 +55,6 @@ class ParseAndSaveAccountInfo {
redditDataRoomDatabase.accountDao().updateAccountInfo(name, profileImageUrl, bannerImageUrl, karma);
} catch (JSONException e) {
parseFailed = true;
Log.i("parse comment error", "message: " + e.getMessage());
}
return null;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -201,7 +201,6 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override
public void onParsePostFail() {
Log.i("Post fetch error", "Error parsing data");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
}
});
@ -232,13 +231,11 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override
public void onParsePostsListingFail() {
Log.i("Post fetch error", "Error parsing data");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
}
});
}
} else {
Log.i("Post fetch error", response.message());
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message()));
}
}
@ -275,12 +272,10 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override
public void onParsePostsListingFail() {
Log.i("Best post", "Error parsing data");
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
}
});
} else {
Log.i("best post", response.message());
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message()));
}
}
@ -319,7 +314,6 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override
public void onParsePostFail() {
Log.i("Post fetch error", "Error parsing data");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
}
});
@ -350,13 +344,11 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override
public void onParsePostsListingFail() {
Log.i("Post fetch error", "Error parsing data");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
}
});
}
} else {
Log.i("Post fetch error", response.message());
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message()));
}
}
@ -399,12 +391,10 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override
public void onParsePostsListingFail() {
Log.i("Best post", "Error parsing data");
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
}
});
} else {
Log.i("Best post", response.message());
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message()));
}
}
@ -457,12 +447,10 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override
public void onParsePostsListingFail() {
Log.i("Post fetch error", "Error parsing data");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
}
});
} else {
Log.i("Post fetch error", response.message());
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message()));
}
}
@ -505,12 +493,10 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override
public void onParsePostsListingFail() {
Log.i("User posts", "Error parsing data");
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
}
});
} else {
Log.i("User posts", response.message());
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message()));
}
}
@ -572,12 +558,10 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override
public void onParsePostsListingFail() {
Log.i("Post fetch error", "Error parsing data");
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
}
});
} else {
Log.i("Post fetch error", response.message());
initialLoadStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, response.message()));
}
}
@ -629,12 +613,10 @@ class PostDataSource extends PageKeyedDataSource<String, Post> {
@Override
public void onParsePostsListingFail() {
Log.i("Search post", "Error parsing data");
paginationNetworkStateLiveData.postValue(new NetworkState(NetworkState.Status.FAILED, "Error parsing data"));
}
});
} else {
Log.i("Search post", 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.drawable.Drawable;
import android.net.Uri;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
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) {
if(holder instanceof DataViewHolder) {
Post post = getItem(position);
if(post == null) {
Log.i("is null", Integer.toString(holder.getAdapterPosition()));
} else {
if(post != null) {
final String id = post.getFullName();
final String subredditNamePrefixed = post.getSubredditNamePrefixed();
String subredditName = subredditNamePrefixed.substring(2);

View File

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

View File

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

View File

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

View File

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