mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-16 10:06:19 +00:00
formatted all files.
This commit is contained in:
@ -22,7 +22,8 @@ class SosDeviceBloc extends Bloc<SosDeviceEvent, SosDeviceState> {
|
||||
|
||||
late SosStatusModel deviceStatus;
|
||||
|
||||
FutureOr<void> _getDeviceStatus(GetDeviceStatus event, Emitter<SosDeviceState> emit) async {
|
||||
FutureOr<void> _getDeviceStatus(
|
||||
GetDeviceStatus event, Emitter<SosDeviceState> emit) async {
|
||||
emit(SosDeviceLoadingState());
|
||||
try {
|
||||
final status = await DevicesManagementApi().getDeviceStatus(event.uuid);
|
||||
@ -33,7 +34,8 @@ class SosDeviceBloc extends Bloc<SosDeviceEvent, SosDeviceState> {
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<void> _getBatchStatus(GetBatchStatus event, Emitter<SosDeviceState> emit) async {
|
||||
FutureOr<void> _getBatchStatus(
|
||||
GetBatchStatus event, Emitter<SosDeviceState> emit) async {
|
||||
emit(SosDeviceLoadingState());
|
||||
try {
|
||||
final status = await DevicesManagementApi().getBatchStatus(event.uuids);
|
||||
@ -44,25 +46,31 @@ class SosDeviceBloc extends Bloc<SosDeviceEvent, SosDeviceState> {
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<void> _getDeviceRecords(GetDeviceRecords event, Emitter<SosDeviceState> emit) async {
|
||||
FutureOr<void> _getDeviceRecords(
|
||||
GetDeviceRecords event, Emitter<SosDeviceState> emit) async {
|
||||
emit(SosReportLoadingState());
|
||||
try {
|
||||
final from = DateTime.now().subtract(const Duration(days: 30)).millisecondsSinceEpoch;
|
||||
final from = DateTime.now()
|
||||
.subtract(const Duration(days: 30))
|
||||
.millisecondsSinceEpoch;
|
||||
final to = DateTime.now().millisecondsSinceEpoch;
|
||||
final DeviceReport records =
|
||||
await DevicesManagementApi.getDeviceReportsByDate(event.uuid, 'sos', from.toString(), to.toString());
|
||||
final records = await DevicesManagementApi.getDeviceReportsByDate(
|
||||
event.uuid, 'sos', from.toString(), to.toString());
|
||||
emit(SosReportLoadedState(records));
|
||||
} catch (e) {
|
||||
emit(SosReportErrorState(e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<void> _getDeviceAutomationRecords(GetDeviceAutomationRecords event, Emitter<SosDeviceState> emit) async {
|
||||
FutureOr<void> _getDeviceAutomationRecords(
|
||||
GetDeviceAutomationRecords event, Emitter<SosDeviceState> emit) async {
|
||||
emit(SosAutomationReportLoadingState());
|
||||
try {
|
||||
final from = DateTime.now().subtract(const Duration(days: 30)).millisecondsSinceEpoch;
|
||||
final from = DateTime.now()
|
||||
.subtract(const Duration(days: 30))
|
||||
.millisecondsSinceEpoch;
|
||||
final to = DateTime.now().millisecondsSinceEpoch;
|
||||
final DeviceReport records = await DevicesManagementApi.getDeviceReportsByDate(
|
||||
final records = await DevicesManagementApi.getDeviceReportsByDate(
|
||||
event.uuid, 'sos_automation', from.toString(), to.toString());
|
||||
emit(SosAutomationReportLoadedState(records));
|
||||
} catch (e) {
|
||||
@ -70,14 +78,17 @@ class SosDeviceBloc extends Bloc<SosDeviceEvent, SosDeviceState> {
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<void> _backToSosStatusView(BackToSosStatusView event, Emitter<SosDeviceState> emit) {
|
||||
FutureOr<void> _backToSosStatusView(
|
||||
BackToSosStatusView event, Emitter<SosDeviceState> emit) {
|
||||
emit(SosDeviceLoadedState(deviceStatus));
|
||||
}
|
||||
|
||||
FutureOr<void> _sosFactoryReset(SosFactoryReset event, Emitter<SosDeviceState> emit) async {
|
||||
FutureOr<void> _sosFactoryReset(
|
||||
SosFactoryReset event, Emitter<SosDeviceState> emit) async {
|
||||
emit(SosDeviceLoadingState());
|
||||
try {
|
||||
final response = await DevicesManagementApi().factoryReset(event.factoryReset, event.deviceId);
|
||||
final response = await DevicesManagementApi()
|
||||
.factoryReset(event.factoryReset, event.deviceId);
|
||||
if (response) {
|
||||
emit(SosDeviceLoadedState(deviceStatus));
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user