curtain wizard & bugs fixes

This commit is contained in:
mohammad
2024-10-09 14:58:08 +03:00
parent e0049c0aec
commit 465a2e3108
22 changed files with 158 additions and 117 deletions

View File

@ -1,5 +1,6 @@
import 'dart:async';
import 'dart:convert';
import 'dart:developer';
import 'package:syncrow_app/features/devices/model/device_category_model.dart';
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
@ -60,11 +61,8 @@ class DevicesAPI {
}
static Future<List<DevicesCategoryModel>> fetchGroups(String spaceId) async {
// Map<String, dynamic> params = {"homeId": spaceId, "pageSize": 100, "pageNo": 1};
final response = await _httpService.get(
path: ApiEndpoints.groupBySpace.replaceAll('{unitUuid}', spaceId),
// queryParameters: params,
showServerMessage: false,
expectedResponseModel: (json) => DevicesCategoryModel.fromJsonList(json),
);
@ -72,12 +70,12 @@ class DevicesAPI {
}
static Future<Map<String, dynamic>> getDeviceStatus(String deviceId) async {
print(deviceId);
final response = await _httpService.get(
path: ApiEndpoints.deviceFunctionsStatus
.replaceAll('{deviceUuid}', deviceId),
showServerMessage: false,
expectedResponseModel: (json) {
print('json======${json}');
return json;
},
);
@ -124,6 +122,7 @@ class DevicesAPI {
return <DeviceModel>[];
}
List<DeviceModel> devices = [];
for (var device in json) {
devices.add(DeviceModel.fromJson(device));
}
@ -386,13 +385,11 @@ class DevicesAPI {
String? code,
var value,
}) async {
print({"devicesUuid": devicesUuid, "code": code, "value": value});
final response = await _httpService.post(
path: ApiEndpoints.controlBatch,
body: {"devicesUuid": devicesUuid, "code": code, "value": value},
showServerMessage: true,
expectedResponseModel: (json) {
print('json-=-=-=-=-=-${json}');
return json;
},
);