twostraws / CodeScanner

A SwiftUI view that is able to scan barcodes, QR codes, and more, and send back what was found.
MIT License
1.01k stars 286 forks source link

Manually check AVCaptureDevice access #49

Closed rholstad closed 2 years ago

rholstad commented 2 years ago

Simple change illustrating how the existing setup code can be modified to handle initial camera access denial.

nathanfallet commented 2 years ago

@rholstad Why did you declare a function setupCaptureDevice to call it only once in AVCaptureDevice.requestAccess? What about wrapping the original code directly inside AVCaptureDevice.requestAccess?

rholstad commented 2 years ago

@NathanFallet No reason.

rholstad commented 2 years ago

@NathanFallet fetched upstream changes, inlined the setupCaptureDevice function, and added a setNeedsStatusBarAppearanceUpdate call since I found that the status bar remained after the privacy alert was dismissed.

twostraws commented 2 years ago

Thank you!