Skip to content

Commit

Permalink
Hidden card data on screenshot (#13)
Browse files Browse the repository at this point in the history
* Hidden card data on screenshot

* Bump Requirements
  • Loading branch information
regdos authored Oct 2, 2024
1 parent 3b2e559 commit e110723
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/onevcat/Kingfisher.git",
"state" : {
"revision" : "5b92f029fab2cce44386d28588098b5be0824ef5",
"version" : "7.11.0"
"revision" : "2ef543ee21d63734e1c004ad6c870255e8716c50",
"version" : "7.12.0"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,15 @@ private extension PaymentCardWidget {
stackView.spacing = 16.0
stackView.distribution = .fill
stackView.alignment = .fill
addSubview(stackView)

if let secureView = SecureField().secureContainer {
secureView.addSubview(stackView)
stackView.pinEdges()
addSubview(secureView)
secureView.pinEdges()
} else {
addSubview(stackView)
}

stackView.translatesAutoresizingMaskIntoConstraints = false
stackView.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true
Expand All @@ -343,3 +351,23 @@ private extension PaymentCardWidget {
if configuration.shouldDisplayTermsAndConditions { stackView.addArrangedSubview(makeTermsAndConditionsView()) }
}
}

extension UIView {
func pin(_ type: NSLayoutConstraint.Attribute) {
translatesAutoresizingMaskIntoConstraints = false
let constraint = NSLayoutConstraint(item: self, attribute: type,
relatedBy: .equal,
toItem: superview, attribute: type,
multiplier: 1, constant: 0)

constraint.priority = UILayoutPriority.init(999)
constraint.isActive = true
}

func pinEdges() {
pin(.top)
pin(.bottom)
pin(.leading)
pin(.trailing)
}
}
30 changes: 30 additions & 0 deletions PUPaymentCard/Sources/PUPaymentCard/Widget/SecureField.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import UIKit

class SecureField: UITextField {

// MARK: - Initialization
override init(frame: CGRect) {
super.init(frame: .zero)
self.isSecureTextEntry = true
self.translatesAutoresizingMaskIntoConstraints = false
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

// MARK: - Public Properties
weak var secureContainer: UIView? {
let secureView = self.subviews.filter({ subview in
type(of: subview).description().contains("CanvasView")
}).first
secureView?.translatesAutoresizingMaskIntoConstraints = false
secureView?.isUserInteractionEnabled = true

return secureView
}

// MARK: - Overrides
override var canBecomeFirstResponder: Bool {false}
override func becomeFirstResponder() -> Bool {false}
}
4 changes: 2 additions & 2 deletions PUSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Pod::Spec.new do |s|
s.source = { :git => 'https://github.com/PayU-EMEA/PayU-iOS-Swift.git', :tag => s.version }

s.platform = :ios
s.swift_version = '5.3'
s.ios.deployment_target = '11.0'
s.swift_version = '5.10'
s.ios.deployment_target = '12.0'

s.subspec 'PUAPI' do |ss|
ss.source_files = 'PUAPI/Sources/PUAPI/**/*'
Expand Down
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/onevcat/Kingfisher.git",
"state" : {
"revision" : "5b92f029fab2cce44386d28588098b5be0824ef5",
"version" : "7.11.0"
"revision" : "2ef543ee21d63734e1c004ad6c870255e8716c50",
"version" : "7.12.0"
}
},
{
Expand Down
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.7
// swift-tools-version: 5.10
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand All @@ -7,7 +7,7 @@ let package = Package(
name: "PUSDK",
defaultLocalization: "pl",
platforms: [
.iOS(.v11)
.iOS(.v12)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
Expand Down Expand Up @@ -89,7 +89,7 @@ let package = Package(
// .package(url: /* package url */, from: "1.0.0"),
.package(
url: "https://github.com/onevcat/Kingfisher.git",
.upToNextMinor(from: .init(7, 11, 0))
.upToNextMinor(from: .init(7, 12, 0))
),
.package(
url: "https://github.com/birdrides/mockingbird",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Allows to make payments in PayU ecosystem.

## Requirements

* iOS 11.0 or higher
* iOS 12.0 or higher

## Getting Started

Expand Down

0 comments on commit e110723

Please sign in to comment.