From 7ef67916bc9e0d4dfafb88337735f96ad4aaa15c Mon Sep 17 00:00:00 2001 From: Valentina Iancu Date: Wed, 10 Apr 2024 18:23:41 +0200 Subject: [PATCH] refactor(GiniCaptureSDK): Cleanup code - removed unnecessary code - indentation fixed - rename made in comments PP-353 --- .../Camera/CameraViewController+Actions.swift | 2 +- .../Camera/CameraViewController+Popups.swift | 4 ++-- .../Camera/Camera/CameraViewController.swift | 16 +++++++-------- .../GiniScreenAPICoordinator+Camera.swift | 20 +++++++++---------- .../Core/Tracking/AnalyticsProperties.swift | 13 ------------ 5 files changed, 21 insertions(+), 34 deletions(-) diff --git a/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Camera/Camera/CameraViewController+Actions.swift b/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Camera/Camera/CameraViewController+Actions.swift index ad13b2b49..c4270ea03 100644 --- a/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Camera/Camera/CameraViewController+Actions.swift +++ b/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Camera/Camera/CameraViewController+Actions.swift @@ -1,5 +1,5 @@ // -// Camera2ViewController+Actions.swift +// CameraViewController+Actions.swift // // // Created by Krzysztof Kryniecki on 14/09/2022. diff --git a/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Camera/Camera/CameraViewController+Popups.swift b/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Camera/Camera/CameraViewController+Popups.swift index 37f2ea39c..ac5303617 100644 --- a/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Camera/Camera/CameraViewController+Popups.swift +++ b/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Camera/Camera/CameraViewController+Popups.swift @@ -1,6 +1,6 @@ // -// Camera2ViewController+Extension.swift -// +// CameraViewController+Extension.swift +// // // Created by Krzysztof Kryniecki on 14/09/2022. // Copyright © 2022 Gini GmbH. All rights reserved. diff --git a/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Camera/Camera/CameraViewController.swift b/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Camera/Camera/CameraViewController.swift index 8463f114e..5752e31f5 100644 --- a/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Camera/Camera/CameraViewController.swift +++ b/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Camera/Camera/CameraViewController.swift @@ -667,14 +667,14 @@ extension CameraViewController: CameraLensSwitcherViewDelegate { var device: AVCaptureDevice? switch lens { - case .ultraWide: - if #available(iOS 13.0, *) { - device = AVCaptureDevice.default(.builtInUltraWideCamera, for: .video, position: .back) - } - case .wide: - device = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back) - case .tele: - device = AVCaptureDevice.default(.builtInTelephotoCamera, for: .video, position: .back) + case .ultraWide: + if #available(iOS 13.0, *) { + device = AVCaptureDevice.default(.builtInUltraWideCamera, for: .video, position: .back) + } + case .wide: + device = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back) + case .tele: + device = AVCaptureDevice.default(.builtInTelephotoCamera, for: .video, position: .back) } guard let device = device else { return } diff --git a/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Screen API Coordinator/GiniScreenAPICoordinator+Camera.swift b/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Screen API Coordinator/GiniScreenAPICoordinator+Camera.swift index 69cf0bc26..a1f8bd14d 100644 --- a/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Screen API Coordinator/GiniScreenAPICoordinator+Camera.swift +++ b/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Screens/Screen API Coordinator/GiniScreenAPICoordinator+Camera.swift @@ -238,7 +238,7 @@ extension GiniScreenAPICoordinator: DocumentPickerCoordinatorDelegate { } if coordinator.currentPickerDismissesAutomatically { self.cameraScreen?.showErrorDialog(for: error, - positiveAction: positiveAction) + positiveAction: positiveAction) } else { coordinator.currentPickerViewController?.showErrorDialog(for: error, positiveAction: positiveAction) @@ -247,16 +247,16 @@ extension GiniScreenAPICoordinator: DocumentPickerCoordinatorDelegate { } } - public func documentPicker(_ coordinator: DocumentPickerCoordinator, failedToPickDocumentsAt urls: [URL]) { - let error = FilePickerError.failedToOpenDocument - if coordinator.currentPickerDismissesAutomatically { - self.cameraScreen?.showErrorDialog(for: error, - positiveAction: nil) - } else { - coordinator.currentPickerViewController?.showErrorDialog(for: error, - positiveAction: nil) + public func documentPicker(_ coordinator: DocumentPickerCoordinator, failedToPickDocumentsAt urls: [URL]) { + let error = FilePickerError.failedToOpenDocument + if coordinator.currentPickerDismissesAutomatically { + self.cameraScreen?.showErrorDialog(for: error, + positiveAction: nil) + } else { + coordinator.currentPickerViewController?.showErrorDialog(for: error, + positiveAction: nil) + } } - } fileprivate func addDropInteraction(forView view: UIView, with delegate: UIDropInteractionDelegate) { let dropInteraction = UIDropInteraction(delegate: delegate) diff --git a/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Tracking/AnalyticsProperties.swift b/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Tracking/AnalyticsProperties.swift index f7c6d53cb..045dfa2b9 100644 --- a/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Tracking/AnalyticsProperties.swift +++ b/CaptureSDK/GiniCaptureSDK/Sources/GiniCaptureSDK/Core/Tracking/AnalyticsProperties.swift @@ -4,7 +4,6 @@ // Copyright © 2024 Gini GmbH. All rights reserved. // - import Foundation struct AnalyticsProperty { let key: AnalyticsPropertyKey @@ -27,24 +26,12 @@ extension Int: AnalyticsPropertyValue { } } -extension UInt: AnalyticsPropertyValue { - func analyticsPropertyValue() -> UInt { - return self - } -} - extension Bool: AnalyticsPropertyValue { func analyticsPropertyValue() -> Bool { return self } } -extension Double: AnalyticsPropertyValue { - func analyticsPropertyValue() -> Double { - return self - } -} - enum AnalyticsPropertyKey: String { case screenName = "screen_name"