Skip to content

Commit

Permalink
Release version 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Team Mobile Schorsch committed Mar 3, 2022
1 parent c7539ec commit d59fc67
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 17 deletions.
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.3.1"))
.package(url: "https://github.com/gini/capture-sdk-ios.git", .exact("1.4.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.3.1"))
.package(url: "https://github.com/gini/capture-sdk-pinning-ios.git", .exact("1.4.0"))
]
```

Expand Down
14 changes: 12 additions & 2 deletions Documentation/source/Integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The Gini Capture SDK provides two integration options. A [Screen API](#screen-ap
The Screen API provides a custom `UIViewController` object, which can be presented modally. It handles the complete process from showing the onboarding until providing a UI for the analysis.
The Screen API, in turn, offers two different ways of implementation:

#### UI with Default Networking (Recommended)
### UI with Default Networking (Recommended)
Using this method you don't need to care about handling the analysis process with the [Gini Bank API Library](https://github.com/gini/bank-api-library-ios), you only need to provide your API credentials and a delegate to get the analysis results.

```swift
Expand All @@ -21,6 +21,8 @@ let viewController = GiniCapture.viewController(withClient: client,
present(viewController, animated: true, completion:nil)
```

#### Certificate Pinning

Optionally if you want to use _Certificate pinning_, provide metadata for the upload process, you can pass both your public key pinning configuration (see [TrustKit repo](https://github.com/datatheorem/TrustKit) for more information), the metadata information and the _API type_ (the [Gini Pay API](https://pay-api.gini.net/documentation/#gini-pay-api-documentation-v1-0) is used by default) as follows:

```swift
Expand Down Expand Up @@ -59,7 +61,15 @@ present(viewController, animated: true, completion:nil)
> - The document metadata for the upload process is intended to be used for reporting.
> - The multipage is supported only by the `.default` api.
#### UI with Custom Networking
#### Retrieve the Analyzed Document

The `AnalysisResult` returned in `GiniCaptureResultsDelegate.giniCaptureAnalysisDidFinishWith(result:, sendFeedbackBlock:)`
will return the analyzed Gini Bank API document in its `document` property.

When extractions were retrieved without using the Gini Bank API, then the `AnalysisResult.document` will be `nil`. For example when the
extractions came from an EPS QR Code.

### UI with Custom Networking
You can also provide your own networking by implementing the `GiniCaptureNetworkService` and `GiniCaptureResultsDelegate` protocols. Pass your instances to the UIViewController initialiser of GiniCapture as shown below.

```swift
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.3.1"
public let GiniCaptureSDKVersion = "1.4.0"
25 changes: 19 additions & 6 deletions Sources/GiniCaptureSDK/Networking/AnalysisResult.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,37 @@ import UIKit
import GiniBankAPILibrary

@objcMembers public class AnalysisResult: NSObject {
/// Images processed in the analysis
/**
* Images processed in the analysis.
*/
public let images: [UIImage]
/*

/**
* Specific extractions obtained in the analysis.
* Besides the list of extractions that can be found here
* (http://developer.gini.net/gini-api/html/document_extractions.html#available-specific-extractions),
*
* Besides the list of extractions that can be found
* [here](http://developer.gini.net/gini-api/html/document_extractions.html#available-specific-extractions),
* it can also return the epsPaymentQRCodeUrl extraction, obtained from a EPS QR code.
*/
public let extractions: [String: Extraction]

/*
/**
* Line item compound extractions obtained in the analysis.
*/
public let lineItems: [[Extraction]]?

public init(extractions: [String: Extraction], lineItems: [[Extraction]]? = nil, images: [UIImage]) {
/**
* The analyzed Gini Bank API document.
*
* It returns `nil` when extractions were retrieved without using the Gini Bank API.
* For example when the extractions came from an EPS QR code.
*/
public let document: Document?

public init(extractions: [String: Extraction], lineItems: [[Extraction]]? = nil, images: [UIImage], document: Document? = nil) {
self.images = images
self.extractions = extractions
self.lineItems = lineItems
self.document = document
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ import GiniBankAPILibrary
}
}

public func deliver(result: ExtractionResult, analysisDelegate: AnalysisDelegate) {
public func deliver(result: ExtractionResult, and document: Document? = nil, to analysisDelegate: AnalysisDelegate) {
let hasExtactions = result.extractions.count > 0

DispatchQueue.main.async { [weak self] in
Expand All @@ -126,13 +126,13 @@ import GiniBankAPILibrary
})


let result = AnalysisResult(extractions: extractions, lineItems: result.lineItems, images: images)
let result = AnalysisResult(extractions: extractions, lineItems: result.lineItems, images: images, document: document)

let documentService = self.documentService

self.resultsDelegate?.giniCaptureAnalysisDidFinishWith(result: result) { updatedExtractions in
documentService.sendFeedback(with: updatedExtractions.map { $0.value })
documentService.resetToInitialState()
documentService.sendFeedback(with: updatedExtractions.map { $0.value })
documentService.resetToInitialState()
}
} else {
self.resultsDelegate?
Expand All @@ -150,7 +150,7 @@ extension GiniNetworkingScreenAPICoordinator {
self.documentService.startAnalysis { result in
switch result {
case .success(let extractions):
self.deliver(result: extractions, analysisDelegate: networkDelegate)
self.deliver(result: extractions, and: self.documentService.document, to: networkDelegate)
case .failure(let error):

guard error != .requestCancelled else { return }
Expand Down Expand Up @@ -215,7 +215,7 @@ extension GiniNetworkingScreenAPICoordinator: GiniCaptureDelegate {
}
let extractionResult = ExtractionResult(extractions: extractions, lineItems: [], returnReasons: [])

self.deliver(result: extractionResult, analysisDelegate: networkDelegate)
self.deliver(result: extractionResult, to: networkDelegate)
return
}

Expand Down

0 comments on commit d59fc67

Please sign in to comment.