Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature/#288] 하단 탭바 구조 수정 #307

Merged
merged 1 commit into from
Oct 15, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public extension ModulePath {
// MARK: - FeatureModule
public extension ModulePath {
enum Feature: String, CaseIterable {
case GoodFeeling
case Guide
case TabBar
case Report
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public enum BottleWebViewType {
case login
case bottles
case editProfile
case goodFeeling

var path: String {
switch self {
Expand All @@ -39,6 +40,8 @@ public enum BottleWebViewType {
return "bottles"
case .editProfile:
return "profile/edit"
case .goodFeeling:
return "bottles/sents"
}
}

Expand All @@ -58,6 +61,9 @@ public enum BottleWebViewType {

case .editProfile:
return makeUrlWithToken(path)

case .goodFeeling:
return makeUrlWithToken(path)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ private extension MatchingView {
)

OutlinedStyleButton(
.small(contentType: .image(type: .local(bottleImageSystem: .icom(.share)))),
.small(contentType: .image(type: .local(bottleImageSystem: .icon(.share)))),
title: "복사하기",
buttonType: .throttle
) {
Expand Down
21 changes: 21 additions & 0 deletions Projects/Feature/GoodFeeling/Example/Sources/AppView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import SwiftUI

import FeatureGoodFeeling
import FeatureGoodFeelingInterface

import DomainAuth
import DomainAuthInterface

import ComposableArchitecture

@main
struct AppView: App {
var body: some Scene {
WindowGroup {
GoodFeelingRootView(store: Store(
initialState: GoodFeelingRootFeature.State(),
reducer: { GoodFeelingRootFeature() }
))
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// GoodFeelingFeatureInterface.swift
// FeatureGoodFeelingInterface
//
// Created by JongHoon on 10/6/24.
//

import Foundation

import ComposableArchitecture

@Reducer
public struct GoodFeelingFeature {
private let reducer: Reduce<State, Action>

public init(reducer: Reduce<State, Action>) {
self.reducer = reducer
}

@ObservableState
public struct State: Equatable {
public init() {

}
}

public enum Action: BindableAction {
case binding(BindingAction<State>)
}

public var body: some ReducerOf<Self> {
reducer
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// GoodFeelingFeature.swift
// FeatureGoodFeelingInterface
//
// Created by JongHoon on 10/6/24.
//

import Foundation

import ComposableArchitecture

extension GoodFeelingFeature {
public init() {
let reducer = Reduce<State, Action> { state, action in
return .none
}

self.init(reducer: reducer)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// GoodFeelingView.swift
// FeatureGoodFeelingInterface
//
// Created by JongHoon on 10/6/24.
//

import SwiftUI

import FeatureBaseWebViewInterface

import ComposableArchitecture

public struct GoodFeelingView: View {
@Perception.Bindable private var store: StoreOf<GoodFeelingFeature>

public init(store: StoreOf<GoodFeelingFeature>) {
self.store = store
}

public var body: some View {
WithPerceptionTracking {
BaseWebView(
type: .goodFeeling,
actionDidInputted: { action in
// TODO: action handling
}
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//
// FeatureGoodFeelingRootView.swift
// FeatureGoodFeeling
//
// Created by JongHoon on 10/6/24.
//

import SwiftUI

import SharedDesignSystem

import ComposableArchitecture

public struct GoodFeelingRootView: View {
@Perception.Bindable private var store: StoreOf<GoodFeelingRootFeature>

public init(store: StoreOf<GoodFeelingRootFeature>) {
self.store = store
}

public var body: some View {
WithPerceptionTracking {
NavigationStack(path: $store.scope(state: \.path, action: \.path)) {
VStack(spacing: 0.0) {
GoodFeelingView(store: store.scope(
state: \.goodFeeling,
action: \.goodFeeling
))
Spacer()
.frame(height: BottleConstants.bottomTabBarHeight.value)
}
.setTabBar(selectedTab: .goodFeeling) { selectedTab in
store.send(.selectedTabDidChanged(selectedTab))
}
} destination: { store in
WithPerceptionTracking {

}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//
// GoodFeelingRootFeature.swift
// FeatureGoodFeelingInterface
//
// Created by JongHoon on 10/6/24.
//

import Foundation

import FeatureTabBarInterface

import ComposableArchitecture

@Reducer
public struct GoodFeelingRootFeature {
private let reducer: Reduce<State, Action>

public init(reducer: Reduce<State, Action>) {
self.reducer = reducer
}

@Reducer(state: .equatable)
public enum Path {

}

@ObservableState
public struct State: Equatable {
public var goodFeeling: GoodFeelingFeature.State

var path = StackState<Path.State>()

public init() {
self.goodFeeling = .init()
}
}

public enum Action {
case selectedTabDidChanged(TabType)
case goodFeeling(GoodFeelingFeature.Action)

case path(StackAction<Path.State, Path.Action>)
case delegate(Delegate)

public enum Delegate {
case selectedTabDidChanged(TabType)
}
}

public var body: some ReducerOf<Self> {
Scope(state: \.goodFeeling, action: \.goodFeeling) {
GoodFeelingFeature()
}

reducer
.forEach(\.path, action: \.path)
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// GoodFeelingRootFeatureInterface.swift
// FeatureGoodFeelingInterface
//
// Created by JongHoon on 10/6/24.
//

import Foundation

import ComposableArchitecture

extension GoodFeelingRootFeature {
public init() {
let reducer = Reduce<State, Action> { state, action in
switch action {
case let .selectedTabDidChanged(selectedTab):
return .send(.delegate(.selectedTabDidChanged(selectedTab)))

default:
return .none
}
}

self.init(reducer: reducer)
}
}
53 changes: 53 additions & 0 deletions Projects/Feature/GoodFeeling/Project.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import ProjectDescription
import ProjectDescriptionHelpers
import DependencyPlugin

let project = Project.makeModule(
name: ModulePath.Feature.name+ModulePath.Feature.GoodFeeling.rawValue,
targets: [
.feature(
interface: .GoodFeeling,
factory: .init(
dependencies: [
.domain,
.feature(interface: .TabBar),
.feature(interface: .BaseWebView)
]
)
),
.feature(
implements: .GoodFeeling,
factory: .init(
dependencies: [
.feature(interface: .GoodFeeling)
]
)
),
.feature(
testing: .GoodFeeling,
factory: .init(
dependencies: [
.feature(interface: .GoodFeeling)
]
)
),
.feature(
tests: .GoodFeeling,
factory: .init(
dependencies: [
.feature(testing: .GoodFeeling),
.feature(implements: .GoodFeeling)
]
)
),
.feature(
example: .GoodFeeling,
factory: .init(
dependencies: [
.feature(testing: .GoodFeeling),
.feature(implements: .GoodFeeling)
]
)
)
]
)
1 change: 1 addition & 0 deletions Projects/Feature/GoodFeeling/Sources/Source.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// This is for Tuist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// This is for Tuist
11 changes: 11 additions & 0 deletions Projects/Feature/GoodFeeling/Tests/Sources/GoodFeelingTest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import XCTest

final class GoodFeelingTests: XCTestCase {
override func setUpWithError() throws {}

override func tearDownWithError() throws {}

func testExample() {
XCTAssertEqual(1, 1)
}
}
7 changes: 6 additions & 1 deletion Projects/Feature/Sources/TabView/MainTabView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@

import SwiftUI

import FeatureSandBeachInterface
import FeatureGoodFeelingInterface
import FeatureBottleStorageInterface
import FeatureMyPageInterface
import FeatureSandBeachInterface
import FeatureTabBarInterface
import SharedDesignSystem

Expand All @@ -30,6 +31,10 @@ public struct MainTabView: View {
.tag(TabType.sandBeach)
.toolbar(.hidden, for: .tabBar)

GoodFeelingRootView(store: store.scope(state: \.goodFeelingRoot, action: \.goodFeelingRoot))
.tag(TabType.goodFeeling)
.toolbar(.hidden, for: .tabBar)

BottleStorageView(store: store.scope(state: \.bottleStorage, action: \.bottleStorage))
.tag(TabType.bottleStorage)
.toolbar(.hidden, for: .tabBar)
Expand Down
Loading