Make ProxiedDevices a subclass of PollingDeviceDiscovery. (#130640)

The daemon ignores all device discovery that is not a PollingDeviceDiscovery. Make ProxiedDevices a PollingDeviceDiscovery so that it can be used in flutter daemon.

Note that there is a TODO item added in the test, which I intend to attempt fixing in a subsequent PR.
This commit is contained in:
Lau Ching Jun
2023-07-17 10:40:12 -07:00
committed by GitHub
parent e06650bdbe
commit d64cc47920
2 changed files with 44 additions and 3 deletions

View File

@@ -36,14 +36,15 @@ T _cast<T>(Object? object) {
///
/// If [deltaFileTransfer] is true, the proxy will use an rsync-like algorithm that
/// only transfers the changed part of the application package for deployment.
class ProxiedDevices extends DeviceDiscovery {
class ProxiedDevices extends PollingDeviceDiscovery {
ProxiedDevices(this.connection, {
bool deltaFileTransfer = true,
bool enableDdsProxy = false,
required Logger logger,
}) : _deltaFileTransfer = deltaFileTransfer,
_enableDdsProxy = enableDdsProxy,
_logger = logger;
_logger = logger,
super('Proxied devices');
/// [DaemonConnection] used to communicate with the daemon.
final DaemonConnection connection;
@@ -88,6 +89,9 @@ class ProxiedDevices extends DeviceDiscovery {
return filter.filterDevices(devices);
}
@override
Future<List<Device>> pollingGetDevices({Duration? timeout}) => discoverDevices(timeout: timeout);
@override
List<String> get wellKnownIds => const <String>[];