mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 22:57:21 +00:00
fix a logic
This commit is contained in:
@ -331,13 +331,14 @@ class AcBloc extends Bloc<AcsEvent, AcsState> {
|
||||
|
||||
try {
|
||||
final scaledValue = totalMinutes ~/ 6;
|
||||
Future.delayed(const Duration(seconds: 1), () async {
|
||||
await DevicesManagementApi().deviceControl(
|
||||
deviceId,
|
||||
Status(code: 'countdown_time', value: scaledValue),
|
||||
);
|
||||
});
|
||||
|
||||
await _runDebounce(
|
||||
isBatch: false,
|
||||
deviceId: deviceId,
|
||||
code: 'countdown_time',
|
||||
value: scaledValue,
|
||||
oldValue: scaledValue,
|
||||
emit: emit,
|
||||
);
|
||||
_startCountdownTimer(emit);
|
||||
emit(currentState.copyWith(isTimerActive: timerActive));
|
||||
} catch (e) {
|
||||
@ -345,12 +346,14 @@ class AcBloc extends Bloc<AcsEvent, AcsState> {
|
||||
emit(AcsFailedState(error: e.toString()));
|
||||
}
|
||||
} else {
|
||||
Future.delayed(const Duration(seconds: 1), () async {
|
||||
await DevicesManagementApi().deviceControl(
|
||||
deviceId,
|
||||
Status(code: 'countdown_time', value: 0),
|
||||
);
|
||||
});
|
||||
await _runDebounce(
|
||||
isBatch: false,
|
||||
deviceId: deviceId,
|
||||
code: 'countdown_time',
|
||||
value: 0,
|
||||
oldValue: 0,
|
||||
emit: emit,
|
||||
);
|
||||
_countdownTimer?.cancel();
|
||||
scheduledHours = 0;
|
||||
scheduledMinutes = 0;
|
||||
|
Reference in New Issue
Block a user