mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-14 17:25:47 +00:00
Refactor device_info_model.dart and devices_api.dart
This commit is contained in:
@ -77,7 +77,7 @@ class DeviceInfoModel {
|
||||
uuid: json['uuid'],
|
||||
productUuid: json['productUuid'],
|
||||
productType: json['productType'],
|
||||
permissionType: json['permissionType'],
|
||||
permissionType: json['permissionType'] ?? '',
|
||||
macAddress: json['macAddress'],
|
||||
subspace: Subspace.fromJson(json['subspace']),
|
||||
);
|
||||
|
@ -102,7 +102,8 @@ class DevicesAPI {
|
||||
static Future<Map<String, dynamic>> getPowerClampStatus(
|
||||
String deviceId) async {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.deviceFunctionsStatus.replaceAll('{deviceUuid}', deviceId),
|
||||
path: ApiEndpoints.deviceFunctionsStatus
|
||||
.replaceAll('{deviceUuid}', deviceId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
@ -144,7 +145,7 @@ class DevicesAPI {
|
||||
path: ApiEndpoints.deviceScene.replaceAll('{deviceUuid}', deviceId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
return json['data'];
|
||||
});
|
||||
return response;
|
||||
}
|
||||
@ -593,10 +594,11 @@ class DevicesAPI {
|
||||
}
|
||||
final result = <DeviceModel>[];
|
||||
for (final device in data) {
|
||||
final mappedDevice = DeviceModel.fromJson(device);
|
||||
if (mappedDevice.productType?.name != DeviceType.FlushMountedSensor.name) {
|
||||
result.add(mappedDevice);
|
||||
}
|
||||
final mappedDevice = DeviceModel.fromJson(device);
|
||||
if (mappedDevice.productType?.name !=
|
||||
DeviceType.FlushMountedSensor.name) {
|
||||
result.add(mappedDevice);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
Reference in New Issue
Block a user