mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 13:19:52 +01:00
Clean up plugin injection code, remove unused module.
This commit is contained in:
@@ -47,7 +47,7 @@ public class AndroidBluetoothPluginFactory implements DuplexPluginFactory {
|
|||||||
private final BackoffFactory backoffFactory;
|
private final BackoffFactory backoffFactory;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public AndroidBluetoothPluginFactory(@IoExecutor Executor ioExecutor,
|
AndroidBluetoothPluginFactory(@IoExecutor Executor ioExecutor,
|
||||||
@WakefulIoExecutor Executor wakefulIoExecutor,
|
@WakefulIoExecutor Executor wakefulIoExecutor,
|
||||||
AndroidExecutor androidExecutor,
|
AndroidExecutor androidExecutor,
|
||||||
AndroidWakeLockManager wakeLockManager,
|
AndroidWakeLockManager wakeLockManager,
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class AndroidLanTcpPluginFactory implements DuplexPluginFactory {
|
|||||||
private final Application app;
|
private final Application app;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public AndroidLanTcpPluginFactory(@IoExecutor Executor ioExecutor,
|
AndroidLanTcpPluginFactory(@IoExecutor Executor ioExecutor,
|
||||||
@WakefulIoExecutor Executor wakefulIoExecutor,
|
@WakefulIoExecutor Executor wakefulIoExecutor,
|
||||||
EventBus eventBus,
|
EventBus eventBus,
|
||||||
BackoffFactory backoffFactory,
|
BackoffFactory backoffFactory,
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class AndroidTorPluginFactory implements DuplexPluginFactory {
|
|||||||
private final File torDirectory;
|
private final File torDirectory;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public AndroidTorPluginFactory(@IoExecutor Executor ioExecutor,
|
AndroidTorPluginFactory(@IoExecutor Executor ioExecutor,
|
||||||
@WakefulIoExecutor Executor wakefulIoExecutor,
|
@WakefulIoExecutor Executor wakefulIoExecutor,
|
||||||
Application app,
|
Application app,
|
||||||
NetworkManager networkManager,
|
NetworkManager networkManager,
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
package org.briarproject.bramble.plugin;
|
|
||||||
|
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
|
||||||
import org.briarproject.bramble.api.plugin.BluetoothConstants;
|
|
||||||
import org.briarproject.bramble.api.plugin.LanTcpConstants;
|
|
||||||
import org.briarproject.bramble.api.plugin.PluginConfig;
|
|
||||||
import org.briarproject.bramble.api.plugin.TransportId;
|
|
||||||
import org.briarproject.bramble.api.plugin.duplex.DuplexPluginFactory;
|
|
||||||
import org.briarproject.bramble.api.plugin.simplex.SimplexPluginFactory;
|
|
||||||
import org.briarproject.bramble.plugin.bluetooth.JavaBluetoothPluginFactory;
|
|
||||||
import org.briarproject.bramble.plugin.modem.ModemPluginFactory;
|
|
||||||
import org.briarproject.bramble.plugin.tcp.LanTcpPluginFactory;
|
|
||||||
import org.briarproject.bramble.plugin.tcp.WanTcpPluginFactory;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import dagger.Module;
|
|
||||||
import dagger.Provides;
|
|
||||||
|
|
||||||
import static java.util.Arrays.asList;
|
|
||||||
import static java.util.Collections.emptyList;
|
|
||||||
import static java.util.Collections.singletonList;
|
|
||||||
import static java.util.Collections.singletonMap;
|
|
||||||
|
|
||||||
@Module
|
|
||||||
public class DesktopPluginModule extends PluginModule {
|
|
||||||
|
|
||||||
@Provides
|
|
||||||
PluginConfig getPluginConfig(JavaBluetoothPluginFactory bluetooth,
|
|
||||||
ModemPluginFactory modem, LanTcpPluginFactory lan,
|
|
||||||
WanTcpPluginFactory wan) {
|
|
||||||
@NotNullByDefault
|
|
||||||
PluginConfig pluginConfig = new PluginConfig() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<DuplexPluginFactory> getDuplexFactories() {
|
|
||||||
return asList(bluetooth, modem, lan, wan);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Collection<SimplexPluginFactory> getSimplexFactories() {
|
|
||||||
return emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldPoll() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<TransportId, List<TransportId>> getTransportPreferences() {
|
|
||||||
// Prefer LAN to Bluetooth
|
|
||||||
return singletonMap(BluetoothConstants.ID,
|
|
||||||
singletonList(LanTcpConstants.ID));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return pluginConfig;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -56,7 +56,7 @@ public class UnixTorPluginFactory implements DuplexPluginFactory {
|
|||||||
private final File torDirectory;
|
private final File torDirectory;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public UnixTorPluginFactory(@IoExecutor Executor ioExecutor,
|
UnixTorPluginFactory(@IoExecutor Executor ioExecutor,
|
||||||
@WakefulIoExecutor Executor wakefulIoExecutor,
|
@WakefulIoExecutor Executor wakefulIoExecutor,
|
||||||
NetworkManager networkManager,
|
NetworkManager networkManager,
|
||||||
LocationUtils locationUtils,
|
LocationUtils locationUtils,
|
||||||
|
|||||||
@@ -149,6 +149,7 @@ public class AppModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
@Singleton
|
||||||
PluginConfig providePluginConfig(AndroidBluetoothPluginFactory bluetooth,
|
PluginConfig providePluginConfig(AndroidBluetoothPluginFactory bluetooth,
|
||||||
AndroidTorPluginFactory tor, AndroidLanTcpPluginFactory lan,
|
AndroidTorPluginFactory tor, AndroidLanTcpPluginFactory lan,
|
||||||
RemovableDrivePluginFactory drive) {
|
RemovableDrivePluginFactory drive) {
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ internal class HeadlessModule(private val appDir: File) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
@Singleton
|
||||||
internal fun providePluginConfig(tor: UnixTorPluginFactory): PluginConfig {
|
internal fun providePluginConfig(tor: UnixTorPluginFactory): PluginConfig {
|
||||||
val duplex: List<DuplexPluginFactory> =
|
val duplex: List<DuplexPluginFactory> =
|
||||||
if (isLinux() || isMac()) listOf(tor) else emptyList()
|
if (isLinux() || isMac()) listOf(tor) else emptyList()
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ internal class HeadlessTestModule(private val appDir: File) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
@Singleton
|
||||||
internal fun providePluginConfig(): PluginConfig {
|
internal fun providePluginConfig(): PluginConfig {
|
||||||
return object : PluginConfig {
|
return object : PluginConfig {
|
||||||
override fun getDuplexFactories(): Collection<DuplexPluginFactory> = emptyList()
|
override fun getDuplexFactories(): Collection<DuplexPluginFactory> = emptyList()
|
||||||
|
|||||||
Reference in New Issue
Block a user