Merged with dev branch

This commit is contained in:
Abdullah Alassaf
2024-07-25 13:35:10 +03:00
24 changed files with 716 additions and 527 deletions

View File

2
.env.development Normal file
View File

@ -0,0 +1,2 @@
ENV_NAME=development
BASE_URL=https://syncrow-dev.azurewebsites.net

View File

2
.env.production Normal file
View File

@ -0,0 +1,2 @@
ENV_NAME=production
BASE_URL=https://syncrow-staging.azurewebsites.net

View File

@ -0,0 +1,2 @@
ENV_NAME=staging
BASE_URL=https://syncrow-staging.azurewebsites.net

2
.gitignore vendored
View File

@ -20,7 +20,7 @@ migrate_working_dir/
# VS Code which you may wish to be included in version control, so this line # VS Code which you may wish to be included in version control, so this line
# is commented out by default. # is commented out by default.
#.vscode/ #.vscode/
*.env
# Flutter/Dart/Pub related # Flutter/Dart/Pub related
**/doc/api/ **/doc/api/
**/ios/Flutter/.last_build_id **/ios/Flutter/.last_build_id

View File

@ -64,7 +64,8 @@ class AuthCubit extends Cubit<AuthState> {
return 'Please enter your password'; return 'Please enter your password';
} }
if (value.isNotEmpty) { if (value.isNotEmpty) {
if (!RegExp(r'^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$') if (!RegExp(
r'^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!"#$%&()*+,-./:;<=>?@[\]^_`{|}~])[A-Za-z\d!"#$%&()*+,-./:;<=>?@[\]^_`{|}~]{8,}$')
.hasMatch(value)) { .hasMatch(value)) {
return 'Password must contain at least:\n - one uppercase letter.\n - one lowercase letter.\n - one number. \n - special character'; return 'Password must contain at least:\n - one uppercase letter.\n - one lowercase letter.\n - one number. \n - special character';
} }

View File

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart'; import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_event.dart'; import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_event.dart';
@ -12,6 +14,7 @@ import 'package:syncrow_app/utils/resource_manager/constants.dart';
class ACsBloc extends Bloc<AcsEvent, AcsState> { class ACsBloc extends Bloc<AcsEvent, AcsState> {
final String acId; final String acId;
AcStatusModel deviceStatus = AcStatusModel( AcStatusModel deviceStatus = AcStatusModel(
uuid: '',
acSwitch: true, acSwitch: true,
modeString: 'hot', modeString: 'hot',
tempSet: 300, tempSet: 300,
@ -24,6 +27,7 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
bool allAcsOn = true; bool allAcsOn = true;
bool allTempSame = true; bool allTempSame = true;
int globalTemp = 25; int globalTemp = 25;
Timer? _timer;
ACsBloc({required this.acId}) : super(AcsInitialState()) { ACsBloc({required this.acId}) : super(AcsInitialState()) {
on<AcsInitial>(_fetchAcsStatus); on<AcsInitial>(_fetchAcsStatus);
@ -56,11 +60,11 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
for (var status in response['status']) { for (var status in response['status']) {
statusModelList.add(StatusModel.fromJson(status)); statusModelList.add(StatusModel.fromJson(status));
} }
deviceStatus = AcStatusModel.fromJson(statusModelList); deviceStatus = AcStatusModel.fromJson(response['productUuid'], statusModelList);
emit(GetAcStatusState(acStatusModel: deviceStatus)); emit(GetAcStatusState(acStatusModel: deviceStatus));
} }
} catch (e) { } catch (e) {
emit(AcsFailedState(error: e.toString())); emit(AcsFailedState(errorMessage: e.toString()));
return; return;
} }
} }
@ -68,8 +72,6 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
_getAllAcs() async { _getAllAcs() async {
deviceStatusList = []; deviceStatusList = [];
devicesList = []; devicesList = [];
allAcsOn = true;
allTempSame = true;
devicesList = await DevicesAPI.getDeviceByGroupName( devicesList = await DevicesAPI.getDeviceByGroupName(
HomeCubit.getInstance().selectedSpace?.id ?? '', 'AC'); HomeCubit.getInstance().selectedSpace?.id ?? '', 'AC');
@ -79,8 +81,210 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
for (var status in response['status']) { for (var status in response['status']) {
statusModelList.add(StatusModel.fromJson(status)); statusModelList.add(StatusModel.fromJson(status));
} }
deviceStatusList.add(AcStatusModel.fromJson(statusModelList)); deviceStatusList.add(AcStatusModel.fromJson(response['productUuid'], statusModelList));
} }
_setAllAcsTempsAndSwitches();
}
void _changeAcSwitch(AcSwitch event, Emitter<AcsState> emit) async {
final acSwitchValue = !event.acSwitch;
if (allAcsPage) {
emit(AcsLoadingState());
for (AcStatusModel ac in deviceStatusList) {
if (ac.uuid == event.productId) {
ac.acSwitch = acSwitchValue;
}
}
_setAllAcsTempsAndSwitches();
_emitAcsStatus(emit);
} else {
emit(AcChangeLoading(acStatusModel: deviceStatus));
deviceStatus.acSwitch = acSwitchValue;
emit(AcModifyingState(acStatusModel: deviceStatus));
}
await _runDeBouncerForOneDevice(deviceId: event.deviceId, code: 'switch', value: acSwitchValue);
}
void _changeAllAcSwitch(ChangeAllSwitch event, Emitter<AcsState> emit) async {
emit(AcsLoadingState());
if (deviceStatusList.length == devicesList.length) {
for (int i = 0; i < deviceStatusList.length; i++) {
deviceStatusList[i].acSwitch = event.value;
}
}
_setAllAcsTempsAndSwitches();
_emitAcsStatus(emit);
_runDeBouncerForAllAcs(code: 'switch', value: event.value);
}
void _increaseAllTemp(IncreaseAllTemp event, Emitter<AcsState> emit) async {
emit(AcsLoadingState());
double tempValue = event.value + 0.5;
int value = (tempValue * 10).toInt();
if (!_checkTemperatureValue(tempValue, emit)) {
return;
}
if (deviceStatusList.length == devicesList.length) {
for (int i = 0; i < deviceStatusList.length; i++) {
deviceStatusList[i].tempSet = value;
}
}
_setAllAcsTempsAndSwitches();
_emitAcsStatus(emit);
_runDeBouncerForAllAcs(code: 'temp_set', value: value);
}
void _decreaseAllTemp(DecreaseAllTemp event, Emitter<AcsState> emit) async {
emit(AcsLoadingState());
double tempValue = event.value - 0.5;
int value = (tempValue * 10).toInt();
if (!_checkTemperatureValue(tempValue, emit)) {
return;
}
if (deviceStatusList.length == devicesList.length) {
for (int i = 0; i < deviceStatusList.length; i++) {
deviceStatusList[i].tempSet = value;
}
}
_setAllAcsTempsAndSwitches();
_emitAcsStatus(emit);
_runDeBouncerForAllAcs(code: 'temp_set', value: value);
}
void _changeLockValue(ChangeLock event, Emitter<AcsState> emit) async {
emit(AcChangeLoading(acStatusModel: deviceStatus));
final lockValue = !event.lockBool;
deviceStatus.childLock = lockValue;
emit(AcModifyingState(acStatusModel: deviceStatus));
_runDeBouncerForOneDevice(deviceId: acId, code: 'child_lock', value: lockValue);
}
void _increaseCoolTo(IncreaseCoolToTemp event, Emitter<AcsState> emit) async {
emit(AcChangeLoading(acStatusModel: deviceStatus));
double tempValue = event.value + 0.5;
int value = (tempValue * 10).toInt();
if (!_checkTemperatureValue(tempValue, emit)) {
return;
}
if (allAcsPage) {
emit(AcsLoadingState());
for (AcStatusModel ac in deviceStatusList) {
if (ac.uuid == event.productId) {
ac.tempSet = value;
}
}
_setAllAcsTempsAndSwitches();
_emitAcsStatus(emit);
} else {
emit(AcChangeLoading(acStatusModel: deviceStatus));
deviceStatus.tempSet = value;
emit(AcModifyingState(acStatusModel: deviceStatus));
}
await _runDeBouncerForOneDevice(deviceId: event.deviceId, code: 'temp_set', value: value);
}
void _decreaseCoolTo(DecreaseCoolToTemp event, Emitter<AcsState> emit) async {
emit(AcChangeLoading(acStatusModel: deviceStatus));
double tempValue = event.value - 0.5;
int value = (tempValue * 10).toInt();
if (!_checkTemperatureValue(tempValue, emit)) {
return;
}
if (allAcsPage) {
emit(AcsLoadingState());
for (AcStatusModel ac in deviceStatusList) {
if (ac.uuid == event.productId) {
ac.tempSet = value;
}
}
_setAllAcsTempsAndSwitches();
_emitAcsStatus(emit);
} else {
emit(AcChangeLoading(acStatusModel: deviceStatus));
deviceStatus.tempSet = value;
emit(AcModifyingState(acStatusModel: deviceStatus));
}
await _runDeBouncerForOneDevice(deviceId: event.deviceId, code: 'temp_set', value: value);
}
void _changeAcMode(ChangeAcMode event, Emitter<AcsState> emit) async {
final tempMode = tempModesMap[getNextItem(tempModesMap, event.tempModes)]!;
if (allAcsPage) {
emit(AcsLoadingState());
for (AcStatusModel ac in deviceStatusList) {
if (ac.uuid == event.productId) {
ac.modeString = getACModeString(tempMode);
ac.acMode = AcStatusModel.getACMode(getACModeString(tempMode));
}
}
_emitAcsStatus(emit);
} else {
emit(AcChangeLoading(acStatusModel: deviceStatus));
deviceStatus.modeString = getACModeString(tempMode);
deviceStatus.acMode = AcStatusModel.getACMode(getACModeString(tempMode));
emit(AcModifyingState(acStatusModel: deviceStatus));
}
await _runDeBouncerForOneDevice(
deviceId: event.deviceId, code: 'mode', value: getACModeString(tempMode));
}
void _changeFanSpeed(ChangeFanSpeed event, Emitter<AcsState> emit) async {
emit(AcChangeLoading(acStatusModel: deviceStatus));
final fanSpeed = event.fanSpeeds;
if (allAcsPage) {
emit(AcsLoadingState());
for (AcStatusModel ac in deviceStatusList) {
if (ac.uuid == event.productId) {
ac.fanSpeedsString = getNextFanSpeedKey(fanSpeed);
ac.acFanSpeed = AcStatusModel.getFanSpeed(getNextFanSpeedKey(fanSpeed));
}
}
_emitAcsStatus(emit);
} else {
emit(AcChangeLoading(acStatusModel: deviceStatus));
deviceStatus.fanSpeedsString = getNextFanSpeedKey(fanSpeed);
deviceStatus.acFanSpeed = AcStatusModel.getFanSpeed(getNextFanSpeedKey(fanSpeed));
emit(AcModifyingState(acStatusModel: deviceStatus));
}
await _runDeBouncerForOneDevice(
deviceId: event.deviceId, code: 'level', value: getNextFanSpeedKey(fanSpeed));
}
String getACModeString(TempModes value) {
if (value == TempModes.cold) {
return 'cold';
} else if (value == TempModes.hot) {
return 'hot';
} else if (value == TempModes.wind) {
return 'wind';
} else {
return 'cold';
}
}
void _setAllAcsTempsAndSwitches() {
allAcsOn = true;
allTempSame = true;
if (deviceStatusList.isNotEmpty) { if (deviceStatusList.isNotEmpty) {
int temp = deviceStatusList[0].tempSet; int temp = deviceStatusList[0].tempSet;
deviceStatusList.firstWhere((element) { deviceStatusList.firstWhere((element) {
@ -99,195 +303,71 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
} }
} }
void _changeAcSwitch(AcSwitch event, Emitter<AcsState> emit) async { _runDeBouncerForAllAcs({required String code, required dynamic value}) {
emit(AcChangeLoading(acStatusModel: deviceStatus)); if (_timer != null) {
_timer!.cancel();
final acSwitchValue = !event.acSwitch;
try {
final response = await DevicesAPI.controlDevice(
DeviceControlModel(
deviceId: allAcsPage ? event.deviceId : acId, code: 'switch', value: acSwitchValue),
allAcsPage ? event.deviceId : acId);
if (response['success'] ?? false) {
deviceStatus.acSwitch = acSwitchValue;
}
} catch (_) {}
if (allAcsPage) {
await Future.delayed(const Duration(seconds: 1));
add(const AcsInitial(allAcs: true));
} else {
emit(AcModifyingState(acStatusModel: deviceStatus));
} }
} _timer = Timer(const Duration(seconds: 1), () async {
void _changeAllAcSwitch(ChangeAllSwitch event, Emitter<AcsState> emit) async {
emit(AcsLoadingState());
try {
if (deviceStatusList.length == devicesList.length) { if (deviceStatusList.length == devicesList.length) {
for (int i = 0; i < deviceStatusList.length; i++) { for (int i = 0; i < deviceStatusList.length; i++) {
await DevicesAPI.controlDevice( try {
DeviceControlModel(deviceId: devicesList[i].uuid, code: 'switch', value: event.value), await DevicesAPI.controlDevice(
devicesList[i].uuid ?? ''); DeviceControlModel(deviceId: devicesList[i].uuid, code: code, value: value),
devicesList[i].uuid ?? '');
} catch (_) {
await Future.delayed(const Duration(milliseconds: 500));
add(const AcsInitial(allAcs: true));
}
} }
} }
} catch (_) {} });
await Future.delayed(const Duration(seconds: 1));
add(const AcsInitial(allAcs: true));
} }
void _increaseAllTemp(IncreaseAllTemp event, Emitter<AcsState> emit) async { _runDeBouncerForOneDevice({
emit(AcsLoadingState()); required String deviceId,
try { required String code,
double tempValue = event.value + 0.5; required dynamic value,
int value = (tempValue * 10).toInt(); }) {
if (deviceStatusList.length == devicesList.length) { if (_timer != null) {
for (int i = 0; i < deviceStatusList.length; i++) { _timer!.cancel();
await DevicesAPI.controlDevice( }
DeviceControlModel(deviceId: devicesList[i].uuid, code: 'temp_set', value: value), _timer = Timer(const Duration(seconds: 1), () async {
devicesList[i].uuid ?? ''); try {
final response = await DevicesAPI.controlDevice(
DeviceControlModel(deviceId: allAcsPage ? deviceId : acId, code: code, value: value),
allAcsPage ? deviceId : acId);
if (!response['success']) {
add(AcsInitial(allAcs: allAcsPage));
} }
} catch (_) {
await Future.delayed(const Duration(milliseconds: 500));
add(AcsInitial(allAcs: allAcsPage));
} }
} catch (_) {} });
await Future.delayed(const Duration(seconds: 1));
add(const AcsInitial(allAcs: true));
} }
void _decreaseAllTemp(DecreaseAllTemp event, Emitter<AcsState> emit) async { bool _checkTemperatureValue(double value, Emitter<AcsState> emit) {
emit(AcsLoadingState()); if (value >= 20 && value <= 30) {
try { return true;
double tempValue = event.value - 0.5;
int value = (tempValue * 10).toInt();
if (deviceStatusList.length == devicesList.length) {
for (int i = 0; i < deviceStatusList.length; i++) {
await DevicesAPI.controlDevice(
DeviceControlModel(deviceId: devicesList[i].uuid, code: 'temp_set', value: value),
devicesList[i].uuid ?? '');
}
}
} catch (_) {}
await Future.delayed(const Duration(seconds: 1));
add(const AcsInitial(allAcs: true));
}
void _changeLockValue(ChangeLock event, Emitter<AcsState> emit) async {
emit(AcChangeLoading(acStatusModel: deviceStatus));
final lockValue = !event.lockBool;
try {
final response = await DevicesAPI.controlDevice(
DeviceControlModel(deviceId: acId, code: 'child_lock', value: lockValue), acId);
if (response['success'] ?? false) {
deviceStatus.childLock = lockValue;
}
} catch (_) {}
emit(AcModifyingState(acStatusModel: deviceStatus));
}
void _increaseCoolTo(IncreaseCoolToTemp event, Emitter<AcsState> emit) async {
emit(AcChangeLoading(acStatusModel: deviceStatus));
double tempValue = event.value + 0.5;
int value = (tempValue * 10).toInt();
try {
final response = await DevicesAPI.controlDevice(
DeviceControlModel(
deviceId: allAcsPage ? event.deviceId : acId, code: 'temp_set', value: value),
allAcsPage ? event.deviceId : acId);
if (response['success'] ?? false) {
deviceStatus.tempSet = value;
}
} catch (_) {}
if (allAcsPage) {
await Future.delayed(const Duration(seconds: 1));
add(const AcsInitial(allAcs: true));
} else { } else {
emit(AcModifyingState(acStatusModel: deviceStatus)); emit(const AcsFailedState(errorMessage: 'The temperature must be between 20 and 30'));
emit(GetAllAcsStatusState(
allAcsStatues: deviceStatusList,
allAcs: devicesList,
allOn: allAcsOn,
allTempSame: allTempSame,
temp: globalTemp));
return false;
} }
} }
void _decreaseCoolTo(DecreaseCoolToTemp event, Emitter<AcsState> emit) async { _emitAcsStatus(Emitter<AcsState> emit) {
emit(AcChangeLoading(acStatusModel: deviceStatus)); emit(GetAllAcsStatusState(
allAcsStatues: deviceStatusList,
double tempValue = event.value - 0.5; allAcs: devicesList,
int value = (tempValue * 10).toInt(); allOn: allAcsOn,
try { allTempSame: allTempSame,
final response = await DevicesAPI.controlDevice( temp: globalTemp));
DeviceControlModel(
deviceId: allAcsPage ? event.deviceId : acId, code: 'temp_set', value: value),
allAcsPage ? event.deviceId : acId);
if (response['success'] ?? false) {
deviceStatus.tempSet = value;
}
} catch (_) {}
if (allAcsPage) {
await Future.delayed(const Duration(seconds: 1));
add(const AcsInitial(allAcs: true));
} else {
emit(AcModifyingState(acStatusModel: deviceStatus));
}
}
void _changeAcMode(ChangeAcMode event, Emitter<AcsState> emit) async {
emit(AcChangeLoading(acStatusModel: deviceStatus));
final tempMode = tempModesMap[getNextItem(tempModesMap, event.tempModes)]!;
try {
final response = await DevicesAPI.controlDevice(
DeviceControlModel(
deviceId: allAcsPage ? event.deviceId : acId,
code: 'mode',
value: getACModeString(tempMode)),
allAcsPage ? event.deviceId : acId);
if (response['success'] ?? false) {
deviceStatus.modeString = getACModeString(tempMode);
deviceStatus.acMode = AcStatusModel.getACMode(getACModeString(tempMode));
}
} catch (_) {}
if (allAcsPage) {
await Future.delayed(const Duration(seconds: 1));
add(const AcsInitial(allAcs: true));
} else {
emit(AcModifyingState(acStatusModel: deviceStatus));
}
}
void _changeFanSpeed(ChangeFanSpeed event, Emitter<AcsState> emit) async {
emit(AcChangeLoading(acStatusModel: deviceStatus));
final fanSpeed = event.fanSpeeds;
final response = await DevicesAPI.controlDevice(
DeviceControlModel(
deviceId: allAcsPage ? event.deviceId : acId,
code: 'level',
value: getNextFanSpeedKey(fanSpeed)),
allAcsPage ? event.deviceId : acId);
try {
if (response['success'] ?? false) {
deviceStatus.fanSpeedsString = getNextFanSpeedKey(fanSpeed);
deviceStatus.acFanSpeed = AcStatusModel.getFanSpeed(getNextFanSpeedKey(fanSpeed));
}
} catch (_) {}
if (allAcsPage) {
await Future.delayed(const Duration(seconds: 1));
add(const AcsInitial(allAcs: true));
} else {
emit(AcModifyingState(acStatusModel: deviceStatus));
}
}
String getACModeString(TempModes value) {
if (value == TempModes.cold) {
return 'cold';
} else if (value == TempModes.hot) {
return 'hot';
} else if (value == TempModes.wind) {
return 'wind';
} else {
return 'cold';
}
} }
} }

View File

@ -13,10 +13,11 @@ class AcsLoading extends AcsEvent {}
class AcSwitch extends AcsEvent { class AcSwitch extends AcsEvent {
final bool acSwitch; final bool acSwitch;
final String deviceId; final String deviceId;
const AcSwitch({required this.acSwitch, this.deviceId = ''}); final String productId;
const AcSwitch({required this.acSwitch, this.deviceId = '', this.productId = ''});
@override @override
List<Object> get props => [acSwitch, deviceId]; List<Object> get props => [acSwitch, deviceId, productId];
} }
class AcsInitial extends AcsEvent { class AcsInitial extends AcsEvent {
@ -31,7 +32,8 @@ class ACsChangeStatus extends AcsEvent {}
class IncreaseCoolToTemp extends AcsEvent { class IncreaseCoolToTemp extends AcsEvent {
final double value; final double value;
final String deviceId; final String deviceId;
const IncreaseCoolToTemp({required this.value, this.deviceId = ''}); final String productId;
const IncreaseCoolToTemp({required this.value, this.deviceId = '', this.productId = ''});
@override @override
List<Object> get props => [value, deviceId]; List<Object> get props => [value, deviceId];
@ -40,7 +42,9 @@ class IncreaseCoolToTemp extends AcsEvent {
class DecreaseCoolToTemp extends AcsEvent { class DecreaseCoolToTemp extends AcsEvent {
final double value; final double value;
final String deviceId; final String deviceId;
const DecreaseCoolToTemp({required this.value, this.deviceId = ''}); final String productId;
const DecreaseCoolToTemp({required this.value, this.deviceId = '', this.productId = ''});
@override @override
List<Object> get props => [value, deviceId]; List<Object> get props => [value, deviceId];
@ -49,19 +53,22 @@ class DecreaseCoolToTemp extends AcsEvent {
class ChangeAcMode extends AcsEvent { class ChangeAcMode extends AcsEvent {
final TempModes tempModes; final TempModes tempModes;
final String deviceId; final String deviceId;
const ChangeAcMode({required this.tempModes, this.deviceId = ''}); final String productId;
const ChangeAcMode({required this.tempModes, this.deviceId = '', this.productId = ''});
@override @override
List<Object> get props => [tempModes, deviceId]; List<Object> get props => [tempModes, deviceId, productId];
} }
class ChangeFanSpeed extends AcsEvent { class ChangeFanSpeed extends AcsEvent {
final FanSpeeds fanSpeeds; final FanSpeeds fanSpeeds;
final String deviceId; final String deviceId;
const ChangeFanSpeed({required this.fanSpeeds, this.deviceId = ''}); final String productId;
const ChangeFanSpeed({required this.fanSpeeds, this.deviceId = '', this.productId = ''});
@override @override
List<Object> get props => [fanSpeeds, deviceId]; List<Object> get props => [fanSpeeds, deviceId, productId];
} }
class ChangeLock extends AcsEvent { class ChangeLock extends AcsEvent {

View File

@ -56,10 +56,10 @@ class GetAllAcsStatusState extends AcsState {
} }
class AcsFailedState extends AcsState { class AcsFailedState extends AcsState {
final String error; final String errorMessage;
const AcsFailedState({required this.error}); const AcsFailedState({required this.errorMessage});
@override @override
List<Object> get props => [error]; List<Object> get props => [errorMessage];
} }

View File

@ -95,6 +95,22 @@ class ThreeGangBloc extends Bloc<ThreeGangEvent, ThreeGangState> {
void _changeFirstSwitch(ChangeFirstSwitchStatusEvent event, Emitter<ThreeGangState> emit) async { void _changeFirstSwitch(ChangeFirstSwitchStatusEvent event, Emitter<ThreeGangState> emit) async {
emit(LoadingNewSate(threeGangModel: deviceStatus)); emit(LoadingNewSate(threeGangModel: deviceStatus));
try { try {
if (threeGangGroup) {
bool allSwitchesValue = true;
groupThreeGangList.forEach((element) {
if (element.deviceId == event.deviceId) {
element.firstSwitch = !event.value;
}
if (!element.firstSwitch || !element.secondSwitch || !element.thirdSwitch) {
allSwitchesValue = false;
}
});
emit(UpdateGroupState(threeGangList: groupThreeGangList, allSwitches: allSwitchesValue));
} else {
deviceStatus.firstSwitch = !event.value;
emit(UpdateState(threeGangModel: deviceStatus));
}
final response = await DevicesAPI.controlDevice( final response = await DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: threeGangGroup ? event.deviceId : threeGangId, deviceId: threeGangGroup ? event.deviceId : threeGangId,
@ -102,15 +118,11 @@ class ThreeGangBloc extends Bloc<ThreeGangEvent, ThreeGangState> {
value: !event.value), value: !event.value),
threeGangGroup ? event.deviceId : threeGangId); threeGangGroup ? event.deviceId : threeGangId);
if (response['success'] ?? false) { if (!response['success']) {
deviceStatus.firstSwitch = !event.value; add(InitialEvent(groupScreen: threeGangGroup));
} }
} catch (_) {} } catch (_) {
if (threeGangGroup) { add(InitialEvent(groupScreen: threeGangGroup));
await Future.delayed(const Duration(seconds: 1));
add(const InitialEvent(groupScreen: true));
} else {
emit(UpdateState(threeGangModel: deviceStatus));
} }
} }
@ -118,6 +130,22 @@ class ThreeGangBloc extends Bloc<ThreeGangEvent, ThreeGangState> {
ChangeSecondSwitchStatusEvent event, Emitter<ThreeGangState> emit) async { ChangeSecondSwitchStatusEvent event, Emitter<ThreeGangState> emit) async {
emit(LoadingNewSate(threeGangModel: deviceStatus)); emit(LoadingNewSate(threeGangModel: deviceStatus));
try { try {
if (threeGangGroup) {
bool allSwitchesValue = true;
groupThreeGangList.forEach((element) {
if (element.deviceId == event.deviceId) {
element.secondSwitch = !event.value;
}
if (!element.firstSwitch || !element.secondSwitch || !element.thirdSwitch) {
allSwitchesValue = false;
}
});
emit(UpdateGroupState(threeGangList: groupThreeGangList, allSwitches: allSwitchesValue));
} else {
deviceStatus.secondSwitch = !event.value;
emit(UpdateState(threeGangModel: deviceStatus));
}
final response = await DevicesAPI.controlDevice( final response = await DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: threeGangGroup ? event.deviceId : threeGangId, deviceId: threeGangGroup ? event.deviceId : threeGangId,
@ -125,21 +153,33 @@ class ThreeGangBloc extends Bloc<ThreeGangEvent, ThreeGangState> {
value: !event.value), value: !event.value),
threeGangGroup ? event.deviceId : threeGangId); threeGangGroup ? event.deviceId : threeGangId);
if (response['success'] ?? false) { if (!response['success']) {
deviceStatus.secondSwitch = !event.value; add(InitialEvent(groupScreen: threeGangGroup));
} }
} catch (_) {} } catch (_) {
if (threeGangGroup) { add(InitialEvent(groupScreen: threeGangGroup));
await Future.delayed(const Duration(seconds: 1));
add(const InitialEvent(groupScreen: true));
} else {
emit(UpdateState(threeGangModel: deviceStatus));
} }
} }
void _changeThirdSwitch(ChangeThirdSwitchStatusEvent event, Emitter<ThreeGangState> emit) async { void _changeThirdSwitch(ChangeThirdSwitchStatusEvent event, Emitter<ThreeGangState> emit) async {
emit(LoadingNewSate(threeGangModel: deviceStatus)); emit(LoadingNewSate(threeGangModel: deviceStatus));
try { try {
if (threeGangGroup) {
bool allSwitchesValue = true;
groupThreeGangList.forEach((element) {
if (element.deviceId == event.deviceId) {
element.thirdSwitch = !event.value;
}
if (!element.firstSwitch || !element.secondSwitch || !element.thirdSwitch) {
allSwitchesValue = false;
}
});
emit(UpdateGroupState(threeGangList: groupThreeGangList, allSwitches: allSwitchesValue));
} else {
deviceStatus.thirdSwitch = !event.value;
emit(UpdateState(threeGangModel: deviceStatus));
}
final response = await DevicesAPI.controlDevice( final response = await DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: threeGangGroup ? event.deviceId : threeGangId, deviceId: threeGangGroup ? event.deviceId : threeGangId,
@ -147,15 +187,11 @@ class ThreeGangBloc extends Bloc<ThreeGangEvent, ThreeGangState> {
value: !event.value), value: !event.value),
threeGangGroup ? event.deviceId : threeGangId); threeGangGroup ? event.deviceId : threeGangId);
if (response['success'] ?? false) { if (!response['success']) {
deviceStatus.thirdSwitch = !event.value; add(InitialEvent(groupScreen: threeGangGroup));
} }
} catch (_) {} } catch (_) {
if (threeGangGroup) { add(InitialEvent(groupScreen: threeGangGroup));
await Future.delayed(const Duration(seconds: 1));
add(const InitialEvent(groupScreen: true));
} else {
emit(UpdateState(threeGangModel: deviceStatus));
} }
} }
@ -163,52 +199,82 @@ class ThreeGangBloc extends Bloc<ThreeGangEvent, ThreeGangState> {
emit(LoadingNewSate(threeGangModel: deviceStatus)); emit(LoadingNewSate(threeGangModel: deviceStatus));
try { try {
deviceStatus.firstSwitch = false;
deviceStatus.secondSwitch = false;
deviceStatus.thirdSwitch = false;
emit(UpdateState(threeGangModel: deviceStatus));
final response = await Future.wait([ final response = await Future.wait([
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel(deviceId: threeGangId, code: 'switch_1', value: false), threeGangId), DeviceControlModel(
deviceId: threeGangId, code: 'switch_1', value: deviceStatus.firstSwitch),
threeGangId),
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel(deviceId: threeGangId, code: 'switch_2', value: false), threeGangId), DeviceControlModel(
deviceId: threeGangId, code: 'switch_2', value: deviceStatus.secondSwitch),
threeGangId),
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel(deviceId: threeGangId, code: 'switch_3', value: false), threeGangId), DeviceControlModel(
deviceId: threeGangId, code: 'switch_3', value: deviceStatus.thirdSwitch),
threeGangId),
]); ]);
if (response.every((element) => element['success'] ?? false)) { if (response.every((element) => !element['success'])) {
deviceStatus.firstSwitch = false; await Future.delayed(const Duration(milliseconds: 500));
deviceStatus.secondSwitch = false; add(const InitialEvent(groupScreen: false));
deviceStatus.thirdSwitch = false;
} }
} catch (_) {} } catch (_) {
emit(UpdateState(threeGangModel: deviceStatus)); await Future.delayed(const Duration(milliseconds: 500));
add(const InitialEvent(groupScreen: false));
}
} }
void _allOn(AllOnEvent event, Emitter<ThreeGangState> emit) async { void _allOn(AllOnEvent event, Emitter<ThreeGangState> emit) async {
emit(LoadingNewSate(threeGangModel: deviceStatus)); emit(LoadingNewSate(threeGangModel: deviceStatus));
try { try {
deviceStatus.firstSwitch = true;
deviceStatus.secondSwitch = true;
deviceStatus.thirdSwitch = true;
emit(UpdateState(threeGangModel: deviceStatus));
final response = await Future.wait([ final response = await Future.wait([
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel(deviceId: threeGangId, code: 'switch_1', value: true), threeGangId), DeviceControlModel(
deviceId: threeGangId, code: 'switch_1', value: deviceStatus.firstSwitch),
threeGangId),
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel(deviceId: threeGangId, code: 'switch_2', value: true), threeGangId), DeviceControlModel(
deviceId: threeGangId, code: 'switch_2', value: deviceStatus.secondSwitch),
threeGangId),
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel(deviceId: threeGangId, code: 'switch_3', value: true), threeGangId), DeviceControlModel(
deviceId: threeGangId, code: 'switch_3', value: deviceStatus.thirdSwitch),
threeGangId),
]); ]);
if (response.every((element) => element['success'] ?? false)) { if (response.every((element) => !element['success'])) {
deviceStatus.firstSwitch = true; await Future.delayed(const Duration(milliseconds: 500));
deviceStatus.secondSwitch = true; add(const InitialEvent(groupScreen: false));
deviceStatus.thirdSwitch = true;
} }
} catch (_) {} } catch (_) {
emit(UpdateState(threeGangModel: deviceStatus)); await Future.delayed(const Duration(milliseconds: 500));
add(const InitialEvent(groupScreen: false));
}
} }
void _groupAllOn(GroupAllOnEvent event, Emitter<ThreeGangState> emit) async { void _groupAllOn(GroupAllOnEvent event, Emitter<ThreeGangState> emit) async {
emit(LoadingNewSate(threeGangModel: deviceStatus)); emit(LoadingNewSate(threeGangModel: deviceStatus));
try { try {
for (int i = 0; i < groupThreeGangList.length; i++) { for (int i = 0; i < groupThreeGangList.length; i++) {
await Future.wait([ groupThreeGangList[i].firstSwitch = true;
groupThreeGangList[i].secondSwitch = true;
groupThreeGangList[i].thirdSwitch = true;
}
emit(UpdateGroupState(threeGangList: groupThreeGangList, allSwitches: true));
for (int i = 0; i < groupThreeGangList.length; i++) {
final response = await Future.wait([
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: groupThreeGangList[i].deviceId, code: 'switch_1', value: true), deviceId: groupThreeGangList[i].deviceId, code: 'switch_1', value: true),
@ -222,18 +288,31 @@ class ThreeGangBloc extends Bloc<ThreeGangEvent, ThreeGangState> {
deviceId: groupThreeGangList[i].deviceId, code: 'switch_3', value: true), deviceId: groupThreeGangList[i].deviceId, code: 'switch_3', value: true),
groupThreeGangList[i].deviceId), groupThreeGangList[i].deviceId),
]); ]);
if (response.every((element) => !element['success'])) {
await Future.delayed(const Duration(milliseconds: 500));
add(const InitialEvent(groupScreen: true));
break;
}
} }
} catch (_) {} } catch (_) {
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(milliseconds: 500));
add(const InitialEvent(groupScreen: true)); add(const InitialEvent(groupScreen: true));
}
} }
void _groupAllOff(GroupAllOffEvent event, Emitter<ThreeGangState> emit) async { void _groupAllOff(GroupAllOffEvent event, Emitter<ThreeGangState> emit) async {
emit(LoadingNewSate(threeGangModel: deviceStatus)); emit(LoadingNewSate(threeGangModel: deviceStatus));
try { try {
for (int i = 0; i < groupThreeGangList.length; i++) { for (int i = 0; i < groupThreeGangList.length; i++) {
await Future.wait([ groupThreeGangList[i].firstSwitch = false;
groupThreeGangList[i].secondSwitch = false;
groupThreeGangList[i].thirdSwitch = false;
}
emit(UpdateGroupState(threeGangList: groupThreeGangList, allSwitches: false));
for (int i = 0; i < groupThreeGangList.length; i++) {
final response = await Future.wait([
DevicesAPI.controlDevice( DevicesAPI.controlDevice(
DeviceControlModel( DeviceControlModel(
deviceId: groupThreeGangList[i].deviceId, code: 'switch_1', value: false), deviceId: groupThreeGangList[i].deviceId, code: 'switch_1', value: false),
@ -247,10 +326,17 @@ class ThreeGangBloc extends Bloc<ThreeGangEvent, ThreeGangState> {
deviceId: groupThreeGangList[i].deviceId, code: 'switch_3', value: false), deviceId: groupThreeGangList[i].deviceId, code: 'switch_3', value: false),
groupThreeGangList[i].deviceId), groupThreeGangList[i].deviceId),
]); ]);
if (response.every((element) => !element['success'])) {
await Future.delayed(const Duration(milliseconds: 500));
add(const InitialEvent(groupScreen: true));
break;
}
} }
} catch (_) {} } catch (_) {
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(milliseconds: 500));
add(const InitialEvent(groupScreen: true)); add(const InitialEvent(groupScreen: true));
}
} }
void _changeSliding(ChangeSlidingSegment event, Emitter<ThreeGangState> emit) async { void _changeSliding(ChangeSlidingSegment event, Emitter<ThreeGangState> emit) async {

View File

@ -2,6 +2,7 @@ import 'package:syncrow_app/features/devices/model/status_model.dart';
import 'package:syncrow_app/utils/resource_manager/constants.dart'; import 'package:syncrow_app/utils/resource_manager/constants.dart';
class AcStatusModel { class AcStatusModel {
String uuid;
bool acSwitch; bool acSwitch;
String modeString; String modeString;
int tempSet; int tempSet;
@ -12,7 +13,8 @@ class AcStatusModel {
late FanSpeeds acFanSpeed; late FanSpeeds acFanSpeed;
AcStatusModel( AcStatusModel(
{required this.acSwitch, {required this.uuid,
required this.acSwitch,
required this.modeString, required this.modeString,
required this.tempSet, required this.tempSet,
required this.currentTemp, required this.currentTemp,
@ -22,7 +24,7 @@ class AcStatusModel {
acFanSpeed = getFanSpeed(fanSpeedsString); acFanSpeed = getFanSpeed(fanSpeedsString);
} }
factory AcStatusModel.fromJson(List<StatusModel> jsonList) { factory AcStatusModel.fromJson(String id, List<StatusModel> jsonList) {
late bool _acSwitch; late bool _acSwitch;
late String _mode; late String _mode;
late int _tempSet; late int _tempSet;
@ -45,6 +47,7 @@ class AcStatusModel {
} }
} }
return AcStatusModel( return AcStatusModel(
uuid: id,
acSwitch: _acSwitch, acSwitch: _acSwitch,
modeString: _mode, modeString: _mode,
tempSet: _tempSet, tempSet: _tempSet,

View File

@ -17,12 +17,13 @@ class DeviceModel {
String? timeZone; String? timeZone;
int? updateTime; int? updateTime;
String? uuid; String? uuid;
String? productUuid;
DeviceType? productType; DeviceType? productType;
bool isSelected = false; bool isSelected = false;
late List<FunctionModel> functions; late List<FunctionModel> functions;
DeviceModel( DeviceModel(
{this.activeTime, {this.activeTime,
// this.id, this.productUuid,
this.localKey, this.localKey,
this.model, this.model,
this.name, this.name,
@ -60,27 +61,26 @@ class DeviceModel {
tempIcon = Assets.assetsIconsLogo; tempIcon = Assets.assetsIconsLogo;
} }
return DeviceModel( return DeviceModel(
icon: tempIcon, icon: tempIcon,
activeTime: json['activeTime'], activeTime: json['activeTime'],
// id: json['id'], // id: json['id'],
localKey: json['localKey'], localKey: json['localKey'],
model: json['model'], model: json['model'],
name: json['name'], name: json['name'],
isOnline: json['online'], isOnline: json['online'],
productName: json['productName'], productName: json['productName'],
timeZone: json['timeZone'], timeZone: json['timeZone'],
updateTime: json['updateTime'], updateTime: json['updateTime'],
uuid: json['uuid'], uuid: json['uuid'],
productType: type, productType: type,
type: json['productType'], type: json['productType'],
status: [], status: [],
); productUuid: json['productUuid']);
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
return { return {
'activeTime': activeTime, 'activeTime': activeTime,
// 'id': id,
'localKey': localKey, 'localKey': localKey,
'model': model, 'model': model,
'name': name, 'name': name,

View File

@ -1,9 +1,9 @@
class GroupThreeGangModel { class GroupThreeGangModel {
final String deviceId; final String deviceId;
final String deviceName; final String deviceName;
final bool firstSwitch; bool firstSwitch;
final bool secondSwitch; bool secondSwitch;
final bool thirdSwitch; bool thirdSwitch;
GroupThreeGangModel({ GroupThreeGangModel({
required this.deviceId, required this.deviceId,

View File

@ -11,6 +11,7 @@ import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_interface_temp_
import 'package:syncrow_app/features/shared_widgets/default_container.dart'; import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/generated/assets.dart'; import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
class AcInterface extends StatelessWidget { class AcInterface extends StatelessWidget {
const AcInterface({super.key, required this.ac}); const AcInterface({super.key, required this.ac});
@ -22,15 +23,12 @@ class AcInterface extends StatelessWidget {
return BlocConsumer<ACsBloc, AcsState>( return BlocConsumer<ACsBloc, AcsState>(
listener: (context, state) { listener: (context, state) {
if (state is AcsFailedState) { if (state is AcsFailedState) {
ScaffoldMessenger.of(context).showSnackBar( CustomSnackBar.displaySnackBar(state.errorMessage);
SnackBar(
content: Text(state.error),
),
);
} }
}, },
builder: (context, state) { builder: (context, state) {
AcStatusModel statusModel = AcStatusModel( AcStatusModel statusModel = AcStatusModel(
uuid: ac.uuid ?? '',
acSwitch: true, acSwitch: true,
modeString: 'hot', modeString: 'hot',
tempSet: 300, tempSet: 300,

View File

@ -9,14 +9,12 @@ import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/utils/resource_manager/constants.dart'; import 'package:syncrow_app/utils/resource_manager/constants.dart';
class ACModeControlUnit extends StatelessWidget { class ACModeControlUnit extends StatelessWidget {
const ACModeControlUnit({ const ACModeControlUnit(
super.key, {super.key, required this.acStatus, required this.deviceId, this.productId = ''});
required this.acStatus,
required this.deviceId,
});
final AcStatusModel acStatus; final AcStatusModel acStatus;
final String deviceId; final String deviceId;
final String? productId;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -28,8 +26,10 @@ class ACModeControlUnit extends StatelessWidget {
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
if (state is! AcChangeLoading && state is! AcsLoadingState) { if (state is! AcChangeLoading && state is! AcsLoadingState) {
BlocProvider.of<ACsBloc>(context) BlocProvider.of<ACsBloc>(context).add(ChangeFanSpeed(
.add(ChangeFanSpeed(fanSpeeds: acStatus.acFanSpeed, deviceId: deviceId)); fanSpeeds: acStatus.acFanSpeed,
deviceId: deviceId,
productId: productId ?? ''));
} }
// else if (state is AcModifyingState) { // else if (state is AcModifyingState) {
// BlocProvider.of<ACsBloc>(context) // BlocProvider.of<ACsBloc>(context)
@ -54,8 +54,10 @@ class ACModeControlUnit extends StatelessWidget {
// .add(ChangeAcMode(tempModes: state.acStatusModel.acMode)); // .add(ChangeAcMode(tempModes: state.acStatusModel.acMode));
// } // }
if (state is! AcChangeLoading && state is! AcsLoadingState) { if (state is! AcChangeLoading && state is! AcsLoadingState) {
BlocProvider.of<ACsBloc>(context) BlocProvider.of<ACsBloc>(context).add(ChangeAcMode(
.add(ChangeAcMode(tempModes: acStatus.acMode, deviceId: deviceId)); tempModes: acStatus.acMode,
deviceId: deviceId,
productId: productId ?? ''));
} }
}, },
child: DefaultContainer( child: DefaultContainer(

View File

@ -35,10 +35,10 @@ class ACTempWidget extends StatelessWidget {
child: InkWell( child: InkWell(
onTap: () { onTap: () {
double tempC = temp / 10; double tempC = temp / 10;
if (tempC > 20) { BlocProvider.of<ACsBloc>(context).add(DecreaseCoolToTemp(
BlocProvider.of<ACsBloc>(context) value: tempC,
.add(DecreaseCoolToTemp(value: tempC, deviceId: deviceModel.uuid ?? '')); deviceId: deviceModel.uuid ?? '',
} productId: deviceModel.productUuid ?? ''));
}, },
child: SvgPicture.asset( child: SvgPicture.asset(
Assets.assetsIconsMinus, Assets.assetsIconsMinus,
@ -57,10 +57,10 @@ class ACTempWidget extends StatelessWidget {
child: InkWell( child: InkWell(
onTap: () { onTap: () {
double tempC = temp / 10; double tempC = temp / 10;
if (tempC < 30) { BlocProvider.of<ACsBloc>(context).add(IncreaseCoolToTemp(
BlocProvider.of<ACsBloc>(context) value: tempC,
.add(IncreaseCoolToTemp(value: tempC, deviceId: deviceModel.uuid ?? '')); deviceId: deviceModel.uuid ?? '',
} productId: deviceModel.productUuid ?? ''));
}, },
child: SvgPicture.asset( child: SvgPicture.asset(
Assets.assetsIconsPlus, Assets.assetsIconsPlus,

View File

@ -9,9 +9,9 @@ import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_mode_control_un
import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_temp_widget.dart'; import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_temp_widget.dart';
import 'package:syncrow_app/features/devices/view/widgets/ACs/universal_ac_temp.dart'; import 'package:syncrow_app/features/devices/view/widgets/ACs/universal_ac_temp.dart';
import 'package:syncrow_app/features/devices/view/widgets/universal_switch.dart'; import 'package:syncrow_app/features/devices/view/widgets/universal_switch.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/devices_default_switch.dart'; import 'package:syncrow_app/features/shared_widgets/devices_default_switch.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
import 'package:syncrow_app/utils/helpers/snack_bar.dart';
class ACsList extends StatelessWidget { class ACsList extends StatelessWidget {
const ACsList({ const ACsList({
@ -20,7 +20,12 @@ class ACsList extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocBuilder<ACsBloc, AcsState>( return BlocConsumer<ACsBloc, AcsState>(
listener: (context, state) {
if (state is AcsFailedState) {
CustomSnackBar.displaySnackBar(state.errorMessage);
}
},
builder: (context, state) { builder: (context, state) {
List<AcStatusModel> devicesStatuesList = []; List<AcStatusModel> devicesStatuesList = [];
List<DeviceModel> devicesList = []; List<DeviceModel> devicesList = [];
@ -35,74 +40,78 @@ class ACsList extends StatelessWidget {
temperature = state.temp; temperature = state.temp;
} }
return SingleChildScrollView( return SingleChildScrollView(
child: state is AcChangeLoading || state is AcsLoadingState child:
? const Center( // state is AcChangeLoading || state is AcsLoadingState
child: // ? const Center(
DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()), // child:
) // DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()),
: Column( // )
crossAxisAlignment: CrossAxisAlignment.stretch, // :
children: [ Column(
// universal AC controller crossAxisAlignment: CrossAxisAlignment.stretch,
const SizedBox(height: 10), children: [
const BodySmall(text: "All ACs"), // universal AC controller
const SizedBox(height: 5), const SizedBox(height: 10),
UniversalSwitch( const BodySmall(text: "All ACs"),
allOn: allOn, const SizedBox(height: 5),
), UniversalSwitch(
const SizedBox(height: 10), allOn: allOn,
UniversalACTemp( ),
allTempSame: allTempSame, const SizedBox(height: 10),
temp: temperature, UniversalACTemp(
), allTempSame: allTempSame,
const SizedBox(height: 10), temp: temperature,
),
const SizedBox(height: 10),
// other ACs controls // other ACs controls
ListView.builder( ListView.builder(
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
itemCount: devicesList.length, itemCount: devicesList.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
const SizedBox( const SizedBox(
height: 10, height: 10,
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
BodySmall(text: devicesList[index].name ?? ''), BodySmall(text: devicesList[index].name ?? ''),
], ],
), ),
const SizedBox(height: 5), const SizedBox(height: 5),
DevicesDefaultSwitch( DevicesDefaultSwitch(
switchValue: devicesStatuesList[index].acSwitch, switchValue: devicesStatuesList[index].acSwitch,
action: () { action: () {
BlocProvider.of<ACsBloc>(context).add(AcSwitch( BlocProvider.of<ACsBloc>(context).add(AcSwitch(
acSwitch: devicesStatuesList[index].acSwitch, acSwitch: devicesStatuesList[index].acSwitch,
deviceId: devicesList[index].uuid ?? ''));
},
),
const SizedBox(height: 10),
ACTempWidget(
deviceModel: devicesList[index],
temp: devicesStatuesList[index].tempSet,
),
const SizedBox(height: 10),
ACModeControlUnit(
acStatus: devicesStatuesList[index],
deviceId: devicesList[index].uuid ?? '', deviceId: devicesList[index].uuid ?? '',
), productId: devicesList[index].productUuid ?? ''));
const SizedBox(height: 10), },
], ),
); const SizedBox(height: 10),
}, ACTempWidget(
), deviceModel: devicesList[index],
], temp: devicesStatuesList[index].tempSet,
), ),
const SizedBox(height: 10),
ACModeControlUnit(
acStatus: devicesStatuesList[index],
deviceId: devicesList[index].uuid ?? '',
productId: devicesList[index].productUuid ?? '',
),
const SizedBox(height: 10),
],
);
},
),
],
),
); );
}, },
); );

View File

@ -29,9 +29,7 @@ class UniversalACTemp extends StatelessWidget {
child: InkWell( child: InkWell(
onTap: () { onTap: () {
double temperature = temp / 10; double temperature = temp / 10;
if (temperature < 30) { BlocProvider.of<ACsBloc>(context).add(DecreaseAllTemp(value: temperature));
BlocProvider.of<ACsBloc>(context).add(DecreaseAllTemp(value: temperature));
}
}, },
child: SvgPicture.asset( child: SvgPicture.asset(
Assets.assetsIconsMinus, Assets.assetsIconsMinus,
@ -50,9 +48,7 @@ class UniversalACTemp extends StatelessWidget {
child: InkWell( child: InkWell(
onTap: () { onTap: () {
double temperature = temp / 10; double temperature = temp / 10;
if (temperature > 20) { BlocProvider.of<ACsBloc>(context).add(IncreaseAllTemp(value: temperature));
BlocProvider.of<ACsBloc>(context).add(IncreaseAllTemp(value: temperature));
}
}, },
child: SvgPicture.asset( child: SvgPicture.asset(
Assets.assetsIconsPlus, Assets.assetsIconsPlus,

View File

@ -4,7 +4,6 @@ import 'package:syncrow_app/features/devices/bloc/three_gang_bloc/three_gang_blo
import 'package:syncrow_app/features/devices/bloc/three_gang_bloc/three_gang_event.dart'; import 'package:syncrow_app/features/devices/bloc/three_gang_bloc/three_gang_event.dart';
import 'package:syncrow_app/features/devices/bloc/three_gang_bloc/three_gang_state.dart'; import 'package:syncrow_app/features/devices/bloc/three_gang_bloc/three_gang_state.dart';
import 'package:syncrow_app/features/devices/model/group_three_gang_model.dart'; import 'package:syncrow_app/features/devices/model/group_three_gang_model.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/devices_default_switch.dart'; import 'package:syncrow_app/features/shared_widgets/devices_default_switch.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
@ -18,78 +17,71 @@ class ThreeGangList extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocBuilder<ThreeGangBloc, ThreeGangState>( return BlocBuilder<ThreeGangBloc, ThreeGangState>(
builder: (context, state) { builder: (context, state) {
return state is LoadingNewSate return SingleChildScrollView(
? const Center( child: Column(
child: DefaultContainer(width: 50, height: 50, child: CircularProgressIndicator()), crossAxisAlignment: CrossAxisAlignment.stretch,
) children: [
: SingleChildScrollView( const SizedBox(height: 10),
child: Column( const BodySmall(text: 'All Lights'),
crossAxisAlignment: CrossAxisAlignment.stretch, const SizedBox(height: 5),
children: [ DevicesDefaultSwitch(
const SizedBox(height: 10), switchValue: allSwitches,
const BodySmall(text: 'All Lights'), action: () {
const SizedBox(height: 5), BlocProvider.of<ThreeGangBloc>(context).add(GroupAllOnEvent());
DevicesDefaultSwitch( },
switchValue: allSwitches, secondAction: () {
action: () { BlocProvider.of<ThreeGangBloc>(context).add(GroupAllOffEvent());
BlocProvider.of<ThreeGangBloc>(context).add(GroupAllOnEvent()); },
}, ),
secondAction: () { ListView.builder(
BlocProvider.of<ThreeGangBloc>(context).add(GroupAllOffEvent()); shrinkWrap: true,
}, physics: const NeverScrollableScrollPhysics(),
), padding: const EdgeInsets.all(0),
ListView.builder( itemCount: threeGangList.length,
shrinkWrap: true, itemBuilder: (context, index) {
physics: const NeverScrollableScrollPhysics(), return Column(
padding: const EdgeInsets.all(0), crossAxisAlignment: CrossAxisAlignment.start,
itemCount: threeGangList.length, children: [
itemBuilder: (context, index) { const SizedBox(height: 10),
return Column( BodySmall(text: '${threeGangList[index].deviceName} beside light'),
crossAxisAlignment: CrossAxisAlignment.start, const SizedBox(height: 5),
children: [ DevicesDefaultSwitch(
const SizedBox(height: 10), switchValue: threeGangList[index].firstSwitch,
BodySmall(text: '${threeGangList[index].deviceName} beside light'), action: () {
const SizedBox(height: 5), BlocProvider.of<ThreeGangBloc>(context).add(ChangeFirstSwitchStatusEvent(
DevicesDefaultSwitch( value: threeGangList[index].firstSwitch,
switchValue: threeGangList[index].firstSwitch, deviceId: threeGangList[index].deviceId));
action: () { },
BlocProvider.of<ThreeGangBloc>(context).add( ),
ChangeFirstSwitchStatusEvent( const SizedBox(height: 10),
value: threeGangList[index].firstSwitch, BodySmall(text: '${threeGangList[index].deviceName} ceiling light'),
deviceId: threeGangList[index].deviceId)); const SizedBox(height: 5),
}, DevicesDefaultSwitch(
), switchValue: threeGangList[index].secondSwitch,
const SizedBox(height: 10), action: () {
BodySmall(text: '${threeGangList[index].deviceName} ceiling light'), BlocProvider.of<ThreeGangBloc>(context).add(ChangeSecondSwitchStatusEvent(
const SizedBox(height: 5), value: threeGangList[index].secondSwitch,
DevicesDefaultSwitch( deviceId: threeGangList[index].deviceId));
switchValue: threeGangList[index].secondSwitch, },
action: () { ),
BlocProvider.of<ThreeGangBloc>(context).add( const SizedBox(height: 10),
ChangeSecondSwitchStatusEvent( BodySmall(text: '${threeGangList[index].deviceName} spotlight'),
value: threeGangList[index].secondSwitch, const SizedBox(height: 5),
deviceId: threeGangList[index].deviceId)); DevicesDefaultSwitch(
}, switchValue: threeGangList[index].thirdSwitch,
), action: () {
const SizedBox(height: 10), BlocProvider.of<ThreeGangBloc>(context).add(ChangeThirdSwitchStatusEvent(
BodySmall(text: '${threeGangList[index].deviceName} spotlight'), value: threeGangList[index].thirdSwitch,
const SizedBox(height: 5), deviceId: threeGangList[index].deviceId));
DevicesDefaultSwitch( },
switchValue: threeGangList[index].thirdSwitch, ),
action: () { ],
BlocProvider.of<ThreeGangBloc>(context).add( );
ChangeThirdSwitchStatusEvent( },
value: threeGangList[index].thirdSwitch, ),
deviceId: threeGangList[index].deviceId)); ],
}, ),
), );
],
);
},
),
],
),
);
}, },
); );
} }

View File

@ -6,6 +6,7 @@ import 'package:syncrow_app/features/menu/view/widgets/menu_list.dart';
import 'package:syncrow_app/features/menu/view/widgets/profile/profile_tab.dart'; import 'package:syncrow_app/features/menu/view/widgets/profile/profile_tab.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart'; import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart'; import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
import 'package:syncrow_app/utils/context_extension.dart'; import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/constants.dart'; import 'package:syncrow_app/utils/resource_manager/constants.dart';
@ -33,6 +34,11 @@ class MenuView extends StatelessWidget {
const SizedBox( const SizedBox(
height: 15, height: 15,
), ),
const BodyMedium(
text: String.fromEnvironment('FLAVOR', defaultValue: 'production')),
const SizedBox(
height: 15,
),
InkWell( InkWell(
onTap: () { onTap: () {
AuthCubit.get(context).logout(); AuthCubit.get(context).logout();

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:syncrow_app/firebase_options.dart'; import 'package:syncrow_app/firebase_options.dart';
import 'package:syncrow_app/services/locator.dart'; import 'package:syncrow_app/services/locator.dart';
import 'package:syncrow_app/utils/bloc_observer.dart'; import 'package:syncrow_app/utils/bloc_observer.dart';
@ -15,9 +16,8 @@ void main() {
//to catch all the errors in the app and send them to firebase //to catch all the errors in the app and send them to firebase
runZonedGuarded(() async { runZonedGuarded(() async {
//to load the environment variables //to load the environment variables
// const environment = const environment = String.fromEnvironment('FLAVOR', defaultValue: 'production');
// String.fromEnvironment('FLAVOR', defaultValue: 'production'); await dotenv.load(fileName: '.env.$environment');
// await dotenv.load(fileName: '.env.$environment');
// //this is to make the app work with the self-signed certificate // //this is to make the app work with the self-signed certificate
// HttpOverrides.global = MyHttpOverrides(); // HttpOverrides.global = MyHttpOverrides();

View File

@ -1,165 +1,163 @@
import 'package:flutter_dotenv/flutter_dotenv.dart';
abstract class ApiEndpoints { abstract class ApiEndpoints {
static const String baseUrl = 'https://syncrow-dev.azurewebsites.net'; static String baseUrl = dotenv.env['BASE_URL'] ?? '';
// static const String baseUrl = 'http://100.107.182.63:4001'; //Localhost
////////////////////////////////////// Authentication /////////////////////////////// ////////////////////////////////////// Authentication ///////////////////////////////
static const String signUp = '$baseUrl/authentication/user/signup'; static const String signUp = '/authentication/user/signup';
static const String login = '$baseUrl/authentication/user/login'; static const String login = '/authentication/user/login';
static const String deleteUser = '$baseUrl/authentication/user/delete/{id}'; static const String deleteUser = '/authentication/user/delete/{id}';
static const String sendOtp = '$baseUrl/authentication/user/send-otp'; static const String sendOtp = '/authentication/user/send-otp';
static const String verifyOtp = '$baseUrl/authentication/user/verify-otp'; static const String verifyOtp = '/authentication/user/verify-otp';
static const String forgetPassword = '$baseUrl/authentication/user/forget-password'; static const String forgetPassword = '/authentication/user/forget-password';
////////////////////////////////////// Spaces /////////////////////////////////////// ////////////////////////////////////// Spaces ///////////////////////////////////////
///Community Module ///Community Module
//POST //POST
static const String addCommunity = '$baseUrl/community'; static const String addCommunity = '/community';
static const String addCommunityToUser = '$baseUrl/community/user'; static const String addCommunityToUser = '/community/user';
//GET //GET
static const String communityByUuid = '$baseUrl/community/{communityUuid}'; static const String communityByUuid = '/community/{communityUuid}';
static const String communityChild = '$baseUrl/community/child/{communityUuid}'; static const String communityChild = '/community/child/{communityUuid}';
static const String communityUser = '$baseUrl/community/user/{userUuid}'; static const String communityUser = '/community/user/{userUuid}';
//PUT //PUT
static const String renameCommunity = '$baseUrl/community/rename/{communityUuid}'; static const String renameCommunity = '/community/rename/{communityUuid}';
///Building Module ///Building Module
//POST //POST
static const String addBuilding = '$baseUrl/building'; static const String addBuilding = '/building';
static const String addBuildingToUser = '$baseUrl/building/user'; static const String addBuildingToUser = '/building/user';
//GET //GET
static const String buildingByUuid = '$baseUrl/building/{buildingUuid}'; static const String buildingByUuid = '/building/{buildingUuid}';
static const String buildingChild = '$baseUrl/building/child/{buildingUuid}'; static const String buildingChild = '/building/child/{buildingUuid}';
static const String buildingParent = '$baseUrl/building/parent/{buildingUuid}'; static const String buildingParent = '/building/parent/{buildingUuid}';
static const String buildingUser = '$baseUrl/building/user/{userUuid}'; static const String buildingUser = '/building/user/{userUuid}';
//PUT //PUT
static const String renameBuilding = '$baseUrl/building/rename/{buildingUuid}'; static const String renameBuilding = '/building/rename/{buildingUuid}';
///Floor Module ///Floor Module
//POST //POST
static const String addFloor = '$baseUrl/floor'; static const String addFloor = '/floor';
static const String addFloorToUser = '$baseUrl/floor/user'; static const String addFloorToUser = '/floor/user';
//GET //GET
static const String floorByUuid = '$baseUrl/floor/{floorUuid}'; static const String floorByUuid = '/floor/{floorUuid}';
static const String floorChild = '$baseUrl/floor/child/{floorUuid}'; static const String floorChild = '/floor/child/{floorUuid}';
static const String floorParent = '$baseUrl/floor/parent/{floorUuid}'; static const String floorParent = '/floor/parent/{floorUuid}';
static const String floorUser = '$baseUrl/floor/user/{userUuid}'; static const String floorUser = '/floor/user/{userUuid}';
//PUT //PUT
static const String renameFloor = '$baseUrl/floor/rename/{floorUuid}'; static const String renameFloor = '/floor/rename/{floorUuid}';
///Unit Module ///Unit Module
//POST //POST
static const String addUnit = '$baseUrl/unit'; static const String addUnit = '/unit';
static const String addUnitToUser = '$baseUrl/unit/user'; static const String addUnitToUser = '/unit/user';
//GET //GET
static const String unitByUuid = '$baseUrl/unit/'; static const String unitByUuid = '/unit/';
static const String unitChild = '$baseUrl/unit/child/'; static const String unitChild = '/unit/child/';
static const String unitParent = '$baseUrl/unit/parent/{unitUuid}'; static const String unitParent = '/unit/parent/{unitUuid}';
static const String unitUser = '$baseUrl/unit/user/'; static const String unitUser = '/unit/user/';
static const String invitationCode = '$baseUrl/unit/{unitUuid}/invitation-code'; static const String invitationCode = '/unit/{unitUuid}/invitation-code';
static const String verifyInvitationCode = '$baseUrl/unit/user/verify-code'; static const String verifyInvitationCode = '/unit/user/verify-code';
//PUT //PUT
static const String renameUnit = '$baseUrl/unit/rename/{unitUuid}'; static const String renameUnit = '/unit/rename/{unitUuid}';
///Room Module ///Room Module
//POST //POST
static const String addRoom = '$baseUrl/room'; static const String addRoom = '/room';
static const String addRoomToUser = '$baseUrl/room/user'; static const String addRoomToUser = '/room/user';
//GET //GET
static const String roomByUuid = '$baseUrl/room/{roomUuid}'; static const String roomByUuid = '/room/{roomUuid}';
static const String roomParent = '$baseUrl/room/parent/{roomUuid}'; static const String roomParent = '/room/parent/{roomUuid}';
static const String roomUser = '$baseUrl/room/user/{userUuid}'; static const String roomUser = '/room/user/{userUuid}';
//PUT //PUT
static const String renameRoom = '$baseUrl/room/rename/{roomUuid}'; static const String renameRoom = '/room/rename/{roomUuid}';
///Group Module ///Group Module
//POST //POST
static const String addGroup = '$baseUrl/group'; static const String addGroup = '/group';
static const String controlGroup = '$baseUrl/group/control'; static const String controlGroup = '/group/control';
//GET //GET
static const String groupBySpace = '$baseUrl/group/{unitUuid}'; static const String groupBySpace = '/group/{unitUuid}';
static const String devicesByGroupName = '$baseUrl/group/{unitUuid}/devices/{groupName}'; static const String devicesByGroupName = '/group/{unitUuid}/devices/{groupName}';
static const String groupByUuid = '$baseUrl/group/{groupUuid}'; static const String groupByUuid = '/group/{groupUuid}';
//DELETE //DELETE
static const String deleteGroup = '$baseUrl/group/{groupUuid}'; static const String deleteGroup = '/group/{groupUuid}';
////////////////////////////////////// Devices /////////////////////////////////////// ////////////////////////////////////// Devices ///////////////////////////////////////
///Device Module ///Device Module
//POST //POST
static const String addDeviceToRoom = '$baseUrl/device/room'; static const String addDeviceToRoom = '/device/room';
static const String addDeviceToGroup = '$baseUrl/device/group'; static const String addDeviceToGroup = '/device/group';
static const String controlDevice = '$baseUrl/device/{deviceUuid}/control'; static const String controlDevice = '/device/{deviceUuid}/control';
static const String firmwareDevice = '$baseUrl/device/{deviceUuid}/firmware/{firmwareVersion}'; static const String firmwareDevice = '/device/{deviceUuid}/firmware/{firmwareVersion}';
static const String getDevicesByUserId = '$baseUrl/device/user/{userId}'; static const String getDevicesByUserId = '/device/user/{userId}';
static const String getDevicesByUnitId = '$baseUrl/device/unit/{unitUuid}'; static const String getDevicesByUnitId = '/device/unit/{unitUuid}';
//GET //GET
static const String deviceByRoom = '$baseUrl/device/room'; static const String deviceByRoom = '/device/room';
static const String deviceByUuid = '$baseUrl/device/{deviceUuid}'; static const String deviceByUuid = '/device/{deviceUuid}';
static const String deviceFunctions = '$baseUrl/device/{deviceUuid}/functions'; static const String deviceFunctions = '/device/{deviceUuid}/functions';
static const String gatewayApi = '$baseUrl/device/gateway/{gatewayUuid}/devices'; static const String gatewayApi = '/device/gateway/{gatewayUuid}/devices';
static const String deviceFunctionsStatus = '$baseUrl/device/{deviceUuid}/functions/status'; static const String deviceFunctionsStatus = '/device/{deviceUuid}/functions/status';
///Device Permission Module ///Device Permission Module
//POST //POST
static const String addDevicePermission = '$baseUrl/device-permission/add'; static const String addDevicePermission = '/device-permission/add';
//GET //GET
static const String devicePermissionList = '$baseUrl/device-permission/list'; static const String devicePermissionList = '/device-permission/list';
//PUT //PUT
static const String editDevicePermission = '$baseUrl/device-permission/edit/{userId}'; static const String editDevicePermission = '/device-permission/edit/{userId}';
static const String assignDeviceToRoom = '$baseUrl/device/room'; static const String assignDeviceToRoom = '/device/room';
/// Scene API //////////////////// /// Scene API ////////////////////
/// POST /// POST
static const String createScene = '$baseUrl/scene/tap-to-run'; static const String createScene = '/scene/tap-to-run';
static const String triggerScene = '$baseUrl/scene/tap-to-run/trigger/{sceneId}'; static const String triggerScene = '/scene/tap-to-run/trigger/{sceneId}';
/// GET /// GET
static const String getUnitScenes = '$baseUrl/scene/tap-to-run/{unitUuid}'; static const String getUnitScenes = '/scene/tap-to-run/{unitUuid}';
static const String getScene = '$baseUrl/scene/tap-to-run/details/{sceneId}'; static const String getScene = '/scene/tap-to-run/details/{sceneId}';
/// PUT /// PUT
static const String updateScene = '$baseUrl/scene/tap-to-run/{sceneId}'; static const String updateScene = '/scene/tap-to-run/{sceneId}';
/// DELETE /// DELETE
static const String deleteScene = '$baseUrl/scene/tap-to-run/{unitUuid}/{sceneId}'; static const String deleteScene = '/scene/tap-to-run/{unitUuid}/{sceneId}';
//////////////////////Door Lock ////////////////////// //////////////////////Door Lock //////////////////////
//online //online
static const String addTemporaryPassword = static const String addTemporaryPassword = '/door-lock/temporary-password/online/{doorLockUuid}';
'$baseUrl/door-lock/temporary-password/online/{doorLockUuid}'; static const String getTemporaryPassword = '/door-lock/temporary-password/online/{doorLockUuid}';
static const String getTemporaryPassword =
'$baseUrl/door-lock/temporary-password/online/{doorLockUuid}';
//one-time offline //one-time offline
static const String addOneTimeTemporaryPassword = static const String addOneTimeTemporaryPassword =
'$baseUrl/door-lock/temporary-password/offline/one-time/{doorLockUuid}'; '/door-lock/temporary-password/offline/one-time/{doorLockUuid}';
static const String getOneTimeTemporaryPassword = static const String getOneTimeTemporaryPassword =
'$baseUrl/door-lock/temporary-password/offline/one-time/{doorLockUuid}'; '/door-lock/temporary-password/offline/one-time/{doorLockUuid}';
//multiple-time offline //multiple-time offline
static const String addMultipleTimeTemporaryPassword = static const String addMultipleTimeTemporaryPassword =
'$baseUrl/door-lock/temporary-password/offline/multiple-time/{doorLockUuid}'; '/door-lock/temporary-password/offline/multiple-time/{doorLockUuid}';
static const String getMultipleTimeTemporaryPassword = static const String getMultipleTimeTemporaryPassword =
'$baseUrl/door-lock/temporary-password/offline/multiple-time/{doorLockUuid}'; '/door-lock/temporary-password/offline/multiple-time/{doorLockUuid}';
//multiple-time offline //multiple-time offline
static const String deleteTemporaryPassword = static const String deleteTemporaryPassword =
'$baseUrl/door-lock/temporary-password/{doorLockUuid}/{passwordId}'; '/door-lock/temporary-password/{doorLockUuid}/{passwordId}';
//user //user
static const String getUser = '$baseUrl/user/{userUuid}'; static const String getUser = '/user/{userUuid}';
static const String saveRegion = '$baseUrl/user/region/{userUuid}'; static const String saveRegion = '/user/region/{userUuid}';
static const String saveTimeZone = '$baseUrl/user/timezone/{userUuid}'; static const String saveTimeZone = '/user/timezone/{userUuid}';
static const String saveName = '$baseUrl/user/name/{userUuid}'; static const String saveName = '/user/name/{userUuid}';
static const String sendPicture = '$baseUrl/user/profile-picture/{userUuid}'; static const String sendPicture = '/user/profile-picture/{userUuid}';
static const String getRegion = '$baseUrl/region'; static const String getRegion = '/region';
static const String getTimezone = '$baseUrl/timezone'; static const String getTimezone = '/timezone';
} }

View File

@ -5,7 +5,7 @@ description: This is the mobile application project, developed with Flutter for
# pub.dev using `flutter pub publish`. This is preferred for private packages. # pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 1.0.1+11 version: 1.0.1+12
environment: environment:
sdk: ">=3.0.6 <4.0.0" sdk: ">=3.0.6 <4.0.0"
@ -76,6 +76,11 @@ flutter:
- assets/icons/MenuIcons/SecurityAndPrivacyIcons/ - assets/icons/MenuIcons/SecurityAndPrivacyIcons/
- assets/icons/curtainsIcon/ - assets/icons/curtainsIcon/
- assets/icons/functions_icons/ - assets/icons/functions_icons/
- .env.development
- .env.staging
- .env.production
fonts: fonts:
- family: Aftika - family: Aftika
fonts: fonts: