Skip to content

Commit

Permalink
Load sort type from correct shared preferences (#1202)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tabasavr authored Nov 5, 2022
1 parent 0ae9b74 commit ff10eb5
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -814,11 +814,11 @@ public void changeSortType(SortType sortType) {

@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;
Expand Down

0 comments on commit ff10eb5

Please sign in to comment.