mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Switched AppBus for ResultHandler, Controller for Helper. Added the basics for LifecycleControllers and implemented it for BriarActivity and NavDrawerActivity
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package org.briarproject.android.controller;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import org.briarproject.api.db.DatabaseConfig;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class ConfigControllerImp implements ConfigController {
|
||||
|
||||
private final static String PREF_DB_KEY = "key";
|
||||
|
||||
@Inject
|
||||
protected SharedPreferences briarPrefs;
|
||||
@Inject
|
||||
protected volatile DatabaseConfig databaseConfig;
|
||||
|
||||
@Inject
|
||||
public ConfigControllerImp() {
|
||||
|
||||
}
|
||||
|
||||
public String getEncryptedDatabaseKey() {
|
||||
return briarPrefs.getString(PREF_DB_KEY, null);
|
||||
}
|
||||
|
||||
public void clearPrefs() {
|
||||
SharedPreferences.Editor editor = briarPrefs.edit();
|
||||
editor.clear();
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initialized() {
|
||||
String hex = getEncryptedDatabaseKey();
|
||||
if (hex != null && databaseConfig.databaseExists()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user