mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-26 03:07:55 +00:00
connected all devices
This commit is contained in:
@@ -16,6 +16,7 @@ import 'package:syncrow_app/features/devices/view/widgets/lights/lights_view.dar
|
||||
import 'package:syncrow_app/features/devices/view/widgets/three_gang/three_gang_interface.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/smart_door/doors_list_view.dart';
|
||||
import 'package:syncrow_app/services/api/devices_api.dart';
|
||||
import 'package:syncrow_app/services/api/home_management_api.dart';
|
||||
import 'package:syncrow_app/services/api/network_exception.dart';
|
||||
import 'package:syncrow_app/services/api/spaces_api.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||
@@ -289,6 +290,9 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
|
||||
fetchDevicesByRoomId(String? roomId) async {
|
||||
if (roomId == null) return;
|
||||
if (roomId == '-1') {
|
||||
return fetchAllDevices();
|
||||
}
|
||||
|
||||
emitSafe(GetDevicesLoading());
|
||||
int roomIndex = HomeCubit.getInstance()
|
||||
@@ -316,6 +320,16 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
// }
|
||||
}
|
||||
|
||||
void fetchAllDevices() async {
|
||||
emitSafe(GetDevicesLoading());
|
||||
try {
|
||||
final allDevices = await HomeManagementAPI.fetchDevicesByUserId();
|
||||
emitSafe(GetDevicesSuccess(allDevices));
|
||||
} catch (e) {
|
||||
emitSafe(GetDevicesError(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
fetchDevicesStatues(String deviceUuid, int roomIndex, {String? code}) async {
|
||||
emitSafe(GetDeviceStatusLoading(code: code));
|
||||
int deviceIndex = HomeCubit.getInstance()
|
||||
|
||||
Reference in New Issue
Block a user