From 4395384586923940c2aba15cb467a5a7f80fe606 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Sat, 16 Oct 2021 14:50:18 +0800 Subject: [PATCH] Fix no multireddits found in MultiredditSelectionActivity in anonymous mode. Do not sync multireddits in anonymous mode in MultiredditSelectionActivity. --- .../activities/MultiredditSelectionActivity.java | 4 +++- .../activities/SubscribedThingListingActivity.java | 2 +- .../fragments/MultiRedditListingFragment.java | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java index d5ae4f84..7b1596f8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java @@ -150,7 +150,9 @@ public class MultiredditSelectionActivity extends BaseActivity implements Activi return; } - loadMultiReddits(); + if (mAccessToken != null) { + loadMultiReddits(); + } if (initializeFragment) { mFragment = new MultiRedditListingFragment(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java index d4c4caee..de5438e1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java @@ -398,7 +398,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti SubscribedSubredditsListingFragment fragment = new SubscribedSubredditsListingFragment(); Bundle bundle = new Bundle(); bundle.putBoolean(SubscribedSubredditsListingFragment.EXTRA_IS_SUBREDDIT_SELECTION, false); - bundle.putString(SubscribedSubredditsListingFragment.EXTRA_ACCOUNT_NAME, mAccountName == null ? "-" : mAccountName); + bundle.putString(SubscribedSubredditsListingFragment.EXTRA_ACCOUNT_NAME, mAccountName); bundle.putString(SubscribedSubredditsListingFragment.EXTRA_ACCESS_TOKEN, mAccessToken); fragment.setArguments(bundle); return fragment; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MultiRedditListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MultiRedditListingFragment.java index c6ff0b85..302b0ea0 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MultiRedditListingFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MultiRedditListingFragment.java @@ -108,7 +108,7 @@ public class MultiRedditListingFragment extends Fragment implements FragmentComm } } - String accountName = getArguments().getString(EXTRA_ACCOUNT_NAME); + String accountName = getArguments().getString(EXTRA_ACCOUNT_NAME, "-"); String accessToken = getArguments().getString(EXTRA_ACCESS_TOKEN); boolean isGettingMultiredditInfo = getArguments().getBoolean(EXTRA_IS_GETTING_MULTIREDDIT_INFO, false);