diff --git a/MiniScanner.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/UserInterfaceState.xcuserstate b/MiniScanner.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/UserInterfaceState.xcuserstate index 0a9fe476494b62ad6d8a2d853bb89f923c14dd0c..6e83eb66bbd48a0607ebf5e7ab906d31741f9734 100644 Binary files a/MiniScanner.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/UserInterfaceState.xcuserstate and b/MiniScanner.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/MiniScanner/Modules/DocumentPreview/DocumentPreviewViewController.swift b/MiniScanner/Modules/DocumentPreview/DocumentPreviewViewController.swift index c86d00cde5a71c79ed61998ade8b8b08f992a2a3..5bbe5ebda9d2574e2ff9153590da4a2dfd2e7d5d 100644 --- a/MiniScanner/Modules/DocumentPreview/DocumentPreviewViewController.swift +++ b/MiniScanner/Modules/DocumentPreview/DocumentPreviewViewController.swift @@ -35,8 +35,6 @@ final class DocumentPreviewViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - - // Do any additional setup after loading the view. pdfView.accessibilityIdentifier = "pdfView" navigationItem.title = file?.displayName pdfView.setDocument(file?.pdfDocument) diff --git a/MiniScanner/Supporting Files/CustomWeScan/Scan/ScannerViewController.swift b/MiniScanner/Supporting Files/CustomWeScan/Scan/ScannerViewController.swift index 9afc22a9d422f59e15b2b4ae90a2769f994e0cd9..e313b973a8f44d58ffcd4bf7312c2daf5ac43bed 100644 --- a/MiniScanner/Supporting Files/CustomWeScan/Scan/ScannerViewController.swift +++ b/MiniScanner/Supporting Files/CustomWeScan/Scan/ScannerViewController.swift @@ -119,6 +119,12 @@ public final class ScannerViewController: UIViewController { return flashButton }() + lazy private var cancelBarButton: UIBarButtonItem = { + let cancelBarButton = UIBarButtonItem(title: "Cancel", style: .done, target: self, action: #selector(cancelTapped)) + cancelBarButton.tintColor = .white + return cancelBarButton + }() + lazy private var activityIndicator: UIActivityIndicatorView = { let activityIndicator = UIActivityIndicatorView(style: .gray) activityIndicator.hidesWhenStopped = true @@ -228,7 +234,11 @@ public final class ScannerViewController: UIViewController { } private func setupNavigationBar() { - navigationItem.setLeftBarButton(flashButton, animated: false) + if isAddedToPDF { + navigationItem.setLeftBarButtonItems([cancelBarButton, flashButton], animated: false) + } else { + navigationItem.setLeftBarButton(flashButton, animated: false) + } navigationItem.setRightBarButton(autoScanButton, animated: false) if UIImagePickerController.isFlashAvailable(for: .rear) == false { @@ -424,6 +434,10 @@ public final class ScannerViewController: UIViewController { } } + @objc private func cancelTapped() { + self.navigationController?.popViewController(animated: true) + } + @objc private func cancelImageScannerController() { self.navigationController?.popViewController(animated: true) }