Load sort type from correct shared preferences (#1202)

When extracting sort type loading logic the shared preferences that are used to load sort type got accidentally changed to the wrong ones. This resulted in always using the default value which is displayed as Best.

Fortunately the saving code was not changed so only reading has to be fixed.
This commit is contained in:
Sergei Kozelko 2022-11-05 21:22:02 +07:00 committed by GitHub
parent 0ae9b74729
commit ff10eb5f92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -814,11 +814,11 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
@NonNull
private SortType.Type loadSortType() {
String sortTypeName = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, SortType.Type.CONFIDENCE.name());
String sortTypeName = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, SortType.Type.CONFIDENCE.name());
if (SortType.Type.BEST.name().equals(sortTypeName)) {
// migrate from BEST to CONFIDENCE
// key guaranteed to exist because got non-default value
mSharedPreferences.edit()
mSortTypeSharedPreferences.edit()
.putString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, SortType.Type.CONFIDENCE.name())
.apply();
return SortType.Type.CONFIDENCE;