Skip to content

Commit 80fc1c7

Browse files
authored
feat: 기록 수정 감정 선택 UI 개선 (#277)
* [BOOK-506] feat: 기록 상세 화면 감정 표시 개편 - #270 * [BOOK-507] feat: 도서 기록 감정 선택 UI 개선 - #271 * [BOOK-508] feat: 기록 수정 감정 선택 UI 개선 - #272 * [BOOK-508] fix: reflect reviews
1 parent ccb185e commit 80fc1c7

18 files changed

Lines changed: 404 additions & 269 deletions

File tree

src/Projects/BKData/Sources/Constant/APIConfig.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,21 @@ private final class BKDataBundleToken {}
77
enum APIConfig {
88
private static let bundle = Bundle(for: BKDataBundleToken.self)
99

10-
/// V1 API Base URL (auth, books, users, home)
11-
static let baseURL: String = {
10+
/// API Base URL (xcconfig에서 /api까지만 포함)
11+
private static let baseURL: String = {
1212
guard let value = bundle.object(forInfoDictionaryKey: "BASE_API_URL") as? String else {
1313
fatalError("Can't load environment: BKData.BASE_API_URL")
1414
}
1515
return value
1616
}()
1717

18+
/// V1 API Base URL (auth, books, users, home)
19+
static let baseURLv1: String = {
20+
return baseURL + "/v1"
21+
}()
22+
1823
/// V2 API Base URL (emotions, reading-records)
1924
static let baseURLv2: String = {
20-
// V1 URL에서 v2로 변경
21-
return baseURL.replacingOccurrences(of: "/api/v1", with: "/api/v2")
25+
return baseURL + "/v2"
2226
}()
2327
}

src/Projects/BKData/Sources/DTO/Response/DetailRecordResponseDTO.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ extension DetailRecordResponseDTO {
3939
}
4040
}
4141

42-
// api-v2
4342
public struct DetailRecordV2ResponseDTO: Decodable {
4443
public let id: String
4544
public let userBookId: String

src/Projects/BKData/Sources/DataAssembly.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ public struct DataAssembly: Assembly {
166166
)
167167
}
168168

169+
container.register(type: ExternalLinkRepository.self) { _ in
170+
return DefaultExternalLinkRepository()
171+
}
172+
169173
container.register(
170174
type: EmotionRepository.self,
171175
scope: .singleton

src/Projects/BKDomain/Sources/Entity/Emotion.swift

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,51 +7,3 @@ public enum Emotion: String, CaseIterable, Decodable {
77
case insight = "깨달음"
88
case other = "기타"
99
}
10-
11-
public enum SubEmotion: String, CaseIterable {
12-
// 따뜻함
13-
case comforted = "위로받은"
14-
case cozy = "포근한"
15-
case tender = "다정한"
16-
case grateful = "고마운"
17-
case relieved = "마음이 놓이는"
18-
case peaceful = "편안한"
19-
20-
// 즐거움
21-
case excited = "설레는"
22-
case satisfied = "뿌듯한"
23-
case cheerful = "유쾌한"
24-
case joyful = "기쁜"
25-
case thrilling = "흥미진진한"
26-
27-
// 슬픔
28-
case hollow = "허무한"
29-
case lonely = "외로운"
30-
case regretful = "아쉬운"
31-
case stunned = "먹먹한"
32-
case bittersweet = "애틋한"
33-
case pitiful = "안타까운"
34-
case nostalgic = "그리운"
35-
36-
// 깨달음
37-
case amazed = "감탄한"
38-
case insightful = "통찰력을 얻은"
39-
case inspired = "영감을 받은"
40-
case deepened = "생각이 깊어진"
41-
case understood = "새롭게 이해한"
42-
43-
public static func subEmotions(for emotion: Emotion) -> [SubEmotion] {
44-
switch emotion {
45-
case .warmth:
46-
return [.comforted, .cozy, .tender, .grateful, .relieved, .peaceful]
47-
case .joy:
48-
return [.excited, .satisfied, .cheerful, .joyful, .thrilling]
49-
case .sad:
50-
return [.hollow, .lonely, .regretful, .stunned, .bittersweet, .pitiful, .nostalgic]
51-
case .insight:
52-
return [.amazed, .insightful, .inspired, .deepened, .understood]
53-
case .other:
54-
return []
55-
}
56-
}
57-
}

src/Projects/BKDomain/Sources/Entity/PrimaryEmotion.swift

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,4 @@ public enum PrimaryEmotion: String, CaseIterable, Codable {
3131
case .other: return "네 가지 감정으로 표현하기 어려울 때"
3232
}
3333
}
34-
35-
/// Emotion으로 변환
36-
public func toEmotion() -> Emotion {
37-
switch self {
38-
case .warmth: return .warmth
39-
case .joy: return .joy
40-
case .sadness: return .sad
41-
case .insight: return .insight
42-
case .other: return .other
43-
}
44-
}
45-
46-
/// Emotion에서 변환
47-
public static func from(emotion: Emotion) -> PrimaryEmotion {
48-
switch emotion {
49-
case .warmth: return .warmth
50-
case .joy: return .joy
51-
case .sad: return .sadness
52-
case .insight: return .insight
53-
case .other: return .other
54-
}
55-
}
5634
}

src/Projects/BKDomain/Sources/Entity/RecordInfo.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,4 @@ public struct RecordInfo: Decodable, Equatable {
4646
self.bookCoverImageUrl = bookCoverImageUrl
4747
self.author = author
4848
}
49-
50-
/// 이전 API와의 호환성을 위한 computed property
51-
public var emotionTags: [Emotion] {
52-
[primaryEmotion.toEmotion()]
53-
}
5449
}

src/Projects/BKDomain/Sources/VO/RecordDetails/RecordVO.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,4 @@ public struct RecordVO {
2222
self.primaryEmotion = primaryEmotion
2323
self.detailEmotionIds = detailEmotionIds
2424
}
25-
26-
/// 이전 API와의 호환성을 위한 생성자
27-
public init(
28-
pageNumber: Int?,
29-
quote: String,
30-
review: String?,
31-
emotionTags: [String]
32-
) {
33-
self.pageNumber = pageNumber
34-
self.quote = quote
35-
self.memo = review
36-
self.primaryEmotion = .other
37-
self.detailEmotionIds = emotionTags
38-
}
3925
}

src/Projects/BKPresentation/Sources/MainFlow/BookDetail/View/BookDetailViewCell.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,7 @@ final class BookDetailViewCell: UICollectionViewCell {
8484
noteLabel.setText(text: displayedNote)
8585
emotionTagLabel.setText(text: "#\(emotion.displayName)")
8686
creationLabel.setText(text: item.createdAt.toKoreanDotDateString())
87-
if let page = item.page {
88-
pageLabel.setText(text: "\(page)p")
89-
} else {
90-
pageLabel.setText(text: "-p")
91-
}
87+
pageLabel.setText(text: item.page.toPageString)
9288
}
9389

9490
func applyMoreButtonGesture(

src/Projects/BKPresentation/Sources/MainFlow/Note/View/EmotionRegistrationView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ final class EmotionRegistrationView: BaseView {
371371
rowView.addGestureRecognizer(tapGesture)
372372
rowView.tag = emotion.hashValue
373373

374-
// Set up chip removal callback
375374
rowView.onDetailEmotionRemoved = { [weak self] detailEmotion in
376375
self?.removeDetailEmotion(detailEmotion)
377376
}

src/Projects/BKPresentation/Sources/MainFlow/Note/ViewModel/NoteForm.swift

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,6 @@ struct NoteForm: Equatable {
88
let memo: String?
99
let primaryEmotion: PrimaryEmotion
1010
let detailEmotions: [DetailEmotion]
11-
12-
/// 이전 API 호환성 생성자
13-
init(
14-
page: Int?,
15-
sentence: String,
16-
emotion: Emotion,
17-
appreciation: String?
18-
) {
19-
self.page = page
20-
self.sentence = sentence
21-
self.memo = appreciation
22-
self.primaryEmotion = PrimaryEmotion.from(emotion: emotion)
23-
self.detailEmotions = []
24-
}
25-
26-
init(
27-
page: Int?,
28-
sentence: String,
29-
memo: String?,
30-
primaryEmotion: PrimaryEmotion,
31-
detailEmotions: [DetailEmotion]
32-
) {
33-
self.page = page
34-
self.sentence = sentence
35-
self.memo = memo
36-
self.primaryEmotion = primaryEmotion
37-
self.detailEmotions = detailEmotions
38-
}
3911
}
4012

4113
extension NoteForm {

0 commit comments

Comments
 (0)