fix: Fix torch not turning off after it has been enabled (#1997)
fix: Fix torch and low-light boost not turning off again
This commit is contained in:
parent
cd0b413706
commit
62ca95725d
@ -226,24 +226,25 @@ extension CameraSession {
|
||||
}
|
||||
|
||||
// Configure Low-Light-Boost
|
||||
if configuration.enableLowLightBoost {
|
||||
let isDifferent = configuration.enableLowLightBoost != device.automaticallyEnablesLowLightBoostWhenAvailable
|
||||
if isDifferent && !device.isLowLightBoostSupported {
|
||||
if device.automaticallyEnablesLowLightBoostWhenAvailable != configuration.enableLowLightBoost {
|
||||
guard device.isLowLightBoostSupported else {
|
||||
throw CameraError.device(.lowLightBoostNotSupported)
|
||||
}
|
||||
device.automaticallyEnablesLowLightBoostWhenAvailable = configuration.enableLowLightBoost
|
||||
}
|
||||
|
||||
// Configure Torch
|
||||
if configuration.torch != .off {
|
||||
let torchMode = configuration.torch.toTorchMode()
|
||||
if device.torchMode != torchMode {
|
||||
guard device.hasTorch else {
|
||||
throw CameraError.device(.flashUnavailable)
|
||||
}
|
||||
|
||||
device.torchMode = configuration.torch.toTorchMode()
|
||||
device.torchMode = torchMode
|
||||
if torchMode == .on {
|
||||
try device.setTorchModeOn(level: 1.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// pragma MARK: Zoom
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user