Skip to content

Commit

Permalink
Merge pull request #723 from CyBear-Jinni/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
guyluz11 authored Jan 27, 2024
2 parents 68ea31b + 9553d40 commit 95747ed
Show file tree
Hide file tree
Showing 87 changed files with 1,455 additions and 3,272 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

env:
flutter_channel: 'stable' # or: 'dev' or 'beta'
flutter_version: '3.13.6'
flutter_version: '3.16.5'

jobs:
build:
Expand Down
46 changes: 34 additions & 12 deletions lib/domain/connections_service.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
import 'dart:async';
import 'dart:collection';
import 'dart:convert';
import 'dart:io';

import 'package:cbj_integrations_controller/integrations_controller.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:cybearjinni/infrastructure/core/injection.dart';
import 'package:cybearjinni/infrastructure/core/logger.dart';
import 'package:cybearjinni/infrastructure/network_utilities_flutter.dart';
import 'package:dartz/dartz.dart';
import 'package:flutter/foundation.dart';
import 'package:grpc/grpc.dart';
import 'package:location/location.dart';
import 'package:network_info_plus/network_info_plus.dart';
import 'package:network_tools_flutter/network_tools_flutter.dart';
import 'package:permission_handler/permission_handler.dart'
as permission_handler;
import 'package:rxdart/rxdart.dart';

part 'package:cybearjinni/infrastructure/connection_service/app_connection_service.dart';
part 'package:cybearjinni/infrastructure/connection_service/hub_connection_service.dart';
part 'package:cybearjinni/infrastructure/connection_service/demo_connection_service.dart';
part 'package:cybearjinni/infrastructure/connection_service/none_connection_service.dart';
part 'package:cybearjinni/infrastructure/connection_service/remote_pipes_connection_service.dart';

enum ConnectionType {
appAsHub,
Expand All @@ -26,39 +42,41 @@ abstract interface class ConnectionsService {

static ConnectionType _currentConnectionType = ConnectionType.appAsHub;

static void setCurrentConnectionType(ConnectionType? connectionType) {
static void setCurrentConnectionType(ConnectionType connectionType) {
if (connectionType == _currentConnectionType) {
return;
}
final ConnectionsService? oldInstance = _instance;
_instance?.dispose();

_currentConnectionType = connectionType;

switch (connectionType) {
case ConnectionType.appAsHub:
_instance = _AppConnectionService();
_currentConnectionType = ConnectionType.appAsHub;
case ConnectionType.demo:
case ConnectionType.hub:
_instance = _HubConnectionService();
case ConnectionType.remotePipes:
_instance = _RemotePipesConnectionService();
case ConnectionType.demo:
_instance = _DemoConnectionService();
_currentConnectionType = ConnectionType.demo;
case ConnectionType.none:
case null:
_instance = _NoneConnectionService();
_currentConnectionType = ConnectionType.none;
}
oldInstance?.dispose();
}

static ConnectionType getCurrentConnectionType() => _currentConnectionType;

Future<bool> connect({String? address});

Future searchDevices();

void setEntityState(ActionObject action);
void setEntityState(RequestActionObject action);

Future setEtitiesToArea(String areaId, HashSet<String> entities);

Future<HashMap<String, DeviceEntityBase>> get getAllEntities;
Future<HashMap<String, DeviceEntityBase>> get getEntities;

Future<HashMap<String, AreaEntity>> get getAllAreas;
Future<HashMap<String, AreaEntity>> get getAreas;

Stream<MapEntry<String, DeviceEntityBase>> watchEntities();

Expand All @@ -68,9 +86,13 @@ abstract interface class ConnectionsService {

Future setNewArea(AreaEntity area);

Future<HashMap<String, SceneCbjEntity>> getScenes();
Future<HashMap<String, SceneCbjEntity>> get getScenes;

Future activateScene(String id);

Future addScene(SceneCbjEntity scene);

Future loginVendor(VendorLoginEntity value);

Future<List<VendorEntityInformation>> getVendors();
}
14 changes: 0 additions & 14 deletions lib/domain/device/devices_errors.dart

This file was deleted.

35 changes: 0 additions & 35 deletions lib/domain/device/devices_failures.dart

This file was deleted.

88 changes: 0 additions & 88 deletions lib/domain/device/devices_validators.dart

This file was deleted.

145 changes: 0 additions & 145 deletions lib/domain/device/i_device_repository.dart

This file was deleted.

Loading

0 comments on commit 95747ed

Please sign in to comment.