mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Use wrapper for interacting with shared preferences (#2288)
* Use wrapper for accessing shared preferences across the app * Use Json kv store for storing place object * Fix tests * Fix test failure * Fix UI tests
This commit is contained in:
parent
1b7b909107
commit
d4fa9cfa45
61 changed files with 908 additions and 585 deletions
|
|
@ -5,7 +5,6 @@ import android.app.Application;
|
|||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.os.Build;
|
||||
import android.os.Process;
|
||||
|
|
@ -37,6 +36,7 @@ import fr.free.nrw.commons.concurrency.ThreadPoolService;
|
|||
import fr.free.nrw.commons.contributions.ContributionDao;
|
||||
import fr.free.nrw.commons.data.DBOpenHelper;
|
||||
import fr.free.nrw.commons.di.ApplicationlessInjection;
|
||||
import fr.free.nrw.commons.kvstore.BasicKvStore;
|
||||
import fr.free.nrw.commons.logging.FileLoggingTree;
|
||||
import fr.free.nrw.commons.logging.LogUtils;
|
||||
import fr.free.nrw.commons.modifications.ModifierSequenceDao;
|
||||
|
|
@ -59,9 +59,8 @@ public class CommonsApplication extends Application {
|
|||
@Inject SessionManager sessionManager;
|
||||
@Inject DBOpenHelper dbOpenHelper;
|
||||
|
||||
@Inject @Named("default_preferences") SharedPreferences defaultPrefs;
|
||||
@Inject @Named("application_preferences") SharedPreferences applicationPrefs;
|
||||
@Inject @Named("prefs") SharedPreferences otherPrefs;
|
||||
@Inject @Named("default_preferences") BasicKvStore defaultPrefs;
|
||||
@Inject @Named("application_preferences") BasicKvStore applicationPrefs;
|
||||
|
||||
/**
|
||||
* Constants begin
|
||||
|
|
@ -221,10 +220,9 @@ public class CommonsApplication extends Application {
|
|||
.subscribe(() -> {
|
||||
Timber.d("All accounts have been removed");
|
||||
//TODO: fix preference manager
|
||||
defaultPrefs.edit().clear().apply();
|
||||
applicationPrefs.edit().clear().apply();
|
||||
applicationPrefs.edit().putBoolean("firstrun", false).apply();
|
||||
otherPrefs.edit().clear().apply();
|
||||
defaultPrefs.clearAll();
|
||||
applicationPrefs.clearAll();
|
||||
applicationPrefs.putBoolean("firstrun", false);
|
||||
updateAllDatabases();
|
||||
logoutListener.onLogoutComplete();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue