Skip to content

Commit

Permalink
fix openSettingsURLString' has been renamed to 'UIApplicationOpenSett…
Browse files Browse the repository at this point in the history
…ingsURLString
  • Loading branch information
cuni0716 committed Jun 12, 2019
1 parent b62efb6 commit 4ebe29e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/ios/QRScanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import AVFoundation

@objc(QRScanner)
class QRScanner : CDVPlugin, AVCaptureMetadataOutputObjectsDelegate {

class CameraView: UIView {
var videoPreviewLayer:AVCaptureVideoPreviewLayer?

func interfaceOrientationToVideoOrientation(_ orientation : UIInterfaceOrientation) -> AVCaptureVideoOrientation {
switch (orientation) {
case UIInterfaceOrientation.portrait:
Expand All @@ -29,18 +29,18 @@ class QRScanner : CDVPlugin, AVCaptureMetadataOutputObjectsDelegate {
layer.frame = self.bounds;
}
}

self.videoPreviewLayer?.connection?.videoOrientation = interfaceOrientationToVideoOrientation(UIApplication.shared.statusBarOrientation);
}


func addPreviewLayer(_ previewLayer:AVCaptureVideoPreviewLayer?) {
previewLayer!.videoGravity = AVLayerVideoGravity.resizeAspectFill
previewLayer!.frame = self.bounds
self.layer.addSublayer(previewLayer!)
self.videoPreviewLayer = previewLayer;
}

func removePreviewLayer() {
if self.videoPreviewLayer != nil {
self.videoPreviewLayer!.removeFromSuperlayer()
Expand Down Expand Up @@ -468,7 +468,7 @@ class QRScanner : CDVPlugin, AVCaptureMetadataOutputObjectsDelegate {

@objc func openSettings(_ command: CDVInvokedUrlCommand) {
if #available(iOS 10.0, *) {
guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {
guard let settingsUrl = URL(string: UIApplicationOpenSettingsURLString) else {
return
}
if UIApplication.shared.canOpenURL(settingsUrl) {
Expand All @@ -481,7 +481,7 @@ class QRScanner : CDVPlugin, AVCaptureMetadataOutputObjectsDelegate {
} else {
// pre iOS 10.0
if #available(iOS 8.0, *) {
UIApplication.shared.openURL(NSURL(string: UIApplication.openSettingsURLString)! as URL)
UIApplication.shared.openURL(NSURL(string: UIApplicationOpenSettingsURLString)! as URL)
self.getStatus(command)
} else {
self.sendErrorCode(command: command, error: QRScannerError.open_settings_unavailable)
Expand Down

0 comments on commit 4ebe29e

Please sign in to comment.