bitpay / cordova-plugin-qrscanner

A fast, energy efficient, highly-configurable QR code scanner for Cordova apps and the browser.
MIT License
568 stars 772 forks source link

Not compatible with WKWebView #4

Closed majochoc closed 8 years ago

majochoc commented 8 years ago

I've looked at all elements in my webview tree, and can't find any elements in the path that don't have a transparent background.

Status shows that the webview background is transparent. I can scan and get results, but can't see the preview. Just a white screen (well grayish? I can see a difference in the screen and status bar). device is iPhone 5, iOS 9.3.1, xCode 7.3. App is Meteor 1.3 with Cordova. Any ideas of what else to look for?

Here's the status object from the console:

authorized: true canEnableLight: true canOpenSettings: true currentCamera: 0 denied: false lightEnabled: false prepared: true previewing: true restricted: false scanning: true webviewBackgroundIsTransparent: true

bitjson commented 8 years ago

Hey @majochoc – could you try running the tests on the device you're using? The test/setupTests.sh script should generate the test project for iOS (using cordova-test-framework). You can tap "Manual Tests" to review if each function is working on your device. That could help narrow down the issue significantly.

Also, when running your app from XCode, do you get any errors or relevant logging information in the console?

majochoc commented 8 years ago

I ran the tests prior to trying to use it in my app. I didn't see a preview there, either. Should I see a preview in the manual tests when I click on the QRScanner.show() button? - Also, the text description on that test button leaves me wondering. It says "Should clear background of provided element a all parents". I don't see an interface to provide an element id.

majochoc commented 8 years ago

So was doing some more research. This may be unique to Meteor 1.3. 1.3 is the latest version and the Cordova support now includes WKWebview instead of a UIWebview. Other plugins have had difficulty setting the background to transparent on a WKWebview.

bitjson commented 8 years ago

Thank you for the info! This plugin is only tested for UIWebView right now, but it would be great to get it compatible with WKWebView. I'd love to review a pull request if you'd like to take a swing at it. I might have a chance to work on it next week as well.

majochoc commented 8 years ago

I'll try to work on it. I haven't used Swift before, so I have a bit of curve to learn there. Its even been a while since I actively developed with Obj-C. For my project I have needs for other metadataObjectTypes. Do you have any plans to support other types, or expose them thru an API?

majochoc commented 8 years ago

BTW, with regards to #3, I still get a valid status. And I still get scan results.

majochoc commented 8 years ago

Created pull request with patch - #5

bitjson commented 8 years ago

Solved by https://github.com/bitpay/cordova-plugin-qrscanner/pull/5

bitjson commented 8 years ago

@majochoc thanks for mentioning the confusing language in the tests too, I just fixed in https://github.com/bitpay/cordova-plugin-qrscanner/commit/c3cbe5d99d1a9b3f41402838203c82db6d2e1f61. Was a remnant of an earlier API.