Skip to content

Commit

Permalink
Release version 1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Team Mobile Schorsch committed May 6, 2022
1 parent a1635d6 commit dfa159e
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 24 deletions.
16 changes: 13 additions & 3 deletions Documentation/source/Customization guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,22 @@ Some background and text colors use the `GiniColor` type with which you can set
- With title only
- Title → `GiniConfiguration.navigationBarCameraTitleCloseButton`
- Help button
- Image &#8594; <span style="color:#009EDF">*navigationCameraHelp*</span> image asset
- Title &#8594; <span style="color:#009EDF">*ginicapture.navigationbar.camera.help*</span> localized string

- With image and title
- Image &#8594; <span style="color:#009EDF">*navigationCameraHelp*</span> image asset
- Title &#8594; <span style="color:#009EDF">*ginicapture.navigationbar.camera.help*</span> localized string
- With title only
- Title &#8594; `GiniConfiguration.navigationBarCameraTitleHelpButton`
##### 2. Camera preview
- Preview frame color &#8594; `GiniConfiguration.cameraPreviewFrameColor`
- Guides color &#8594; `GiniConfiguration.cameraPreviewCornerGuidesColor`
- Focus large image &#8594; <span style="color:#009EDF">*cameraFocusLarge*</span> image asset
- Focus large small &#8594; <span style="color:#009EDF">*cameraFocusSmall*</span> image asset
- Opaque view style (when tool tip is shown) &#8594; `GiniConfiguration.toolTipOpaqueBackgroundStyle`

##### 3. Camera buttons container
- Background color &#8594; `GiniConfiguration.cameraButtonsViewBackgroundColor`
- Container view background color under the home indicator &#8594; `GiniConfiguration.cameraContainerViewBackgroundColor`
- Capture button
- Image &#8594; <span style="color:#009EDF">*cameraCaptureButton*</span> image asset
- Import button
Expand Down Expand Up @@ -193,7 +199,9 @@ Some background and text colors use the `GiniColor` type with which you can set
- Title &#8594; `GiniConfiguration.navigationBarHelpScreenTitleBackToMenuButton`

##### 1. Supported format cells
- Supported fortmats icon &#8594; <span style="color:#009EDF">*supportedFormatsIcon*</span> image asset
- Supported formats icon color &#8594; `GiniConfiguration.supportedFormatsIconColor`
- Non supported fortmats icon &#8594; <span style="color:#009EDF">*nonSupportedFormatsIcon*</span> image asset
- Non supported formats icon color &#8594; `GiniConfiguration.nonSupportedFormatsIconColor`

## Open with tutorial screen
Expand Down Expand Up @@ -244,6 +252,8 @@ Some background and text colors use the `GiniColor` type with which you can set

##### 2. Go to camera button
- Background color &#8594; `GiniConfiguration.noResultsBottomButtonColor`
- Text color &#8594; `GiniConfiguration.noResultsBottomButtonTextColor`
- Corner radius &#8594; `GiniConfiguration.noResultsBottomButtonCornerRadius`

## Gallery album screen

Expand Down
4 changes: 2 additions & 2 deletions Documentation/source/Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ Once you have your Swift package set up, adding `GiniCaptureSDK` as a dependency

```swift
dependencies: [
.package(url: "https://github.com/gini/capture-sdk-ios.git", .exact("1.6.0"))
.package(url: "https://github.com/gini/capture-sdk-ios.git", .exact("1.7.0"))
]
```

In case that you want to use the certificate pinning in the library, add `GiniCaptureSDKPinning`:
```swift
dependencies: [
.package(url: "https://github.com/gini/capture-sdk-pinning-ios.git", .exact("1.6.0"))
.package(url: "https://github.com/gini/capture-sdk-pinning-ios.git", .exact("1.7.0"))
]
```

Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let package = Package(
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(name: "GiniBankAPILibrary", url: "https://github.com/gini/bank-api-library-ios.git", .exact("1.2.0")),
.package(name: "GiniBankAPILibrary", url: "https://github.com/gini/bank-api-library-ios.git", .exact("1.3.0")),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
Expand Down
13 changes: 13 additions & 0 deletions Sources/GiniCaptureSDK/Core/Extensions/UIImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,17 @@ extension UIImage {
return UIImage(cgImage: downsampledImage)
}

func tintedImageWithColor(_ color: UIColor) -> UIImage? {
let image = withRenderingMode(.alwaysTemplate)
UIGraphicsBeginImageContextWithOptions(size, false, scale)
color.set()
image.draw(in: CGRect(origin: .zero, size: size))

guard let imageColored = UIGraphicsGetImageFromCurrentImageContext() else {
return nil
}
UIGraphicsEndImageContext()
return imageColored
}

}
25 changes: 25 additions & 0 deletions Sources/GiniCaptureSDK/Core/GiniConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,21 @@ import UIKit
*/
@objc public var cameraPreviewCornerGuidesColor = UIColor.white

/**
Sets the background color of camera container view.
*/
@objc public var cameraContainerViewBackgroundColor = GiniColor(lightModeColor: .black, darkModeColor: .black)

/**
Sets the color of camera preview frame.
*/
@objc public var cameraPreviewFrameColor = GiniColor(lightModeColor: UIColor(white: 0.0, alpha: 0.7), darkModeColor: UIColor(white: 0.0, alpha: 0.7))

/**
Sets the background color of camera buttons view.
*/
@objc public var cameraButtonsViewBackgroundColor = GiniColor(lightModeColor: .black, darkModeColor: .black)

/**
Set the types supported by the file import feature. `GiniCaptureImportFileTypes.none` by default.
*/
Expand Down Expand Up @@ -608,6 +623,16 @@ import UIKit
*/
@objc public var noResultsBottomButtonColor = Colors.Gini.blue

/**
Sets the text color of the bottom button to the specified color.
*/
@objc public var noResultsBottomButtonTextColor = GiniColor.init(lightModeColor: .white, darkModeColor: .white)

/**
Sets the corner radius of the bottom button.
*/
@objc public var noResultsBottomButtonCornerRadius: CGFloat = 0.0

/**
Sets the color of the warning container background to the specified color.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ final class CameraButtonsViewController: UIViewController {

public override func loadView() {
super.loadView()
view.backgroundColor = .black
view.backgroundColor = UIColor.from(giniColor: giniConfiguration.cameraButtonsViewBackgroundColor)
view.translatesAutoresizingMaskIntoConstraints = false

view.addSubview(captureButton)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import AVFoundation

final class CameraPreviewView: UIView {

let frameColor = UIColor(white: 0.0, alpha: 0.7)
let frameColor = UIColor.from(giniColor: GiniConfiguration.shared.cameraPreviewFrameColor)
let guideLineLength: CGFloat = 50.0
let guideLineWidth: CGFloat = 2.0
/// the size of the guides compared to the size of the whole view
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ import AVFoundation
public override func loadView() {
super.loadView()
edgesForExtendedLayout = []
view.backgroundColor = .black
view.backgroundColor = UIColor.from(giniColor: giniConfiguration.cameraContainerViewBackgroundColor)

// `previewView` must be added at 0 because otherwise NotAuthorizedView button won't ever be touchable
addChild(cameraPreviewViewController)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@ public final class ImageAnalysisNoResultsViewController: UIViewController {
bottomButton.translatesAutoresizingMaskIntoConstraints = false
bottomButton.setTitle(self.bottomButtonText, for: .normal)
bottomButton.titleLabel?.font = giniConfiguration.customFont.with(weight: .bold, size: 14, style: .caption1)
bottomButton.setTitleColor(UIColor.white.withAlphaComponent(0.5), for: .highlighted)
let bottomButtonTextColor = UIColor.from(giniColor: giniConfiguration.noResultsBottomButtonTextColor)
bottomButton.setTitleColor(bottomButtonTextColor, for: .normal)
bottomButton.setTitleColor(bottomButtonTextColor.withAlphaComponent(0.5), for: .highlighted)
bottomButton.setImage(self.bottomButtonIconImage, for: .normal)
if let highlightedImage = self.bottomButtonIconImage?.tintedImageWithColor(bottomButtonTextColor.withAlphaComponent(0.5)){
bottomButton.setImage(highlightedImage, for: .highlighted)
}
bottomButton.addTarget(self, action: #selector(didTapBottomButtonAction), for: .touchUpInside)
bottomButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 20)
bottomButton.backgroundColor = GiniConfiguration.shared.noResultsBottomButtonColor
bottomButton.backgroundColor = giniConfiguration.noResultsBottomButtonColor
bottomButton.layer.cornerRadius = giniConfiguration.noResultsBottomButtonCornerRadius
return bottomButton
}()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,12 @@ final class SupportedFormatsViewController: UITableViewController {
var sections: [SupportedFormatCollectionSection] = [
(.localized(resource: HelpStrings.supportedFormatsSection1Title),
[.localized(resource: HelpStrings.supportedFormatsSection1Item1Text)],
UIImage(named: "supportedFormatsIcon",
in: giniCaptureBundle(),
compatibleWith: nil),
UIImageNamedPreferred(named: "supportedFormatsIcon"),
GiniConfiguration.shared.supportedFormatsIconColor),
(.localized(resource: HelpStrings.supportedFormatsSection2Title),
[.localized(resource: HelpStrings.supportedFormatsSection2Item1Text),
.localized(resource: HelpStrings.supportedFormatsSection2Item2Text)],
UIImage(named: "nonSupportedFormatsIcon", in: giniCaptureBundle(), compatibleWith: nil),
UIImageNamedPreferred(named: "nonSupportedFormatsIcon"),
GiniConfiguration.shared.nonSupportedFormatsIconColor)
]

Expand Down
2 changes: 1 addition & 1 deletion Sources/GiniCaptureSDK/GiniCaptureSDKVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
// Created by Nadya Karaban on 29.10.21.
//

public let GiniCaptureSDKVersion = "1.6.0"
public let GiniCaptureSDKVersion = "1.7.0"
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public final class AccountingDocumentService: DocumentServiceProtocol {
document = nil
}

public func sendFeedback(with updatedExtractions: [Extraction]) {
public func sendFeedback(with updatedExtractions: [Extraction], updatedCompoundExtractions: [String : [[Extraction]]]?) {
guard let document = document else { return }
documentService.submitFeedback(for: document, with: updatedExtractions) { result in
switch result {
Expand Down
6 changes: 3 additions & 3 deletions Sources/GiniCaptureSDK/Networking/DocumentService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ public final class DocumentService: DocumentServiceProtocol {
partialDocuments[imageDocument.id]?.info.rotationDelta = imageDocument.rotationDelta
}

public func sendFeedback(with updatedExtractions: [Extraction]) {
public func sendFeedback(with updatedExtractions: [Extraction], updatedCompoundExtractions: [String: [[Extraction]]]?) {
Log(message: "Sending feedback", event: "💬")
guard let document = document else {
Log(message: "Cannot send feedback: no document", event: .error)
return
}
captureNetworkService.sendFeedback(document: document, updatedExtractions: updatedExtractions) { result in
captureNetworkService.sendFeedback(document: document, updatedExtractions: updatedExtractions, updatedCompoundExtractions: updatedCompoundExtractions) { result in
switch result {
case .success:
Log(message: "Feedback sent with \(updatedExtractions.count) extractions",
Log(message: "Feedback sent with \(updatedExtractions.count) extractions and \(updatedCompoundExtractions?.count ?? 0) compound extractions",
event: "🚀")
case .failure(let error):
let message = "Error sending feedback for document with id: \(document.id) error: \(error)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public protocol DocumentServiceProtocol: AnyObject {
func cancelAnalysis()
func remove(document: GiniCaptureDocument)
func resetToInitialState()
func sendFeedback(with updatedExtractions: [Extraction])
func sendFeedback(with updatedExtractions: [Extraction], updatedCompoundExtractions: [String: [[Extraction]]]?)
func startAnalysis(completion: @escaping AnalysisCompletion)
func sortDocuments(withSameOrderAs documents: [GiniCaptureDocument])
func upload(document: GiniCaptureDocument,
Expand Down
12 changes: 10 additions & 2 deletions Sources/GiniCaptureSDK/Networking/GiniCaptureNetworkService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public protocol GiniCaptureNetworkService: AnyObject {
completion: @escaping UploadDocumentCompletion)
func sendFeedback(document: Document,
updatedExtractions: [Extraction],
updatedCompoundExtractions: [String: [[Extraction]]]?,
completion: @escaping (Result<Void, GiniError>) -> Void)
func log(errorEvent: ErrorEvent,
completion: @escaping (Result<Void, GiniError>) -> Void)
Expand Down Expand Up @@ -134,9 +135,16 @@ class DefaultCaptureNetworkService: GiniCaptureNetworkService {

func sendFeedback(document: Document,
updatedExtractions: [Extraction],
updatedCompoundExtractions: [String: [[Extraction]]]?,
completion: @escaping (Result<Void, GiniError>) -> Void) {
documentService.submitFeedback(for: document, with: updatedExtractions) { result in
completion(result)
if let updatedCompoundExtractions = updatedCompoundExtractions {
documentService.submitFeedback(for: document, with: updatedExtractions, and: updatedCompoundExtractions) { result in
completion(result)
}
} else {
documentService.submitFeedback(for: document, with: updatedExtractions) { result in
completion(result)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ import GiniBankAPILibrary
let documentService = self.documentService

self.resultsDelegate?.giniCaptureAnalysisDidFinishWith(result: result) { updatedExtractions in
documentService.sendFeedback(with: updatedExtractions.map { $0.value })
documentService.sendFeedback(with: updatedExtractions.map { $0.value }, updatedCompoundExtractions: nil)
documentService.resetToInitialState()
}
} else {
Expand Down

0 comments on commit dfa159e

Please sign in to comment.