mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 20:29:52 +01:00
Create minimal AccountManager interface.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.bramble;
|
||||
|
||||
import org.briarproject.bramble.account.AccountModule;
|
||||
import org.briarproject.bramble.client.ClientModule;
|
||||
import org.briarproject.bramble.contact.ContactModule;
|
||||
import org.briarproject.bramble.crypto.CryptoExecutorModule;
|
||||
@@ -26,6 +27,7 @@ import org.briarproject.bramble.versioning.VersioningModule;
|
||||
import dagger.Module;
|
||||
|
||||
@Module(includes = {
|
||||
AccountModule.class,
|
||||
ClientModule.class,
|
||||
ContactModule.class,
|
||||
CryptoModule.class,
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.briarproject.bramble.account;
|
||||
|
||||
import org.briarproject.bramble.api.account.AccountManager;
|
||||
import org.briarproject.bramble.api.db.DatabaseConfig;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
class AccountManagerImpl implements AccountManager {
|
||||
|
||||
private final DatabaseConfig databaseConfig;
|
||||
|
||||
@Inject
|
||||
AccountManagerImpl(DatabaseConfig databaseConfig) {
|
||||
this.databaseConfig = databaseConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasDatabaseKey() {
|
||||
return databaseConfig.getEncryptionKey() != null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.briarproject.bramble.account;
|
||||
|
||||
import org.briarproject.bramble.api.account.AccountManager;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
@Module
|
||||
public class AccountModule {
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
AccountManager provideAccountManager(AccountManagerImpl accountManager) {
|
||||
return accountManager;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user