Skip to content
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 @@ -6,13 +6,13 @@ import Foundation
struct InsertRecordRequestDTO: Encodable {
let pageNumber: Int
let quote: String
let review: String
let review: String?
let emotionTags: [String]

init(
pageNumber: Int,
quote: String,
review: String,
review: String?,
emotionTags: [String]
) {
self.pageNumber = pageNumber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public struct DetailRecordResponseDTO: Decodable {
public let userBookId: String
public let pageNumber: Int
public let quote: String
public let review: String
public let review: String?
public let emotionTags: [Emotion]
public let createdAt: String
public let updatedAt: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public struct InsertRecordResponseDTO: Decodable {
let userBookId: String
let pageNumber: Int
let quote: String
let review: String
let review: String?
let emotionTags: [Emotion]
let createdAt: String
let updatedAt: String
Expand Down
4 changes: 2 additions & 2 deletions src/Projects/BKDomain/Sources/Entity/RecordInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public struct RecordInfo: Decodable, Equatable {
public let bookId: String
public let pageNumber: Int
public let quote: String
public let review: String
public let review: String?
public let emotionTags: [Emotion]
public let createdAt: Date
public let updatedAt: Date?
Expand All @@ -21,7 +21,7 @@ public struct RecordInfo: Decodable, Equatable {
bookId: String,
pageNumber: Int,
quote: String,
review: String,
review: String?,
emotionTags: [Emotion],
createdAt: Date,
updatedAt: Date?,
Expand Down
4 changes: 2 additions & 2 deletions src/Projects/BKDomain/Sources/VO/RecordDetails/RecordVO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import Foundation
public struct RecordVO {
public let pageNumber: Int
public let quote: String
public let review: String
public let review: String?
public let emotionTags: [String]

public init(
pageNumber: Int,
quote: String,
review: String,
review: String?,
emotionTags: [String]
) {
self.pageNumber = pageNumber
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ struct NoteForm: Equatable {
let page: Int
let sentence: String
let emotion: Emotion
let appreciation: String
let appreciation: String?
}

extension NoteForm {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,20 @@ final class AppreciationResultView: BaseView {
func apply(
emotion: EmotionIcon,
creationDate: Date,
appreciation: String
appreciation: String? = ""
) {
emotionIcon.image = emotion.icon
emotionLabel.setText(text: emotion.rawValue)
creationLabel.setText(text: creationDate.toKoreanDateString())
appreciationLabel.setText(text: appreciation)

if let review = appreciation, !review.isEmpty {
appreciationLabel.setText(text: review)
appreciationLabel.isHidden = false
rootStack.spacing = LayoutConstants.rootStackSpacing
} else {
appreciationLabel.isHidden = true
rootStack.spacing = 0
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ final class NoteCompletionView: BaseView {
appreciationResultView.apply(
emotion: EmotionIcon.from(emotion: recordInfo.emotionTags.first ?? .joy),
creationDate: recordInfo.createdAt,
appreciation: recordInfo.review
appreciation: recordInfo.review ?? ""
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,10 @@ final class NoteEditView: BaseView {

pageField.setText("\(recordInfo.pageNumber)")
sentenceTextView.setText(recordInfo.quote)
appreciationTextView.setText(recordInfo.review)

if let review = recordInfo.review {
appreciationTextView.setText(review)
}
// 감정 라벨은 selectedEmotion 바인딩에서만 설정
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class NoteEditViewModel: BaseViewModel {
case errorHandled
case presentEmotionEdit
case emotionSelected(Emotion)
case saveButtonTapped(formData: (page: Int?, sentence: String, appreciation: String))
case saveButtonTapped(formData: (page: Int?, sentence: String, appreciation: String?))
case patchRecordSuccessed(RecordInfo)
case deleteButtonTapped
case deleteRecordSuccessed
Expand Down Expand Up @@ -95,9 +95,8 @@ final class NoteEditViewModel: BaseViewModel {
case .saveButtonTapped(let formData):
guard let selectedEmotion = state.selectedEmotion,
let page = formData.page,
!formData.sentence.isEmpty,
!formData.appreciation.isEmpty else {
break
!formData.sentence.isEmpty else {
break
}

let noteForm = NoteForm(
Expand Down