mirror of
https://github.com/samsonjs/SwiftyCam.git
synced 2026-03-31 10:05:51 +00:00
Added delegate to prompt to app settings
This commit is contained in:
parent
85d9bc917c
commit
ad38933dca
4 changed files with 27 additions and 7 deletions
|
|
@ -184,7 +184,7 @@
|
|||
};
|
||||
1675A9711E00A68300B80903 = {
|
||||
CreatedOnToolsVersion = 8.1;
|
||||
DevelopmentTeam = DGV5BLXSF9;
|
||||
DevelopmentTeam = G8E5P2X66G;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
};
|
||||
|
|
@ -421,11 +421,11 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
DEVELOPMENT_TEAM = DGV5BLXSF9;
|
||||
DEVELOPMENT_TEAM = G8E5P2X66G;
|
||||
INFOPLIST_FILE = DemoSwiftyCam/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.Walzy.DemoSwiftyCam;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.Walzy.DemoSwiftyCam1;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
|
|
@ -436,11 +436,11 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
DEVELOPMENT_TEAM = DGV5BLXSF9;
|
||||
DEVELOPMENT_TEAM = G8E5P2X66G;
|
||||
INFOPLIST_FILE = DemoSwiftyCam/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.Walzy.DemoSwiftyCam;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.Walzy.DemoSwiftyCam1;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ class ViewController: SwiftyCamViewController, SwiftyCamViewControllerDelegate {
|
|||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
shouldPrompToAppSettings = true
|
||||
cameraDelegate = self
|
||||
maximumVideoDuration = 10.0
|
||||
shouldUseDeviceOrientation = true
|
||||
|
|
|
|||
|
|
@ -158,6 +158,10 @@ open class SwiftyCamViewController: UIViewController {
|
|||
/// Setting to true will prompt user for access to microphone on View Controller launch.
|
||||
public var audioEnabled = true
|
||||
|
||||
/// Sets whether or not app should display prompt to app settings if audio/video permission is denied
|
||||
/// If set to false, delegate function will be called to handle exception
|
||||
public var shouldPrompToAppSettings = true
|
||||
|
||||
/// Public access to Pinch Gesture
|
||||
fileprivate(set) public var pinchGesture : UIPinchGestureRecognizer!
|
||||
|
||||
|
|
@ -386,8 +390,11 @@ open class SwiftyCamViewController: UIViewController {
|
|||
}
|
||||
|
||||
case .notAuthorized:
|
||||
// Prompt to App Settings
|
||||
self.promptToAppSettings()
|
||||
if self.shouldPrompToAppSettings == true {
|
||||
self.promptToAppSettings()
|
||||
} else {
|
||||
self.cameraDelegate?.swiftyCamNotAuthorized(self)
|
||||
}
|
||||
case .configurationFailed:
|
||||
// Unknown Error
|
||||
DispatchQueue.main.async {
|
||||
|
|
|
|||
|
|
@ -104,6 +104,14 @@ public protocol SwiftyCamViewControllerDelegate: class {
|
|||
*/
|
||||
|
||||
func swiftyCamDidFailToConfigure(_ swiftyCam: SwiftyCamViewController)
|
||||
|
||||
/**
|
||||
SwiftyCamViewControllerDelegate function called when when SwiftyCamViewController does not have access to camera or microphone.
|
||||
|
||||
- Parameter swiftyCam: Current SwiftyCamViewController
|
||||
*/
|
||||
|
||||
func swiftyCamNotAuthorized(_ swiftyCam: SwiftyCamViewController)
|
||||
}
|
||||
|
||||
public extension SwiftyCamViewControllerDelegate {
|
||||
|
|
@ -148,6 +156,10 @@ public extension SwiftyCamViewControllerDelegate {
|
|||
func swiftyCamDidFailToConfigure(_ swiftyCam: SwiftyCamViewController) {
|
||||
// Optional
|
||||
}
|
||||
|
||||
func swiftyCamNotAuthorized(_ swiftyCam: SwiftyCamViewController) {
|
||||
// Optional
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue