Commit f8df6b88 authored by akwizgran's avatar akwizgran

Add BriarAccountManager subclass.

parent 277d0454
Pipeline #1941 canceled with stage
......@@ -2,7 +2,6 @@ package org.briarproject.bramble;
import android.app.Application;
import org.briarproject.bramble.account.AndroidAccountModule;
import org.briarproject.bramble.plugin.tor.CircumventionProvider;
import org.briarproject.bramble.plugin.tor.CircumventionProviderImpl;
import org.briarproject.bramble.system.AndroidSystemModule;
......@@ -13,7 +12,6 @@ import dagger.Module;
import dagger.Provides;
@Module(includes = {
AndroidAccountModule.class,
AndroidSystemModule.class
})
public class BrambleAndroidModule {
......
......@@ -24,8 +24,8 @@ class AndroidAccountManager extends AccountManagerImpl
private static final String PREF_DB_KEY = "key";
protected final Context appContext;
private final SharedPreferences prefs;
private final Context appContext;
@Inject
AndroidAccountManager(DatabaseConfig databaseConfig,
......
package org.briarproject.bramble.account;
import android.app.Application;
import android.content.SharedPreferences;
import org.briarproject.bramble.api.crypto.CryptoComponent;
import org.briarproject.bramble.api.db.DatabaseConfig;
import org.briarproject.briar.R;
import org.briarproject.briar.android.Localizer;
import org.briarproject.briar.android.util.UiUtils;
import javax.inject.Inject;
class BriarAccountManager extends AndroidAccountManager {
@Inject
BriarAccountManager(DatabaseConfig databaseConfig, CryptoComponent crypto,
SharedPreferences prefs, Application app) {
super(databaseConfig, crypto, prefs, app);
}
@Override
public void deleteAccount() {
synchronized (stateChangeLock) {
super.deleteAccount();
Localizer.reinitialize();
UiUtils.setTheme(appContext,
appContext.getString(R.string.pref_theme_light_value));
}
}
}
......@@ -8,11 +8,11 @@ import dagger.Module;
import dagger.Provides;
@Module
public class AndroidAccountModule {
public class BriarAccountModule {
@Provides
@Singleton
AccountManager provideAccountManager(AndroidAccountManager accountManager) {
AccountManager provideAccountManager(BriarAccountManager accountManager) {
return accountManager;
}
}
package org.briarproject.briar.android;
import android.content.SharedPreferences;
import org.briarproject.bramble.BrambleAndroidModule;
import org.briarproject.bramble.BrambleCoreEagerSingletons;
import org.briarproject.bramble.BrambleCoreModule;
import org.briarproject.bramble.account.BriarAccountModule;
import org.briarproject.bramble.api.account.AccountManager;
import org.briarproject.bramble.api.contact.ContactExchangeTask;
import org.briarproject.bramble.api.contact.ContactManager;
import org.briarproject.bramble.api.crypto.CryptoComponent;
import org.briarproject.bramble.api.crypto.CryptoExecutor;
import org.briarproject.bramble.api.crypto.PasswordStrengthEstimator;
import org.briarproject.bramble.api.db.DatabaseConfig;
import org.briarproject.bramble.api.db.DatabaseExecutor;
import org.briarproject.bramble.api.event.EventBus;
import org.briarproject.bramble.api.identity.IdentityManager;
......@@ -63,6 +60,7 @@ import dagger.Component;
BrambleCoreModule.class,
BriarCoreModule.class,
BrambleAndroidModule.class,
BriarAccountModule.class,
AppModule.class
})
public interface AndroidComponent
......@@ -74,10 +72,6 @@ public interface AndroidComponent
PasswordStrengthEstimator passwordStrengthIndicator();
CryptoComponent cryptoComponent();
DatabaseConfig databaseConfig();
@DatabaseExecutor
Executor databaseExecutor();
......@@ -93,8 +87,6 @@ public interface AndroidComponent
AndroidNotificationManager androidNotificationManager();
SharedPreferences sharedPreferences();
ScreenFilterMonitor screenFilterMonitor();
ConnectionRegistry connectionRegistry();
......
......@@ -14,7 +14,6 @@ import android.widget.ProgressBar;
import org.briarproject.bramble.api.account.AccountManager;
import org.briarproject.briar.R;
import org.briarproject.briar.android.Localizer;
import org.briarproject.briar.android.activity.ActivityComponent;
import org.briarproject.briar.android.activity.BaseActivity;
import org.briarproject.briar.android.controller.BriarController;
......@@ -111,8 +110,6 @@ public class PasswordActivity extends BaseActivity {
private void deleteAccount() {
accountManager.deleteAccount();
Localizer.reinitialize();
UiUtils.setTheme(this, getString(R.string.pref_theme_light_value));
setResult(RESULT_CANCELED);
Intent i = new Intent(this, SetupActivity.class);
i.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment