feat: Moves info view feature to it's own module.
This commit is contained in:
@@ -18,6 +18,7 @@ let package = Package(
|
|||||||
.library(name: "CalculateAtFeature", targets: ["CalculateAtFeature"]),
|
.library(name: "CalculateAtFeature", targets: ["CalculateAtFeature"]),
|
||||||
.library(name: "EstimatedPressureDependency", targets: ["EstimatedPressureDependency"]),
|
.library(name: "EstimatedPressureDependency", targets: ["EstimatedPressureDependency"]),
|
||||||
.library(name: "FlaggedViews", targets: ["FlaggedViews"]),
|
.library(name: "FlaggedViews", targets: ["FlaggedViews"]),
|
||||||
|
.library(name: "InfoViewFeature", targets: ["InfoViewFeature"]),
|
||||||
.library(name: "PressureEstimationsFeature", targets: ["PressureEstimationsFeature"]),
|
.library(name: "PressureEstimationsFeature", targets: ["PressureEstimationsFeature"]),
|
||||||
.library(name: "SharedModels", targets: ["SharedModels"]),
|
.library(name: "SharedModels", targets: ["SharedModels"]),
|
||||||
.library(name: "Styleguide", targets: ["Styleguide"]),
|
.library(name: "Styleguide", targets: ["Styleguide"]),
|
||||||
@@ -45,6 +46,7 @@ let package = Package(
|
|||||||
name: "CalculateAtFeature",
|
name: "CalculateAtFeature",
|
||||||
dependencies: [
|
dependencies: [
|
||||||
"EstimatedPressureDependency",
|
"EstimatedPressureDependency",
|
||||||
|
"InfoViewFeature",
|
||||||
"SharedModels",
|
"SharedModels",
|
||||||
"Styleguide",
|
"Styleguide",
|
||||||
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
|
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
|
||||||
@@ -69,6 +71,14 @@ let package = Package(
|
|||||||
],
|
],
|
||||||
swiftSettings: settings
|
swiftSettings: settings
|
||||||
),
|
),
|
||||||
|
.target(
|
||||||
|
name: "InfoViewFeature",
|
||||||
|
dependencies: [
|
||||||
|
"Styleguide",
|
||||||
|
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
|
||||||
|
],
|
||||||
|
swiftSettings: settings
|
||||||
|
),
|
||||||
.target(
|
.target(
|
||||||
name: "SharedModels",
|
name: "SharedModels",
|
||||||
swiftSettings: settings
|
swiftSettings: settings
|
||||||
@@ -77,7 +87,6 @@ let package = Package(
|
|||||||
name: "Styleguide",
|
name: "Styleguide",
|
||||||
dependencies: [
|
dependencies: [
|
||||||
"SharedModels",
|
"SharedModels",
|
||||||
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
|
|
||||||
],
|
],
|
||||||
swiftSettings: settings
|
swiftSettings: settings
|
||||||
),
|
),
|
||||||
@@ -93,6 +102,7 @@ let package = Package(
|
|||||||
dependencies: [
|
dependencies: [
|
||||||
"EstimatedPressureDependency",
|
"EstimatedPressureDependency",
|
||||||
"FlaggedViews",
|
"FlaggedViews",
|
||||||
|
"InfoViewFeature",
|
||||||
"SharedModels",
|
"SharedModels",
|
||||||
"Styleguide",
|
"Styleguide",
|
||||||
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
|
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
import ComposableArchitecture
|
import ComposableArchitecture
|
||||||
import DependenciesAdditions
|
import DependenciesAdditions
|
||||||
import EstimatedPressureDependency
|
import EstimatedPressureDependency
|
||||||
|
import InfoViewFeature
|
||||||
import SharedModels
|
import SharedModels
|
||||||
import Styleguide
|
import Styleguide
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import TCAExtras
|
import TCAExtras
|
||||||
|
|
||||||
@Reducer
|
@Reducer
|
||||||
public struct CalculateAtFeature {
|
public struct CalculateAtFeature: Sendable {
|
||||||
|
|
||||||
@Reducer(state: .equatable)
|
@Reducer(state: .equatable)
|
||||||
public enum Destination {
|
public enum Destination {
|
||||||
case infoView(InfoViewFeature)
|
case infoView(InfoViewFeature)
|
||||||
@@ -16,7 +17,7 @@ public struct CalculateAtFeature {
|
|||||||
|
|
||||||
@ObservableState
|
@ObservableState
|
||||||
@dynamicMemberLookup
|
@dynamicMemberLookup
|
||||||
public struct State: Equatable {
|
public struct State: Equatable, Sendable {
|
||||||
@Presents public var destination: Destination.State?
|
@Presents public var destination: Destination.State?
|
||||||
public var focus: Focus? = nil
|
public var focus: Focus? = nil
|
||||||
public var values: ValueContainer
|
public var values: ValueContainer
|
||||||
@@ -53,7 +54,7 @@ public struct CalculateAtFeature {
|
|||||||
case targetValue
|
case targetValue
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct ValueContainer: Equatable {
|
public struct ValueContainer: Equatable, Sendable {
|
||||||
public var existingAirflow: Double?
|
public var existingAirflow: Double?
|
||||||
public var existingPressure: Double?
|
public var existingPressure: Double?
|
||||||
public var targetValue: Double?
|
public var targetValue: Double?
|
||||||
@@ -72,7 +73,7 @@ public struct CalculateAtFeature {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CalculationType: Hashable, CaseIterable, Identifiable {
|
public enum CalculationType: Hashable, CaseIterable, Identifiable, Sendable {
|
||||||
case airflowAtNewPressure
|
case airflowAtNewPressure
|
||||||
case pressureAtNewAirflow
|
case pressureAtNewAirflow
|
||||||
|
|
||||||
@@ -145,7 +146,7 @@ public struct CalculateAtFeature {
|
|||||||
case view(View)
|
case view(View)
|
||||||
|
|
||||||
@CasePathable
|
@CasePathable
|
||||||
public enum ReceiveAction {
|
public enum ReceiveAction: Sendable {
|
||||||
case calculatedValue(Positive<Double>?)
|
case calculatedValue(Positive<Double>?)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,19 +366,19 @@ fileprivate extension InfoViewFeature.State {
|
|||||||
switch calculationType {
|
switch calculationType {
|
||||||
case .airflowAtNewPressure:
|
case .airflowAtNewPressure:
|
||||||
self.init(
|
self.init(
|
||||||
title: """
|
title: "Airflow at Pressure",
|
||||||
Calculate the airflow at the target pressure from the existing airflow and existing pressure.
|
|
||||||
""",
|
|
||||||
body: """
|
body: """
|
||||||
|
Calculate the airflow at the target pressure from the existing airflow and existing pressure.
|
||||||
|
|
||||||
This can be useful to determine the effect of a different blower speed on a specific measurement location (generally the supply or return plenum).
|
This can be useful to determine the effect of a different blower speed on a specific measurement location (generally the supply or return plenum).
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
case .pressureAtNewAirflow:
|
case .pressureAtNewAirflow:
|
||||||
self.init(
|
self.init(
|
||||||
title: """
|
title: "Pressure at Airflow",
|
||||||
Calculate the pressure at the target airflow from the existing airflow and existing pressure.
|
|
||||||
""",
|
|
||||||
body: """
|
body: """
|
||||||
|
Calculate the pressure at the target airflow from the existing airflow and existing pressure.
|
||||||
|
|
||||||
This can be useful to determine the effect of a different blower speed on a specific measurement location (generally the supply or return plenum).
|
This can be useful to determine the effect of a different blower speed on a specific measurement location (generally the supply or return plenum).
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import ComposableArchitecture
|
import ComposableArchitecture
|
||||||
|
import Styleguide
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
@Reducer
|
@Reducer
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import ComposableArchitecture
|
import ComposableArchitecture
|
||||||
import DependenciesAdditions
|
import DependenciesAdditions
|
||||||
|
import InfoViewFeature
|
||||||
import SharedModels
|
import SharedModels
|
||||||
import Styleguide
|
import Styleguide
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import ComposableArchitecture
|
import ComposableArchitecture
|
||||||
import FlaggedViews
|
import FlaggedViews
|
||||||
|
import InfoViewFeature
|
||||||
import SharedModels
|
import SharedModels
|
||||||
import Styleguide
|
import Styleguide
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|||||||
@@ -10,13 +10,11 @@ extension View {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#warning("Fix me.")
|
|
||||||
// The decimal pad autocompletes too quickly in the simulator, needs tested on an actual
|
// The decimal pad autocompletes too quickly in the simulator, needs tested on an actual
|
||||||
// device.
|
// device.
|
||||||
public func decimalPad() -> some View {
|
public func decimalPad() -> some View {
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
// self.keyboardType(.decimalPad)
|
self.keyboardType(.decimalPad)
|
||||||
self.keyboardType(.numberPad)
|
|
||||||
#else
|
#else
|
||||||
self
|
self
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ final class PositiveNumericTests: XCTestCase {
|
|||||||
|
|
||||||
@Test(
|
@Test(
|
||||||
"Values are positive only",
|
"Values are positive only",
|
||||||
|
.tags(.sharedModel),
|
||||||
arguments: [
|
arguments: [
|
||||||
0.1,
|
0.1,
|
||||||
-0.1
|
-0.1
|
||||||
@@ -83,6 +84,7 @@ final class PositiveNumericTests: XCTestCase {
|
|||||||
|
|
||||||
@Test(
|
@Test(
|
||||||
"PlenumDimension area calculation",
|
"PlenumDimension area calculation",
|
||||||
|
.tags(.sharedModel),
|
||||||
arguments: [
|
arguments: [
|
||||||
(PlenumDimension.rectangular(width: 24, height: 12), 2),
|
(PlenumDimension.rectangular(width: 24, height: 12), 2),
|
||||||
(PlenumDimension.round(16), 1.4)
|
(PlenumDimension.round(16), 1.4)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import SharedModels
|
|||||||
import Testing
|
import Testing
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
|
@Suite(.tags(.sharedModel, .percentage))
|
||||||
struct PercentagePostfixOperatorTests {
|
struct PercentagePostfixOperatorTests {
|
||||||
static let arguments: [(Percentage, Double)] = [
|
static let arguments: [(Percentage, Double)] = [
|
||||||
(50%, 50),
|
(50%, 50),
|
||||||
@@ -15,6 +16,7 @@ struct PercentagePostfixOperatorTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suite(.tags(.sharedModel, .percentage))
|
||||||
struct PercentageInitializationTests {
|
struct PercentageInitializationTests {
|
||||||
|
|
||||||
@Test("Percentage expressible tests")
|
@Test("Percentage expressible tests")
|
||||||
@@ -34,6 +36,7 @@ struct PercentageInitializationTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suite(.tags(.sharedModel, .percentage))
|
||||||
struct PercentageMathTests {
|
struct PercentageMathTests {
|
||||||
|
|
||||||
let first = 2%
|
let first = 2%
|
||||||
@@ -66,7 +69,7 @@ struct PercentageMathTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test("Percentage custom string convertible")
|
@Test("Percentage custom string convertible", .tags(.sharedModel, .percentage))
|
||||||
func percentageString() {
|
func percentageString() {
|
||||||
#expect(50%.description == "50%")
|
#expect(50%.description == "50%")
|
||||||
}
|
}
|
||||||
|
|||||||
6
Tests/EstimatedPressureTests/Tags.swift
Normal file
6
Tests/EstimatedPressureTests/Tags.swift
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import Testing
|
||||||
|
|
||||||
|
extension Tag {
|
||||||
|
@Tag static var sharedModel: Self
|
||||||
|
@Tag static var percentage: Self
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user