Skip to content

Commit

Permalink
refactor(statusDictionary): rename 'webviewBackgroundIsTransparent' -…
Browse files Browse the repository at this point in the history
…> 'showing'
  • Loading branch information
bitjson committed Jun 29, 2016
1 parent 2bb1803 commit 0ab2a6d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ QRScanner.getStatus(function(status){
"prepared": Boolean
"scanning": Boolean
"previewing": Boolean
"webviewBackgroundIsTransparent": Boolean
"showing": Boolean
"lightEnabled": Boolean
"canOpenSettings": Boolean
"canEnableLight": Boolean
Expand All @@ -246,9 +246,9 @@ Name | Description
`denied` | A boolean value which is true if the user permenantly denied camera access to the app (`AVAuthorizationStatus.Denied`). Once denied, camera access can only be gained by requesting the user change their decision (consider offering a link to the setting via `openSettings()`).
`restricted` | A boolean value which is true if the user is unable to grant permissions due to parental controls, organization security configuration profiles, or similar reasons.
`prepared` | A boolean value which is true if QRScanner is prepared to capture video and render it to the view.
`showing` | A boolean value which is true when the preview layer is visible (and on all platforms but `browser`, the native webview background is transparent).
`scanning` | A boolean value which is true if QRScanner is actively scanning for a QR code.
`previewing` | A boolean value which is true if QRScanner is displaying a live preview from the device's camera. Set to false when the preview is paused.
`webviewBackgroundIsTransparent` | A boolean value which is true when the native webview background is transparent.
`lightEnabled` | A boolean value which is true if the light is enabled.
`canOpenSettings` | A boolean value which is true only if the users' operating system is able to `QRScanner.openSettings()`.
`canEnableLight` | A boolean value which is true only if the users' device can enable a light in the direction of the currentCamera.
Expand Down
6 changes: 3 additions & 3 deletions src/ios/QRScanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,9 @@ class QRScanner : CDVPlugin, AVCaptureMetadataOutputObjectsDelegate {
previewing = captureVideoPreviewLayer!.connection.enabled
}

var webviewBackgroundIsTransparent = false
var showing = false
if(self.webView!.backgroundColor == UIColor.clearColor()){
webviewBackgroundIsTransparent = true
showing = true
}

var lightEnabled = false
Expand Down Expand Up @@ -403,7 +403,7 @@ class QRScanner : CDVPlugin, AVCaptureMetadataOutputObjectsDelegate {
"prepared": boolToNumberString(prepared),
"scanning": boolToNumberString(scanning),
"previewing": boolToNumberString(previewing),
"webviewBackgroundIsTransparent": boolToNumberString(webviewBackgroundIsTransparent),
"showing": boolToNumberString(showing),
"lightEnabled": boolToNumberString(lightEnabled),
"canOpenSettings": boolToNumberString(canOpenSettings),
"canEnableLight": boolToNumberString(canEnableLight),
Expand Down
2 changes: 1 addition & 1 deletion tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ exports.defineAutoTests = function() {
expect(typeof status.prepared).toBe('boolean');
expect(typeof status.scanning).toBe('boolean');
expect(typeof status.previewing).toBe('boolean');
expect(typeof status.webviewBackgroundIsTransparent).toBe('boolean');
expect(typeof status.showing).toBe('boolean');
expect(typeof status.lightEnabled).toBe('boolean');
expect(typeof status.canOpenSettings).toBe('boolean');
expect(typeof status.canEnableLight).toBe('boolean');
Expand Down
4 changes: 2 additions & 2 deletions www/QRScanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function stringToBool(string) {
case '0':
return false;
default:
throw new Error('QRScanner plugin returned an invalid boolean number-string.');
throw new Error('QRScanner plugin returned an invalid boolean number-string: ' + string);
}
}

Expand All @@ -20,7 +20,7 @@ function convertStatus(statusDictionary) {
prepared: stringToBool(statusDictionary.prepared),
scanning: stringToBool(statusDictionary.scanning),
previewing: stringToBool(statusDictionary.previewing),
webviewBackgroundIsTransparent: stringToBool(statusDictionary.webviewBackgroundIsTransparent),
showing: stringToBool(statusDictionary.showing),
lightEnabled: stringToBool(statusDictionary.lightEnabled),
canOpenSettings: stringToBool(statusDictionary.canOpenSettings),
canEnableLight: stringToBool(statusDictionary.canEnableLight),
Expand Down

0 comments on commit 0ab2a6d

Please sign in to comment.