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