Skip to content

Commit

Permalink
Public release 1.15.1.
Browse files Browse the repository at this point in the history
Public release 1.15.1.
  • Loading branch information
dmytrokhl committed Sep 7, 2023
2 parents 078b113 + d8e8e6a commit 926bb7b
Show file tree
Hide file tree
Showing 186 changed files with 517 additions and 280 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ internal class MaskedTextField: UITextField {
internal var getSecureTextWithDivider: String? {
return getRawTextWithDivider()
}


/// The natural size for the Textfield, considering only properties of the view itself.
override var intrinsicContentSize: CGSize {
return getIntrinsicContentSize()
}

// MARK: - Text Padding
var padding: UIEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)

Expand Down Expand Up @@ -272,6 +277,17 @@ internal class MaskedTextField: UITextField {
}
}
}

// Calculate IntrinsicContentSize
fileprivate func getIntrinsicContentSize() -> CGSize {
if secureText.isNilOrEmpty && placeholder.isNilOrEmpty {
return super.intrinsicContentSize
}
/// If there is placeholder in field, intrinsicContentSize should return max width between placeholder and input text
let placeholderSize = placeholder?.size() ?? .zero
let secureTextSize = secureText?.size() ?? .zero
return secureTextSize.width >= placeholderSize.width ? secureTextSize : placeholderSize
}
}

// MARK: - UITextFieldDelegate
Expand Down
15 changes: 15 additions & 0 deletions Sources/VGSCollectSDK/UIElements/Text Field/VGSCVCTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public final class VGSCVCTextField: VGSTextField {
updatecvcIconViewSize()
}
}

/// The natural size for the Textfield, considering only properties of the view itself.
public override var intrinsicContentSize: CGSize {
return getIntrinsicContentSize()
}

// MARK: Custom CVC images for specific card brands
/// Asks custom image for specific `VGSPaymentCards.CardBrand`
Expand Down Expand Up @@ -167,4 +172,14 @@ internal extension VGSCVCTextField {
heightConstraint.identifier = "heightConstraint"
cvcIconImageView.addConstraints([widthConstraint, heightConstraint])
}

/// Calculate IntrinsicContentSize
private func getIntrinsicContentSize() -> CGSize {
/// Text size with paddings
let size = super.intrinsicContentSize
/// Add icon size
let height = size.height + cvcIconSize.height
let width = size.width + cvcIconSize.width + stackSpacing
return CGSize(width: width, height: height)
}
}
87 changes: 51 additions & 36 deletions Sources/VGSCollectSDK/UIElements/Text Field/VGSCardTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,47 +13,52 @@ import UIKit
/// An object that displays an editable text area. Can be use instead of a `VGSTextField` when need to detect and show credit card brand images.
public final class VGSCardTextField: VGSTextField {

internal let cardIconView = UIImageView()
internal lazy var stackView = self.makeStackView()
internal let stackSpacing: CGFloat = 8.0
internal lazy var defaultUnknowBrandImage: UIImage? = {
return VGSPaymentCards.CardBrand.unknown.brandIcon
}()
internal let cardIconView = UIImageView()
internal lazy var stackView = self.makeStackView()
internal let stackSpacing: CGFloat = 8.0
internal lazy var defaultUnknowBrandImage: UIImage? = {
return VGSPaymentCards.CardBrand.unknown.brandIcon
}()

// MARK: - Enum cases
/// Available Card brand icon positions enum.
public enum CardIconLocation {
/// Card brand icon at left side of `VGSCardTextField`.
case left

/// Card brand icon at right side of `VGSCardTextField`.
case right
}
// MARK: - Enum cases
/// Available Card brand icon positions enum.
public enum CardIconLocation {
/// Card brand icon at left side of `VGSCardTextField`.
case left

// MARK: Attributes
/// Card brand icon position inside `VGSCardTextField`.
public var cardIconLocation = CardIconLocation.right {
didSet {
setCardIconAtLocation(cardIconLocation)
}
}
/// Card brand icon at right side of `VGSCardTextField`.
case right
}

/// Card brand icon size.
public var cardIconSize: CGSize = CGSize(width: 45, height: 45) {
didSet {
updateCardIconViewSize()
}
// MARK: Attributes
/// Card brand icon position inside `VGSCardTextField`.
public var cardIconLocation = CardIconLocation.right {
didSet {
setCardIconAtLocation(cardIconLocation)
}

// MARK: Custom card brand images
/// Asks custom image for specific `VGSPaymentCards.CardBrand`
public var cardsIconSource: ((VGSPaymentCards.CardBrand) -> UIImage?)?

/// :nodoc:
public override func didMoveToSuperview() {
super.didMoveToSuperview()
updateCardImage()
}

/// Card brand icon size.
public var cardIconSize: CGSize = CGSize(width: 45, height: 45) {
didSet {
updateCardIconViewSize()
}
}

// MARK: Custom card brand images
/// Asks custom image for specific `VGSPaymentCards.CardBrand`
public var cardsIconSource: ((VGSPaymentCards.CardBrand) -> UIImage?)?

/// :nodoc:
public override func didMoveToSuperview() {
super.didMoveToSuperview()
updateCardImage()
}

/// The natural size for the Textfield, considering only properties of the view itself.
public override var intrinsicContentSize: CGSize {
return getIntrinsicContentSize()
}
}

internal extension VGSCardTextField {
Expand Down Expand Up @@ -94,6 +99,16 @@ internal extension VGSCardTextField {
self.layoutIfNeeded()
}

/// Calculate IntrinsicContentSize
private func getIntrinsicContentSize() -> CGSize {
// Text size with paddings
let size = super.intrinsicContentSize
// Add icon size
let height = size.height + cardIconSize.height
let width = size.width + cardIconSize.width + stackSpacing
return CGSize(width: width, height: height)
}

private func makeStackView() -> UIStackView {
let stack = UIStackView()
stack.alignment = .fill
Expand Down
13 changes: 13 additions & 0 deletions Sources/VGSCollectSDK/UIElements/Text Field/VGSTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public class VGSTextField: UIView {
textField.attributedPlaceholder = attributedPlaceholder
}
}

/// The natural size for the Textfield, considering only properties of the view itself.
public override var intrinsicContentSize: CGSize {
return getIntrinsicContentSize()
}

/// `UIEdgeInsets` for text and placeholder inside `VGSTextField`.
public var padding = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) {
Expand Down Expand Up @@ -339,6 +344,14 @@ internal extension VGSTextField {
NSLayoutConstraint.activate(verticalConstraint)
self.layoutIfNeeded()
}

/// Calculate IntrinsicContentSize
private func getIntrinsicContentSize() -> CGSize {
/// Add paddings
let width = textField.intrinsicContentSize.width + padding.left + padding.right
let height = textField.intrinsicContentSize.height + padding.bottom + padding.top
return CGSize(width: width, height: height)
}

@objc
func textFieldValueChanged() {
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.15.0"
static let vgsCollectVersion: String = "1.15.1"
}

extension Dictionary {
Expand Down
2 changes: 1 addition & 1 deletion 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.15.0'
spec.version = '1.15.1'
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
6 changes: 2 additions & 4 deletions VGSCollectSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@
FD3C01C223AFC0980096B4A4 /* VGSTextField+CVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "VGSTextField+CVC.swift"; sourceTree = "<group>"; };
FD4ED0E22373662500AEAD24 /* MaskedTextField+security.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "MaskedTextField+security.swift"; sourceTree = "<group>"; };
FD4ED0E42373666500AEAD24 /* TextFieldSecurity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldSecurity.swift; sourceTree = "<group>"; };
FD6F5656238E7FBB00C24123 /* CardType+icon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CardType+icon.swift"; sourceTree = "<group>"; };
FD790B96243BB403006A30CB /* CardBrandTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CardBrandTest.swift; sourceTree = "<group>"; };
FD790B98243BB42B006A30CB /* _CardBrandDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = _CardBrandDataSource.swift; sourceTree = "<group>"; };
FD8B62462497CD580097C9AB /* VGSExpDateTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VGSExpDateTextField.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1121,7 +1120,6 @@
FD2495632330E313009024E6 /* Card */ = {
isa = PBXGroup;
children = (
FD6F5656238E7FBB00C24123 /* CardType+icon.swift */,
324B5E7224A23F6B0036867E /* VGSValidationRuleLuhnCheck.swift */,
324B5E9C24A64A600036867E /* VGSValidationRulePaymentCard.swift */,
);
Expand Down Expand Up @@ -2045,7 +2043,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.15.0;
MARKETING_VERSION = 1.15.1;
PRODUCT_BUNDLE_IDENTIFIER = com.vgs.framework;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -2077,7 +2075,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.15.0;
MARKETING_VERSION = 1.15.1;
PRODUCT_BUNDLE_IDENTIFIER = com.vgs.framework;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
2 changes: 1 addition & 1 deletion docs/Classes/CardState.html
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-07-19)</p>
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-09-07)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/Classes/SSNState.html
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-07-19)</p>
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-09-07)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/Classes/State.html
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-07-19)</p>
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-09-07)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</body>
Expand Down
36 changes: 33 additions & 3 deletions docs/Classes/VGSCVCTextField.html
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ <h1>VGSCVCTextField</h1>
<p>An object that displays an editable text area. Can be use instead of a <code><a href="../Classes/VGSTextField.html">VGSTextField</a></code> when need to show CVC/CVV images for credit card brands.</p>

<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-collect-ios/tree/master/Sources/VGSCollectSDK/UIElements/Text Field/VGSCVCTextField.swift#L14-L73">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-collect-ios/tree/master/Sources/VGSCollectSDK/UIElements/Text Field/VGSCVCTextField.swift#L14-L78">Show on GitHub</a>
</div>
</div>
</section>
Expand Down Expand Up @@ -508,6 +508,36 @@ <h4>Declaration</h4>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/c:@M@VGSCollectSDK@objc(cs)VGSCVCTextField(py)intrinsicContentSize"></a>
<a name="//apple_ref/swift/Property/intrinsicContentSize" class="dashAnchor"></a>
<a class="token" href="#/c:@M@VGSCollectSDK@objc(cs)VGSCVCTextField(py)intrinsicContentSize">intrinsicContentSize</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>The natural size for the Textfield, considering only properties of the view itself.</p>

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="k">override</span> <span class="k">var</span> <span class="nv">intrinsicContentSize</span><span class="p">:</span> <span class="kt">CGSize</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>

</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-collect-ios/tree/master/Sources/VGSCollectSDK/UIElements/Text Field/VGSCVCTextField.swift#L65-L67">Show on GitHub</a>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
Expand Down Expand Up @@ -546,7 +576,7 @@ <h4>Declaration</h4>
</div>
</div>
<div class="slightly-smaller">
<a href="https://github.com/verygoodsecurity/vgs-collect-ios/tree/master/Sources/VGSCollectSDK/UIElements/Text Field/VGSCVCTextField.swift#L66">Show on GitHub</a>
<a href="https://github.com/verygoodsecurity/vgs-collect-ios/tree/master/Sources/VGSCollectSDK/UIElements/Text Field/VGSCVCTextField.swift#L71">Show on GitHub</a>
</div>
</section>
</div>
Expand All @@ -559,7 +589,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-07-19)</p>
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-09-07)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/Classes/VGSCVCTextField/CVCIconLocation.html
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-07-19)</p>
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-09-07)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/Classes/VGSCVCTokenizationConfiguration.html
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-07-19)</p>
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-09-07)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-07-19)</p>
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-09-07)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</body>
Expand Down
2 changes: 1 addition & 1 deletion docs/Classes/VGSCardNumberTokenizationConfiguration.html
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-07-19)</p>
<p>&copy; 2023 <a class="link" href="https://verygoodsecurity.com" target="_blank" rel="external noopener">Very Good Security</a>. All rights reserved. (Last updated: 2023-09-07)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external noopener">jazzy ♪♫ v0.14.3</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external noopener">Realm</a> project.</p>
</section>
</body>
Expand Down
Loading

0 comments on commit 926bb7b

Please sign in to comment.