Skip to content

Commit

Permalink
Improved class naming
Browse files Browse the repository at this point in the history
  • Loading branch information
guyluz11 committed Dec 18, 2023
1 parent 0b968ca commit f2aa212
Show file tree
Hide file tree
Showing 33 changed files with 248 additions and 276 deletions.
43 changes: 20 additions & 23 deletions lib/domain/device/i_device_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import 'dart:io';
import 'package:cbj_integrations_controller/domain/room/room_entity.dart';
import 'package:cbj_integrations_controller/infrastructure/devices/device_helper/device_helper.dart';
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_hub_server/protoc_as_dart/cbj_hub_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/infrastructure/generic_entities/abstract_entity/device_entity_abstract.dart';
import 'package:cbj_integrations_controller/infrastructure/generic_entities/abstract_entity/device_entity_dto_abstract.dart';
import 'package:cbj_integrations_controller/infrastructure/generic_entities/abstract_entity/device_entity_base.dart';
import 'package:cbj_integrations_controller/infrastructure/generic_entities/abstract_entity/device_entity_dto_base.dart';
import 'package:cbj_integrations_controller/infrastructure/generic_entities/generic_blinds_entity/generic_blinds_entity.dart';
import 'package:cbj_integrations_controller/infrastructure/generic_entities/generic_blinds_entity/generic_blinds_value_objects.dart';
import 'package:cbj_integrations_controller/infrastructure/generic_entities/generic_boiler_entity/generic_boiler_entity.dart';
Expand Down Expand Up @@ -49,42 +49,39 @@ abstract interface class IDeviceRepository {
return _instance ??= _DeviceRepository();
}

void addOrUpdateDevice(DeviceEntityAbstract deviceEntity);
void addOrUpdateDevice(DeviceEntityBase deviceEntity);

void addOrUpdateDeviceAndStateToWaiting(DeviceEntityAbstract deviceEntity);
void addOrUpdateDeviceAndStateToWaiting(DeviceEntityBase deviceEntity);

Future<void> initiateHubConnection();

Future<Either<DevicesFailure, KtList<DeviceEntityAbstract?>>> getAllDevices();
Future<Either<DevicesFailure, KtList<DeviceEntityBase?>>> getAllDevices();

Stream<Either<dynamic, KtList<dynamic>>> watchAll();

Stream<Either<DevicesFailure, KtList<DeviceEntityAbstract?>>>
watchAllDevices();
Stream<Either<DevicesFailure, KtList<DeviceEntityBase?>>> watchAllDevices();

Stream<Either<DevicesFailure, KtList<DeviceEntityAbstract?>>> watchLights();
Stream<Either<DevicesFailure, KtList<DeviceEntityBase?>>> watchLights();

Stream<Either<DevicesFailure, KtList<DeviceEntityAbstract?>>> watchBlinds();
Stream<Either<DevicesFailure, KtList<DeviceEntityBase?>>> watchBlinds();

Stream<Either<DevicesFailure, KtList<DeviceEntityAbstract?>>> watchBoilers();
Stream<Either<DevicesFailure, KtList<DeviceEntityBase?>>> watchBoilers();

Stream<Either<DevicesFailure, KtList<DeviceEntityAbstract?>>> watchSmartTv();
Stream<Either<DevicesFailure, KtList<DeviceEntityBase?>>> watchSmartTv();

Stream<Either<DevicesFailure, KtList<DeviceEntityAbstract?>>> watchSwitches();
Stream<Either<DevicesFailure, KtList<DeviceEntityBase?>>> watchSwitches();

Stream<Either<DevicesFailure, KtList<DeviceEntityAbstract?>>>
watchSmartPlugs();
Stream<Either<DevicesFailure, KtList<DeviceEntityBase?>>> watchSmartPlugs();

Stream<Either<DevicesFailure, KtList<DeviceEntityAbstract?>>>
Stream<Either<DevicesFailure, KtList<DeviceEntityBase?>>>
watchSmartComputers();

Stream<Either<DevicesFailure, KtList<DeviceEntityAbstract?>>> watchPrinters();
Stream<Either<DevicesFailure, KtList<DeviceEntityBase?>>> watchPrinters();

Stream<Either<DevicesFailure, KtList<DeviceEntityAbstract?>>>
watchUncompleted();
Stream<Either<DevicesFailure, KtList<DeviceEntityBase?>>> watchUncompleted();

Future<Either<DevicesFailure, Unit>> create(
DeviceEntityAbstract deviceEntity,
DeviceEntityBase deviceEntity,
);

/// Update document in the database in the following fields
Expand All @@ -94,7 +91,7 @@ abstract interface class IDeviceRepository {
});

Future<Either<DevicesFailure, Unit>> updateWithDeviceEntity({
required DeviceEntityAbstract deviceEntity,
required DeviceEntityBase deviceEntity,
});

Future<Either<DevicesFailure, Unit>> turnOnDevices({
Expand Down Expand Up @@ -174,7 +171,7 @@ abstract interface class IDeviceRepository {
});

Future<Either<DevicesFailure, Unit>> delete(
DeviceEntityAbstract deviceEntity,
DeviceEntityBase deviceEntity,
);

BehaviorSubject<KtList<dynamic>> allResponseFromTheHubStreamController =
Expand All @@ -183,7 +180,7 @@ abstract interface class IDeviceRepository {
BehaviorSubject<KtList<RoomEntity>> roomsResponseFromTheHubStreamController =
BehaviorSubject<KtList<RoomEntity>>();

BehaviorSubject<KtList<DeviceEntityAbstract>>
BehaviorSubject<KtList<DeviceEntityBase>>
devicesResponseFromTheHubStreamController =
BehaviorSubject<KtList<DeviceEntityAbstract>>();
BehaviorSubject<KtList<DeviceEntityBase>>();
}
4 changes: 2 additions & 2 deletions lib/domain/i_phone_as_hub.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'dart:collection';

import 'package:cbj_integrations_controller/infrastructure/devices_service.dart';
import 'package:cbj_integrations_controller/infrastructure/gen/cbj_hub_server/protoc_as_dart/cbj_hub_server.pbgrpc.dart';
import 'package:cbj_integrations_controller/infrastructure/generic_entities/abstract_entity/device_entity_abstract.dart';
import 'package:cbj_integrations_controller/infrastructure/generic_entities/abstract_entity/device_entity_base.dart';
import 'package:cbj_integrations_controller/infrastructure/generic_entities/entity_type_utils.dart';
import 'package:cbj_integrations_controller/infrastructure/search_devices.dart';

Expand All @@ -25,7 +25,7 @@ abstract interface class IPhoneAsHub {
dynamic value,
});

Future<Map<String, DeviceEntityAbstract>> get getAllEntities;
Future<Map<String, DeviceEntityBase>> get getAllEntities;

void startListen();

Expand Down
Loading

0 comments on commit f2aa212

Please sign in to comment.