mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-17 02:25:16 +00:00
Compare commits
5 Commits
SP-1416
...
SP-1285-FE
Author | SHA1 | Date | |
---|---|---|---|
73d28a1800 | |||
5493ca6fb0 | |||
7005d8ba83 | |||
1cff69d496 | |||
60df77efad |
2
.env.dev
2
.env.dev
@ -1,5 +1,3 @@
|
||||
ENV_NAME=development
|
||||
BASE_URL=https://syncrow-dev.azurewebsites.net
|
||||
PROJECT_ID=0e62577c-06fa-41b9-8a92-99a21fbaf51c
|
||||
CLIENT_ID=c024573d191a327ce74db7d4502fdc29
|
||||
CLIENT_SECRET=fec6ccbc33664f94a3b84a45c7cceef3f3ebd1613ef4307db8946ede530cd1ed
|
@ -1,6 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:syncrow_app/features/auth/model/login_with_email_model.dart';
|
||||
import 'package:syncrow_app/features/auth/model/signup_model.dart';
|
||||
@ -218,22 +217,9 @@ class AuthCubit extends Cubit<AuthState> {
|
||||
signUp() async {
|
||||
emit(AuthLoginLoading());
|
||||
final response;
|
||||
|
||||
final clientId = dotenv.env['CLIENT_ID'] ?? '';
|
||||
final clientSecret = dotenv.env['CLIENT_SECRET'] ?? '';
|
||||
|
||||
try {
|
||||
List<String> userFullName = fullName.split(' ');
|
||||
|
||||
final clientToken = await AuthenticationAPI.fetchClientToken(
|
||||
clientId: clientId,
|
||||
clientSecret: clientSecret,
|
||||
);
|
||||
|
||||
final accessToken = clientToken['accessToken'];
|
||||
|
||||
response = await AuthenticationAPI.signUp(
|
||||
accessToken: accessToken,
|
||||
model: SignUpModel(
|
||||
hasAcceptedAppAgreement: true,
|
||||
email: email.toLowerCase(),
|
||||
|
@ -169,18 +169,19 @@ class DeviceManagerBloc extends Bloc<DeviceManagerEvent, DeviceManagerState> {
|
||||
}
|
||||
}
|
||||
|
||||
_getOnlyImplementedDevices(List<DeviceModel> devices) {
|
||||
List<DeviceModel> implementedDevices = [];
|
||||
for (int i = 0; i < devices.length; i++) {
|
||||
if (devices[i].productType == DeviceType.AC ||
|
||||
devices[i].productType == DeviceType.DoorLock ||
|
||||
devices[i].productType == DeviceType.Gateway ||
|
||||
devices[i].productType == DeviceType.WallSensor ||
|
||||
devices[i].productType == DeviceType.CeilingSensor ||
|
||||
devices[i].productType == DeviceType.ThreeGang) {
|
||||
implementedDevices.add(devices[i]);
|
||||
}
|
||||
}
|
||||
return implementedDevices;
|
||||
List<DeviceModel> _getOnlyImplementedDevices(List<DeviceModel> devices) {
|
||||
const allowedDeviceTypes = {
|
||||
DeviceType.AC,
|
||||
DeviceType.DoorLock,
|
||||
DeviceType.Gateway,
|
||||
DeviceType.WallSensor,
|
||||
DeviceType.CeilingSensor,
|
||||
DeviceType.ThreeGang,
|
||||
DeviceType.OneGang,
|
||||
};
|
||||
|
||||
return devices
|
||||
.where((device) => allowedDeviceTypes.contains(device.productType))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,78 @@
|
||||
import 'package:syncrow_app/features/scene/enum/operation_dialog_type.dart';
|
||||
import 'package:syncrow_app/features/scene/model/scene_static_function.dart';
|
||||
import 'package:syncrow_app/generated/assets.dart';
|
||||
|
||||
class OneGangHelperFunctions {
|
||||
static List<SceneStaticFunction> oneGangHelperFunctions(
|
||||
String deviceId, String deviceName, functionValue) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'Light Switch',
|
||||
code: 'switch_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower, description: "ON", value: true),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'Light CountDown',
|
||||
code: 'countdown_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.countdown,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(icon: '', value: 0),
|
||||
],
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> oneGangAutomationFunctions(
|
||||
String deviceId, String deviceName, functionValue) {
|
||||
return [
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsAcPower,
|
||||
operationName: 'Light Switch',
|
||||
code: 'switch_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPower, description: "ON", value: true),
|
||||
SceneOperationalValue(
|
||||
icon: Assets.assetsAcPowerOFF, description: "OFF", value: false),
|
||||
],
|
||||
),
|
||||
SceneStaticFunction(
|
||||
deviceId: deviceId,
|
||||
deviceName: deviceName,
|
||||
icon: Assets.assetsLightCountdown,
|
||||
operationName: 'Light CountDown',
|
||||
code: 'countdown_1',
|
||||
functionValue: functionValue,
|
||||
operationDialogType: OperationDialogType.integerSteps,
|
||||
operationalValues: [
|
||||
SceneOperationalValue(
|
||||
icon: '',
|
||||
description: "sec",
|
||||
value: 0.0,
|
||||
minValue: 0,
|
||||
maxValue: 43200,
|
||||
stepValue: 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ import 'package:syncrow_app/features/scene/helper/functions_per_device/ac_functi
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/door_lock_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/gateway_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/human_presence_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/one_gang_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/presence_sensor.dart';
|
||||
import 'package:syncrow_app/features/scene/helper/functions_per_device/three_gang_functions.dart';
|
||||
import 'package:syncrow_app/features/scene/model/scene_details_model.dart';
|
||||
@ -14,8 +15,9 @@ import 'package:syncrow_app/generated/assets.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||
|
||||
mixin SceneOperationsDataHelper {
|
||||
final Map<DeviceType, Function(List<FunctionModel>, String, String, dynamic, bool)> _functionMap =
|
||||
{
|
||||
final Map<DeviceType,
|
||||
Function(List<FunctionModel>, String, String, dynamic, bool)>
|
||||
_functionMap = {
|
||||
DeviceType.LightBulb: lightBulbFunctions,
|
||||
DeviceType.CeilingSensor: ceilingSensorFunctions,
|
||||
DeviceType.WallSensor: wallSensorFunctions,
|
||||
@ -24,6 +26,7 @@ mixin SceneOperationsDataHelper {
|
||||
DeviceType.Curtain: curtainFunctions,
|
||||
DeviceType.ThreeGang: threeGangFunctions,
|
||||
DeviceType.Gateway: gatewayFunctions,
|
||||
DeviceType.OneGang: oneGangFunctions,
|
||||
};
|
||||
|
||||
final Map<DeviceType, String> _titleMap = {
|
||||
@ -35,7 +38,24 @@ mixin SceneOperationsDataHelper {
|
||||
DeviceType.Curtain: 'Curtain Functions',
|
||||
DeviceType.ThreeGang: '3G Light Switch Functions',
|
||||
DeviceType.Gateway: 'Gateway Functions',
|
||||
DeviceType.OneGang: '1G Light Switch Conditions',
|
||||
};
|
||||
static String _productTypeCache = '';
|
||||
|
||||
//one gang functions
|
||||
static List<SceneStaticFunction> oneGangFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
if (isAutomation) {
|
||||
return OneGangHelperFunctions.oneGangAutomationFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
return OneGangHelperFunctions.oneGangHelperFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
List<SceneStaticFunction> getFunctionsWithIcons({
|
||||
DeviceType? type,
|
||||
@ -45,16 +65,22 @@ mixin SceneOperationsDataHelper {
|
||||
required bool isAutomation,
|
||||
}) {
|
||||
final functionValue = null;
|
||||
return _functionMap[type]?.call(functions, deviceId, deviceName, functionValue, isAutomation) ??
|
||||
lightBulbFunctions(functions, deviceId, deviceName, functionValue, isAutomation);
|
||||
return _functionMap[type]?.call(
|
||||
functions, deviceId, deviceName, functionValue, isAutomation) ??
|
||||
lightBulbFunctions(
|
||||
functions, deviceId, deviceName, functionValue, isAutomation);
|
||||
}
|
||||
|
||||
String getTitle({DeviceType? type}) {
|
||||
return _titleMap[type] ?? '';
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> ceilingSensorFunctions(List<FunctionModel> functions,
|
||||
String deviceId, String deviceName, dynamic functionValue, bool isAutomation) {
|
||||
static List<SceneStaticFunction> ceilingSensorFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
if (isAutomation) {
|
||||
return PresenceSensorHelperFunctions.automationPresenceSensorFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
@ -63,22 +89,35 @@ mixin SceneOperationsDataHelper {
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> curtainFunctions(List<FunctionModel> functions, String deviceId,
|
||||
String deviceName, dynamic functionValue, bool isAutomation) {
|
||||
static List<SceneStaticFunction> curtainFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
return [];
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> doorLockFunctions(List<FunctionModel> functions, String deviceId,
|
||||
String deviceName, dynamic functionValue, bool isAutomation) {
|
||||
static List<SceneStaticFunction> doorLockFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
if (isAutomation) {
|
||||
return DoorLockHelperFunctions.doorLockAutomationFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
return DoorLockHelperFunctions.doorLockTapToRunFunctions(deviceId, deviceName, functionValue);
|
||||
return DoorLockHelperFunctions.doorLockTapToRunFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> wallSensorFunctions(List<FunctionModel> functions,
|
||||
String deviceId, String deviceName, dynamic functionValue, bool isAutomation) {
|
||||
static List<SceneStaticFunction> wallSensorFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
if (isAutomation) {
|
||||
return HumanPresenceHelperFunctions.automationHumanPresenceFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
@ -87,31 +126,51 @@ mixin SceneOperationsDataHelper {
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> lightBulbFunctions(List<FunctionModel> functions,
|
||||
String deviceId, String deviceName, dynamic functionValue, bool isAutomation) {
|
||||
static List<SceneStaticFunction> lightBulbFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
return [];
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> gatewayFunctions(List<FunctionModel> functions, String deviceId,
|
||||
String deviceName, dynamic functionValue, bool isAutomation) {
|
||||
return GatewayHelperFunctions.tabToRunGatewayFunctions(deviceId, deviceName, functionValue);
|
||||
static List<SceneStaticFunction> gatewayFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
return GatewayHelperFunctions.tabToRunGatewayFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> threeGangFunctions(List<FunctionModel> functions,
|
||||
String deviceId, String deviceName, dynamic functionValue, bool isAutomation) {
|
||||
static List<SceneStaticFunction> threeGangFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
if (isAutomation) {
|
||||
return ThreeGangHelperFunctions.threeGangAutomationFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
return ThreeGangHelperFunctions.threeGangHelperFunctions(deviceId, deviceName, functionValue);
|
||||
return ThreeGangHelperFunctions.threeGangHelperFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
static List<SceneStaticFunction> acFunctions(List<FunctionModel> functions, String deviceId,
|
||||
String deviceName, dynamic functionValue, bool isAutomation) {
|
||||
static List<SceneStaticFunction> acFunctions(
|
||||
List<FunctionModel> functions,
|
||||
String deviceId,
|
||||
String deviceName,
|
||||
dynamic functionValue,
|
||||
bool isAutomation) {
|
||||
if (isAutomation) {
|
||||
return ACFunctionsHelper.automationAcFunctions(deviceId, deviceName, functionValue);
|
||||
return ACFunctionsHelper.automationAcFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
return ACFunctionsHelper.tabToRunAcFunctions(deviceId, deviceName, functionValue);
|
||||
return ACFunctionsHelper.tabToRunAcFunctions(
|
||||
deviceId, deviceName, functionValue);
|
||||
}
|
||||
|
||||
List<SceneStaticFunction> getTaskListFunctionsFromApi({
|
||||
@ -149,8 +208,12 @@ mixin SceneOperationsDataHelper {
|
||||
SceneStaticFunction(
|
||||
deviceId: action.entityId,
|
||||
deviceName: action.name.toString(),
|
||||
deviceIcon: action.type == 'automation' ? Assets.player : Assets.handClickIcon,
|
||||
icon: action.type == 'automation' ? Assets.player : Assets.handClickIcon,
|
||||
deviceIcon: action.type == 'automation'
|
||||
? Assets.player
|
||||
: Assets.handClickIcon,
|
||||
icon: action.type == 'automation'
|
||||
? Assets.player
|
||||
: Assets.handClickIcon,
|
||||
operationName: action.type.toString(),
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
functionValue: action.actionExecutor,
|
||||
@ -170,7 +233,8 @@ mixin SceneOperationsDataHelper {
|
||||
),
|
||||
);
|
||||
} else {
|
||||
functions.add(_mapExecutorPropertyToSceneFunction(action, isAutomation));
|
||||
functions
|
||||
.add(_mapExecutorPropertyToSceneFunction(action, isAutomation));
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,7 +270,9 @@ mixin SceneOperationsDataHelper {
|
||||
}) {
|
||||
final executorProperty = action.executorProperty;
|
||||
|
||||
final Map<String, SceneStaticFunction Function(Action, bool, String?, String?)> functionMap = {
|
||||
final Map<String,
|
||||
SceneStaticFunction Function(Action, bool, String?, String?)>
|
||||
functionMap = {
|
||||
'sensitivity': _createSensitivityFunction,
|
||||
'normal_open_switch': _createNormalOpenSwitchFunction,
|
||||
'unlock_fingerprint': _createUnlockFingerprintFunction,
|
||||
@ -282,14 +348,16 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSensitivityFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createSensitivityFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Presence Sensor',
|
||||
Assets.assetsIconsSensors,
|
||||
'Sensitivity',
|
||||
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.listOfOptions,
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.listOfOptions,
|
||||
isAutomation ? _createIntegerStepsOptions() : _createSensitivityOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
@ -297,8 +365,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createNormalOpenSwitchFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createNormalOpenSwitchFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
@ -351,8 +419,8 @@ mixin SceneOperationsDataHelper {
|
||||
];
|
||||
}
|
||||
|
||||
SceneStaticFunction _createUnlockFingerprintFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createUnlockFingerprintFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
@ -366,8 +434,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createUnlockPasswordFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createUnlockPasswordFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
@ -381,8 +449,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createUnlockCardFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createUnlockCardFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
@ -396,8 +464,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createAlarmLockFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createAlarmLockFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
@ -411,8 +479,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createUnlockRequestFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createUnlockRequestFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
@ -426,8 +494,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createResidualElectricityFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createResidualElectricityFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
@ -441,8 +509,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createReverseLockFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createReverseLockFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
@ -456,8 +524,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createUnlockAppFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createUnlockAppFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
@ -471,8 +539,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createHijackFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createHijackFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
@ -486,8 +554,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createDoorbellFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createDoorbellFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
@ -501,8 +569,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createUnlockTemporaryFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createUnlockTemporaryFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'WIFI LOCK PRO',
|
||||
@ -516,8 +584,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createFarDetectionFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createFarDetectionFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
@ -531,8 +599,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createMotionSensitivityFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createMotionSensitivityFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
@ -546,8 +614,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createMotionlessSensitivityFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createMotionlessSensitivityFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
@ -561,8 +629,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createIndicatorFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createIndicatorFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
@ -576,8 +644,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createPresenceTimeFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createPresenceTimeFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
@ -591,8 +659,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createPresenceStateFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createPresenceStateFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
@ -606,14 +674,16 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createDisCurrentFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createDisCurrentFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
Assets.assetsIconsSensors,
|
||||
'Current Distance',
|
||||
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
_createCurrentDistanceOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
@ -621,8 +691,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createIlluminanceValueFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createIlluminanceValueFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
@ -636,8 +706,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createCheckingResultFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createCheckingResultFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Human Presence Sensor',
|
||||
@ -651,8 +721,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSwitchFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createSwitchFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Smart AC Thermostat - Grey - Model A',
|
||||
@ -666,23 +736,27 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createTempSetFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createTempSetFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Smart AC Thermostat - Grey - Model A',
|
||||
Assets.assetsIconsAC,
|
||||
'Set Temperature',
|
||||
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.temperature,
|
||||
isAutomation ? _createAutomationTemperatureOptions() : _createTemperatureOptions(),
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.temperature,
|
||||
isAutomation
|
||||
? _createAutomationTemperatureOptions()
|
||||
: _createTemperatureOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createTempCurrentFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createTempCurrentFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Smart AC Thermostat - Grey - Model A',
|
||||
@ -696,8 +770,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createModeFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createModeFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Smart AC Thermostat - Grey - Model A',
|
||||
@ -711,8 +785,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createLevelFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createLevelFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Smart AC Thermostat - Grey - Model A',
|
||||
@ -726,8 +800,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createChildLockFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createChildLockFunction(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Smart AC Thermostat - Grey - Model A',
|
||||
@ -741,23 +815,38 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSwitch1Function(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsIcons3GangSwitch,
|
||||
'Light 1 Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
SceneStaticFunction _createSwitch1Function(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
switch (action.productType) {
|
||||
case "3G":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsIcons3GangSwitch,
|
||||
'Light 1 Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
default:
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'1 Gang Button Switch L-L',
|
||||
Assets.oneGang,
|
||||
'Light Switch',
|
||||
OperationDialogType.onOff,
|
||||
_createOnOffOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSwitch2Function(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createSwitch2Function(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
@ -771,8 +860,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSwitch3Function(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createSwitch3Function(Action action, bool isAutomation,
|
||||
String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
@ -786,53 +875,84 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createCountdown1Function(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsIcons3GangSwitch,
|
||||
'Light 1 CountDown',
|
||||
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.countdown,
|
||||
isAutomation ? _createAutomationCountDownOptions() : _createCountdownOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
SceneStaticFunction _createCountdown1Function(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
switch (action.productType) {
|
||||
case "3G":
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsIcons3GangSwitch,
|
||||
'Light 1 CountDown',
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? _createAutomationCountDownOptions()
|
||||
: _createCountdownOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
default:
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'1 Gang Button Switch L-L',
|
||||
Assets.oneGang,
|
||||
'Light CountDown',
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? _createAutomationCountDownOptions()
|
||||
: _createCountdownOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
SceneStaticFunction _createCountdown2Function(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createCountdown2Function(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsIcons3GangSwitch,
|
||||
'Light 2 CountDown',
|
||||
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.countdown,
|
||||
isAutomation ? _createAutomationCountDownOptions() : _createCountdownOptions(),
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? _createAutomationCountDownOptions()
|
||||
: _createCountdownOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createCountdown3Function(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createCountdown3Function(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'3 Gang Button Switch L-L',
|
||||
Assets.assetsIcons3GangSwitch,
|
||||
'Light 3 CountDown',
|
||||
isAutomation ? OperationDialogType.integerSteps : OperationDialogType.countdown,
|
||||
isAutomation ? _createAutomationCountDownOptions() : _createCountdownOptions(),
|
||||
isAutomation
|
||||
? OperationDialogType.integerSteps
|
||||
: OperationDialogType.countdown,
|
||||
isAutomation
|
||||
? _createAutomationCountDownOptions()
|
||||
: _createCountdownOptions(),
|
||||
isAutomation,
|
||||
comparator,
|
||||
uniqueCustomId,
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createSwitchAlarmSoundFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createSwitchAlarmSoundFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Gateway',
|
||||
@ -846,8 +966,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createMasterStateFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createMasterStateFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Gateway',
|
||||
@ -861,8 +981,8 @@ mixin SceneOperationsDataHelper {
|
||||
);
|
||||
}
|
||||
|
||||
SceneStaticFunction _createFactoryResetFunction(
|
||||
Action action, bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
SceneStaticFunction _createFactoryResetFunction(Action action,
|
||||
bool isAutomation, String? comparator, String? uniqueCustomId) {
|
||||
return _createSceneFunction(
|
||||
action,
|
||||
'Gateway',
|
||||
@ -1180,8 +1300,12 @@ mixin SceneOperationsDataHelper {
|
||||
uniqueCustomId: taskItem.uniqueCustomId,
|
||||
deviceId: taskItem.deviceId,
|
||||
deviceName: taskItem.deviceName.toString(),
|
||||
deviceIcon: taskItem.operationName == 'automation' ? Assets.player : Assets.handClickIcon,
|
||||
icon: taskItem.operationName == 'automation' ? Assets.player : Assets.handClickIcon,
|
||||
deviceIcon: taskItem.operationName == 'automation'
|
||||
? Assets.player
|
||||
: Assets.handClickIcon,
|
||||
icon: taskItem.operationName == 'automation'
|
||||
? Assets.player
|
||||
: Assets.handClickIcon,
|
||||
operationName: taskItem.operationName,
|
||||
operationDialogType: OperationDialogType.onOff,
|
||||
functionValue: taskItem.functionValue == 'rule_enable' ? true : false,
|
||||
|
@ -74,6 +74,7 @@ class Action {
|
||||
ExecutorProperty? executorProperty;
|
||||
String? name;
|
||||
String? type;
|
||||
String? productType;
|
||||
|
||||
Action({
|
||||
required this.actionExecutor,
|
||||
@ -81,6 +82,7 @@ class Action {
|
||||
this.executorProperty,
|
||||
this.name,
|
||||
this.type,
|
||||
this.productType,
|
||||
});
|
||||
|
||||
String toRawJson() => json.encode(toJson());
|
||||
@ -88,10 +90,11 @@ class Action {
|
||||
static Action? fromJson(Map<String, dynamic> json) {
|
||||
if (json['name'] != null && json['type'] != null) {
|
||||
return Action(
|
||||
actionExecutor: json["actionExecutor"],
|
||||
entityId: json["entityId"],
|
||||
name: json['name'],
|
||||
type: json['type'],
|
||||
actionExecutor: json["actionExecutor"] as String,
|
||||
entityId: json["entityId"] as String,
|
||||
name: json['name'] as String?,
|
||||
type: json['type'] as String?,
|
||||
productType: json['productType'] as String?,
|
||||
);
|
||||
}
|
||||
if (json["executorProperty"] == null) {
|
||||
@ -99,9 +102,10 @@ class Action {
|
||||
}
|
||||
|
||||
return Action(
|
||||
actionExecutor: json["actionExecutor"],
|
||||
entityId: json["entityId"],
|
||||
actionExecutor: json["actionExecutor"] as String,
|
||||
entityId: json["entityId"] as String,
|
||||
executorProperty: ExecutorProperty.fromJson(json["executorProperty"]),
|
||||
productType: json['productType'] as String?,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ abstract class ApiEndpoints {
|
||||
static const String sendOtp = '/authentication/user/send-otp';
|
||||
static const String verifyOtp = '/authentication/user/verify-otp';
|
||||
static const String forgetPassword = '/authentication/user/forget-password';
|
||||
static const String clientLogin = '/client/token';
|
||||
|
||||
////////////////////////////////////// Spaces ///////////////////////////////////////
|
||||
|
||||
///Community Module
|
||||
@ -111,9 +111,9 @@ abstract class ApiEndpoints {
|
||||
//POST
|
||||
static const String addDeviceToRoom = '/device/room';
|
||||
static const String addDeviceToGroup = '/device/group';
|
||||
static const String controlDevice = '/devices/{deviceUuid}/command';
|
||||
static const String controlDevice = '/device/{deviceUuid}/control';
|
||||
static const String firmwareDevice =
|
||||
'/devices/{deviceUuid}/firmware/{firmwareVersion}';
|
||||
'/device/{deviceUuid}/firmware/{firmwareVersion}';
|
||||
static const String getDevicesByUserId = '/device/user/{userId}';
|
||||
static const String getDevicesByUnitId = '/device/unit/{unitUuid}';
|
||||
static const String openDoorLock = '/door-lock/open/{doorLockUuid}';
|
||||
@ -121,13 +121,13 @@ abstract class ApiEndpoints {
|
||||
//GET
|
||||
static const String deviceByRoom =
|
||||
'/projects/{projectUuid}/communities/{communityUuid}/spaces/{spaceUuid}/subspaces/{subSpaceUuid}/devices';
|
||||
static const String deviceByUuid = '/devices/{deviceUuid}';
|
||||
static const String deviceFunctions = '/devices/{deviceUuid}/functions';
|
||||
static const String gatewayApi = '/devices/gateway/{gatewayUuid}/devices';
|
||||
static const String deviceByUuid = '/device/{deviceUuid}';
|
||||
static const String deviceFunctions = '/device/{deviceUuid}/functions';
|
||||
static const String gatewayApi = '/device/gateway/{gatewayUuid}/devices';
|
||||
static const String deviceFunctionsStatus =
|
||||
'/devices/{deviceUuid}/functions/status';
|
||||
'/device/{deviceUuid}/functions/status';
|
||||
static const String powerClamp =
|
||||
'/devices/{deviceUuid}/functions/status';
|
||||
'/device/{powerClampUuid}/power-clamp/status';
|
||||
|
||||
///Device Permission Module
|
||||
//POST
|
||||
@ -153,8 +153,7 @@ abstract class ApiEndpoints {
|
||||
static const String getScene = '/scene/tap-to-run/{sceneId}';
|
||||
static const String getIconScene = '/scene/icon';
|
||||
|
||||
static const String getUnitAutomation =
|
||||
'/projects/{projectId}/communities/{communityId}/spaces/{unitUuid}/automations';
|
||||
static const String getUnitAutomation = '/projects/{projectId}/communities/{communityId}/spaces/{unitUuid}/automations';
|
||||
|
||||
static const String getAutomationDetails =
|
||||
'/projects/{projectId}/automations/{automationId}';
|
||||
@ -162,8 +161,7 @@ abstract class ApiEndpoints {
|
||||
/// PUT
|
||||
static const String updateScene = '/scene/tap-to-run/{sceneId}';
|
||||
|
||||
static const String updateAutomation =
|
||||
'/projects/{projectId}/automations/{automationId}';
|
||||
static const String updateAutomation = '/projects/{projectId}/automations/{automationId}';
|
||||
|
||||
static const String updateAutomationStatus =
|
||||
'/projects/{projectId}/automations/{automationId}';
|
||||
@ -171,8 +169,7 @@ abstract class ApiEndpoints {
|
||||
/// DELETE
|
||||
static const String deleteScene = '/scene/tap-to-run/{sceneId}';
|
||||
|
||||
static const String deleteAutomation =
|
||||
'/projects/{projectId}/automations/{automationId}';
|
||||
static const String deleteAutomation = '/projects/{projectId}/automations/{automationId}';
|
||||
|
||||
//////////////////////Door Lock //////////////////////
|
||||
//online
|
||||
@ -216,18 +213,18 @@ abstract class ApiEndpoints {
|
||||
static const String changeSchedule = '/schedule/enable/{deviceUuid}';
|
||||
static const String deleteSchedule = '/schedule/{deviceUuid}/{scheduleId}';
|
||||
static const String reportLogs =
|
||||
'/devices/report-logs/{deviceUuid}?code={code}&startTime={startTime}&endTime={endTime}';
|
||||
static const String controlBatch = '/devices/batch';
|
||||
static const String statusBatch = '/devices/batch';
|
||||
static const String deviceScene = '/devices/{deviceUuid}/scenes';
|
||||
'/device/report-logs/{deviceUuid}?code={code}&startTime={startTime}&endTime={endTime}';
|
||||
static const String controlBatch = '/device/control/batch';
|
||||
static const String statusBatch = '/device/status/batch';
|
||||
static const String deviceScene = '/device/{deviceUuid}/scenes';
|
||||
|
||||
static const String fourSceneByName =
|
||||
'/devices/{deviceUuid}/scenes?switchName={switchName}';
|
||||
'/device/{deviceUuid}/scenes?switchName={switchName}';
|
||||
|
||||
static const String resetDevice = '/factory/reset/{deviceUuid}';
|
||||
static const String unAssignScenesDevice =
|
||||
'/devices/{deviceUuid}/scenes?switchName={switchName}';
|
||||
static const String getDeviceLogs = '/devices/report-logs/{uuid}?code={code}';
|
||||
'/device/{deviceUuid}/scenes?switchName={switchName}';
|
||||
static const String getDeviceLogs = '/device/report-logs/{uuid}?code={code}';
|
||||
static const String terms = '/terms';
|
||||
static const String policy = '/policy';
|
||||
static const String getPermission = '/permission/{roleUuid}';
|
||||
|
@ -25,15 +25,11 @@ class AuthenticationAPI {
|
||||
return response;
|
||||
}
|
||||
|
||||
static Future<bool> signUp({
|
||||
required SignUpModel model,
|
||||
required String accessToken,
|
||||
}) async {
|
||||
static Future<bool> signUp({required SignUpModel model}) async {
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.signUp,
|
||||
body: model.toJson(),
|
||||
showServerMessage: false,
|
||||
accessToken: accessToken,
|
||||
expectedResponseModel: (json) => json['statusCode'] == 201);
|
||||
return response;
|
||||
}
|
||||
@ -67,20 +63,4 @@ class AuthenticationAPI {
|
||||
expectedResponseModel: (json) => json['data']);
|
||||
return response;
|
||||
}
|
||||
|
||||
static Future<Map<String, dynamic>> fetchClientToken({
|
||||
required String clientId,
|
||||
required String clientSecret,
|
||||
}) async {
|
||||
final response = await HTTPService().post(
|
||||
path: ApiEndpoints.clientLogin,
|
||||
body: {
|
||||
'clientId': clientId,
|
||||
'clientSecret': clientSecret,
|
||||
},
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) => json['data'],
|
||||
);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
@ -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';
|
||||
@ -7,6 +8,7 @@ import 'package:syncrow_app/features/devices/model/device_report_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/function_model.dart';
|
||||
import 'package:syncrow_app/services/api/api_links_endpoints.dart';
|
||||
import 'package:syncrow_app/services/api/http_service.dart';
|
||||
import 'package:syncrow_app/utils/constants/temp_const.dart';
|
||||
import '../../features/devices/model/create_temporary_password_model.dart';
|
||||
|
||||
class DevicesAPI {
|
||||
@ -37,7 +39,7 @@ class DevicesAPI {
|
||||
path: ApiEndpoints.deviceByUuid.replaceAll('{deviceUuid}', deviceId),
|
||||
body: {"deviceName": deviceName},
|
||||
expectedResponseModel: (json) {
|
||||
return json['data'];
|
||||
return json;
|
||||
},
|
||||
);
|
||||
return response;
|
||||
@ -90,7 +92,7 @@ class DevicesAPI {
|
||||
.replaceAll('{deviceUuid}', deviceId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json['data'];
|
||||
return json;
|
||||
},
|
||||
);
|
||||
return response;
|
||||
@ -99,7 +101,7 @@ class DevicesAPI {
|
||||
static Future<Map<String, dynamic>> getPowerClampStatus(
|
||||
String deviceId) async {
|
||||
final response = await _httpService.get(
|
||||
path: ApiEndpoints.deviceFunctionsStatus.replaceAll('{powerClampUuid}', deviceId),
|
||||
path: ApiEndpoints.powerClamp.replaceAll('{powerClampUuid}', deviceId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
@ -130,7 +132,7 @@ class DevicesAPI {
|
||||
path: ApiEndpoints.deviceFunctions.replaceAll('{deviceUuid}', deviceId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
final functions = FunctionModel.fromJson(json['data']);
|
||||
final functions = FunctionModel.fromJson(json);
|
||||
return functions;
|
||||
});
|
||||
return response;
|
||||
@ -186,7 +188,7 @@ class DevicesAPI {
|
||||
path: ApiEndpoints.deviceByUuid.replaceAll('{deviceUuid}', deviceId),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
return json['data'];
|
||||
return json;
|
||||
});
|
||||
return response;
|
||||
}
|
||||
@ -262,7 +264,7 @@ class DevicesAPI {
|
||||
if (json == null || json.isEmpty || json == []) {
|
||||
return devices;
|
||||
}
|
||||
for (var device in json['data']['devices']) {
|
||||
for (var device in json['devices']) {
|
||||
devices.add(DeviceModel.fromJson(device));
|
||||
}
|
||||
return devices;
|
||||
@ -489,12 +491,7 @@ class DevicesAPI {
|
||||
}) async {
|
||||
final response = await _httpService.post(
|
||||
path: ApiEndpoints.controlBatch,
|
||||
body: {
|
||||
"devicesUuid": devicesUuid,
|
||||
"code": code,
|
||||
"value": value,
|
||||
"operationType": 'COMMAND',
|
||||
},
|
||||
body: {"devicesUuid": devicesUuid, "code": code, "value": value},
|
||||
showServerMessage: true,
|
||||
expectedResponseModel: (json) {
|
||||
return json;
|
||||
|
@ -34,7 +34,7 @@ class HomeManagementAPI {
|
||||
path: ApiEndpoints.devices.replaceAll("{projectUuid}", projectUuid),
|
||||
showServerMessage: false,
|
||||
expectedResponseModel: (json) {
|
||||
json['data'].forEach((value) {
|
||||
json.forEach((value) {
|
||||
list.add(DeviceModel.fromJson(value));
|
||||
});
|
||||
});
|
||||
|
@ -48,26 +48,13 @@ class HTTPService {
|
||||
Options? options,
|
||||
dynamic body,
|
||||
bool showServerMessage = true,
|
||||
String? accessToken,
|
||||
required T Function(dynamic) expectedResponseModel}) async {
|
||||
try {
|
||||
final authOptions = options ??
|
||||
Options(
|
||||
headers: accessToken != null
|
||||
? {
|
||||
'Authorization': 'Bearer $accessToken',
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
);
|
||||
|
||||
final response = await client.post(
|
||||
path,
|
||||
data: body,
|
||||
queryParameters: queryParameters,
|
||||
options: authOptions,
|
||||
options: options,
|
||||
);
|
||||
return expectedResponseModel(response.data);
|
||||
} catch (error) {
|
||||
|
Reference in New Issue
Block a user