From 861230d5d29d9299783ee0fd90419e2d6f917e1c Mon Sep 17 00:00:00 2001 From: Team Mobile Schorsch Date: Wed, 15 Dec 2021 14:14:51 +0000 Subject: [PATCH] Release version 1.1.1 --- Documentation/source/Installation.md | 4 ++-- Documentation/source/License.md | 14 +++++--------- LICENSE | 9 ++++----- README.md | 7 +++---- .../GiniCaptureSDK/Core/Extensions/UIView.swift | 2 +- .../GiniCaptureSDK/Core/GiniConfiguration.swift | 5 +++++ .../Core/Helpers/GiniCaptureUtils.swift | 12 ++++++++++-- .../Core/Helpers/PreferredButtonResource.swift | 2 +- .../Screens/Analysis/CaptureSuggestionsView.swift | 2 +- .../SupportedFormatsViewController.swift | 4 ++-- .../MultipageReviewMainCollectionCell.swift | 2 +- .../MultipageReviewPagesCollectionCell.swift | 2 +- .../MultipageReviewViewController.swift | 2 +- .../Screens/Multipage Review/PageStateView.swift | 4 ++-- Sources/GiniCaptureSDKVersion.swift | 2 +- .../GiniCaptureTestsHelper.swift | 10 +++++++--- .../HelpMenuViewControllerTests.swift | 6 +++--- .../OpenWithTutorialViewControllerTests.swift | 2 +- 18 files changed, 51 insertions(+), 40 deletions(-) diff --git a/Documentation/source/Installation.md b/Documentation/source/Installation.md index 64dad7e..7b53f52 100644 --- a/Documentation/source/Installation.md +++ b/Documentation/source/Installation.md @@ -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.1.0")) + .package(url: "https://github.com/gini/capture-sdk-ios.git", .exact("1.1.1")) ] ``` 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.1.0")) + .package(url: "https://github.com/gini/capture-sdk-pinning-ios.git", .exact("1.1.1")) ] ``` diff --git a/Documentation/source/License.md b/Documentation/source/License.md index 85c2839..ef0ac79 100644 --- a/Documentation/source/License.md +++ b/Documentation/source/License.md @@ -1,9 +1,7 @@ License ======= -The [Gini Capture SDK for iOS](https://github.com/gini/capture-sdk-ios) is licensed under a Private License. - -Always make sure to ship all license notices and permissions with your application. +## Gini Capture SDK for iOS is licensed under a Private License. Copyright (c) 2014-2021, Gini GmbH All rights reserved. @@ -21,7 +19,7 @@ Always make sure to ship all license notices and permissions with your applicati The Gini Capture SDK uses code from the following libraries: -## [Gini Bank API Library for iOS](https://github.com/gini/bank-api-library-ios) +### Gini Bank API Library for iOS The MIT License (MIT) @@ -45,9 +43,7 @@ The Gini Capture SDK uses code from the following libraries: OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -The [Gini Capture SDK Pinning for iOS](https://github.com/gini/capture-sdk-pinning-ios) is licensed under a Private License. - -Always make sure to ship all license notices and permissions with your application. +## Gini Capture SDK Pinning for iOS is licensed under a Private License. Copyright (c) 2014-2021, Gini GmbH All rights reserved. @@ -65,7 +61,7 @@ Always make sure to ship all license notices and permissions with your applicati The Gini Capture SDK Pinning uses code from the following libraries: -## [Gini Bank API Library Pinning for iOS](https://github.com/gini/bank-api-library-pinning-ios) +### Gini Bank API Library Pinning for iOS The MIT License (MIT) @@ -89,7 +85,7 @@ The Gini Capture SDK Pinning uses code from the following libraries: OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -## [TrustKit](https://github.com/datatheorem/TrustKit) +### [TrustKit](https://github.com/datatheorem/TrustKit) The MIT License (MIT) diff --git a/LICENSE b/LICENSE index c6749ab..61db89a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,12 +1,12 @@ Copyright (c) 2014-2021, Gini GmbH All rights reserved. +Always make sure to ship all license notices and permissions with your application. + License ======= -The [Gini Capture SDK for iOS](https://github.com/gini/capture-sdk-ios) is licensed under a Private License. - -Always make sure to ship all license notices and permissions with your application. +## Gini Capture SDK for iOS is licensed under a Private License. Copyright (c) 2014-2021, Gini GmbH All rights reserved. @@ -24,7 +24,7 @@ Always make sure to ship all license notices and permissions with your applicati The Gini Capture SDK uses code from the following libraries: -## [Gini Bank API Library for iOS](https://github.com/gini/bank-api-library-ios) +### Gini Bank API Library for iOS The MIT License (MIT) @@ -47,4 +47,3 @@ The Gini Capture SDK uses code from the following libraries: LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/README.md b/README.md index 31c071d..e8f301b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@

- +

+ # Gini Capture SDK for iOS [![Platform](https://img.shields.io/badge/platform-iOS-lightgrey.svg)]() @@ -24,9 +25,7 @@ Further documentation with installation, integration or customization guides can ## Example We are providing example apps for Swift and Objective-C. These apps demonstrate how to integrate the Gini Capture SDK with the Screen API and Component API. To run the example project, clone the repo and run `pod install` from the Example directory first. -To inject your API credentials into the Example app, just add to the Example directory the `Credentials.plist` file with the following format: - - +To inject your API credentials into the Example app, just add to the Example directory the `Credentials.plist` file. ## Requirements diff --git a/Sources/GiniCaptureSDK/Core/Extensions/UIView.swift b/Sources/GiniCaptureSDK/Core/Extensions/UIView.swift index 5c25be8..69e6f0a 100644 --- a/Sources/GiniCaptureSDK/Core/Extensions/UIView.swift +++ b/Sources/GiniCaptureSDK/Core/Extensions/UIView.swift @@ -9,7 +9,7 @@ import UIKit extension UIView { /** Loads instance from nib with the same name. */ func loadNib() -> UIView { - let bundle = Bundle.module + let bundle = giniCaptureBundle() let nibName = type(of: self).description().components(separatedBy: ".").last! let nib = UINib(nibName: nibName, bundle: bundle) return nib.instantiate(withOwner: self, options: nil).first as! UIView diff --git a/Sources/GiniCaptureSDK/Core/GiniConfiguration.swift b/Sources/GiniCaptureSDK/Core/GiniConfiguration.swift index 357a933..7d66991 100644 --- a/Sources/GiniCaptureSDK/Core/GiniConfiguration.swift +++ b/Sources/GiniCaptureSDK/Core/GiniConfiguration.swift @@ -672,6 +672,11 @@ import UIKit } } + /** + Should be set if the default name "Localizable.strings" are not used + */ + public var localizedStringsTableName: String? + // Undocumented--Xamarin only @objc public var closeButtonResource: PreferredButtonResource? @objc public var helpButtonResource: PreferredButtonResource? diff --git a/Sources/GiniCaptureSDK/Core/Helpers/GiniCaptureUtils.swift b/Sources/GiniCaptureSDK/Core/Helpers/GiniCaptureUtils.swift index 5676bdf..5b86601 100644 --- a/Sources/GiniCaptureSDK/Core/Helpers/GiniCaptureUtils.swift +++ b/Sources/GiniCaptureSDK/Core/Helpers/GiniCaptureUtils.swift @@ -38,8 +38,16 @@ public func NSLocalizedStringPreferredFormat(_ key: String, fallbackKey: String = "", comment: String, isCustomizable: Bool = true) -> String { - let clientString = NSLocalizedString(key, comment: comment) - let fallbackClientString = NSLocalizedString(fallbackKey, comment: comment) + var clientString: String + var fallbackClientString: String + if let localizedResourceName = GiniConfiguration.shared.localizedStringsTableName { + clientString = NSLocalizedString(key, tableName: localizedResourceName, comment: comment) + fallbackClientString = NSLocalizedString(fallbackKey,tableName: localizedResourceName, comment: comment) + } else { + clientString = NSLocalizedString(key, comment: comment) + fallbackClientString = NSLocalizedString(fallbackKey, comment: comment) + } + let format: String if (clientString.lowercased() != key.lowercased() || fallbackClientString.lowercased() != fallbackKey.lowercased()) && isCustomizable { diff --git a/Sources/GiniCaptureSDK/Core/Helpers/PreferredButtonResource.swift b/Sources/GiniCaptureSDK/Core/Helpers/PreferredButtonResource.swift index ffa6e54..00274d5 100644 --- a/Sources/GiniCaptureSDK/Core/Helpers/PreferredButtonResource.swift +++ b/Sources/GiniCaptureSDK/Core/Helpers/PreferredButtonResource.swift @@ -36,7 +36,7 @@ class GiniPreferredButtonResource: PreferredButtonResource { private let localizedTextComment: String? private let localizedConfigEntry: String? private let appBundle = Bundle.main - private let libBundle = Bundle.module + private let libBundle = giniCaptureBundle() private var imageSource: ResourceOrigin { if let name = imageName { if UIImage(named: name, in: appBundle, compatibleWith: nil) != nil { diff --git a/Sources/GiniCaptureSDK/Core/Screens/Analysis/CaptureSuggestionsView.swift b/Sources/GiniCaptureSDK/Core/Screens/Analysis/CaptureSuggestionsView.swift index 79f1a82..9e8242e 100644 --- a/Sources/GiniCaptureSDK/Core/Screens/Analysis/CaptureSuggestionsView.swift +++ b/Sources/GiniCaptureSDK/Core/Screens/Analysis/CaptureSuggestionsView.swift @@ -26,7 +26,7 @@ final class CaptureSuggestionsView: UIView { fileprivate let repeatInterval: TimeInterval = 5 fileprivate let superViewBottomAnchor: NSLayoutYAxisAnchor fileprivate let suggestionIconImage = UIImage(named: "analysisSuggestionsIcon", - in: Bundle.module, compatibleWith: nil) + in: giniCaptureBundle(), compatibleWith: nil) fileprivate var suggestionTexts: [String] = [ .localized(resource: AnalysisStrings.suggestion1Text), .localized(resource: AnalysisStrings.suggestion2Text), diff --git a/Sources/GiniCaptureSDK/Core/Screens/Help/Supported formats/SupportedFormatsViewController.swift b/Sources/GiniCaptureSDK/Core/Screens/Help/Supported formats/SupportedFormatsViewController.swift index 9824d8e..f4c4abf 100644 --- a/Sources/GiniCaptureSDK/Core/Screens/Help/Supported formats/SupportedFormatsViewController.swift +++ b/Sources/GiniCaptureSDK/Core/Screens/Help/Supported formats/SupportedFormatsViewController.swift @@ -24,13 +24,13 @@ final class SupportedFormatsViewController: UITableViewController { (.localized(resource: HelpStrings.supportedFormatsSection1Title), [.localized(resource: HelpStrings.supportedFormatsSection1Item1Text)], UIImage(named: "supportedFormatsIcon", - in: Bundle.module, + in: giniCaptureBundle(), compatibleWith: nil), GiniConfiguration.shared.supportedFormatsIconColor), (.localized(resource: HelpStrings.supportedFormatsSection2Title), [.localized(resource: HelpStrings.supportedFormatsSection2Item1Text), .localized(resource: HelpStrings.supportedFormatsSection2Item2Text)], - UIImage(named: "nonSupportedFormatsIcon", in: Bundle.module, compatibleWith: nil), + UIImage(named: "nonSupportedFormatsIcon", in: giniCaptureBundle(), compatibleWith: nil), GiniConfiguration.shared.nonSupportedFormatsIconColor) ] diff --git a/Sources/GiniCaptureSDK/Core/Screens/Multipage Review/MultipageReviewMainCollectionCell.swift b/Sources/GiniCaptureSDK/Core/Screens/Multipage Review/MultipageReviewMainCollectionCell.swift index 169e096..7a8e623 100644 --- a/Sources/GiniCaptureSDK/Core/Screens/Multipage Review/MultipageReviewMainCollectionCell.swift +++ b/Sources/GiniCaptureSDK/Core/Screens/Multipage Review/MultipageReviewMainCollectionCell.swift @@ -18,7 +18,7 @@ final class MultipageReviewMainCollectionCell: UICollectionViewCell { imageView.clipsToBounds = true imageView.accessibilityLabel = NSLocalizedString("ginicapture.review.documentImageTitle", - bundle: Bundle.module, + bundle: giniCaptureBundle(), comment: "Document") return imageView diff --git a/Sources/GiniCaptureSDK/Core/Screens/Multipage Review/MultipageReviewPagesCollectionCell.swift b/Sources/GiniCaptureSDK/Core/Screens/Multipage Review/MultipageReviewPagesCollectionCell.swift index e7bb2b5..468052b 100644 --- a/Sources/GiniCaptureSDK/Core/Screens/Multipage Review/MultipageReviewPagesCollectionCell.swift +++ b/Sources/GiniCaptureSDK/Core/Screens/Multipage Review/MultipageReviewPagesCollectionCell.swift @@ -68,7 +68,7 @@ final class MultipageReviewPagesCollectionCell: UICollectionViewCell { }() lazy var draggableIcon: UIImageView = { - let image = UIImage(named: "draggablePageIcon", in: Bundle.module, compatibleWith: nil) + let image = UIImage(named: "draggablePageIcon", in: giniCaptureBundle(), compatibleWith: nil) let imageView = UIImageView(image: image?.withRenderingMode(.alwaysTemplate)) imageView.translatesAutoresizingMaskIntoConstraints = false imageView.contentMode = .scaleAspectFit diff --git a/Sources/GiniCaptureSDK/Core/Screens/Multipage Review/MultipageReviewViewController.swift b/Sources/GiniCaptureSDK/Core/Screens/Multipage Review/MultipageReviewViewController.swift index 8d01ee6..5fbffde 100644 --- a/Sources/GiniCaptureSDK/Core/Screens/Multipage Review/MultipageReviewViewController.swift +++ b/Sources/GiniCaptureSDK/Core/Screens/Multipage Review/MultipageReviewViewController.swift @@ -188,7 +188,7 @@ public final class MultipageReviewViewController: UIViewController { action: #selector(rotateImageButtonAction)) button.accessibilityLabel = NSLocalizedString("ginicapture.review.rotateButton", - bundle: Bundle.module, + bundle: giniCaptureBundle(), comment: "Rotate button") return button }() diff --git a/Sources/GiniCaptureSDK/Core/Screens/Multipage Review/PageStateView.swift b/Sources/GiniCaptureSDK/Core/Screens/Multipage Review/PageStateView.swift index 3570fc8..4f01361 100644 --- a/Sources/GiniCaptureSDK/Core/Screens/Multipage Review/PageStateView.swift +++ b/Sources/GiniCaptureSDK/Core/Screens/Multipage Review/PageStateView.swift @@ -56,14 +56,14 @@ final class PageStateView: UIView { case .succeeded: backgroundColor = Colors.Gini.springGreen icon.image = UIImage.init(named: "successfullUploadIcon", - in: Bundle.module, + in: giniCaptureBundle(), compatibleWith: nil) loadingIndicator.stopAnimating() case .failed: backgroundColor = Colors.Gini.crimson icon.image = UIImage.init(named: "failureUploadIcon", - in: Bundle.module, + in: giniCaptureBundle(), compatibleWith: nil) loadingIndicator.stopAnimating() case .loading: diff --git a/Sources/GiniCaptureSDKVersion.swift b/Sources/GiniCaptureSDKVersion.swift index 55e543f..48594cd 100644 --- a/Sources/GiniCaptureSDKVersion.swift +++ b/Sources/GiniCaptureSDKVersion.swift @@ -5,4 +5,4 @@ // Created by Nadya Karaban on 29.10.21. // -public let GiniCaptureSDKVersion = "1.1.0" +public let GiniCaptureSDKVersion = "1.1.1" diff --git a/Tests/GiniCaptureSDKTests/GiniCaptureTestsHelper.swift b/Tests/GiniCaptureSDKTests/GiniCaptureTestsHelper.swift index 0c76643..2637d7c 100644 --- a/Tests/GiniCaptureSDKTests/GiniCaptureTestsHelper.swift +++ b/Tests/GiniCaptureSDKTests/GiniCaptureTestsHelper.swift @@ -11,6 +11,10 @@ import UIKit @testable import GiniCaptureSDK final class GiniCaptureTestsHelper { + class func giniTestBundle() -> Bundle { + return Bundle.module + } + class func fileData(named name: String, fileExtension: String) -> Data? { let fileURLPath: String? = Bundle.module .path(forResource: name, ofType: fileExtension) @@ -19,12 +23,12 @@ final class GiniCaptureTestsHelper { class func loadImage(named name: String, fileExtension: String = "jpg") -> UIImage { return UIImage(named: name, - in: Bundle.module, + in: giniTestBundle(), compatibleWith: nil) ?? loadImageFromResources(named: name, fileExtension: fileExtension)! } fileprivate class func loadImageFromResources(named name: String, fileExtension: String = "jpg") -> UIImage? { - guard let fileURLPath = Bundle.module + guard let fileURLPath = giniTestBundle() .path(forResource: name, ofType: fileExtension) else { return nil } return UIImage(contentsOfFile: fileURLPath) } @@ -58,7 +62,7 @@ final class GiniCaptureTestsHelper { } fileprivate class func urlFromFile(named name: String, fileExtension: String) -> URL? { - let fileURLPath: String? = Bundle.module + let fileURLPath: String? = giniTestBundle() .path(forResource: name, ofType: fileExtension) return URL(fileURLWithPath: fileURLPath!) } diff --git a/Tests/GiniCaptureSDKTests/HelpMenuViewControllerTests.swift b/Tests/GiniCaptureSDKTests/HelpMenuViewControllerTests.swift index 047677a..90b6d05 100644 --- a/Tests/GiniCaptureSDKTests/HelpMenuViewControllerTests.swift +++ b/Tests/GiniCaptureSDKTests/HelpMenuViewControllerTests.swift @@ -15,21 +15,21 @@ final class HelpMenuViewControllerTests: XCTestCase { var items: [(text: String, id: Int)] { var items = [ (NSLocalizedString("ginicapture.helpmenu.firstItem", - bundle: Bundle.module, + bundle: giniCaptureBundle(), comment: "help menu first item text"), 1) ] if GiniConfiguration.shared.shouldShowSupportedFormatsScreen { items.append((NSLocalizedString("ginicapture.helpmenu.thirdItem", - bundle: Bundle.module, + bundle: giniCaptureBundle(), comment: "help menu third item text"), 3)) } if GiniConfiguration.shared.openWithEnabled { items.append((NSLocalizedString("ginicapture.helpmenu.secondItem", - bundle: Bundle.module, + bundle: giniCaptureBundle(), comment: "help menu second item text"), 2)) } diff --git a/Tests/GiniCaptureSDKTests/OpenWithTutorialViewControllerTests.swift b/Tests/GiniCaptureSDKTests/OpenWithTutorialViewControllerTests.swift index 7517401..ce0208c 100644 --- a/Tests/GiniCaptureSDKTests/OpenWithTutorialViewControllerTests.swift +++ b/Tests/GiniCaptureSDKTests/OpenWithTutorialViewControllerTests.swift @@ -126,7 +126,7 @@ final class OpenWithTutorialViewControllerTests: XCTestCase { giniConfiguration.shouldShowDragAndDropTutorial = false let openWithTutorialViewController = OpenWithTutorialViewController(giniConfiguration: giniConfiguration) - let dragAndDropStepImage = UIImage(named: "openWithTutorialStep3", in: Bundle.module, compatibleWith: nil) + let dragAndDropStepImage = UIImage(named: "openWithTutorialStep3", in: giniCaptureBundle(), compatibleWith: nil) XCTAssertFalse(openWithTutorialViewController.items.map { $0.image }.contains(dragAndDropStepImage), "open with items should not contain drag and drop image")