Show NSFW communities on search

There was a bug in the code that caused the nsfw settings to report "false" value in the community search.
This commit is contained in:
Balazs Toldi 2023-08-08 16:13:16 +02:00
parent 930a425af5
commit be0bd40995
No known key found for this signature in database
GPG Key ID: 6C7D440036F99D58
3 changed files with 7 additions and 3 deletions

View File

@ -784,7 +784,8 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
bundle.putString(SubredditListingFragment.EXTRA_QUERY, mQuery);
bundle.putBoolean(SubredditListingFragment.EXTRA_IS_GETTING_SUBREDDIT_INFO, false);
bundle.putString(SubredditListingFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
bundle.putString(SubredditListingFragment.EXTRA_ACCOUNT_NAME, mAccountQualifiedName);
bundle.putString(SubredditListingFragment.EXTRA_ACCOUNT_NAME, mAccountName);
bundle.putString(SubredditListingFragment.EXTRA_ACCOUNT_QUALIFIED_NAME, mAccountQualifiedName);
mFragment.setArguments(bundle);
return mFragment;
}

View File

@ -119,7 +119,8 @@ public class SearchSubredditsResultActivity extends BaseActivity implements Acti
bundle.putString(SubredditListingFragment.EXTRA_QUERY, query);
bundle.putBoolean(SubredditListingFragment.EXTRA_IS_GETTING_SUBREDDIT_INFO, true);
bundle.putString(SubredditListingFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
bundle.putString(SubredditListingFragment.EXTRA_ACCOUNT_NAME, mAccountQualifiedName);
bundle.putString(SubredditListingFragment.EXTRA_ACCOUNT_NAME, mAccountName);
bundle.putString(SubredditListingFragment.EXTRA_ACCOUNT_QUALIFIED_NAME, mAccountQualifiedName);
bundle.putBoolean(SubredditListingFragment.EXTRA_IS_MULTI_SELECTION, getIntent().getBooleanExtra(EXTRA_IS_MULTI_SELECTION, false));
mFragment.setArguments(bundle);
} else {

View File

@ -61,6 +61,7 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun
public static final String EXTRA_IS_GETTING_SUBREDDIT_INFO = "EIGSI";
public static final String EXTRA_ACCESS_TOKEN = "EAT";
public static final String EXTRA_ACCOUNT_NAME = "EAN";
public static final String EXTRA_ACCOUNT_QUALIFIED_NAME = "EAQN";
public static final String EXTRA_IS_MULTI_SELECTION = "EIMS";
@BindView(R.id.coordinator_layout_subreddit_listing_fragment)
@ -135,13 +136,14 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun
boolean isGettingSubredditInfo = getArguments().getBoolean(EXTRA_IS_GETTING_SUBREDDIT_INFO);
String accessToken = getArguments().getString(EXTRA_ACCESS_TOKEN);
String accountName = getArguments().getString(EXTRA_ACCOUNT_NAME);
String accountQualifiedName = getArguments().getString(EXTRA_ACCOUNT_QUALIFIED_NAME);
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SEARCH_SUBREDDIT, SortType.Type.TOP_ALL.value);
sortType = new SortType(SortType.Type.fromValue(sort));
boolean nsfw = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.NSFW_BASE, false);
mAdapter = new SubredditListingRecyclerViewAdapter(mActivity, mExecutor, mRetrofit.getRetrofit(), mRetrofit.getRetrofit(),
mCustomThemeWrapper, accessToken, accountName,
mCustomThemeWrapper, accessToken, accountQualifiedName,
mRedditDataRoomDatabase, getArguments().getBoolean(EXTRA_IS_MULTI_SELECTION, false),
new SubredditListingRecyclerViewAdapter.Callback() {
@Override