mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
rebased with master
This commit is contained in:
@@ -3,6 +3,7 @@ package org.briarproject.sync;
|
||||
import org.briarproject.TestDatabaseModule;
|
||||
import org.briarproject.TestLifecycleModule;
|
||||
import org.briarproject.TestSystemModule;
|
||||
import org.briarproject.clients.ClientsModule;
|
||||
import org.briarproject.contact.ContactModule;
|
||||
import org.briarproject.crypto.CryptoModule;
|
||||
import org.briarproject.data.DataModule;
|
||||
@@ -22,7 +23,7 @@ import dagger.Component;
|
||||
TestSystemModule.class, ContactModule.class, CryptoModule.class,
|
||||
DatabaseModule.class, EventModule.class, SyncModule.class,
|
||||
DataModule.class, TransportModule.class, ForumModule.class,
|
||||
IdentityModule.class, MessagingModule.class})
|
||||
IdentityModule.class, MessagingModule.class, ClientsModule.class})
|
||||
public interface ConstantsComponent {
|
||||
void inject(ConstantsTest testCase);
|
||||
}
|
||||
|
||||
@@ -10,11 +10,14 @@ import org.briarproject.api.crypto.SecretKey;
|
||||
import org.briarproject.api.db.DatabaseConfig;
|
||||
import org.briarproject.api.event.EventBus;
|
||||
import org.briarproject.api.lifecycle.LifecycleManager;
|
||||
import org.briarproject.api.messaging.MessagingManager;
|
||||
import org.briarproject.api.plugins.PluginManager;
|
||||
import org.briarproject.api.properties.TransportPropertyManager;
|
||||
import org.briarproject.api.sync.ValidationManager;
|
||||
import org.briarproject.api.transport.KeyManager;
|
||||
import org.briarproject.api.ui.UiCallback;
|
||||
import org.briarproject.messaging.PrivateMessageValidator;
|
||||
import org.briarproject.properties.TransportPropertyValidator;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -41,6 +44,14 @@ public class AndroidModule {
|
||||
AndroidNotificationManager androidNotificationManager;
|
||||
@Inject
|
||||
TransportPropertyManager transportPropertyManager;
|
||||
@Inject
|
||||
MessagingManager messagingManager;
|
||||
@Inject
|
||||
PrivateMessageValidator privateMessageValidator;
|
||||
@Inject
|
||||
TransportPropertyValidator transportPropertyValidator;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void injectEager(AndroidComponent c) {
|
||||
|
||||
@@ -6,8 +6,6 @@ import java.util.logging.Logger;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
import org.briarproject.event.EventModule;
|
||||
|
||||
public class BriarApplication extends Application {
|
||||
|
||||
private static final Logger LOG =
|
||||
|
||||
@@ -23,13 +23,13 @@ public class DataModule {
|
||||
}
|
||||
|
||||
@Provides
|
||||
MetadataParser provideMetaDataParser() {
|
||||
return new MetadataParserImpl();
|
||||
MetadataParser provideMetaDataParser(BdfReaderFactory bdfReaderFactory) {
|
||||
return new MetadataParserImpl(bdfReaderFactory);
|
||||
}
|
||||
|
||||
@Provides
|
||||
MetadataEncoder provideMetaDataEncoider() {
|
||||
return new MetadataEncoderImpl();
|
||||
MetadataEncoder provideMetaDataEncoider(BdfWriterFactory bdfWriterFactory) {
|
||||
return new MetadataEncoderImpl(bdfWriterFactory);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.briarproject.data;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import org.briarproject.api.Bytes;
|
||||
import org.briarproject.api.FormatException;
|
||||
import org.briarproject.api.data.BdfDictionary;
|
||||
@@ -16,6 +14,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static org.briarproject.api.data.BdfDictionary.NULL_VALUE;
|
||||
import static org.briarproject.api.db.Metadata.REMOVE;
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.briarproject.data;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import org.briarproject.api.FormatException;
|
||||
import org.briarproject.api.data.BdfDictionary;
|
||||
import org.briarproject.api.data.BdfReader;
|
||||
@@ -13,6 +11,8 @@ import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static org.briarproject.api.data.BdfDictionary.NULL_VALUE;
|
||||
import static org.briarproject.api.db.Metadata.REMOVE;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.forum;
|
||||
|
||||
import org.briarproject.api.clients.ClientHelper;
|
||||
import org.briarproject.api.contact.ContactManager;
|
||||
import org.briarproject.api.crypto.CryptoComponent;
|
||||
import org.briarproject.api.data.BdfReaderFactory;
|
||||
@@ -12,6 +13,7 @@ import org.briarproject.api.forum.ForumManager;
|
||||
import org.briarproject.api.forum.ForumPostFactory;
|
||||
import org.briarproject.api.forum.ForumSharingManager;
|
||||
import org.briarproject.api.identity.Author;
|
||||
import org.briarproject.api.identity.AuthorFactory;
|
||||
import org.briarproject.api.sync.MessageFactory;
|
||||
import org.briarproject.api.sync.ValidationManager;
|
||||
import org.briarproject.api.system.Clock;
|
||||
@@ -40,23 +42,18 @@ public class ForumModule {
|
||||
|
||||
@Provides
|
||||
ForumPostFactory provideForumPostFactory(CryptoComponent crypto,
|
||||
MessageFactory messageFactory,
|
||||
BdfWriterFactory bdfWriterFactory) {
|
||||
return new ForumPostFactoryImpl(crypto, messageFactory,
|
||||
bdfWriterFactory);
|
||||
ClientHelper clientHelper) {
|
||||
return new ForumPostFactoryImpl(crypto, clientHelper);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
ForumPostValidator provideForumPostValidator(
|
||||
ValidationManager validationManager, CryptoComponent crypto,
|
||||
BdfReaderFactory bdfReaderFactory,
|
||||
BdfWriterFactory bdfWriterFactory,
|
||||
ObjectReader<Author> authorReader, MetadataEncoder metadataEncoder,
|
||||
Clock clock) {
|
||||
AuthorFactory authorFactory, ClientHelper clientHelper,
|
||||
MetadataEncoder metadataEncoder, Clock clock) {
|
||||
ForumPostValidator validator = new ForumPostValidator(crypto,
|
||||
bdfReaderFactory, bdfWriterFactory, authorReader,
|
||||
metadataEncoder, clock);
|
||||
authorFactory, clientHelper, metadataEncoder, clock);
|
||||
validationManager.registerMessageValidator(
|
||||
ForumManagerImpl.CLIENT_ID, validator);
|
||||
return validator;
|
||||
@@ -65,11 +62,10 @@ public class ForumModule {
|
||||
@Provides
|
||||
@Singleton
|
||||
ForumListValidator provideForumListValidator(
|
||||
ValidationManager validationManager,
|
||||
BdfReaderFactory bdfReaderFactory,
|
||||
MetadataEncoder metadataEncoder) {
|
||||
ForumListValidator validator = new ForumListValidator(bdfReaderFactory,
|
||||
metadataEncoder);
|
||||
ValidationManager validationManager, ClientHelper clientHelper,
|
||||
MetadataEncoder metadataEncoder, Clock clock) {
|
||||
ForumListValidator validator = new ForumListValidator(clientHelper,
|
||||
metadataEncoder, clock);
|
||||
validationManager.registerMessageValidator(
|
||||
ForumSharingManagerImpl.CLIENT_ID, validator);
|
||||
return validator;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.messaging;
|
||||
|
||||
import org.briarproject.api.clients.ClientHelper;
|
||||
import org.briarproject.api.contact.ContactManager;
|
||||
import org.briarproject.api.data.BdfReaderFactory;
|
||||
import org.briarproject.api.data.BdfWriterFactory;
|
||||
@@ -25,19 +26,18 @@ public class MessagingModule {
|
||||
|
||||
@Provides
|
||||
PrivateMessageFactory providePrivateMessageFactory(
|
||||
MessageFactory messageFactory,
|
||||
BdfWriterFactory bdfWriterFactory) {
|
||||
return new PrivateMessageFactoryImpl(messageFactory, bdfWriterFactory);
|
||||
ClientHelper clientHelper) {
|
||||
return new PrivateMessageFactoryImpl(clientHelper);
|
||||
}
|
||||
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
PrivateMessageValidator getValidator(ValidationManager validationManager,
|
||||
BdfReaderFactory bdfReaderFactory, MetadataEncoder metadataEncoder,
|
||||
ClientHelper clientHelper, MetadataEncoder metadataEncoder,
|
||||
Clock clock) {
|
||||
PrivateMessageValidator validator = new PrivateMessageValidator(
|
||||
bdfReaderFactory, metadataEncoder, clock);
|
||||
clientHelper, metadataEncoder, clock);
|
||||
validationManager.registerMessageValidator(CLIENT_ID, validator);
|
||||
return validator;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.briarproject.clients.BdfMessageValidator;
|
||||
import static org.briarproject.api.messaging.MessagingConstants.MAX_CONTENT_TYPE_LENGTH;
|
||||
import static org.briarproject.api.messaging.MessagingConstants.MAX_PRIVATE_MESSAGE_BODY_LENGTH;
|
||||
|
||||
class PrivateMessageValidator extends BdfMessageValidator {
|
||||
public class PrivateMessageValidator extends BdfMessageValidator {
|
||||
|
||||
PrivateMessageValidator(ClientHelper clientHelper,
|
||||
MetadataEncoder metadataEncoder, Clock clock) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.properties;
|
||||
|
||||
import org.briarproject.api.clients.ClientHelper;
|
||||
import org.briarproject.api.contact.ContactManager;
|
||||
import org.briarproject.api.data.BdfReaderFactory;
|
||||
import org.briarproject.api.data.MetadataEncoder;
|
||||
@@ -23,10 +24,10 @@ public class PropertiesModule {
|
||||
@Provides
|
||||
@Singleton
|
||||
TransportPropertyValidator getValidator(ValidationManager validationManager,
|
||||
BdfReaderFactory bdfReaderFactory, MetadataEncoder metadataEncoder,
|
||||
ClientHelper clientHelper, MetadataEncoder metadataEncoder,
|
||||
Clock clock) {
|
||||
TransportPropertyValidator validator = new TransportPropertyValidator(
|
||||
bdfReaderFactory, metadataEncoder, clock);
|
||||
clientHelper, metadataEncoder, clock);
|
||||
validationManager.registerMessageValidator(CLIENT_ID, validator);
|
||||
return validator;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import static org.briarproject.api.TransportId.MAX_TRANSPORT_ID_LENGTH;
|
||||
import static org.briarproject.api.properties.TransportPropertyConstants.MAX_PROPERTIES_PER_TRANSPORT;
|
||||
import static org.briarproject.api.properties.TransportPropertyConstants.MAX_PROPERTY_LENGTH;
|
||||
|
||||
class TransportPropertyValidator extends BdfMessageValidator {
|
||||
public class TransportPropertyValidator extends BdfMessageValidator {
|
||||
|
||||
TransportPropertyValidator(ClientHelper clientHelper,
|
||||
MetadataEncoder metadataEncoder, Clock clock) {
|
||||
|
||||
@@ -55,6 +55,7 @@ public class TestLifecycleModule {
|
||||
};
|
||||
}
|
||||
|
||||
@Provides
|
||||
ShutdownManager provideShutdownManager() {
|
||||
return new ShutdownManager() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user