Skip to content
Snippets Groups Projects
Commit d29d68bd authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Add GroupFeature library

parent 7dc9fef0
No related branches found
No related tags found
2 merge requests!153Release 1.1.0,!151[Messenger example] join group
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1410"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "GroupFeature"
BuildableName = "GroupFeature"
BlueprintName = "GroupFeature"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "GroupFeatureTests"
BuildableName = "GroupFeatureTests"
BlueprintName = "GroupFeatureTests"
ReferencedContainer = "container:">
</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">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "GroupFeature"
BuildableName = "GroupFeature"
BlueprintName = "GroupFeature"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
...@@ -22,6 +22,7 @@ let package = Package( ...@@ -22,6 +22,7 @@ let package = Package(
.library(name: "ContactFeature", targets: ["ContactFeature"]), .library(name: "ContactFeature", targets: ["ContactFeature"]),
.library(name: "ContactLookupFeature", targets: ["ContactLookupFeature"]), .library(name: "ContactLookupFeature", targets: ["ContactLookupFeature"]),
.library(name: "ContactsFeature", targets: ["ContactsFeature"]), .library(name: "ContactsFeature", targets: ["ContactsFeature"]),
.library(name: "GroupFeature", targets: ["GroupFeature"]),
.library(name: "GroupsFeature", targets: ["GroupsFeature"]), .library(name: "GroupsFeature", targets: ["GroupsFeature"]),
.library(name: "HomeFeature", targets: ["HomeFeature"]), .library(name: "HomeFeature", targets: ["HomeFeature"]),
.library(name: "MyContactFeature", targets: ["MyContactFeature"]), .library(name: "MyContactFeature", targets: ["MyContactFeature"]),
...@@ -262,6 +263,26 @@ let package = Package( ...@@ -262,6 +263,26 @@ let package = Package(
], ],
swiftSettings: swiftSettings swiftSettings: swiftSettings
), ),
.target(
name: "GroupFeature",
dependencies: [
.target(name: "AppCore"),
.product(name: "ComposableArchitecture", package: "swift-composable-architecture"),
.product(name: "ComposablePresentation", package: "swift-composable-presentation"),
.product(name: "XXClient", package: "elixxir-dapps-sdk-swift"),
.product(name: "XXMessengerClient", package: "elixxir-dapps-sdk-swift"),
.product(name: "XXModels", package: "client-ios-db"),
],
swiftSettings: swiftSettings
),
.testTarget(
name: "GroupFeatureTests",
dependencies: [
.target(name: "GroupFeature"),
.product(name: "CustomDump", package: "swift-custom-dump"),
],
swiftSettings: swiftSettings
),
.target( .target(
name: "GroupsFeature", name: "GroupsFeature",
dependencies: [ dependencies: [
......
...@@ -119,6 +119,16 @@ ...@@ -119,6 +119,16 @@
ReferencedContainer = "container:.."> ReferencedContainer = "container:..">
</BuildableReference> </BuildableReference>
</TestableReference> </TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "GroupFeatureTests"
BuildableName = "GroupFeatureTests"
BlueprintName = "GroupFeatureTests"
ReferencedContainer = "container:..">
</BuildableReference>
</TestableReference>
<TestableReference <TestableReference
skipped = "NO"> skipped = "NO">
<BuildableReference <BuildableReference
......
import ComposableArchitecture
import XXModels
public struct GroupComponent: ReducerProtocol {
public struct State: Equatable {
public init(
group: XXModels.Group
) {
self.group = group
}
public var group: XXModels.Group
}
public enum Action: Equatable {
case start
}
public init() {}
public var body: some ReducerProtocol<State, Action> {
Reduce { state, action in
switch action {
case .start:
return .none
}
}
}
}
import AppCore
import ComposableArchitecture
import SwiftUI
import XXModels
public struct GroupView: View {
public typealias Component = GroupComponent
typealias ViewStore = ComposableArchitecture.ViewStore<ViewState, Component.Action>
public init(store: StoreOf<Component>) {
self.store = store
}
let store: StoreOf<Component>
struct ViewState: Equatable {
init(state: Component.State) {
group = state.group
}
var group: XXModels.Group
}
public var body: some View {
WithViewStore(store, observe: ViewState.init) { viewStore in
Form {
Section("Group name") {
Text(viewStore.group.name)
}
}
.navigationTitle("Group")
.task { viewStore.send(.start) }
}
}
}
#if DEBUG
public struct GroupView_Previews: PreviewProvider {
public static var previews: some View {
NavigationView {
GroupView(store: Store(
initialState: GroupComponent.State(
group: .init(
id: "group-id".data(using: .utf8)!,
name: "Preview group",
leaderId: "group-leader-id".data(using: .utf8)!,
createdAt: Date(timeIntervalSince1970: TimeInterval(86_400)),
authStatus: .participating,
serialized: "group-serialized".data(using: .utf8)!
)
),
reducer: EmptyReducer()
))
}
}
}
#endif
import ComposableArchitecture
import XCTest
import XXModels
@testable import GroupFeature
final class GroupComponentTests: XCTestCase {
func testStart() {
let store = TestStore(
initialState: GroupComponent.State(
group: .stub()
),
reducer: GroupComponent()
)
store.send(.start)
}
}
private extension XXModels.Group {
static func stub() -> XXModels.Group {
XXModels.Group(
id: "group-id".data(using: .utf8)!,
name: "Group name",
leaderId: "group-leader-id".data(using: .utf8)!,
createdAt: Date(timeIntervalSince1970: TimeInterval(86_400)),
authStatus: .participating,
serialized: "group-serialized".data(using: .utf8)!
)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment