mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
Extracted single/batch control services creation into a factory for ease of reusablility for the sake of this migration.
This commit is contained in:
@ -0,0 +1,18 @@
|
||||
import 'package:syncrow_web/services/batch_control_devices_service.dart';
|
||||
import 'package:syncrow_web/services/control_device_service.dart';
|
||||
|
||||
abstract final class DeviceBlocDependenciesFactory {
|
||||
const DeviceBlocDependenciesFactory._();
|
||||
|
||||
static ControlDeviceService createControlDeviceService() {
|
||||
return DebouncedControlDeviceService(
|
||||
decoratee: RemoteControlDeviceService(),
|
||||
);
|
||||
}
|
||||
|
||||
static BatchControlDevicesService createBatchControlDevicesService() {
|
||||
return DebouncedBatchControlDevicesService(
|
||||
decoratee: RemoteBatchControlDevicesService(),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
import 'package:syncrow_web/pages/device_managment/factories/device_bloc_dependencies_factory.dart';
|
||||
import 'package:syncrow_web/pages/device_managment/flush_mounted_presence_sensor/bloc/flush_mounted_presence_sensor_bloc.dart';
|
||||
import 'package:syncrow_web/services/batch_control_devices_service.dart';
|
||||
import 'package:syncrow_web/services/control_device_service.dart';
|
||||
|
||||
abstract final class FlushMountedPresenceSensorBlocFactory {
|
||||
const FlushMountedPresenceSensorBlocFactory._();
|
||||
@ -10,12 +9,8 @@ abstract final class FlushMountedPresenceSensorBlocFactory {
|
||||
}) {
|
||||
return FlushMountedPresenceSensorBloc(
|
||||
deviceId: deviceId,
|
||||
controlDeviceService: DebouncedControlDeviceService(
|
||||
decoratee: RemoteControlDeviceService(),
|
||||
),
|
||||
batchControlDevicesService: DebouncedBatchControlDevicesService(
|
||||
decoratee: RemoteBatchControlDevicesService(),
|
||||
),
|
||||
controlDeviceService: DeviceBlocDependenciesFactory.createControlDeviceService(),
|
||||
batchControlDevicesService: DeviceBlocDependenciesFactory.createBatchControlDevicesService(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user