Skip to content

Commit b0d3b20

Browse files
Update to latest features with framework version 1.6.3.1
1 parent 4038c92 commit b0d3b20

File tree

283 files changed

+68219
-12212
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

283 files changed

+68219
-12212
lines changed

.DS_Store

0 Bytes
Binary file not shown.

DocutainSDKExampleiOSSwift.xcodeproj/project.pbxproj

Lines changed: 214 additions & 0 deletions
Large diffs are not rendered by default.

DocutainSDKExampleiOSSwift/.DS_Store

6 KB
Binary file not shown.

DocutainSDKExampleiOSSwift/AppDelegate.swift

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,23 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1919
initRootWindow()
2020

2121
//the Docutain SDK needs to be initialized priot to using any functionality of it
22-
//a valid license key is required (contact us via [mailto:sdk@Docutain.com] to get a trial license
22+
//a valid license key is required, you can generate one on our website https://sdk.docutain.com/TrialLicense?Source=721410
2323
if(!DocutainSDK.initSDK(licenseKey: licenseKey)){
2424
//init of Docutain SDK failed, get last error message
2525
print("InitSDK failed with error: \(DocutainSDK.getLastError())")
2626
if(licenseKey == "YOUR_LICENSE_KEY_HERE"){
2727
showLicenseEmptyInfo()
2828
return false
29+
} else{
30+
showLicenseErrorInfo()
31+
return false
2932
}
3033
}
3134

3235
if #available(iOS 13.0, *) {
33-
//If you want to use text recognition (OCR) and/or data extraction features, you need to set the AnalyzeConfiguration
34-
//in order to start all the necessary processes
36+
//Reading payment state and BIC when getting the analyzed data is disabled by default
37+
//If you want to analyze these 2 fields as well, you need to set the AnalyzeConfig accordingly
38+
//A good place to do this, is right after initializing the Docutain SDK
3539
let analyzeConfig = AnalyzeConfiguration()
3640
analyzeConfig.readPaymentState = true
3741
analyzeConfig.readBIC = true
@@ -75,26 +79,36 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
7579
}
7680

7781
private func showLicenseEmptyInfo(){
78-
let alert = UIAlertController(title: "License empty", message: "A valid license key is required. Please contact us via sdk@Docutain.com to get a trial license.", preferredStyle: .alert)
79-
alert.addAction(UIAlertAction(title: "Get license", style: .default, handler: {_ in
80-
let email = "sdk@Docutain.com"
81-
let subject = "Trial License Request"
82-
if let mailURLString = "mailto:\(email)?subject=\(subject)".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed),
83-
let mailURL = URL(string: mailURLString) {
84-
if UIApplication.shared.canOpenURL(mailURL) {
85-
UIApplication.shared.open(mailURL)
86-
} else {
87-
print("Mail can not be opened")
88-
}
89-
} else{
90-
print("Mail can not be opened")
82+
let alert = UIAlertController(title: "License empty", message: "A valid license key is required. Please click \"Get License\" in order to create a free trial license key on our website.", preferredStyle: .alert)
83+
alert.addAction(UIAlertAction(title: "Get License", style: .default, handler: {_ in
84+
if let url = URL(string: "https://sdk.docutain.com/TrialLicense?Source=721410") {
85+
UIApplication.shared.open(url, completionHandler: {_ in
86+
exit(0)
87+
})
9188
}
9289
self.window?.isUserInteractionEnabled = false
9390
}))
94-
alert.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel, handler: {_ in
95-
exit(0)
91+
window?.rootViewController?.present(alert, animated: true)
92+
}
93+
94+
private func showLicenseErrorInfo(){
95+
let alert = UIAlertController(title: "License error", message: "A valid license key is required. Please contact our support to get an extended trial license.", preferredStyle: .alert)
96+
alert.addAction(UIAlertAction(title: "Contact Support", style: .default, handler: {_ in
97+
self.sendEmailToSupport(completion: {
98+
exit(0)
99+
})
96100
}))
97101
window?.rootViewController?.present(alert, animated: true)
98102
}
103+
104+
func sendEmailToSupport(completion: @escaping () -> Void) {
105+
let mailtoString = "mailto:support.sdk@Docutain.com?subject=Trial License Error&body=Please keep your following trial license key in this e-mail: \(licenseKey)".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
106+
let mailtoUrl = URL(string: mailtoString!)!
107+
if UIApplication.shared.canOpenURL(mailtoUrl) {
108+
UIApplication.shared.open(mailtoUrl) { success in
109+
completion()
110+
}
111+
}
112+
}
99113
}
100114

Binary file not shown.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "icons8-document-50(@1×).png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"filename" : "icons8-document-100(@2×).png",
10+
"idiom" : "universal",
11+
"scale" : "2x"
12+
},
13+
{
14+
"filename" : "icons8-document-150(@3×).png",
15+
"idiom" : "universal",
16+
"scale" : "3x"
17+
}
18+
],
19+
"info" : {
20+
"author" : "xcode",
21+
"version" : 1
22+
}
23+
}
Loading
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "icons8-scanner-50(@1×).png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"filename" : "icons8-scanner-100(@2×).png",
10+
"idiom" : "universal",
11+
"scale" : "2x"
12+
},
13+
{
14+
"filename" : "icons8-scanner-150(@3×).png",
15+
"idiom" : "universal",
16+
"scale" : "3x"
17+
}
18+
],
19+
"info" : {
20+
"author" : "xcode",
21+
"version" : 1
22+
}
23+
}
Loading
Loading
Loading
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "icons8-text-box-50(@1×).png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"filename" : "icons8-text-box-100(@2×).png",
10+
"idiom" : "universal",
11+
"scale" : "2x"
12+
},
13+
{
14+
"filename" : "icons8-text-box-150(@3×).png",
15+
"idiom" : "universal",
16+
"scale" : "3x"
17+
}
18+
],
19+
"info" : {
20+
"author" : "xcode",
21+
"version" : 1
22+
}
23+
}
Loading
Loading
Loading
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "icons8-pdf-50(@1×).png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"filename" : "icons8-pdf-100(@2×).png",
10+
"idiom" : "universal",
11+
"scale" : "2x"
12+
},
13+
{
14+
"filename" : "icons8-pdf-150(@3×).png",
15+
"idiom" : "universal",
16+
"scale" : "3x"
17+
}
18+
],
19+
"info" : {
20+
"author" : "xcode",
21+
"version" : 1
22+
}
23+
}
Loading
Loading
Loading
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "icons8-settings-50(@1×).png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"filename" : "icons8-settings-100(@2×).png",
10+
"idiom" : "universal",
11+
"scale" : "2x"
12+
},
13+
{
14+
"filename" : "icons8-settings-150(@3×).png",
15+
"idiom" : "universal",
16+
"scale" : "3x"
17+
}
18+
],
19+
"info" : {
20+
"author" : "xcode",
21+
"version" : 1
22+
}
23+
}
Loading
Loading
Loading
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
},
6+
"symbols" : [
7+
{
8+
"filename" : "settings-settings_symbol.svg",
9+
"idiom" : "universal"
10+
}
11+
]
12+
}

DocutainSDKExampleiOSSwift/Assets.xcassets/Settings.symbolset/settings-settings_symbol.svg

Lines changed: 12 additions & 0 deletions
Loading

DocutainSDKExampleiOSSwift/Extensions.swift

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,81 @@
66
//
77

88
import Foundation
9+
import UIKit
910

1011
internal extension String{
1112
func localized() -> Self{
1213
return NSLocalizedString(self, comment: "")
1314
}
1415
}
16+
17+
internal extension NSObject {
18+
static var nameOfClass: String {
19+
return NSStringFromClass(self).components(separatedBy: ".").last!
20+
}
21+
}
22+
23+
internal extension UITableViewCell {
24+
static var identifier: String {
25+
self.nameOfClass
26+
}
27+
}
28+
29+
internal extension UITableView {
30+
func registerCell<T: UITableViewCell>(cell: T.Type) {
31+
self.register(cell, forCellReuseIdentifier: cell.identifier)
32+
}
33+
34+
func dequeueCell<T: UITableViewCell>(cell: T.Type) -> T? {
35+
return dequeueReusableCell(withIdentifier: cell.identifier) as? T
36+
}
37+
}
38+
39+
internal extension UIColor{
40+
convenience init(hexString: String) {
41+
let hexString = hexString.trimmingCharacters(in: .whitespacesAndNewlines)
42+
let scanner = Scanner(string: hexString)
43+
44+
if hexString.hasPrefix("#") {
45+
scanner.scanLocation = 1
46+
}
47+
48+
var color: UInt32 = 0
49+
scanner.scanHexInt32(&color)
50+
51+
let mask = 0x000000FF
52+
let r = Int(color >> 16) & mask
53+
let g = Int(color >> 8) & mask
54+
let b = Int(color) & mask
55+
56+
let red = CGFloat(r) / 255.0
57+
let green = CGFloat(g) / 255.0
58+
let blue = CGFloat(b) / 255.0
59+
60+
self.init(red: red, green: green, blue: blue, alpha: 1)
61+
}
62+
63+
var hexString: String {
64+
65+
var r: CGFloat = 0
66+
var g: CGFloat = 0
67+
var b: CGFloat = 0
68+
var a: CGFloat = 0
69+
70+
getRed(&r, green: &g, blue: &b, alpha: &a)
71+
72+
let rgb: Int = (Int)(r * 255) << 16 | (Int)(g * 255) << 8 | (Int)(b * 255) << 0
73+
74+
return String(format: "#%06x", rgb)
75+
}
76+
}
77+
78+
internal extension [String : String]{
79+
var light: UIColor{
80+
return UIColor(hexString: self["light"]!)
81+
}
82+
83+
var dark: UIColor{
84+
return UIColor(hexString: self["dark"]!)
85+
}
86+
}
Binary file not shown.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
//
2+
// BoolSetting.swift
3+
// DocutainSDKExampleiOSSwift
4+
//
5+
// Created by Marvin Frankenfeld on 10.04.24.
6+
//
7+
8+
import Foundation
9+
10+
public class BoolSetting: Setting {
11+
12+
public typealias Handler = (Bool, SettingType) -> Void
13+
14+
public let settingType: SettingType
15+
public let title: String
16+
public let subtitle: String
17+
public internal(set) var value: Bool {
18+
didSet { self.onChangeHandler(self.value, self.settingType) }
19+
}
20+
public let onChangeHandler: Handler
21+
22+
public init(settingType: SettingType,
23+
initialValue: Bool,
24+
onChangeHandler: @escaping Handler) {
25+
self.title = settingType.rawValue.localized()
26+
self.subtitle = "\(settingType.rawValue)_Description".localized()
27+
self.value = initialValue
28+
self.settingType = settingType
29+
self.onChangeHandler = onChangeHandler
30+
}
31+
}

0 commit comments

Comments
 (0)