Skip to content

Commit

Permalink
refactor(GiniCaptureSDK): Cleanup code
Browse files Browse the repository at this point in the history
- removed unnecessary code
- indentation fixed
- rename made in comments

PP-353
  • Loading branch information
ValentinaIancu-Gini committed Apr 10, 2024
1 parent 3a1bbf3 commit 7ef6791
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Camera2ViewController+Actions.swift
// CameraViewController+Actions.swift
//
//
// Created by Krzysztof Kryniecki on 14/09/2022.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// Copyright © 2024 Gini GmbH. All rights reserved.
//


import Foundation
struct AnalyticsProperty {
let key: AnalyticsPropertyKey
Expand All @@ -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"

Expand Down

0 comments on commit 7ef6791

Please sign in to comment.