diff --git a/lib/features/devices/bloc/flush_sensor_bloc/flush_sensor_bloc.dart b/lib/features/devices/bloc/flush_sensor_bloc/flush_sensor_bloc.dart index 5202fb3..caaeb79 100644 --- a/lib/features/devices/bloc/flush_sensor_bloc/flush_sensor_bloc.dart +++ b/lib/features/devices/bloc/flush_sensor_bloc/flush_sensor_bloc.dart @@ -22,7 +22,7 @@ class FlushSensorBloc extends Bloc { on(_changeValue); on(_flushSensorUpdated); on(_getDeviceReports); - on(fetchDeviceInfo); + on(fetchDeviceInfo); } void _fetchFlushSensorStatus( @@ -163,7 +163,7 @@ class FlushSensorBloc extends Bloc { ); static String deviceName = ''; - void fetchDeviceInfo(FlushSensorInitialDeviseInfo event, + void fetchDeviceInfo(FlushSensorInitialDeviceInfo event, Emitter emit) async { try { emit(FlushSensorLoadingInitialState()); diff --git a/lib/features/devices/bloc/flush_sensor_bloc/flush_sensor_event.dart b/lib/features/devices/bloc/flush_sensor_bloc/flush_sensor_event.dart index ddcd0d1..993211a 100644 --- a/lib/features/devices/bloc/flush_sensor_bloc/flush_sensor_event.dart +++ b/lib/features/devices/bloc/flush_sensor_bloc/flush_sensor_event.dart @@ -11,7 +11,7 @@ class FlushSensorLoadingEvent extends FlushSensorEvent {} class FlushSensorInitialEvent extends FlushSensorEvent {} -class FlushSensorInitialDeviseInfo extends FlushSensorEvent {} +class FlushSensorInitialDeviceInfo extends FlushSensorEvent {} class FlushSensorUpdatedEvent extends FlushSensorEvent {} diff --git a/lib/features/devices/view/widgets/flush_sensor/flush_sensor_interface.dart b/lib/features/devices/view/widgets/flush_sensor/flush_sensor_interface.dart index c0f31d2..2c06dec 100644 --- a/lib/features/devices/view/widgets/flush_sensor/flush_sensor_interface.dart +++ b/lib/features/devices/view/widgets/flush_sensor/flush_sensor_interface.dart @@ -9,7 +9,6 @@ import 'package:syncrow_app/features/devices/bloc/flush_sensor_bloc/flush_sensor import 'package:syncrow_app/features/devices/model/device_model.dart'; import 'package:syncrow_app/features/devices/model/flush_sensor_model.dart'; import 'package:syncrow_app/features/devices/view/device_settings/settings_page.dart'; -import 'package:syncrow_app/features/devices/view/widgets/device_appbar.dart'; import 'package:syncrow_app/features/devices/view/widgets/flush_sensor/flush_persence_records.dart'; import 'package:syncrow_app/features/devices/view/widgets/flush_sensor/flush_sensor_option.dart'; import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart'; @@ -20,7 +19,6 @@ import 'package:syncrow_app/utils/context_extension.dart'; import 'package:syncrow_app/utils/helpers/misc_string_helpers.dart'; import 'package:syncrow_app/utils/helpers/snack_bar.dart'; import 'package:syncrow_app/utils/resource_manager/color_manager.dart'; -import 'package:syncrow_app/utils/resource_manager/constants.dart'; import 'package:syncrow_app/utils/resource_manager/font_manager.dart'; part "presence_indicator.dart"; part "flush_sensor_options_list.dart"; @@ -33,7 +31,8 @@ class FlushMountedInterface extends StatelessWidget { Widget build(BuildContext context) { return BlocProvider( create: (context) => FlushSensorBloc(deviceId: deviceModel.uuid ?? '') - ..add(FlushSensorInitialEvent()), + ..add(FlushSensorInitialEvent()) + ..add(FlushSensorInitialDeviceInfo()), child: BlocBuilder( builder: (context, state) { final bloc = BlocProvider.of(context); @@ -72,7 +71,7 @@ class FlushMountedInterface extends StatelessWidget { ), ); if (val == null) { - bloc.add(FlushSensorInitialDeviseInfo()); + bloc.add(FlushSensorInitialDeviceInfo()); bloc.add(FlushSensorInitialEvent()); } }, diff --git a/lib/services/api/devices_api.dart b/lib/services/api/devices_api.dart index 96ec14a..af64483 100644 --- a/lib/services/api/devices_api.dart +++ b/lib/services/api/devices_api.dart @@ -579,7 +579,7 @@ class DevicesAPI { .replaceAll('{code}', code), showServerMessage: false, expectedResponseModel: (json) { - return DeviceReport.fromJson(json); + return DeviceReport.fromJson(json['data'] as Map); }, ); return response;