Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
Addresses most Xcode warnings outside of signature configurations and…
Browse files Browse the repository at this point in the history
… localization exporting

Unit tests pass, integration tests fail
  • Loading branch information
BritneyS committed Apr 17, 2023
1 parent ad59ded commit 8044897
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 39 deletions.
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 3.1.4
1 change: 0 additions & 1 deletion Spreedly/Internal/JSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
//

import Foundation
import Spreedly

enum JSONError: Error, Equatable {
case keyNotFound(key: String)
Expand Down
2 changes: 1 addition & 1 deletion Spreedly/Internal/SpreedlyClientImpl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class SpreedlyClientImpl: NSObject, SpreedlyClient {
"platform": "apple",
"locale": Locale.current.languageCode ?? "unknown",
"os": [
"name": proc.operatingSystemName(),
"name": proc.operatingSystemVersion,
"arch": arch,
"version": proc.operatingSystemVersionString,
] as [String : Any],
Expand Down
2 changes: 1 addition & 1 deletion Spreedly/Models/BankAccountInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public class BankAccountInfo: PaymentMethodInfo {
"metadata": metadata ?? Metadata(),
"bank_account": try self.toJson(),
"retained": self.retained ?? false
]
] as [String : Any]
]
}
}
2 changes: 1 addition & 1 deletion Spreedly/Models/CreditCardInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class CreditCardInfo: PaymentMethodInfo {
"allow_blank_date": allowBlankDate,
"allow_expired_date": allowExpiredDate,
"retained": self.retained ?? false
]
] as [String : Any]
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions SpreedlyCocoa/Controls/CreditCardNumberTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Foundation
import UIKit
import Spreedly

public protocol CreditCardNumberTextFieldDelegate: class {
public protocol CreditCardNumberTextFieldDelegate: AnyObject {
/// Called whenever the card brand is determined based on the `CreditCardNumberTextField` content. May be
/// called many times.
func cardBrandDetermined(brand: CardBrand)
Expand Down Expand Up @@ -115,7 +115,7 @@ extension CreditCardNumberTextField {
}

/// Masks all digits except the last four with `maskCharacter`.
open func generateMasked(from string: String) -> String {
public func generateMasked(from string: String) -> String {
let cardNumber = string.onlyNumbers()
let maskCharacterCount = max(cardNumber.count - 4, 0)

Expand Down
10 changes: 7 additions & 3 deletions SpreedlyCocoa/Controls/SecureForm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Spreedly
/// A set of methods that you use to receive successfully created payment methods from Spreedly and provide
/// client configuration for that communication.
@objc(SPRSecureFormDelegate)
public protocol SecureFormDelegate: class {
public protocol SecureFormDelegate: AnyObject {
/// Tells the delegate that a payment methods was successfully created.
func spreedly(secureForm: SecureForm, success: Transaction)

Expand Down Expand Up @@ -213,7 +213,7 @@ public class SecureForm: UIView {
maybeSetShippingAddress(on: &info.shippingAddress, fallbackOn: info.address)

let client = getClientOrDieTrying()
_ = client.createPaymentMethodFrom(creditCard: info).subscribe(onSuccess: { transaction in
client.createPaymentMethodFrom(creditCard: info).subscribe(onSuccess: { transaction in
DispatchQueue.main.async {
self.delegate?.didCallSpreedly?(secureForm: self)
if let errors = transaction.errors, errors.count > 0 {
Expand Down Expand Up @@ -260,7 +260,7 @@ public class SecureForm: UIView {
maybeSetShippingAddress(on: &info.shippingAddress, fallbackOn: info.address)

let client = getClientOrDieTrying()
_ = client.createPaymentMethodFrom(bankAccount: info).subscribe(onSuccess: { transaction in
client.createPaymentMethodFrom(bankAccount: info).subscribe(onSuccess: { transaction in
DispatchQueue.main.async {
self.delegate?.didCallSpreedly?(secureForm: self)
if let errors = transaction.errors, errors.count > 0 {
Expand Down Expand Up @@ -291,6 +291,8 @@ public class SecureForm: UIView {
bankAccountHolderType?.selectedSegmentIndex = 0
case .business:
bankAccountHolderType?.selectedSegmentIndex = 1
@unknown default:
bankAccountHolderType?.selectedSegmentIndex = 0
}
}
}
Expand All @@ -314,6 +316,8 @@ public class SecureForm: UIView {
bankAccountType?.selectedSegmentIndex = 0
case .savings:
bankAccountType?.selectedSegmentIndex = 1
@unknown default:
bankAccountType?.selectedSegmentIndex = 0
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion SpreedlyCocoa/Express/ApplePay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ extension ApplePayHandler: PKPaymentAuthorizationControllerDelegate {

let info = ApplePayInfo(copyFrom: defaults, payment: payment)
if let client = client {
_ = client.createPaymentMethodFrom(applePay: info).subscribe(onSuccess: onSuccess, onError: onError)
client.createPaymentMethodFrom(applePay: info).subscribe(onSuccess: onSuccess, onError: onError)
} else if let objcClient = objcClient {
objcClient._objCCreatePaymentMethod(from: info).subscribe(onSuccess: onSuccess, onError: onError)
}
Expand Down
2 changes: 1 addition & 1 deletion SpreedlyCocoa/Express/ExpirationDateProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//

@objc(SPRExpirationDateProvider)
public protocol ExpirationDateProvider: class {
public protocol ExpirationDateProvider: AnyObject {
func expirationDate() -> ExpirationDate?
}

Expand Down
34 changes: 6 additions & 28 deletions SpreedlySdk.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
442A286A0A671222E369442C /* SpreedlyClientImpl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442A2FFB6CFF85B8207B2668 /* SpreedlyClientImpl.swift */; };
442A2975DBA6BA44D577E271 /* Spreedly-env.plist in Resources */ = {isa = PBXBuildFile; fileRef = 442A21723181F2D5F72F5B71 /* Spreedly-env.plist */; };
442A2C50F647133D4E48C7FF /* Secrets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442A21244C58460DB48ED6B3 /* Secrets.swift */; };
442A2D2E48133A09DBBD9299 /* Package.swift.template in Sources */ = {isa = PBXBuildFile; fileRef = 442A257AA5C4556A468C6045 /* Package.swift.template */; };
442A2D788057F47D67D550E6 /* RecacheTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442A2E6D7CB97F55DF7DE5F6 /* RecacheTests.swift */; };
442A2E09E5707DA5C0EC5A6D /* SecureForm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442A2BB20D7CBBCE9E4DD568 /* SecureForm.swift */; };
442A2E1EB4A7C7F18EBAB464 /* SecureStringTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442A218D2C643E6C4141E9D2 /* SecureStringTest.swift */; };
Expand Down Expand Up @@ -801,7 +800,6 @@
F076C6D90DB36BC555C246AC /* BankAccountInfo.swift in Sources */,
A60A0240278796000044BD69 /* SpreedlyVersion.swift in Sources */,
F076CD7FF9E8D8C63D808B1A /* CreditCardInfo.swift in Sources */,
442A2D2E48133A09DBBD9299 /* Package.swift.template in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1007,10 +1005,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Frameworks",
);
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand Down Expand Up @@ -1084,11 +1079,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Frameworks",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand Down Expand Up @@ -1165,10 +1156,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Frameworks",
);
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -1282,10 +1270,7 @@
DEVELOPMENT_TEAM = 6FBAK4HRQ7;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Frameworks",
);
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand Down Expand Up @@ -1356,11 +1341,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Frameworks",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -1438,10 +1419,7 @@
DEVELOPMENT_TEAM = 6FBAK4HRQ7;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Frameworks",
);
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

0 comments on commit 8044897

Please sign in to comment.