Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
602 changes: 0 additions & 602 deletions Hardware/Hardware.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1640"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:HardwareTests/HardwareTests.xctestplan"
default = "YES">
</TestPlanReference>
</TestPlans>
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D88FDB0725DD216B00CB0DBD"
BuildableName = "HardwareTests.xctest"
BlueprintName = "HardwareTests"
ReferencedContainer = "container:Hardware.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This scheme is just a temporary clutch to run the tests in isolation. Once the tests become part of the package, it'll all be done via the package's scheme.

11 changes: 0 additions & 11 deletions Hardware/Hardware/Hardware.h

This file was deleted.

1 change: 0 additions & 1 deletion Hardware/Hardware/Hardware.xcconfig

This file was deleted.

22 changes: 0 additions & 22 deletions Hardware/Hardware/Info.plist

This file was deleted.

24 changes: 24 additions & 0 deletions Hardware/HardwareTests/HardwareTests.xctestplan
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"configurations" : [
{
"id" : "395D5794-483E-4BA1-9702-5094F9A31112",
"name" : "Test Scheme Action",
"options" : {

}
}
],
"defaultOptions" : {

},
"testTargets" : [
{
"target" : {
"containerPath" : "container:Hardware.xcodeproj",
"identifier" : "D88FDB0725DD216B00CB0DBD",
"name" : "HardwareTests"
}
}
],
"version" : 1
}
67 changes: 67 additions & 0 deletions Modules/.swiftpm/xcode/xcshareddata/xcschemes/Hardware.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1640"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Hardware"
BuildableName = "Hardware"
BlueprintName = "Hardware"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "Hardware"
BuildableName = "Hardware"
BlueprintName = "Hardware"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
28 changes: 18 additions & 10 deletions Modules/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ let package = Package(
name: "Experiments",
targets: ["Experiments"]
),
.library(
name: "Hardware",
targets: ["Hardware"]
),
.library(
name: "NetworkingCore",
targets: ["NetworkingCore"]
Expand Down Expand Up @@ -99,6 +103,15 @@ let package = Package(
.product(name: "AutomatticTracks", package: "Automattic-Tracks-iOS"),
]
),
.target(
name: "Hardware",
dependencies: [
"Codegen",
.product(name: "CocoaLumberjackSwift", package: "CocoaLumberjack"),
.product(name: "StripeTerminal", package: "stripe-terminal-ios")
],
resources: [.process("Resources")]
),
.target(
name: "Networking",
dependencies: [
Expand Down Expand Up @@ -213,7 +226,6 @@ let package = Package(

enum XcodeTargetNames {
static let fakes = "Fakes"
static let hardware = "Hardware"
static let hardwareTests = "HardwareTests"
static let networkingTests = "NetworkingTests"
static let notificationExtension = "NotificationExtension"
Expand All @@ -235,7 +247,6 @@ enum XcodeSupport {
static var products: [Product] {
[
XcodeTargetNames.fakes,
XcodeTargetNames.hardware,
XcodeTargetNames.hardwareTests,
XcodeTargetNames.networkingTests,
XcodeTargetNames.notificationExtension,
Expand All @@ -260,21 +271,16 @@ enum XcodeSupport {
XcodeTargetNames.fakes,
dependencies: [
"Codegen",
"Hardware",
"Networking",
]
),
.xcodeTarget(
XcodeTargetNames.hardware,
XcodeTargetNames.hardwareTests,
dependencies: [
"Codegen",
.product(name: "CocoaLumberjackSwift", package: "CocoaLumberjack"),
.product(name: "StripeTerminal", package: "stripe-terminal-ios")
"Hardware"
]
),
.xcodeTarget(
XcodeTargetNames.hardwareTests,
dependencies: [XcodeTargetNames.hardware.asDependency]
),
.xcodeTarget(
XcodeTargetNames.networkingTests,
dependencies: [
Expand Down Expand Up @@ -322,6 +328,7 @@ enum XcodeSupport {
dependencies: [
"Codegen",
"Experiments",
"Hardware",
"Networking",
"Storage",
"WooFoundation",
Expand Down Expand Up @@ -413,6 +420,7 @@ enum XcodeSupport {
XcodeTargetNames.yosemite,
dependencies: [
"Codegen",
"Hardware",
"Networking",
"Storage",
"WooFoundation",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
project:
file: ../../../../../Hardware/Hardware.xcodeproj
target:
name: Hardware
sources:
include:
- ../../../../../Modules/Sources/Hardware/
templates:
- Models+Copiable.swifttemplate
output: ../../../../../Hardware/Hardware/Model/Copiable/
output: ../../../../../Modules/Sources/Hardware/Model/Copiable/
args:
moduleName: Hardware
9 changes: 5 additions & 4 deletions Modules/Sources/Codegen/Sourcery/Fakes/Hardware-Fakes.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
project:
file: ../../../../../Hardware/Hardware.xcodeproj
target:
name: Hardware
sources:
include:
- ../../../../../Modules/Sources/Hardware/
templates:
- Fakes.swifttemplate
output: ../../../../../Fakes/Fakes/Hardware.generated.swift
args:
moduleName: Hardware
15 changes: 15 additions & 0 deletions Modules/Sources/Hardware/Bundle+Hardware.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Foundation

extension Bundle {
static var hardware: Bundle {
#if DEBUG
// Workaround for https://forums.swift.org/t/swift-5-3-swiftpm-resources-in-tests-uses-wrong-bundle-path/37051
if let testBundlePath = ProcessInfo.processInfo.environment["XCTestBundlePath"],
let bundle = Bundle(path: "\(testBundlePath)/Modules_Hardware.bundle") {
return bundle
}
#endif
return Bundle.module

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Codegen
import Foundation

/// The various card brands for a card.
@frozen public enum CardBrand: String, CaseIterable, Codable, GeneratedFakeable {
Expand Down Expand Up @@ -34,13 +35,9 @@ import Codegen
}

extension CardBrand {
// The initializer for Bundle only works with class types.
// We use this class as a shortcut to find the bundle for the CardBrand enum type
private class _Bundle {}

private var iconURL: URL! {
Bundle(for: CardBrand._Bundle.self)
.url(forResource: iconName, withExtension: "svg")
Bundle.hardware.url(forResource: iconName, withExtension: "svg")
}

/// Icon that represents the brand in SVG format
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Codegen
import Foundation

/// An object representing details from a transaction using a card_present payment method.
public struct CardPresentTransactionDetails: Codable, Equatable, GeneratedFakeable {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Foundation

/// Abstraction provided by Hardware so that clients of this library
/// can model a way to provide a connection token.
/// It is meant to abstract an implementation of the [adapter pattern](https://en.wikipedia.org/wiki/Adapter_pattern)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Combine
import Foundation

/// Abstracts the integration with a Card Reader
public protocol CardReaderService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Foundation

/// Models errors thrown by the CardReaderService.
/// It identifies the interaction with the card reader
/// where the error was thrown.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Foundation

/// A property wrapper to return a string as lowercased.
/// This checks also that the currency code is one of the codes
/// returned by Locale.isoCurrencyCodes. If it isn't, it will return an empty string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Foundation

/// A property wrapper to validate that a property is a valid email
/// Property Wrappers can not throw, so
/// what this wrapper does is return a nil when trying to set an invalid
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Codegen
import Foundation

/// A PaymentIntent tracks the process of collecting a payment from your customer.
/// We would create exactly one PaymentIntent for each order
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Foundation

/// Encapsulates the parameters needed to create a PaymentIntent
/// The Stripe Terminal SDK provides support for several parameters
/// i.e. metadata,onBehalfOf...
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Foundation

/// A property wrapper to return a string where:
/// - The characters <>"' are replaced.
/// - The maximum length of the string is 22 characters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Combine
import Foundation

/// A no-op replacement for the adapter wrapping the Stripe Terminal SDK
public struct NoOpCardReaderService: CardReaderService {
// MARK: - Queries
Expand Down
Loading