Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

2. Enable it inside Gini

...

Capture SDK

In order to allow Gini Bank Capture SDK to handle files imported from other apps and to show the Open With with tutorial in the Help menu, it is necessary to indicate it in the GiniBankConfiguration GiniConfiguration.

Code Block
languageswift
        let giniBankConfiguration = GiniBankConfiguration.shared
        ...
        ...
        giniBankConfiguration.openWithEnabled = true

...

In order to determine that the file opened is valid (correct size, correct type, and number of pages below the threshold on PDFs), it is necessary to validate it before using it.

Gini

...

Capture

Code Block
languageswift
func application(_ app: UIApplication,
                 open url: URL,
                 options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool {            

        // 1. Build the document
        let documentBuilder = GiniCaptureDocumentBuilder(documentSource: .appName(name: sourceApplication))
        documentBuilder.importMethod = .openWith

        documentBuilder.build(with: url) { [weak self] (document) in

            guard let self = self else { return }

            // 2. Validate the document
            if let document = document {
                do {
                    try GiniCapture.validate(document,
                                             withConfig: giniBankConfiguration.captureConfiguration())
                    // Load the GiniCapture with the validated document
                } catch {
                    // Show an error pointing out that the document is invalid
                }
            }
        }

        return true
}

...