Skip to content

Commit

Permalink
chore: remove NoCameraAccessView
Browse files Browse the repository at this point in the history
  • Loading branch information
WezSieTato committed Jan 28, 2023
1 parent 7b52c2d commit 3085ad2
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 118 deletions.
18 changes: 0 additions & 18 deletions ScanNow.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
objects = {

/* Begin PBXBuildFile section */
D308746029436AEB00B86040 /* NoCameraAccessViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D308745F29436AEB00B86040 /* NoCameraAccessViewTests.swift */; };
D30FAA3526CB079700B8BF20 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30FAA3426CB079700B8BF20 /* AppDelegate.swift */; };
D30FAA3726CB079700B8BF20 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D30FAA3626CB079700B8BF20 /* SceneDelegate.swift */; };
D30FAA3E26CB079900B8BF20 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D30FAA3D26CB079900B8BF20 /* Assets.xcassets */; };
Expand All @@ -19,7 +18,6 @@
D317D19B291D2E4800FDFDB4 /* Strings.swift in Sources */ = {isa = PBXBuildFile; fileRef = D317D199291D2E4800FDFDB4 /* Strings.swift */; };
D317D19C291D2E4800FDFDB4 /* InfoPlist.swift in Sources */ = {isa = PBXBuildFile; fileRef = D317D19A291D2E4800FDFDB4 /* InfoPlist.swift */; };
D324AD08295EF38A0054E9E5 /* Assets.swift in Sources */ = {isa = PBXBuildFile; fileRef = D324AD07295EF38A0054E9E5 /* Assets.swift */; };
D33164D8291D6773008DF02E /* NoCameraAccessView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D33164D7291D6773008DF02E /* NoCameraAccessView.swift */; };
D336A6AE29016F0F00C1177B /* DocumentDataExportStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = D336A6AD29016F0F00C1177B /* DocumentDataExportStrategy.swift */; };
D336A6B6290197AA00C1177B /* FilenameStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = D336A6B5290197AA00C1177B /* FilenameStrategy.swift */; };
D336A6B829019E9100C1177B /* DocumentShareStrategy.swift in Sources */ = {isa = PBXBuildFile; fileRef = D336A6B729019E9100C1177B /* DocumentShareStrategy.swift */; };
Expand Down Expand Up @@ -72,7 +70,6 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
D308745F29436AEB00B86040 /* NoCameraAccessViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoCameraAccessViewTests.swift; sourceTree = "<group>"; };
D30FAA3126CB079700B8BF20 /* ScanNow.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ScanNow.app; sourceTree = BUILT_PRODUCTS_DIR; };
D30FAA3426CB079700B8BF20 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
D30FAA3626CB079700B8BF20 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand All @@ -88,7 +85,6 @@
D317D199291D2E4800FDFDB4 /* Strings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Strings.swift; sourceTree = "<group>"; };
D317D19A291D2E4800FDFDB4 /* InfoPlist.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InfoPlist.swift; sourceTree = "<group>"; };
D324AD07295EF38A0054E9E5 /* Assets.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Assets.swift; sourceTree = "<group>"; };
D33164D7291D6773008DF02E /* NoCameraAccessView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoCameraAccessView.swift; sourceTree = "<group>"; };
D336A6AD29016F0F00C1177B /* DocumentDataExportStrategy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentDataExportStrategy.swift; sourceTree = "<group>"; };
D336A6B5290197AA00C1177B /* FilenameStrategy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FilenameStrategy.swift; sourceTree = "<group>"; };
D336A6B729019E9100C1177B /* DocumentShareStrategy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentShareStrategy.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -119,7 +115,6 @@
D3A3F72B295F22440036637F /* VersionRowViewSnapshotTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VersionRowViewSnapshotTests.swift; sourceTree = "<group>"; };
D3A3F72D295F22CE0036637F /* GithubRowViewSnapshotTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GithubRowViewSnapshotTests.swift; sourceTree = "<group>"; };
D3A3F72F295F8DB30036637F /* NavigationScannerViewControllerFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationScannerViewControllerFactory.swift; sourceTree = "<group>"; };
D3A73EB32950A415005BB595 /* __Snapshots__ */ = {isa = PBXFileReference; lastKnownFileType = folder; path = __Snapshots__; sourceTree = "<group>"; };
D3A73EB429511E0D005BB595 /* LaunchScreenTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LaunchScreenTests.swift; sourceTree = "<group>"; };
D3A73EB629511E8A005BB595 /* __Snapshots__ */ = {isa = PBXFileReference; lastKnownFileType = folder; path = __Snapshots__; sourceTree = "<group>"; };
D3AF33D62913D2DE00201014 /* __Snapshots__ */ = {isa = PBXFileReference; lastKnownFileType = folder; path = __Snapshots__; sourceTree = "<group>"; };
Expand Down Expand Up @@ -202,7 +197,6 @@
D3B86DE729624E3500989DCB /* generated */,
D3A73EB629511E8A005BB595 /* __Snapshots__ */,
D3A73EB429511E0D005BB595 /* LaunchScreenTests.swift */,
D336A6BE2901EDCB00C1177B /* scanner */,
D336A6BB2901EB9300C1177B /* settings */,
D336A6B92901EB7E00C1177B /* result */,
D30FAA4D26CB079900B8BF20 /* Info.plist */,
Expand All @@ -227,7 +221,6 @@
children = (
D30FAA6B26CBD38400B8BF20 /* ScannerViewController.swift */,
D344DC9A28C0A415000FD06D /* ScanCounter.swift */,
D33164D7291D6773008DF02E /* NoCameraAccessView.swift */,
D3A3F72F295F8DB30036637F /* NavigationScannerViewControllerFactory.swift */,
);
path = scanner;
Expand Down Expand Up @@ -284,15 +277,6 @@
path = settings;
sourceTree = "<group>";
};
D336A6BE2901EDCB00C1177B /* scanner */ = {
isa = PBXGroup;
children = (
D3A73EB32950A415005BB595 /* __Snapshots__ */,
D308745F29436AEB00B86040 /* NoCameraAccessViewTests.swift */,
);
path = scanner;
sourceTree = "<group>";
};
D346DE9027F0B1D900890528 /* settings */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -567,7 +551,6 @@
D3A3F722295F21010036637F /* VersionRowView.swift in Sources */,
D3A3F71D295F1FF70036637F /* FileSettingsSectionView.swift in Sources */,
D3A3F720295F20230036637F /* GithubRowView.swift in Sources */,
D33164D8291D6773008DF02E /* NoCameraAccessView.swift in Sources */,
D3B86DDE296238F700989DCB /* ComposeMailDataFactory.swift in Sources */,
D3A3F71E295F1FF70036637F /* FileSettings.swift in Sources */,
D324AD08295EF38A0054E9E5 /* Assets.swift in Sources */,
Expand All @@ -589,7 +572,6 @@
D37296FF28FD4A0300939783 /* SettingsViewSnapshotTests.swift in Sources */,
D3A3F72E295F22CE0036637F /* GithubRowViewSnapshotTests.swift in Sources */,
D3A3F72C295F22440036637F /* VersionRowViewSnapshotTests.swift in Sources */,
D308746029436AEB00B86040 /* NoCameraAccessViewTests.swift in Sources */,
D3B86DE929624E3500989DCB /* AutoMockable.generated.swift in Sources */,
D336A6BD2901EBC400C1177B /* NoneFilenameStrategyTests.swift in Sources */,
D3B86DE6296246D700989DCB /* ComposeMailDataFactoryTests.swift in Sources */,
Expand Down
12 changes: 2 additions & 10 deletions ScanNow/generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ internal enum Strings {
internal enum Scanner {
/// Scan
internal static let title = Strings.tr("Localizable", "scanner.title", fallback: "Scan")
internal enum NoCamera {
/// Please allow access to your device's camera to use the document scanner feature.
internal static let description = Strings.tr("Localizable", "scanner.noCamera.description", fallback: "Please allow access to your device's camera to use the document scanner feature.")
/// Go to settings
internal static let settingsButton = Strings.tr("Localizable", "scanner.noCamera.settingsButton", fallback: "Go to settings")
/// No camera access
internal static let title = Strings.tr("Localizable", "scanner.noCamera.title", fallback: "No camera access")
}
internal enum Share {
/// _page_%d
internal static func pageSuffix(_ p1: Int) -> String {
Expand Down Expand Up @@ -91,8 +83,8 @@ internal enum Strings {
internal enum NoCamera {
/// Cancel
internal static let cancel = Strings.tr("Localizable", "welcome.noCamera.cancel", fallback: "Cancel")
/// Please allow access to your device's camera to use the document scanner feature.
internal static let description = Strings.tr("Localizable", "welcome.noCamera.description", fallback: "Please allow access to your device's camera to use the document scanner feature.")
/// The application requires access to the camera to be able to scan documents.
internal static let description = Strings.tr("Localizable", "welcome.noCamera.description", fallback: "The application requires access to the camera to be able to scan documents.")
/// Go to settings
internal static let settings = Strings.tr("Localizable", "welcome.noCamera.settings", fallback: "Go to settings")
/// No camera access
Expand Down
4 changes: 0 additions & 4 deletions ScanNow/localizable/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,3 @@
"scanner.title" = "Scan";

"scanner.share.pageSuffix" = "_page_%d";

"scanner.noCamera.title" = "No camera access";
"scanner.noCamera.description" = "Please allow access to your device's camera to use the document scanner feature.";
"scanner.noCamera.settingsButton" = "Go to settings";
4 changes: 0 additions & 4 deletions ScanNow/localizable/pl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,3 @@
"scanner.title" = "Skanuj";

"scanner.share.pageSuffix" = "_strona_%d";

"scanner.noCamera.title" = "Brak dostępu do kamery";
"scanner.noCamera.description" = "Proszę udzielić aplikacji dostępu do kamery w celu użycia funkcji skanowania dokumentów.";
"scanner.noCamera.settingsButton" = "Przejdź do ustawień";
36 changes: 0 additions & 36 deletions ScanNow/scanner/NoCameraAccessView.swift

This file was deleted.

36 changes: 4 additions & 32 deletions ScanNow/scanner/ScannerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ final class ScannerViewController: UIViewController {

title = Strings.Scanner.title

setupChildViewController()
let documentCameraViewController = VNDocumentCameraViewController()
documentCameraViewController.delegate = self
addChildViewControllerOnFullView(documentCameraViewController)
}

override func viewWillAppear(_ animated: Bool) {
Expand All @@ -24,36 +26,6 @@ final class ScannerViewController: UIViewController {
super.viewWillDisappear(animated)
navigationController?.setNavigationBarHidden(false, animated: animated)
}

// MARK: Child view configuration

private func makeDocumentCameraViewController() -> UIViewController {
let documentCameraViewController = VNDocumentCameraViewController()
documentCameraViewController.delegate = self
return documentCameraViewController
}

private func makeNoCameraAccesViewController() -> UIViewController {
return UIHostingController(rootView: NoCameraAccessView())
}

private func makeChildViewController() -> UIViewController {
switch AVCaptureDevice.authorizationStatus(for: .video) {
case .authorized:
return makeDocumentCameraViewController()

case .notDetermined, .denied, .restricted:
fallthrough

@unknown default:
return makeNoCameraAccesViewController()
}
}

private func setupChildViewController() {
let childVC = makeChildViewController()
addChildViewControllerOnFullView(childVC)
}
}

extension ScannerViewController: VNDocumentCameraViewControllerDelegate {
Expand Down Expand Up @@ -88,7 +60,7 @@ extension ScannerViewController: VNDocumentCameraViewControllerDelegate {
SKStoreReviewController.requestReview(in: windowScene)
}

func documentCameraViewControllerDidCancel(_ controller: VNDocumentCameraViewController) {
func documentCameraViewControllerDidCancel(_: VNDocumentCameraViewController) {
navigationController?.popViewController(animated: true)
}
}
2 changes: 0 additions & 2 deletions ScanNow/welcome/WelcomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ final class WelcomeViewController: UIViewController {
}

private func openScanner() {

if AVCaptureDevice.authorizationStatus(for: .video) == .authorized {
navigationController?.pushViewController(ScannerViewController(), animated: true)
} else {
Expand All @@ -43,6 +42,5 @@ final class WelcomeViewController: UIViewController {
alertVC.addAction(UIAlertAction(title: strings.cancel, style: .destructive))
present(alertVC, animated: true, completion: nil)
}

}
}
12 changes: 0 additions & 12 deletions ScanNowTests/scanner/NoCameraAccessViewTests.swift

This file was deleted.

Binary file not shown.

0 comments on commit 3085ad2

Please sign in to comment.