Skip to content
This repository was archived by the owner on Jul 1, 2022. It is now read-only.

Commit d6614da

Browse files
Added the option to disable the volume buttons for capturing photos
1 parent a113fde commit d6614da

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ALCameraViewController/ViewController/CameraViewController.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ open class CameraViewController: UIViewController {
4848
var didUpdateViews = false
4949
var allowCropping = false
5050
var animationRunning = false
51+
let allowVolumeButtonCapture: Bool
5152

5253
var lastInterfaceOrientation : UIInterfaceOrientation?
5354
open var onCompletion: CameraViewCompletion?
@@ -158,8 +159,9 @@ open class CameraViewController: UIViewController {
158159

159160
private let allowsLibraryAccess: Bool
160161

161-
public init(croppingEnabled: Bool, allowsLibraryAccess: Bool = true, allowsSwapCameraOrientation: Bool = true, completion: @escaping CameraViewCompletion) {
162+
public init(croppingEnabled: Bool, allowsLibraryAccess: Bool = true, allowsSwapCameraOrientation: Bool = true, allowVolumeButtonCapture: Bool = true, completion: @escaping CameraViewCompletion) {
162163
self.allowsLibraryAccess = allowsLibraryAccess
164+
self.allowVolumeButtonCapture = allowVolumeButtonCapture
163165
super.init(nibName: nil, bundle: nil)
164166
onCompletion = completion
165167
allowCropping = croppingEnabled
@@ -277,7 +279,10 @@ open class CameraViewController: UIViewController {
277279
cameraView.startSession()
278280
addCameraObserver()
279281
addRotateObserver()
280-
setupVolumeControl()
282+
283+
if allowVolumeButtonCapture {
284+
setupVolumeControl()
285+
}
281286
}
282287

283288
/**

0 commit comments

Comments
 (0)