Skip to content

Commit

Permalink
Public release 1.16.4
Browse files Browse the repository at this point in the history
Public release 1.16.4
  • Loading branch information
dmytrokhl authored Jan 13, 2025
2 parents 45fab53 + 1d7ccb9 commit ce095f8
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 34 deletions.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ let package = Package(
.package(
name: "BlinkCard",
url: "https://github.com/blinkcard/blinkcard-swift-package",
.exact("2.9.1")
.exact("2.10.0")
)
],
targets: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,20 @@ import VGSCollectSDK
#endif

/// UIViewControllerRepresentable responsible for managing `BlinkCard` scanner.
@available(iOS 13.0, *)
public struct VGSBlinkCardControllerRepresentable: UIViewControllerRepresentable {

public typealias UIViewControllerType = UIViewController

internal lazy var cardRecognizer: MBCBlinkCardRecognizer = {
return MBCBlinkCardRecognizer()
}()

internal lazy var overlaySettings: MBCBlinkCardOverlaySettings = {
let settings: MBCBlinkCardOverlaySettings = MBCBlinkCardOverlaySettings()
settings.enableEditScreen = false
return settings
}()

// MARK: - Actions handlers
/// On Scaner finish card recognition.
Expand All @@ -42,6 +49,11 @@ public struct VGSBlinkCardControllerRepresentable: UIViewControllerRepresentable
public var extractIban: Bool = true
/// Whether invalid card number is accepted.
public var allowInvalidCardNumber: Bool = false
/// Defines whether button for presenting onboarding screens will be present on screen.
public var showOnboardingInfo: Bool = true
/// Defines whether tutorial alert will be presented on appear.
public var showIntroductionDialog: Bool = true


/// Card scan data coordinators dict connects scanned data with VGSTextFields.
private var dataCoordinators = [VGSBlinkCardDataType: VGSCardScanCoordinator]()
Expand All @@ -66,25 +78,22 @@ public struct VGSBlinkCardControllerRepresentable: UIViewControllerRepresentable
}

public func makeUIViewController(context: Context) -> UIViewController {
// Set card recognizer
context.coordinator.parent.cardRecognizer.extractOwner = extractOwner
context.coordinator.parent.cardRecognizer.extractCvv = extractCvv
context.coordinator.parent.cardRecognizer.extractExpiryDate = extractExpiryDate
context.coordinator.parent.cardRecognizer.extractIban = extractIban
context.coordinator.parent.cardRecognizer.allowInvalidCardNumber = allowInvalidCardNumber
context.coordinator.parent.overlaySettings.showOnboardingInfo = showOnboardingInfo
context.coordinator.parent.overlaySettings.showIntroductionDialog = showIntroductionDialog

// Create BlinkCard settings
let settings: MBCBlinkCardOverlaySettings = MBCBlinkCardOverlaySettings()
settings.enableEditScreen = false
// Set card recognizer
context.coordinator.parent.cardRecognizer.extractOwner = extractOwner
context.coordinator.parent.cardRecognizer.extractOwner = extractCvv
context.coordinator.parent.cardRecognizer.extractOwner = extractExpiryDate
context.coordinator.parent.cardRecognizer.extractOwner = extractIban
context.coordinator.parent.cardRecognizer.allowInvalidCardNumber = allowInvalidCardNumber
// Crate recognizer collection
let recognizerList = [context.coordinator.parent.cardRecognizer]
let recognizerCollection: MBCRecognizerCollection = MBCRecognizerCollection(recognizers: recognizerList)
// Create overlay view controller
let blinkCardOverlayViewController = MBCBlinkCardOverlayViewController(settings: settings, recognizerCollection: recognizerCollection, delegate: context.coordinator)
// Create recognizer view controller with wanted overlay view controller
let recognizerRunneViewController: UIViewController = MBCViewControllerFactory.recognizerRunnerViewController(withOverlayViewController: blinkCardOverlayViewController)!
// recognizerRunneViewController.modalPresentationStyle = modalPresentationStyle

// Crate recognizer collection
let recognizerList = [context.coordinator.parent.cardRecognizer]
let recognizerCollection: MBCRecognizerCollection = MBCRecognizerCollection(recognizers: recognizerList)
// Create overlay view controller
let blinkCardOverlayViewController = MBCBlinkCardOverlayViewController(settings: context.coordinator.parent.overlaySettings, recognizerCollection: recognizerCollection, delegate: context.coordinator)
// Create recognizer view controller with wanted overlay view controller
let recognizerRunneViewController: UIViewController = MBCViewControllerFactory.recognizerRunnerViewController(withOverlayViewController: blinkCardOverlayViewController)!
return recognizerRunneViewController
}

Expand Down Expand Up @@ -137,6 +146,21 @@ public struct VGSBlinkCardControllerRepresentable: UIViewControllerRepresentable
return newRepresentable
}

/// Set if should `showIntroductionDialog`.
public func showIntroductionDialog(_ show: Bool) -> VGSBlinkCardControllerRepresentable {
var newRepresentable = self
newRepresentable.showIntroductionDialog = show
return newRepresentable
}

/// Set if should `showOnboardingInfo`.
public func showOnboardingInfo(_ show: Bool) -> VGSBlinkCardControllerRepresentable {
var newRepresentable = self
newRepresentable.showOnboardingInfo = show
return newRepresentable
}


// MARK: - Coordinator
public class Coordinator: NSObject, MBCBlinkCardOverlayViewControllerDelegate {
var parent: VGSBlinkCardControllerRepresentable
Expand Down
12 changes: 11 additions & 1 deletion Sources/VGSBlinkCardCollector/VGSBlinkCardController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,17 @@ public class VGSBlinkCardController {
public var allowInvalidCardNumber: Bool = false {
didSet {scanHandler?.cardRecognizer.allowInvalidCardNumber = allowInvalidCardNumber }
}


// MARK: - Overlay settings
/// Defines whether button for presenting onboarding screens will be present on screen. Default: true.
public var showOnboardingInfo: Bool = true {
didSet {scanHandler?.overlaySettings.showOnboardingInfo = showOnboardingInfo }
}
/// Defines whether tutorial alert will be presented on appear. Default: true.
public var showIntroductionDialog: Bool = true {
didSet {scanHandler?.overlaySettings.showIntroductionDialog = showIntroductionDialog }
}

// MARK: - Initialization

/// Initialization
Expand Down
11 changes: 7 additions & 4 deletions Sources/VGSBlinkCardCollector/VGSBlinkCardHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ internal class VGSBlinkCardHandler: NSObject, VGSScanHandlerProtocol {
lazy var cardRecognizer: MBCBlinkCardRecognizer = {
return MBCBlinkCardRecognizer()
}()
/// MBCBlinkCardOverlaySettings.
lazy var overlaySettings : MBCBlinkCardOverlaySettings = {
let settings: MBCBlinkCardOverlaySettings = MBCBlinkCardOverlaySettings()
settings.enableEditScreen = false
return settings
}()

/// Initialization
/// - Parameters:
Expand All @@ -40,14 +46,11 @@ internal class VGSBlinkCardHandler: NSObject, VGSScanHandlerProtocol {

/// Setup BlinlCard params and present scanner.
func presentScanVC(on viewController: UIViewController, animated: Bool, modalPresentationStyle: UIModalPresentationStyle, completion: (() -> Void)?) {
// Create BlinkCard settings
let settings: MBCBlinkCardOverlaySettings = MBCBlinkCardOverlaySettings()
settings.enableEditScreen = false
// Crate recognizer collection
let recognizerList = [cardRecognizer]
let recognizerCollection: MBCRecognizerCollection = MBCRecognizerCollection(recognizers: recognizerList)
// Create overlay view controller
let blinkCardOverlayViewController = MBCBlinkCardOverlayViewController(settings: settings, recognizerCollection: recognizerCollection, delegate: self)
let blinkCardOverlayViewController = MBCBlinkCardOverlayViewController(settings: overlaySettings, recognizerCollection: recognizerCollection, delegate: self)
// Create recognizer view controller with wanted overlay view controller
let recognizerRunneViewController: UIViewController = MBCViewControllerFactory.recognizerRunnerViewController(withOverlayViewController: blinkCardOverlayViewController)!
recognizerRunneViewController.modalPresentationStyle = modalPresentationStyle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Foundation
import SwiftUI

@available(iOS 13.0, *)
/// :nodoc:
public class VGSCardScanCoordinator: ObservableObject {
private weak var textField: VGSTextField?

Expand All @@ -17,13 +18,13 @@ public class VGSCardScanCoordinator: ObservableObject {
self.textField = textField
}

// Set text for the text field
internal func setText(_ text: String) {
public func setText(_ text: String) {
textField?.setText(text)
}
}
@available(iOS 13.0, *)
internal extension VGSCardScanCoordinator {
/// :nodoc:
public extension VGSCardScanCoordinator {
func trackAnalyticsEvent(scannerType: String) {
if let form = textField?.configuration?.vgsCollector {
VGSAnalyticsClient.shared.trackFormEvent(form.formAnalyticsDetails, type: .scan, status: .success, extraData: [ "scannerType": scannerType])
Expand Down
2 changes: 1 addition & 1 deletion Sources/VGSCollectSDK/Utils/Extensions/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal class Utils {

/// VGS Collect SDK Version.
/// Necessary since SPM doesn't track info plist correctly: https://forums.swift.org/t/add-info-plist-on-spm-bundle/40274/5
static let vgsCollectVersion: String = "1.16.3"
static let vgsCollectVersion: String = "1.16.4"
}

extension Dictionary {
Expand Down
4 changes: 2 additions & 2 deletions VGSCollectSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'VGSCollectSDK'
spec.version = '1.16.3'
spec.version = '1.16.4'
spec.summary = 'VGS Collect - is a product suite that allows customers to collect information securely without possession of it.'
spec.swift_version = '5.0'
spec.description = <<-DESC
Expand Down Expand Up @@ -32,7 +32,7 @@ Pod::Spec.new do |spec|
spec.subspec 'BlinkCard' do |blinkcard|
blinkcard.source_files = "Sources/VGSBlinkCardCollector", "Sources/VGSBlinkCardCollector/**/*.{swift}"
blinkcard.dependency "VGSCollectSDK/Core"
blinkcard.dependency "MBBlinkCard", "2.9.1"
blinkcard.dependency "MBBlinkCard", "2.10.0"
blinkcard.ios.deployment_target = "13.0"
end

Expand Down
4 changes: 2 additions & 2 deletions VGSCollectSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2004,7 +2004,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.16.3;
MARKETING_VERSION = 1.16.4;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -2066,7 +2066,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.16.3;
MARKETING_VERSION = 1.16.4;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
Expand Down
4 changes: 2 additions & 2 deletions demoapp/demoapp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@
FD12B9702304616C00B670DD /* Sources */,
FD12B9712304616C00B670DD /* Frameworks */,
FD12B9722304616C00B670DD /* Resources */,
8F65BB67127DA1F8E7161A68 /* [CP] Embed Pods Frameworks */,
7D7FEC246F8CCFF2D5841F50 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -573,7 +573,7 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
8F65BB67127DA1F8E7161A68 /* [CP] Embed Pods Frameworks */ = {
7D7FEC246F8CCFF2D5841F50 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class CardsDataCollectingViewController: UIViewController {
print("⚠️ VGSBlinkCardController not initialized. Check license key!")
}
scanController?.allowInvalidCardNumber = false
// scanController?.showOnboardingInfo = false
// scanController?.showIntroductionDialog = false
// // If you need to set your own card brand icons
//
// VGSPaymentCards.visa.brandIcon = UIImage(named: "my visa icon")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ struct CardDataCollectionSwiftUI: View {
VGSBlinkCardControllerRepresentable(licenseKey: AppCollectorConfiguration.shared.blinkCardLicenseKey!, dataCoordinators: scanedDataCoordinators) { (errorCode) in
print(errorCode)
}.allowInvalidCardNumber(true)
.showOnboardingInfo(false)
.showIntroductionDialog(false)
.onCardScanned({
showingBlinkCardScanner = false
})
Expand Down

0 comments on commit ce095f8

Please sign in to comment.