diff options
Diffstat (limited to 'app/src/main')
19 files changed, 47 insertions, 47 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java index 57ad6270..6d3913e2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java @@ -530,8 +530,8 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee } private void loadSubredditIcon() { - LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), mRedditDataRoomDatabase, subredditName, - mApplicationOnlyRetrofit, iconImageUrl -> { + LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), mRedditDataRoomDatabase, mApplicationOnlyRetrofit, subredditName, + iconImageUrl -> { iconUrl = iconImageUrl; displaySubredditIcon(); loadSubredditIconSuccessful = true; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java index 201ef313..5005e407 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java @@ -492,8 +492,8 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF } private void loadSubredditIcon() { - LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), mRedditDataRoomDatabase, subredditName, - mApplicationOnlyRetrofit, iconImageUrl -> { + LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), mRedditDataRoomDatabase, mApplicationOnlyRetrofit, subredditName, + iconImageUrl -> { iconUrl = iconImageUrl; displaySubredditIcon(); loadSubredditIconSuccessful = true; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java index 6f67febd..9c489dd7 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java @@ -481,8 +481,8 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr } private void loadSubredditIcon() { - LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), mRedditDataRoomDatabase, subredditName, - mApplicationOnlyRetrofit, iconImageUrl -> { + LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), mRedditDataRoomDatabase, mApplicationOnlyRetrofit, subredditName, + iconImageUrl -> { iconUrl = iconImageUrl; displaySubredditIcon(); loadSubredditIconSuccessful = true; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java index bc7c3f9a..191b55e4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java @@ -528,8 +528,8 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr } private void loadSubredditIcon() { - LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), mRedditDataRoomDatabase, subredditName, - mApplicationOnlyRetrofit, iconImageUrl -> { + LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), mRedditDataRoomDatabase, mApplicationOnlyRetrofit, subredditName, + iconImageUrl -> { iconUrl = iconImageUrl; displaySubredditIcon(); loadSubredditIconSuccessful = true; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java index 475cfcbf..c45d1ced 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java @@ -485,8 +485,8 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr } private void loadSubredditIcon() { - LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), mRedditDataRoomDatabase, subredditName, - mApplicationOnlyRetrofit, iconImageUrl -> { + LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), mRedditDataRoomDatabase, mApplicationOnlyRetrofit, subredditName, + iconImageUrl -> { iconUrl = iconImageUrl; displaySubredditIcon(); loadSubredditIconSuccessful = true; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java index bd6463b5..24796c63 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java @@ -511,8 +511,8 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF } private void loadSubredditIcon() { - LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), mRedditDataRoomDatabase, subredditName, - mApplicationOnlyRetrofit, iconImageUrl -> { + LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), mRedditDataRoomDatabase, mApplicationOnlyRetrofit, subredditName, + iconImageUrl -> { iconUrl = iconImageUrl; displaySubredditIcon(); loadSubredditIconSuccessful = true; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java index 446f876b..496c9c44 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java @@ -500,8 +500,8 @@ public class SubmitCrosspostActivity extends BaseActivity implements FlairBottom } private void loadSubredditIcon() { - LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), mRedditDataRoomDatabase, subredditName, - mApplicationOnlyRetrofit, iconImageUrl -> { + LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), mRedditDataRoomDatabase, mApplicationOnlyRetrofit, subredditName, + iconImageUrl -> { iconUrl = iconImageUrl; displaySubredditIcon(); loadSubredditIconSuccessful = true; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPrivateMessagesActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPrivateMessagesActivity.java index 128a69c9..354e589d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPrivateMessagesActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPrivateMessagesActivity.java @@ -78,7 +78,7 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit Retrofit mOauthRetrofit; @Inject @Named("application_only_oauth") - Retrofit mApplicationOnlyOauth; + Retrofit mApplicationOnlyOauthRetrofit; @Inject RedditDataRoomDatabase mRedditDataRoomDatabase; @Inject @@ -249,7 +249,7 @@ public class ViewPrivateMessagesActivity extends BaseActivity implements Activit mProvideUserAvatarCallbacks.add(provideUserAvatarCallback); if (!isLoadingUserAvatar) { LoadUserData.loadUserData(mExecutor, new Handler(), mRedditDataRoomDatabase, - username, mApplicationOnlyOauth, iconImageUrl -> { + username, mApplicationOnlyOauthRetrofit, iconImageUrl -> { isLoadingUserAvatar = false; mUserAvatar = iconImageUrl == null ? "" : iconImageUrl; for (ProvideUserAvatarCallback provideUserAvatarCallbackInArrayList : mProvideUserAvatarCallbacks) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java index 2f3f30c1..70959ace 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java @@ -172,7 +172,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele Retrofit mOauthRetrofit; @Inject @Named("application_only_oauth") - Retrofit mApplicationOnlyOauth; + Retrofit mApplicationOnlyOauthRetrofit; @Inject RedditDataRoomDatabase mRedditDataRoomDatabase; @Inject @@ -442,7 +442,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele subscriptionReady = false; if (resources.getString(R.string.follow).contentEquals(subscribeUserChip.getText())) { if (mAccountName.equals(Account.ANONYMOUS_ACCOUNT)) { - UserFollowing.anonymousFollowUser(mExecutor, new Handler(), mApplicationOnlyOauth, + UserFollowing.anonymousFollowUser(mExecutor, new Handler(), mApplicationOnlyOauthRetrofit, username, mRedditDataRoomDatabase, new UserFollowing.UserFollowingListener() { @Override public void onUserFollowingSuccess() { @@ -459,7 +459,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } }); } else { - UserFollowing.followUser(mOauthRetrofit, mApplicationOnlyOauth, mAccessToken, + UserFollowing.followUser(mOauthRetrofit, mApplicationOnlyOauthRetrofit, mAccessToken, username, mAccountName, mRedditDataRoomDatabase, new UserFollowing.UserFollowingListener() { @Override public void onUserFollowingSuccess() { @@ -494,7 +494,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele } }); } else { - UserFollowing.unfollowUser(mOauthRetrofit, mApplicationOnlyOauth, mAccessToken, + UserFollowing.unfollowUser(mOauthRetrofit, mApplicationOnlyOauthRetrofit, mAccessToken, username, mAccountName, mRedditDataRoomDatabase, new UserFollowing.UserFollowingListener() { @Override public void onUserFollowingSuccess() { @@ -1064,7 +1064,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele private void fetchUserInfo() { if (!mFetchUserInfoSuccess) { - FetchUserData.fetchUserData(mApplicationOnlyOauth, username, new FetchUserData.FetchUserDataListener() { + FetchUserData.fetchUserData(mApplicationOnlyOauthRetrofit, username, new FetchUserData.FetchUserDataListener() { @Override public void onFetchUserDataSuccess(UserData userData, int inboxCount) { new ViewUserDetailActivity.InsertUserDataAsyncTask(mRedditDataRoomDatabase.userDao(), userData, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java index 1f27a19d..a8148722 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -561,8 +561,8 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler } else { if (mPost.getSubredditIconUrl() == null) { LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), - mRedditDataRoomDatabase, mPost.getSubredditNamePrefixed().substring(2), - mApplicationOnlyRetrofit, iconImageUrl -> { + mRedditDataRoomDatabase, mApplicationOnlyRetrofit, mPost.getSubredditNamePrefixed().substring(2), + iconImageUrl -> { if (iconImageUrl == null || iconImageUrl.equals("")) { mGlide.load(R.drawable.subreddit_default_icon) .apply(RequestOptions.bitmapTransform(new RoundedCornersTransformation(72, 0))) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserListingRecyclerViewAdapter.java index 0a013d12..c29ddd80 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/UserListingRecyclerViewAdapter.java @@ -59,7 +59,7 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R private final BaseActivity activity; private final Executor executor; private final Retrofit oauthRetrofit; - private final Retrofit applicationOnlyOauth; + private final Retrofit applicationOnlyOauthRetrofit; private final String accessToken; private final String accountName; private final RedditDataRoomDatabase redditDataRoomDatabase; @@ -74,7 +74,7 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R private NetworkState networkState; private final Callback callback; - public UserListingRecyclerViewAdapter(BaseActivity activity, Executor executor, Retrofit oauthRetrofit, Retrofit applicationOnlyOauth, + public UserListingRecyclerViewAdapter(BaseActivity activity, Executor executor, Retrofit oauthRetrofit, Retrofit applicationOnlyOauthRetrofit, CustomThemeWrapper customThemeWrapper, @Nullable String accessToken, @NonNull String accountName, RedditDataRoomDatabase redditDataRoomDatabase, boolean isMultiSelection, Callback callback) { @@ -82,7 +82,7 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R this.activity = activity; this.executor = executor; this.oauthRetrofit = oauthRetrofit; - this.applicationOnlyOauth = applicationOnlyOauth; + this.applicationOnlyOauthRetrofit = applicationOnlyOauthRetrofit; this.accessToken = accessToken; this.accountName = accountName; this.redditDataRoomDatabase = redditDataRoomDatabase; @@ -150,7 +150,7 @@ public class UserListingRecyclerViewAdapter extends PagedListAdapter<UserData, R public void isNotSubscribed() { ((DataViewHolder) holder).subscribeButton.setVisibility(View.VISIBLE); ((DataViewHolder) holder).subscribeButton.setOnClickListener(view -> { - UserFollowing.followUser(oauthRetrofit, applicationOnlyOauth, + UserFollowing.followUser(oauthRetrofit, applicationOnlyOauthRetrofit, accessToken, userData.getName(), accountName, redditDataRoomDatabase, new UserFollowing.UserFollowingListener() { @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/LoadSubredditIcon.java b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/LoadSubredditIcon.java index e8d0180c..8e29cdde 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/LoadSubredditIcon.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/LoadSubredditIcon.java @@ -15,7 +15,7 @@ import retrofit2.Retrofit; public class LoadSubredditIcon { public static void loadSubredditIcon(Executor executor, Handler handler, RedditDataRoomDatabase redditDataRoomDatabase, - String subredditName, Retrofit applicationOnlyOauthRetrofit, + Retrofit applicationOnlyOauthRetrofit, String subredditName, LoadSubredditIconAsyncTaskListener loadSubredditIconAsyncTaskListener) { executor.execute(() -> { SubredditDao subredditDao = redditDataRoomDatabase.subredditDao(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/LoadUserData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/LoadUserData.java index 42e0c7ce..c96bb821 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/LoadUserData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/asynctasks/LoadUserData.java @@ -13,14 +13,14 @@ import retrofit2.Retrofit; public class LoadUserData { public static void loadUserData(Executor executor, Handler handler, RedditDataRoomDatabase redditDataRoomDatabase, String userName, - Retrofit applicationOnlyOauth, LoadUserDataAsyncTaskListener loadUserDataAsyncTaskListener) { + Retrofit applicationOnlyOauthRetrofit, LoadUserDataAsyncTaskListener loadUserDataAsyncTaskListener) { executor.execute(() -> { UserDao userDao = redditDataRoomDatabase.userDao(); if (userDao.getUserData(userName) != null) { String iconImageUrl = userDao.getUserData(userName).getIconUrl(); handler.post(() -> loadUserDataAsyncTaskListener.loadUserDataSuccess(iconImageUrl)); } else { - handler.post(() -> FetchUserData.fetchUserData(applicationOnlyOauth, userName, new FetchUserData.FetchUserDataListener() { + handler.post(() -> FetchUserData.fetchUserData(applicationOnlyOauthRetrofit, userName, new FetchUserData.FetchUserDataListener() { @Override public void onFetchUserDataSuccess(UserData userData, int inboxCount) { InsertUserData.insertUserData(executor, handler, redditDataRoomDatabase, userData, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/HistoryPostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/HistoryPostFragment.java index 4d7f1130..752fe396 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/HistoryPostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/HistoryPostFragment.java @@ -931,7 +931,7 @@ public class HistoryPostFragment extends Fragment implements FragmentCommunicato } else { if (isSubreddit) { LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), mRedditDataRoomDatabase, - subredditOrUserName, mApplicationOnlyRetrofit, + mApplicationOnlyRetrofit, subredditOrUserName, iconImageUrl -> { subredditOrUserIcons.put(subredditOrUserName, iconImageUrl); loadIconListener.loadIconSuccess(subredditOrUserName, iconImageUrl); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java index 082733b6..e49ff234 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java @@ -1742,7 +1742,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator { } else { if (isSubreddit) { LoadSubredditIcon.loadSubredditIcon(mExecutor, new Handler(), mRedditDataRoomDatabase, - subredditOrUserName, mApplicationOnlyRetrofit, + mApplicationOnlyRetrofit, subredditOrUserName, iconImageUrl -> { subredditOrUserIcons.put(subredditOrUserName, iconImageUrl); loadIconListener.loadIconSuccess(subredditOrUserName, iconImageUrl); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/UserListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/UserListingFragment.java index 0d235589..44c472e1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/UserListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/UserListingFragment.java @@ -81,7 +81,7 @@ public class UserListingFragment extends Fragment implements FragmentCommunicato Retrofit mOauthRetrofit; @Inject @Named("application_only_oauth") - Retrofit mApplicationOnlyOauth; + Retrofit mApplicationOnlyOauthRetrofit; @Inject RedditDataRoomDatabase mRedditDataRoomDatabase; @Inject @@ -143,7 +143,7 @@ public class UserListingFragment extends Fragment implements FragmentCommunicato sortType = new SortType(SortType.Type.valueOf(sort.toUpperCase())); boolean nsfw = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean((accountName.equals(Account.ANONYMOUS_ACCOUNT) ? "" : accountName) + SharedPreferencesUtils.NSFW_BASE, false); - mAdapter = new UserListingRecyclerViewAdapter(mActivity, mExecutor, mOauthRetrofit, mApplicationOnlyOauth, + mAdapter = new UserListingRecyclerViewAdapter(mActivity, mExecutor, mOauthRetrofit, mApplicationOnlyOauthRetrofit, mCustomThemeWrapper, accessToken, accountName, mRedditDataRoomDatabase, getArguments().getBoolean(EXTRA_IS_MULTI_SELECTION, false), new UserListingRecyclerViewAdapter.Callback() { @@ -179,7 +179,7 @@ public class UserListingFragment extends Fragment implements FragmentCommunicato }); } - UserListingViewModel.Factory factory = new UserListingViewModel.Factory(mApplicationOnlyOauth, mQuery, + UserListingViewModel.Factory factory = new UserListingViewModel.Factory(mApplicationOnlyOauthRetrofit, mQuery, sortType, nsfw); mUserListingViewModel = new ViewModelProvider(this, factory).get(UserListingViewModel.class); mUserListingViewModel.getUsers().observe(getViewLifecycleOwner(), UserData -> mAdapter.submitList(UserData)); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSubscription.java b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSubscription.java index 969f9ea4..31c327b1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSubscription.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/subreddit/SubredditSubscription.java @@ -27,11 +27,11 @@ public class SubredditSubscription { accountName, "sub", redditDataRoomDatabase, subredditSubscriptionListener); } - public static void anonymousSubscribeToSubreddit(Executor executor, Handler handler, Retrofit applicationOnlyOauth, + public static void anonymousSubscribeToSubreddit(Executor executor, Handler handler, Retrofit applicationOnlyOauthRetrofit, RedditDataRoomDatabase redditDataRoomDatabase, String subredditName, SubredditSubscriptionListener subredditSubscriptionListener) { - FetchSubredditData.fetchSubredditData(applicationOnlyOauth, subredditName, new FetchSubredditData.FetchSubredditDataListener() { + FetchSubredditData.fetchSubredditData(applicationOnlyOauthRetrofit, subredditName, new FetchSubredditData.FetchSubredditDataListener() { @Override public void onFetchSubredditDataSuccess(SubredditData subredditData, int nCurrentOnlineSubscribers) { insertSubscription(executor, handler, redditDataRoomDatabase, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/user/FetchUserData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/user/FetchUserData.java index 1c1c8c3b..7fab00f6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/user/FetchUserData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/user/FetchUserData.java @@ -15,9 +15,9 @@ import retrofit2.Callback; import retrofit2.Retrofit; public class FetchUserData { - public static void fetchUserData(Retrofit applicationOnlyOauth, String userName, + public static void fetchUserData(Retrofit applicationOnlyOauthRetrofit, String userName, FetchUserDataListener fetchUserDataListener) { - fetchUserData(null, applicationOnlyOauth, null, userName, fetchUserDataListener); + fetchUserData(null, applicationOnlyOauthRetrofit, null, userName, fetchUserDataListener); } public static void fetchUserData(@Nullable RedditDataRoomDatabase redditDataRoomDatabase, Retrofit retrofit, diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserFollowing.java b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserFollowing.java index a6c181ec..faac787d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserFollowing.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/user/UserFollowing.java @@ -21,18 +21,18 @@ import retrofit2.Callback; import retrofit2.Retrofit; public class UserFollowing { - public static void followUser(Retrofit oauthRetrofit, Retrofit applicationOnlyOauth, + public static void followUser(Retrofit oauthRetrofit, Retrofit applicationOnlyOauthRetrofit, @Nullable String accessToken, String username, @NonNull String accountName, RedditDataRoomDatabase redditDataRoomDatabase, UserFollowingListener userFollowingListener) { - userFollowing(oauthRetrofit, applicationOnlyOauth, accessToken, username, accountName, "sub", + userFollowing(oauthRetrofit, applicationOnlyOauthRetrofit, accessToken, username, accountName, "sub", redditDataRoomDatabase.subscribedUserDao(), userFollowingListener); } - public static void anonymousFollowUser(Executor executor, Handler handler, Retrofit applicationOnlyOauth, + public static void anonymousFollowUser(Executor executor, Handler handler, Retrofit applicationOnlyOauthRetrofit, String username, RedditDataRoomDatabase redditDataRoomDatabase, UserFollowingListener userFollowingListener) { - FetchUserData.fetchUserData(applicationOnlyOauth, username, new FetchUserData.FetchUserDataListener() { + FetchUserData.fetchUserData(applicationOnlyOauthRetrofit, username, new FetchUserData.FetchUserDataListener() { @Override public void onFetchUserDataSuccess(UserData userData, int inboxCount) { executor.execute(() -> { @@ -53,11 +53,11 @@ public class UserFollowing { }); } - public static void unfollowUser(Retrofit oauthRetrofit, Retrofit applicationOnlyOauth, + public static void unfollowUser(Retrofit oauthRetrofit, Retrofit applicationOnlyOauthRetrofit, @Nullable String accessToken, String username, @NonNull String accountName, RedditDataRoomDatabase redditDataRoomDatabase, UserFollowingListener userFollowingListener) { - userFollowing(oauthRetrofit, applicationOnlyOauth, accessToken, username, accountName, "unsub", + userFollowing(oauthRetrofit, applicationOnlyOauthRetrofit, accessToken, username, accountName, "unsub", redditDataRoomDatabase.subscribedUserDao(), userFollowingListener); } @@ -71,7 +71,7 @@ public class UserFollowing { }); } - private static void userFollowing(Retrofit oauthRetrofit, Retrofit applicationOnlyOauth, @Nullable String accessToken, + private static void userFollowing(Retrofit oauthRetrofit, Retrofit applicationOnlyOauthRetrofit, @Nullable String accessToken, String username, @NonNull String accountName, String action, SubscribedUserDao subscribedUserDao, UserFollowingListener userFollowingListener) { RedditAPI api = oauthRetrofit.create(RedditAPI.class); @@ -86,7 +86,7 @@ public class UserFollowing { public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> response) { if (response.isSuccessful()) { if (action.equals("sub")) { - FetchUserData.fetchUserData(applicationOnlyOauth, username, new FetchUserData.FetchUserDataListener() { + FetchUserData.fetchUserData(applicationOnlyOauthRetrofit, username, new FetchUserData.FetchUserDataListener() { @Override public void onFetchUserDataSuccess(UserData userData, int inboxCount) { new UpdateSubscriptionAsyncTask(subscribedUserDao, userData, accountName, true).execute(); |