Skip to content

Commit 536d420

Browse files
committed
Refactor: RoutineLevelType, RoutineCategoryType 모듈 위치 변경으로 인한 Presentation 모듈 수정
- Presentation 모듈에 있는 RoutineLevelType, RoutineCategoryType가 Domain을 extension해서 필요한 값을 추가하여 사용할 수 있도록 수정 - 그에 따른 import Domain 추가
1 parent df3542f commit 536d420

7 files changed

Lines changed: 25 additions & 20 deletions

File tree

Projects/Presentation/Sources/Onboarding/Model/RecommendedRoutine.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,20 @@ public struct RecommendedRoutine: OnboardingChoiceProtocol, Hashable {
1212
let mainTitle: String
1313
let subTitle: String?
1414
let routineCategory: RoutineCategoryType
15+
let routineLevel: RoutineLevelType
1516

1617
init(
1718
id: Int,
1819
mainTitle: String,
1920
subTitle: String?,
20-
routineCategory: RoutineCategoryType = .recommendation
21+
routineCategory: RoutineCategoryType,
22+
routineLevel: RoutineLevelType
2123
) {
2224
self.id = id
2325
self.mainTitle = mainTitle
2426
self.subTitle = subTitle
2527
self.routineCategory = routineCategory
28+
self.routineLevel = routineLevel
2629
}
2730
}
2831

@@ -31,6 +34,9 @@ extension RecommendedRoutineEntity {
3134
return RecommendedRoutine(
3235
id: id,
3336
mainTitle: title,
34-
subTitle: description)
37+
subTitle: description,
38+
routineCategory: category ?? .recommendation,
39+
routineLevel: level ?? .easy
40+
)
3541
}
3642
}

Projects/Presentation/Sources/RecommendedRoutine/Model/RoutineCategoryType.swift

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,26 @@
55
// Created by 최정인 on 7/12/25.
66
//
77

8-
enum RoutineCategoryType: CaseIterable {
9-
case recommendation
10-
case outdoor
11-
case wakeup
12-
case connection
13-
case rest
14-
case growth
8+
import Domain
159

10+
extension RoutineCategoryType {
1611
var id: Int {
1712
switch self {
1813
case .recommendation: 1
1914
case .outdoor: 2
20-
case .wakeup: 3
21-
case .connection: 4
22-
case .rest: 5
23-
case .growth: 6
15+
case .outdoorReport: 3
16+
case .wakeup: 4
17+
case .connection: 5
18+
case .rest: 6
19+
case .growth: 7
2420
}
2521
}
2622

2723
var title: String {
2824
switch self {
2925
case .recommendation: "맞춤 추천"
3026
case .outdoor: "나가봐요"
27+
case .outdoorReport: "나가봐요_제보"
3128
case .wakeup: "일어나요"
3229
case .connection: "연결해요"
3330
case .rest: "쉬어가요"

Projects/Presentation/Sources/RecommendedRoutine/Model/RoutineLevelType.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
// Created by 최정인 on 7/17/25.
66
//
77

8-
enum RoutineLevelType: SelectableItem, CaseIterable {
9-
case easy
10-
case normal
11-
case hard
8+
import Domain
129

10+
extension RoutineLevelType: SelectableItem {
1311
var id: Int {
1412
switch self {
1513
case .easy: 1

Projects/Presentation/Sources/RecommendedRoutine/View/Component/RegisterEmotionButton.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ final class RegisterEmotionButton: UIButton {
1313
private enum Layout {
1414
static let borderWith: CGFloat = 1
1515
static let cornerRadius: CGFloat = 12
16-
static let plusIconImageSize: CGFloat = 8
16+
static let plusIconImageSize: CGFloat = 10
1717
static let plusIconSize: CGFloat = 20
1818
static let plusIconLeadingSpacing: CGFloat = 24
1919
static let buttonLabelLeadingSpacing: CGFloat = 10

Projects/Presentation/Sources/RecommendedRoutine/View/Component/RoutineCategoryButton.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Created by 최정인 on 7/12/25.
66
//
77

8+
import Domain
89
import SnapKit
910
import UIKit
1011

Projects/Presentation/Sources/RecommendedRoutine/View/Component/RoutineCategoryView.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Created by 최정인 on 7/12/25.
66
//
77

8+
import Domain
89
import UIKit
910

1011
protocol RoutineCategoryViewDelegate: AnyObject {
@@ -23,6 +24,7 @@ final class RoutineCategoryView: UIView {
2324
private let scrollView = UIScrollView()
2425
private let buttonStackView = UIStackView()
2526
private var categoryButtons: [RoutineCategoryType: RoutineCategoryButton] = [:]
27+
private let routineCategories = RoutineCategoryType.allCases.filter({ $0 != .outdoorReport }).sorted(by: { $0.id < $1.id })
2628
weak var delegate: RoutineCategoryViewDelegate?
2729

2830
override init(frame: CGRect) {
@@ -41,7 +43,7 @@ final class RoutineCategoryView: UIView {
4143
buttonStackView.axis = .horizontal
4244
buttonStackView.spacing = Layout.stackViewSpacing
4345

44-
RoutineCategoryType.allCases.sorted(by: { $0.id < $1.id }).forEach { type in
46+
routineCategories.forEach { type in
4547
let button = RoutineCategoryButton(category: type)
4648
button.addAction(UIAction { [weak self] _ in
4749
guard let self else { return }
@@ -60,7 +62,7 @@ final class RoutineCategoryView: UIView {
6062
make.edges.equalToSuperview()
6163
}
6264

63-
RoutineCategoryType.allCases.sorted(by: { $0.id < $1.id }).forEach { type in
65+
routineCategories.forEach { type in
6466
guard let button = categoryButtons[type] else { return }
6567
buttonStackView.addArrangedSubview(button)
6668
button.snp.makeConstraints { make in

Projects/Presentation/Sources/RecommendedRoutine/View/Component/RoutineLevelButton.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Created by 최정인 on 7/12/25.
66
//
77

8+
import Domain
89
import UIKit
910

1011
final class RoutineLevelButton: UIButton {

0 commit comments

Comments
 (0)