[FIX] SharedPreferences data migration (#2413)

This commit is contained in:
Djorkaeff Alexandre 2020-08-20 10:09:15 -03:00 committed by GitHub
parent df267a2790
commit f9b201caaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -72,9 +72,15 @@ public class MainActivity extends ReactFragmentActivity {
SortPreferences sortPreferences = new Gson().fromJson(sortJson, SortPreferences.class);
WritableMap sortMap = new Arguments().createMap();
sortMap.putString("sortBy", sortPreferences.sortBy);
sortMap.putBoolean("groupByType", sortPreferences.groupByType);
sortMap.putBoolean("showFavorites", sortPreferences.showFavorites);
sortMap.putBoolean("showUnread", sortPreferences.showUnread);
if (sortPreferences.groupByType != null) {
sortMap.putBoolean("groupByType", sortPreferences.groupByType);
}
if (sortPreferences.showFavorites != null) {
sortMap.putBoolean("showFavorites", sortPreferences.showFavorites);
}
if (sortPreferences.showUnread != null) {
sortMap.putBoolean("showUnread", sortPreferences.showUnread);
}
Bundle bundle = Arguments.toBundle(sortMap);
mmkv.encode(SORT_PREFS_KEY, bundle);
}