Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want to stop camera after validation of QR code #170

Open
anuj2219 opened this issue Apr 25, 2019 · 2 comments
Open

I want to stop camera after validation of QR code #170

anuj2219 opened this issue Apr 25, 2019 · 2 comments

Comments

@anuj2219
Copy link

anuj2219 commented Apr 25, 2019

Hi,

I am trying to stop camera after validation code.

Example - I am validation domain first after scan because end user may be scan other QR code. So if I am using didFindCode and after that I am validating code if code is not for my app so I start scanning again but in this case camera screen is fluctuating.

Here is my code I am using QRCodeReaderView for custom view

        reader.didFindCode = {[weak self] result in
            guard let `self` = self else { return }
            let url = result.value
            let url1 = URL.init(string: url)
            if let baseUrl = url1?.host{
                if baseUrl == "domain.co" || baseUrl == "domainName.co"{
                  // Some Code Validation 
                    }
                }else{
                    self.snackbar.text = "Invlid QR code"
                    MDCSnackbarManager.show(self.snackbar)
                    self.reader.startScanning()
                }
            }
        }
        reader.startScanning()

So please let me know if I am missing anything.

Thanks for great QR example

@yannickl
Copy link
Owner

Sorry I don't understand your use case. :/

You should call the reader.stopScanning() method to stop the camera.

@anuj2219
Copy link
Author

I am trying to say I want to stop camera after validation QRCode if QR is invalid want keep camera open like Linkedin QR scanner for user profile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants