mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-08-26 07:19:39 +00:00
fixes bugs and add project id staging
This commit is contained in:
@ -136,7 +136,6 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
ac.acSwitch = acSwitchValue;
|
ac.acSwitch = acSwitchValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_setAllAcsTempsAndSwitches();
|
_setAllAcsTempsAndSwitches();
|
||||||
_emitAcsStatus(emit);
|
_emitAcsStatus(emit);
|
||||||
@ -458,24 +457,27 @@ class ACsBloc extends Bloc<AcsEvent, AcsState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _getCounterValue(GetCounterEvent event, Emitter<AcsState> emit) async {
|
void _getCounterValue(GetCounterEvent event, Emitter<AcsState> emit) async {
|
||||||
try {
|
emit(AcsLoadingState());
|
||||||
emit(AcsLoadingState());
|
var response = await DevicesAPI.getDeviceStatus(acId);
|
||||||
var response = await DevicesAPI.getDeviceStatus(acId);
|
List<StatusModel> statusModelList = [];
|
||||||
List<StatusModel> statusModelList = [];
|
for (var status in response['status']) {
|
||||||
for (var status in response['status']) {
|
statusModelList.add(StatusModel.fromJson(status));
|
||||||
statusModelList.add(StatusModel.fromJson(status));
|
}
|
||||||
}
|
deviceStatus =
|
||||||
deviceStatus =
|
AcStatusModel.fromJson(response['productUuid'], statusModelList);
|
||||||
AcStatusModel.fromJson(response['productUuid'], statusModelList);
|
deviceStatus.countdown1;
|
||||||
|
var duration;
|
||||||
if (event.deviceCode == 'countdown_time') {
|
if (deviceStatus.countdown1 == 5) {
|
||||||
deviceStatus.countdown1 > 0
|
duration = const Duration(minutes: 30);
|
||||||
? _onStartTimer(deviceStatus.countdown1)
|
var countNum = duration.inSeconds;
|
||||||
: emit(UpdateTimerState(seconds: deviceStatus.countdown1));
|
_onStartTimer(countNum);
|
||||||
}
|
} else if (deviceStatus.countdown1 > 5) {
|
||||||
} catch (e) {
|
duration = Duration(minutes: deviceStatus.countdown1 * 6);
|
||||||
emit(AcsFailedState(errorMessage: e.toString()));
|
var countNum = duration.inSeconds;
|
||||||
return;
|
_onStartTimer(countNum);
|
||||||
|
} else {
|
||||||
|
_timer?.cancel();
|
||||||
|
emit(TimerRunComplete());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,6 @@ class DevicesCubit extends Cubit<DevicesState> {
|
|||||||
return _instance ??= DevicesCubit._();
|
return _instance ??= DevicesCubit._();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> close() {
|
Future<void> close() {
|
||||||
_instance = null;
|
_instance = null;
|
||||||
@ -478,8 +477,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
|||||||
final statusIndex =
|
final statusIndex =
|
||||||
device.status.indexWhere((s) => s.code == switchCode);
|
device.status.indexWhere((s) => s.code == switchCode);
|
||||||
if (statusIndex != -1) {
|
if (statusIndex != -1) {
|
||||||
final currentValue = device.status[statusIndex].value ?? false;
|
final toggledValue = control.value;
|
||||||
final toggledValue = !currentValue;
|
|
||||||
final controlRequest = DeviceControlModel(
|
final controlRequest = DeviceControlModel(
|
||||||
code: switchCode, value: toggledValue, deviceId: deviceUuid);
|
code: switchCode, value: toggledValue, deviceId: deviceUuid);
|
||||||
final response =
|
final response =
|
||||||
@ -518,8 +516,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
|||||||
final statusIndex =
|
final statusIndex =
|
||||||
device.status.indexWhere((s) => s.code == switchCode);
|
device.status.indexWhere((s) => s.code == switchCode);
|
||||||
if (statusIndex != -1) {
|
if (statusIndex != -1) {
|
||||||
final currentValue = device.status[statusIndex].value ?? false;
|
final toggledValue = control.value;
|
||||||
final toggledValue = !currentValue;
|
|
||||||
final controlRequest = DeviceControlModel(
|
final controlRequest = DeviceControlModel(
|
||||||
code: switchCode, value: toggledValue, deviceId: deviceUuid);
|
code: switchCode, value: toggledValue, deviceId: deviceUuid);
|
||||||
final response =
|
final response =
|
||||||
@ -556,8 +553,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
|||||||
final statusIndex =
|
final statusIndex =
|
||||||
device.status.indexWhere((s) => s.code == switchCode);
|
device.status.indexWhere((s) => s.code == switchCode);
|
||||||
if (statusIndex != -1) {
|
if (statusIndex != -1) {
|
||||||
final currentValue = device.status[statusIndex].value ?? false;
|
final toggledValue = control.value;
|
||||||
final toggledValue = !currentValue;
|
|
||||||
final controlRequest = DeviceControlModel(
|
final controlRequest = DeviceControlModel(
|
||||||
code: switchCode, value: toggledValue, deviceId: deviceUuid);
|
code: switchCode, value: toggledValue, deviceId: deviceUuid);
|
||||||
final response =
|
final response =
|
||||||
@ -589,8 +585,7 @@ class DevicesCubit extends Cubit<DevicesState> {
|
|||||||
|
|
||||||
final statusIndex = device.status.indexWhere((s) => s.code == 'switch_1');
|
final statusIndex = device.status.indexWhere((s) => s.code == 'switch_1');
|
||||||
if (statusIndex != -1) {
|
if (statusIndex != -1) {
|
||||||
final currentValue = device.status[statusIndex].value ?? false;
|
final toggledValue = control.value;
|
||||||
final toggledValue = !currentValue;
|
|
||||||
final controlRequest = DeviceControlModel(
|
final controlRequest = DeviceControlModel(
|
||||||
code: 'switch_1', value: toggledValue, deviceId: deviceUuid);
|
code: 'switch_1', value: toggledValue, deviceId: deviceUuid);
|
||||||
final response =
|
final response =
|
||||||
|
@ -43,6 +43,7 @@ class AcInterfaceControls extends StatelessWidget {
|
|||||||
PageRouteBuilder(
|
PageRouteBuilder(
|
||||||
pageBuilder: (context, animation1, animation2) =>
|
pageBuilder: (context, animation1, animation2) =>
|
||||||
AcTimerPage(
|
AcTimerPage(
|
||||||
|
deviceStatus: deviceStatus,
|
||||||
device: deviceModel,
|
device: deviceModel,
|
||||||
deviceCode: deviceModel.type!,
|
deviceCode: deviceModel.type!,
|
||||||
switchCode: '',
|
switchCode: '',
|
||||||
|
@ -7,7 +7,7 @@ import 'package:syncrow_app/features/devices/bloc/6_scene_switch_bloc/6_scene_st
|
|||||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_bloc.dart';
|
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_bloc.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';
|
||||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart';
|
||||||
|
import 'package:syncrow_app/features/devices/model/ac_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/ACs/custom_halfhour_timer_picker.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/ACs/custom_halfhour_timer_picker.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
|
||||||
@ -20,10 +20,13 @@ class AcTimerPage extends StatelessWidget {
|
|||||||
final DeviceModel device;
|
final DeviceModel device;
|
||||||
final String deviceCode;
|
final String deviceCode;
|
||||||
final String switchCode;
|
final String switchCode;
|
||||||
|
final AcStatusModel deviceStatus;
|
||||||
|
|
||||||
const AcTimerPage(
|
const AcTimerPage(
|
||||||
{required this.device,
|
{required this.device,
|
||||||
required this.deviceCode,
|
required this.deviceCode,
|
||||||
required this.switchCode,
|
required this.switchCode,
|
||||||
|
required this.deviceStatus,
|
||||||
super.key});
|
super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -37,27 +40,24 @@ class AcTimerPage extends StatelessWidget {
|
|||||||
create: (context) => ACsBloc(acId: device.uuid ?? ''),
|
create: (context) => ACsBloc(acId: device.uuid ?? ''),
|
||||||
child: BlocBuilder<ACsBloc, AcsState>(
|
child: BlocBuilder<ACsBloc, AcsState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
final oneGangBloc = BlocProvider.of<ACsBloc>(context);
|
final acBloc = BlocProvider.of<ACsBloc>(context);
|
||||||
Duration duration = Duration.zero;
|
Duration duration = Duration.zero;
|
||||||
int selectedValue = 0;
|
int selectedValue = 0;
|
||||||
|
|
||||||
int countNum = 0;
|
int countNum = 0;
|
||||||
if (state is UpdateTimerState) {
|
if (state is AcsInitialState) {
|
||||||
|
acBloc.add(GetCounterEvent(deviceCode: deviceCode));
|
||||||
|
} else if (state is UpdateTimerState) {
|
||||||
countNum = state.seconds;
|
countNum = state.seconds;
|
||||||
} else if (state is TimerRunInProgress) {
|
} else if (state is TimerRunInProgress) {
|
||||||
countNum = state.remainingTime;
|
countNum = state.remainingTime;
|
||||||
} else if (state is TimerRunComplete) {
|
} else if (state is TimerRunComplete) {
|
||||||
countNum = 0;
|
countNum = 0;
|
||||||
}
|
}
|
||||||
// else if (state is LoadingNewSate) {
|
|
||||||
// countNum = 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
return PopScope(
|
return PopScope(
|
||||||
canPop: false,
|
canPop: false,
|
||||||
onPopInvoked: (didPop) {
|
onPopInvoked: (didPop) {
|
||||||
if (!didPop) {
|
if (!didPop) {
|
||||||
oneGangBloc.add(OnClose());
|
acBloc.add(OnClose());
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -90,7 +90,7 @@ class AcTimerPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Center(
|
Center(
|
||||||
child: Container(
|
child: SizedBox(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.center,
|
MainAxisAlignment.center,
|
||||||
@ -102,7 +102,7 @@ class AcTimerPage extends StatelessWidget {
|
|||||||
.slidingBlueColor,
|
.slidingBlueColor,
|
||||||
fontSize: 40,
|
fontSize: 40,
|
||||||
)
|
)
|
||||||
: Container(
|
: SizedBox(
|
||||||
child: CustomHalfHourPicker(
|
child: CustomHalfHourPicker(
|
||||||
onValueChanged: (value) {
|
onValueChanged: (value) {
|
||||||
selectedValue =
|
selectedValue =
|
||||||
@ -120,8 +120,6 @@ class AcTimerPage extends StatelessWidget {
|
|||||||
countNum =
|
countNum =
|
||||||
duration.inSeconds;
|
duration.inSeconds;
|
||||||
}
|
}
|
||||||
print(
|
|
||||||
"Selected Value: $selectedValue, Duration: $duration");
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -131,12 +129,14 @@ class AcTimerPage extends StatelessWidget {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (countNum > 0) {
|
if (countNum > 0) {
|
||||||
oneGangBloc.add(SetCounterValue(
|
acBloc.add(SetCounterValue(
|
||||||
seconds: countNum,
|
seconds: countNum,
|
||||||
deviceCode:'countdown_time',
|
deviceCode:
|
||||||
|
'countdown_time',
|
||||||
duration: selectedValue));
|
duration: selectedValue));
|
||||||
} else if (duration != Duration.zero) {
|
} else if (duration !=
|
||||||
oneGangBloc.add(SetCounterValue(
|
Duration.zero) {
|
||||||
|
acBloc.add(SetCounterValue(
|
||||||
seconds: 0,
|
seconds: 0,
|
||||||
deviceCode:
|
deviceCode:
|
||||||
'countdown_time',
|
'countdown_time',
|
||||||
|
@ -4,7 +4,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_bloc.dart';
|
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_bloc.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';
|
||||||
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart';
|
import 'package:syncrow_app/features/devices/bloc/acs_bloc/acs_state.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/ac_model.dart';
|
|
||||||
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_interface.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/ACs/ac_interface.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/ACs/acs_list.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/ACs/acs_list.dart';
|
||||||
@ -23,8 +22,6 @@ class ACsView extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
print("ACsView deviceModel UUID: ${deviceModel?.uuid}");
|
|
||||||
|
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
create: (context) => ACsBloc(acId: deviceModel?.uuid ?? '')
|
create: (context) => ACsBloc(acId: deviceModel?.uuid ?? '')
|
||||||
..add(AcsInitial(allAcs: deviceModel != null ? false : true)),
|
..add(AcsInitial(allAcs: deviceModel != null ? false : true)),
|
||||||
@ -41,7 +38,6 @@ class ACsView extends StatelessWidget {
|
|||||||
extendBody: true,
|
extendBody: true,
|
||||||
appBar: deviceModel != null
|
appBar: deviceModel != null
|
||||||
? DeviceAppbar(
|
? DeviceAppbar(
|
||||||
//BlocProvider.of<ACsBloc>(context).deviceStatus.acSwitch.toString()
|
|
||||||
value: true,
|
value: true,
|
||||||
deviceName: deviceModel!.name!,
|
deviceName: deviceModel!.name!,
|
||||||
deviceUuid: deviceModel!.uuid!,
|
deviceUuid: deviceModel!.uuid!,
|
||||||
|
@ -306,7 +306,7 @@ class CeilingSensorInterface extends StatelessWidget {
|
|||||||
.toString()
|
.toString()
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.replaceAll('sec', 's')
|
.replaceAll('sec', 's')
|
||||||
.replaceAll('1hr', '1hour'), // Replacing "sec" with "s"
|
.replaceAll('1hr', '1hour'),
|
||||||
code: 'nobody_time'));
|
code: 'nobody_time'));
|
||||||
}
|
}
|
||||||
} else if (title == 'Maximum Distance') {
|
} else if (title == 'Maximum Distance') {
|
||||||
@ -344,7 +344,7 @@ class CeilingSensorInterface extends StatelessWidget {
|
|||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) => const CeilingHelpDescription()),
|
MaterialPageRoute(builder: (context) => const CeilingHelpDescription()),
|
||||||
);
|
);
|
||||||
} else if (title == 'Induction History') {
|
} else if (title == 'Presence Record') {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
@ -393,7 +393,7 @@ class CeilingSensorInterface extends StatelessWidget {
|
|||||||
'val': nobodyTimeVal,
|
'val': nobodyTimeVal,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'title': 'Induction History',
|
'title': 'Presence Record',
|
||||||
'icon': Assets.assetsIconsPresenceSensorAssetsInductionRecording,
|
'icon': Assets.assetsIconsPresenceSensorAssetsInductionRecording,
|
||||||
'page': null,
|
'page': null,
|
||||||
'withArrow': false,
|
'withArrow': false,
|
||||||
|
@ -31,12 +31,12 @@ class MaxDistanceControl extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int _parseValue(String value) {
|
int _parseValue(String value) {
|
||||||
if (value.endsWith('sec')) {
|
if (value.endsWith('s')) {
|
||||||
return int.parse(value.replaceAll('sec', '').trim());
|
return int.parse(value.replaceAll('s', '').trim());
|
||||||
} else if (value.endsWith('min')) {
|
} else if (value.endsWith('min')) {
|
||||||
return int.parse(value.replaceAll('min', '').trim()) * 60;
|
return int.parse(value.replaceAll('min', '').trim()) * 60;
|
||||||
} else if (value.endsWith('hr')) {
|
} else if (value.endsWith('hour')) {
|
||||||
return int.parse(value.replaceAll('hr', '').trim()) * 3600;
|
return int.parse(value.replaceAll('hour', '').trim()) * 3600;
|
||||||
}
|
}
|
||||||
return 0; // Default to 0 if the format is unrecognized
|
return 0; // Default to 0 if the format is unrecognized
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ class MaxDistanceControlState extends State<MaxDistanceControl> {
|
|||||||
|
|
||||||
String _formatLabel(double seconds) {
|
String _formatLabel(double seconds) {
|
||||||
if (seconds == 0) return 'None';
|
if (seconds == 0) return 'None';
|
||||||
if (seconds < 60) return '${seconds.toInt()}sec';
|
if (seconds < 60) return '${seconds.toInt()}s';
|
||||||
if (seconds < 3600) {
|
if (seconds < 3600) {
|
||||||
final minutes = (seconds / 60).round();
|
final minutes = (seconds / 60).round();
|
||||||
return '${minutes}min';
|
return '${minutes}min';
|
||||||
@ -90,7 +90,6 @@ class MaxDistanceControlState extends State<MaxDistanceControl> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final double currentSeconds = _stepValues[_currentIndex];
|
final double currentSeconds = _stepValues[_currentIndex];
|
||||||
|
|
||||||
return Dialog(
|
return Dialog(
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -128,7 +127,9 @@ class MaxDistanceControlState extends State<MaxDistanceControl> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
TitleMedium(
|
TitleMedium(
|
||||||
text: _formatLabel(currentSeconds),
|
text: _formatLabel(currentSeconds)
|
||||||
|
.replaceAll('1hr', '1hour')
|
||||||
|
.replaceAllMapped(RegExp(r's$'), (match) => 'sec'),
|
||||||
style: context.titleMedium.copyWith(
|
style: context.titleMedium.copyWith(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
fontWeight: FontsManager.bold,
|
fontWeight: FontsManager.bold,
|
||||||
|
@ -21,32 +21,28 @@ class DevicesViewBody extends StatelessWidget {
|
|||||||
return BlocBuilder<HomeCubit, HomeState>(
|
return BlocBuilder<HomeCubit, HomeState>(
|
||||||
builder: (context, homeState) {
|
builder: (context, homeState) {
|
||||||
final homeCubit = HomeCubit.getInstance();
|
final homeCubit = HomeCubit.getInstance();
|
||||||
|
|
||||||
// Handle state priority: Errors first
|
// Handle state priority: Errors first
|
||||||
if (homeState is ActivationError) {
|
if (homeState is ActivationError) {
|
||||||
return const CreateUnitWidget();
|
return const CreateUnitWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle loading states
|
// Handle loading states
|
||||||
if (homeState is GetSpacesLoading || homeState is HomeLoading) {
|
if (homeState is GetSpacesLoading || homeState is HomeLoading) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle error states
|
// Handle error states
|
||||||
if (homeState is GetSpacesError) {
|
if (homeState is GetSpacesError) {
|
||||||
return const CreateUnitWidget();
|
return const CreateUnitWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle success states
|
// Handle success states
|
||||||
if (homeState is GetSpacesSuccess ||
|
if (homeState is GetSpacesSuccess ||
|
||||||
homeState is RoomUnSelected ||
|
homeState is RoomUnSelected ||
|
||||||
homeState is RoomSelected ||
|
homeState is RoomSelected ||
|
||||||
homeState is NavChangePage) {
|
homeState is NavChangePage ||
|
||||||
|
homeState is GetSpaceRoomsSuccess) {
|
||||||
// Show empty state if no spaces
|
// Show empty state if no spaces
|
||||||
if (homeCubit.spaces.isEmpty) {
|
if (homeCubit.spaces.isEmpty) {
|
||||||
return const CreateUnitWidget();
|
return const CreateUnitWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
return BlocBuilder<DevicesCubit, DevicesState>(
|
return BlocBuilder<DevicesCubit, DevicesState>(
|
||||||
builder: (context, devicesState) {
|
builder: (context, devicesState) {
|
||||||
// Devices loading states
|
// Devices loading states
|
||||||
@ -55,7 +51,6 @@ class DevicesViewBody extends StatelessWidget {
|
|||||||
devicesState is GetDevicesLoading) {
|
devicesState is GetDevicesLoading) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Devices error state
|
// Devices error state
|
||||||
if (devicesState is GetDevicesError) {
|
if (devicesState is GetDevicesError) {
|
||||||
return Center(child: BodyLarge(text: devicesState.errorMsg));
|
return Center(child: BodyLarge(text: devicesState.errorMsg));
|
||||||
@ -65,7 +60,6 @@ class DevicesViewBody extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback for unknown states
|
// Fallback for unknown states
|
||||||
return const Center(child: BodyLarge(text: ''));
|
return const Center(child: BodyLarge(text: ''));
|
||||||
},
|
},
|
||||||
@ -74,7 +68,6 @@ class DevicesViewBody extends StatelessWidget {
|
|||||||
|
|
||||||
Widget _buildMainContent(BuildContext context, HomeCubit homeCubit) {
|
Widget _buildMainContent(BuildContext context, HomeCubit homeCubit) {
|
||||||
final devicesCubit = context.read<DevicesCubit>();
|
final devicesCubit = context.read<DevicesCubit>();
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
@ -51,14 +51,11 @@ class DevicesAPI {
|
|||||||
static Future<Map<String, dynamic>> controlDevice(
|
static Future<Map<String, dynamic>> controlDevice(
|
||||||
DeviceControlModel controlModel, String deviceId) async {
|
DeviceControlModel controlModel, String deviceId) async {
|
||||||
try {
|
try {
|
||||||
print('object-*/-*/-*/${controlModel.toJson()}');
|
|
||||||
final response = await _httpService.post(
|
final response = await _httpService.post(
|
||||||
path: ApiEndpoints.controlDevice.replaceAll('{deviceUuid}', deviceId),
|
path: ApiEndpoints.controlDevice.replaceAll('{deviceUuid}', deviceId),
|
||||||
body: controlModel.toJson(),
|
body: controlModel.toJson(),
|
||||||
showServerMessage: true,
|
showServerMessage: true,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
print('object-*/-*/-*/${json}');
|
|
||||||
|
|
||||||
return json;
|
return json;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -191,7 +188,6 @@ class DevicesAPI {
|
|||||||
path: ApiEndpoints.deviceByUuid.replaceAll('{deviceUuid}', deviceId),
|
path: ApiEndpoints.deviceByUuid.replaceAll('{deviceUuid}', deviceId),
|
||||||
showServerMessage: false,
|
showServerMessage: false,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
print('object-*-*-*${json}');
|
|
||||||
return json;
|
return json;
|
||||||
});
|
});
|
||||||
return response;
|
return response;
|
||||||
@ -229,7 +225,7 @@ class DevicesAPI {
|
|||||||
.replaceAll('{communityUuid}', communityUuid)
|
.replaceAll('{communityUuid}', communityUuid)
|
||||||
.replaceAll('{spaceUuid}', spaceUuid)
|
.replaceAll('{spaceUuid}', spaceUuid)
|
||||||
.replaceAll('{subSpaceUuid}', roomId)
|
.replaceAll('{subSpaceUuid}', roomId)
|
||||||
.replaceAll('{projectUuid}', TempConst.projectId);
|
.replaceAll('{projectUuid}', TempConst.projectIdDev);
|
||||||
|
|
||||||
final response = await _httpService.get(
|
final response = await _httpService.get(
|
||||||
path: path,
|
path: path,
|
||||||
@ -569,21 +565,16 @@ class DevicesAPI {
|
|||||||
required String communityUuid,
|
required String communityUuid,
|
||||||
required String spaceUuid,
|
required String spaceUuid,
|
||||||
}) async {
|
}) async {
|
||||||
print('communityUuid=$communityUuid');
|
|
||||||
print('spaceUuid=$spaceUuid');
|
|
||||||
print('projectUuid=${TempConst.projectId}');
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final String path = ApiEndpoints.getAllDevices
|
final String path = ApiEndpoints.getAllDevices
|
||||||
.replaceAll('{communityUuid}', communityUuid)
|
.replaceAll('{communityUuid}', communityUuid)
|
||||||
.replaceAll('{spaceUuid}', spaceUuid)
|
.replaceAll('{spaceUuid}', spaceUuid)
|
||||||
.replaceAll('{projectUuid}', TempConst.projectId);
|
.replaceAll('{projectUuid}', TempConst.projectIdDev);
|
||||||
|
|
||||||
final response = await _httpService.get(
|
final response = await _httpService.get(
|
||||||
path: path,
|
path: path,
|
||||||
showServerMessage: false,
|
showServerMessage: false,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
print('response-*/-*/$json');
|
|
||||||
final data = json['data'];
|
final data = json['data'];
|
||||||
|
|
||||||
if (data == null || data.isEmpty) {
|
if (data == null || data.isEmpty) {
|
||||||
|
@ -150,7 +150,7 @@ class HomeCreation {
|
|||||||
final fullPath = ApiEndpoints.addSubSpace
|
final fullPath = ApiEndpoints.addSubSpace
|
||||||
.replaceAll('{communityUuid}', communityId)
|
.replaceAll('{communityUuid}', communityId)
|
||||||
.replaceAll('{spaceUuid}', spaceId)
|
.replaceAll('{spaceUuid}', spaceId)
|
||||||
.replaceAll('{projectUuid}', TempConst.projectId);
|
.replaceAll('{projectUuid}', TempConst.projectIdDev);
|
||||||
final response = await _httpService.post(
|
final response = await _httpService.post(
|
||||||
path: fullPath,
|
path: fullPath,
|
||||||
body: body,
|
body: body,
|
||||||
|
@ -40,7 +40,7 @@ class HomeManagementAPI {
|
|||||||
final path = ApiEndpoints.spaceDevices
|
final path = ApiEndpoints.spaceDevices
|
||||||
.replaceAll('{communityUuid}', communityUuid)
|
.replaceAll('{communityUuid}', communityUuid)
|
||||||
.replaceAll('{spaceUuid}', spaceUuid)
|
.replaceAll('{spaceUuid}', spaceUuid)
|
||||||
.replaceAll('{projectUuid}', TempConst.projectId);
|
.replaceAll('{projectUuid}', TempConst.projectIdDev);
|
||||||
|
|
||||||
await _httpService.get(
|
await _httpService.get(
|
||||||
path: path,
|
path: path,
|
||||||
@ -67,6 +67,7 @@ class HomeManagementAPI {
|
|||||||
try {
|
try {
|
||||||
final response = await _httpService.post(
|
final response = await _httpService.post(
|
||||||
path: ApiEndpoints.assignDeviceToRoom
|
path: ApiEndpoints.assignDeviceToRoom
|
||||||
|
.replaceAll('{projectUuid}', TempConst.projectIdDev)
|
||||||
.replaceAll('{communityUuid}', communityId)
|
.replaceAll('{communityUuid}', communityId)
|
||||||
.replaceAll('{spaceUuid}', spaceId)
|
.replaceAll('{spaceUuid}', spaceId)
|
||||||
.replaceAll('{subSpaceUuid}', subSpaceId)
|
.replaceAll('{subSpaceUuid}', subSpaceId)
|
||||||
@ -90,7 +91,7 @@ class HomeManagementAPI {
|
|||||||
.replaceAll('{spaceUuid}', spaceId)
|
.replaceAll('{spaceUuid}', spaceId)
|
||||||
.replaceAll('{subSpaceUuid}', subSpaceId)
|
.replaceAll('{subSpaceUuid}', subSpaceId)
|
||||||
.replaceAll('{deviceUuid}', deviceId)
|
.replaceAll('{deviceUuid}', deviceId)
|
||||||
.replaceAll('{projectUuid}', TempConst.projectId),
|
.replaceAll('{projectUuid}', TempConst.projectIdDev),
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
return json;
|
return json;
|
||||||
},
|
},
|
||||||
|
@ -57,7 +57,7 @@ class SceneApi {
|
|||||||
path: ApiEndpoints.getUnitScenes
|
path: ApiEndpoints.getUnitScenes
|
||||||
.replaceAll('{spaceUuid}', unitId)
|
.replaceAll('{spaceUuid}', unitId)
|
||||||
.replaceAll('{communityUuid}', communityId)
|
.replaceAll('{communityUuid}', communityId)
|
||||||
.replaceAll('{projectUuid}', TempConst.projectId),
|
.replaceAll('{projectUuid}', TempConst.projectIdDev),
|
||||||
queryParameters: {'showInHomePage': showInDevice},
|
queryParameters: {'showInHomePage': showInDevice},
|
||||||
showServerMessage: false,
|
showServerMessage: false,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
|
@ -38,7 +38,7 @@ class SpacesAPI {
|
|||||||
final path = ApiEndpoints.listSubspace
|
final path = ApiEndpoints.listSubspace
|
||||||
.replaceFirst('{communityUuid}', communityId)
|
.replaceFirst('{communityUuid}', communityId)
|
||||||
.replaceFirst('{spaceUuid}', spaceId)
|
.replaceFirst('{spaceUuid}', spaceId)
|
||||||
.replaceAll('{projectUuid}', TempConst.projectId);
|
.replaceAll('{projectUuid}', TempConst.projectIdDev);
|
||||||
|
|
||||||
final response = await _httpService.get(
|
final response = await _httpService.get(
|
||||||
path: path,
|
path: path,
|
||||||
@ -71,7 +71,7 @@ class SpacesAPI {
|
|||||||
path: ApiEndpoints.invitationCode
|
path: ApiEndpoints.invitationCode
|
||||||
.replaceAll('{unitUuid}', unitId)
|
.replaceAll('{unitUuid}', unitId)
|
||||||
.replaceAll('{communityUuid}', communityId)
|
.replaceAll('{communityUuid}', communityId)
|
||||||
.replaceAll('{projectUuid}', TempConst.projectId),
|
.replaceAll('{projectUuid}', TempConst.projectIdDev),
|
||||||
showServerMessage: false,
|
showServerMessage: false,
|
||||||
expectedResponseModel: (json) {
|
expectedResponseModel: (json) {
|
||||||
if (json != null && json['data'] != null) {
|
if (json != null && json['data'] != null) {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
class TempConst {
|
class TempConst {
|
||||||
static const projectId = '0e62577c-06fa-41b9-8a92-99a21fbaf51c';
|
static const projectIdDev = '0e62577c-06fa-41b9-8a92-99a21fbaf51c';
|
||||||
|
static const projectIdStag = 'bcda711e-9fc2-4168-a05e-171b4026d1ff';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user