Skip to content

Commit

Permalink
Bump to v4.4.8 (#179)
Browse files Browse the repository at this point in the history
Format + apply linter
  • Loading branch information
djoksimo authored Jul 19, 2024
1 parent e145a19 commit fa85d10
Show file tree
Hide file tree
Showing 11 changed files with 120 additions and 123 deletions.
4 changes: 2 additions & 2 deletions ForageSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Pod::Spec.new do |spec|

spec.name = "ForageSDK"
spec.version = "4.4.7"
spec.version = "4.4.8"
spec.summary = "ForageSDK"
spec.description = "The ForageSDK process Electronic Benefit Transfer (EBT) payments in your e-commerce application."
spec.homepage = "https://github.com/teamforage/forage-ios-sdk"
spec.license = { :type => "MIT", :file => "LICENSE" }
spec.author = { "Rob Gormisky" => "[email protected]" }
spec.platform = :ios, "13.0"
spec.readme = "https://raw.githubusercontent.com/teamforage/forage-ios-sdk/main/README.md"
spec.source = { :git => "https://github.com/teamforage/forage-ios-sdk.git", :tag => "4.4.7" }
spec.source = { :git => "https://github.com/teamforage/forage-ios-sdk.git", :tag => "4.4.8" }
spec.source_files = ["Sources/ForageSDK/**/*.swift", "DatadogPrivate-Objc/**/*.{h,m}"]
spec.dependency 'VGSCollectSDK', '1.15.3'
spec.dependency 'LaunchDarkly', '9.6.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class RosettaPINTextField: UIView, VaultWrapper, UITextFieldDelegate {
let currentValue = textField.text ?? ""
guard let valueRange = Range(range, in: currentValue) else { return false }
let newValue = currentValue.replacingCharacters(in: valueRange, with: string)
let isOnlyNumeric = newValue.allSatisfy { $0.isNumber }
let isOnlyNumeric = newValue.allSatisfy(\.isNumber)
let isFourOrFewer = newValue.count <= 4
return isOnlyNumeric && isFourOrFewer
}
Expand Down Expand Up @@ -101,18 +101,18 @@ class RosettaPINTextField: UIView, VaultWrapper, UITextFieldDelegate {
}

@objc func textFieldDidChange(_ textField: UITextField) {
self._isEmpty = !textField.hasText
self._isValid = textField.text?.count == 4 && (textField.text?.allSatisfy { $0.isNumber } ?? false)
self._isComplete = self._isValid
self.delegate?.textFieldDidChange(self)
_isEmpty = !textField.hasText
_isValid = textField.text?.count == 4 && (textField.text?.allSatisfy(\.isNumber) ?? false)
_isComplete = _isValid
delegate?.textFieldDidChange(self)
}

@objc func editingBegan(_ textField: UITextField) {
self.delegate?.firstResponderDidChange(self)
delegate?.firstResponderDidChange(self)
}

@objc func editingEnded(_ textField: UITextField) {
self.delegate?.firstResponderDidChange(self)
delegate?.firstResponderDidChange(self)
}

func clearText() {
Expand Down
4 changes: 2 additions & 2 deletions Sources/ForageSDK/ForageSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class ForageSDK {

public var environment: Environment = .sandbox
// Don't update! Only updated when releasing.
public static let version = "4.4.7"
public static let version = "4.4.8"
public static let shared = ForageSDK()

// MARK: Init
Expand Down Expand Up @@ -69,7 +69,7 @@ public class ForageSDK {
public class func setup(_ config: Config) {
ForageSDK.config = config
let environment = Environment(sessionToken: config.sessionToken)

updateMerchantID(config.merchantID)
updateSessionToken(config.sessionToken)

Expand Down
6 changes: 3 additions & 3 deletions Sources/ForageSDK/Foundation/ForageSDK+ForageServices.swift
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ extension ForageSDK: ForageSDKService {
)
return false
}

/// Determine if we should log an error or a warning
internal func logErrorResponse(_ message: String, error: Error, attributes: [String: Encodable]?, responseMonitor: ResponseMonitor?) {
func logErrorResponse(_ message: String, error: Error, attributes: [String: Encodable]?, responseMonitor: ResponseMonitor?) {
responseMonitor?.setForageErrorCode(error)
if let statusCode = (error as? ForageError)?.httpStatusCode, let forageLogger = ForageSDK.logger {
responseMonitor?.setHttpStatusCode(statusCode)
Expand All @@ -282,7 +282,7 @@ extension ForageSDK: ForageSDKService {
} else {
ForageSDK.logger?.error(message, error: error, attributes: nil)
}

responseMonitor?.end()
responseMonitor?.logResult()
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/ForageSDK/Foundation/Network/Collector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ class RosettaPINSubmitter: VaultCollector {
session: URLSessionProtocol = URLSession.shared
) {
self.textElement = textElement
self.customHeaders = [:]
customHeaders = [:]
self.forageVaultConfig = forageVaultConfig
self.logger = logger
self.session = session
Expand Down Expand Up @@ -489,7 +489,7 @@ class RosettaPINSubmitter: VaultCollector {
}

let isFourCharacters = pin.count == 4
let isOnlyNumeric = pin.allSatisfy { $0.isNumber }
let isOnlyNumeric = pin.allSatisfy(\.isNumber)
let isValidPIN = isFourCharacters && isOnlyNumeric

if isValidPIN {
Expand Down
9 changes: 4 additions & 5 deletions Sources/ForageSDK/Foundation/Telemetry/ForageLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ protocol ForageLogger {
class DatadogLogger: ForageLogger {
private static let DD_CLIENT_TOKEN: String = "pub1e4572ba0f5e53df108c333d5ec66c02"
private static let DD_SERVICE_NAME: String = "ios-sdk"

// DO NOT UPDATE! Generate 1 TraceID per living session of the app
static let traceId: String = generateTraceID()

private var logger: LoggerProtocol?
private var config: ForageLoggerConfig?

Expand Down Expand Up @@ -208,13 +208,12 @@ class DatadogLogger: ForageLogger {
Logs.enable(in: datadogInstance)
return datadogInstance
}

// ensure logger is re-initialized if the environment changes!
private func buildInstanceName(environment: Environment) -> String {
return "forage-\(environment.rawValue)"
"forage-\(environment.rawValue)"
}


private func getMessageWithPrefix(_ message: String) -> String {
if let prefix = config?.prefix {
return prefix.isEmpty ? message : "[\(prefix)] \(message)"
Expand Down
Loading

0 comments on commit fa85d10

Please sign in to comment.