mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-25 03:27:56 +00:00
Fixed logout issue
This commit is contained in:
@@ -293,10 +293,8 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
if (roomId == null) return;
|
||||
|
||||
emitSafe(GetDevicesLoading());
|
||||
int roomIndex = HomeCubit.getInstance()
|
||||
.selectedSpace!
|
||||
.rooms!
|
||||
.indexWhere((element) => element.id == roomId);
|
||||
int roomIndex =
|
||||
HomeCubit.getInstance().selectedSpace!.rooms!.indexWhere((element) => element.id == roomId);
|
||||
try {
|
||||
HomeCubit.getInstance().selectedSpace!.rooms![roomIndex].devices =
|
||||
await DevicesAPI.getDevicesByRoomId(roomId);
|
||||
@@ -308,8 +306,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
|
||||
//get status for each device
|
||||
//TODO get devices status per page via page controller instead of getting all devices status at once
|
||||
List<DeviceModel> devices =
|
||||
HomeCubit.getInstance().selectedSpace!.rooms![roomIndex].devices!;
|
||||
List<DeviceModel> devices = HomeCubit.getInstance().selectedSpace!.rooms![roomIndex].devices!;
|
||||
if (devices.isNotEmpty) {
|
||||
for (var device in devices) {
|
||||
fetchDevicesStatues(device.uuid!, roomIndex);
|
||||
@@ -334,11 +331,8 @@ class DevicesCubit extends Cubit<DevicesState> {
|
||||
emitSafe(GetDeviceStatusError(e.toString()));
|
||||
return;
|
||||
}
|
||||
HomeCubit.getInstance()
|
||||
.selectedSpace!
|
||||
.rooms![roomIndex]
|
||||
.devices![deviceIndex]
|
||||
.status = statuses;
|
||||
HomeCubit.getInstance().selectedSpace!.rooms![roomIndex].devices![deviceIndex].status =
|
||||
statuses;
|
||||
emitSafe(GetDeviceStatusSuccess(code: code));
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,7 @@ class LightsView extends StatelessWidget {
|
||||
builder: (context, state) {
|
||||
DeviceModel? selectedLight;
|
||||
if (DevicesCubit.getInstance().getSelectedDevice() is DeviceModel) {
|
||||
selectedLight =
|
||||
DevicesCubit.getInstance().getSelectedDevice() as DeviceModel;
|
||||
selectedLight = DevicesCubit.getInstance().getSelectedDevice() as DeviceModel;
|
||||
}
|
||||
List<DeviceModel> lights = [];
|
||||
if (DevicesCubit.allCategories![1].devices != null) {
|
||||
|
||||
Reference in New Issue
Block a user