Compare commits

...

8 Commits

Author SHA1 Message Date
Vladimir Makarov f6a8c19e19
Merge pull request #7 from TouchInstinct/fix/session_preset_fix
Session preset support check fixed
2021-12-15 23:09:42 +05:00
Vladimir Makarov d0937c42a5 Checking for only 4K support added 2021-12-15 23:07:19 +05:00
Vladimir Makarov b1f649ec68 Session preset support check fixed 2021-12-15 20:46:51 +05:00
Vladimir Makarov 03ea77b113
Merge pull request #6 from TouchInstinct/fix/session_preset_fix
Session preset for unsupporting 4K devices fixed
2021-12-15 17:43:37 +05:00
Vladimir Makarov 8a60b59c62 Session preset for unsupporting 4K devices fixed 2021-12-15 17:19:10 +05:00
EMandravina 3ab48fced3
Merge pull request #5 from TouchInstinct/fix/MB-2873_qr
MB-2873 fixed settings
2021-11-29 12:24:54 +03:00
Ekaterina Mandravina 446b08f78a up version and removed extra checker 2021-11-29 11:41:20 +03:00
Ekaterina Mandravina 3bf635e857 MB-2873 fixed settings 2021-11-22 15:01:48 +03:00
2 changed files with 29 additions and 1 deletions

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'QRCodeReader'
s.version = '1.0.4'
s.version = '1.0.7'
s.summary = 'iOS framework contain core view elements and logic component for work with QR codes.'
s.homepage = 'https://github.com/TouchInstinct/QRCodeReader-ios'

View File

@ -61,6 +61,8 @@ open class QRCodeReader: NSObject, AVCaptureMetadataOutputObjectsDelegate {
super.init()
configureDefaultDevice()
sessionQueue.async {
self.configureDefaultComponents()
}
@ -141,6 +143,10 @@ open class QRCodeReader: NSObject, AVCaptureMetadataOutputObjectsDelegate {
// MARK: - Private Methods
private func configureDefaultComponents() {
if let defaultDevice = defaultDevice,
defaultDevice.supportsSessionPreset(.hd4K3840x2160) {
session.sessionPreset = .hd4K3840x2160
}
for output in session.outputs {
session.removeOutput(output)
@ -160,6 +166,28 @@ open class QRCodeReader: NSObject, AVCaptureMetadataOutputObjectsDelegate {
session.commitConfiguration()
}
private func configureDefaultDevice() {
guard let device = defaultDevice else { return }
do {
try device.lockForConfiguration()
if device.isAutoFocusRangeRestrictionSupported {
device.autoFocusRangeRestriction = .near
}
if device.isFocusModeSupported(.continuousAutoFocus) {
device.focusMode = .continuousAutoFocus
}
if device.isLowLightBoostSupported {
device.automaticallyEnablesLowLightBoostWhenAvailable = true
}
device.unlockForConfiguration()
} catch _ { }
}
// MARK: - AVCaptureMetadataOutputObjectsDelegate