fix: include it in if loop
This commit is contained in:
@@ -10,7 +10,11 @@ import "package:photos/core/event_bus.dart";
|
||||
import "package:photos/events/compute_control_event.dart";
|
||||
import "package:thermal/thermal.dart";
|
||||
|
||||
enum _ComputeRunState { idle, runningML, generatingStream }
|
||||
enum _ComputeRunState {
|
||||
idle,
|
||||
runningML,
|
||||
generatingStream,
|
||||
}
|
||||
|
||||
class ComputeController {
|
||||
final _logger = Logger("ComputeController");
|
||||
@@ -47,16 +51,16 @@ class ComputeController {
|
||||
// if you need to test on physical device, uncomment this check
|
||||
return;
|
||||
}
|
||||
BatteryInfoPlugin().iosBatteryInfoStream.listen((
|
||||
IosBatteryInfo? batteryInfo,
|
||||
) {
|
||||
BatteryInfoPlugin()
|
||||
.iosBatteryInfoStream
|
||||
.listen((IosBatteryInfo? batteryInfo) {
|
||||
_oniOSBatteryStateUpdate(batteryInfo);
|
||||
});
|
||||
}
|
||||
if (Platform.isAndroid) {
|
||||
BatteryInfoPlugin().androidBatteryInfoStream.listen((
|
||||
AndroidBatteryInfo? batteryInfo,
|
||||
) {
|
||||
BatteryInfoPlugin()
|
||||
.androidBatteryInfoStream
|
||||
.listen((AndroidBatteryInfo? batteryInfo) {
|
||||
_onAndroidBatteryStateUpdate(batteryInfo);
|
||||
});
|
||||
}
|
||||
@@ -72,14 +76,13 @@ class ComputeController {
|
||||
_logger.info("Device not healthy or user interacting, denying request.");
|
||||
return false;
|
||||
}
|
||||
final result = ml
|
||||
? _requestML()
|
||||
: stream
|
||||
? _requestStream()
|
||||
: null;
|
||||
if (result == null) {
|
||||
bool result = false;
|
||||
if (ml) {
|
||||
result = _requestML();
|
||||
} else if (stream) {
|
||||
result = _requestStream();
|
||||
} else {
|
||||
_logger.severe("No compute request specified, denying request.");
|
||||
return false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user