From bbb8b89235646cd5b73eeaf05b9c85b234466ab6 Mon Sep 17 00:00:00 2001 From: Sanghee Date: Fri, 23 Aug 2024 12:53:57 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=ED=99=88:=20=EB=A7=81=ED=81=AC=20?= =?UTF-8?q?=ED=81=B4=EB=A6=AD=20=EC=8B=9C=20=EC=9D=BD=EC=9D=8C=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Projects/Core/Models/Card.swift | 3 +++ .../ResponseDTO/Common/AIClassificationCardDTO.swift | 1 + .../Core/Services/ResponseDTO/Common/CardDTO.swift | 1 + Projects/Features/Scene/HomeScene/Home.swift | 10 +++++++++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Projects/Core/Models/Card.swift b/Projects/Core/Models/Card.swift index 60b1e5e3..2ea1abe9 100644 --- a/Projects/Core/Models/Card.swift +++ b/Projects/Core/Models/Card.swift @@ -29,6 +29,7 @@ public struct Card: Hashable { public let description: String? public var category: String? public let createdAt: Date + public let readAt: Date? public var isFavorite: Bool? public let keywords: [Keyword]? public let aiStatus: AIStatus? @@ -42,6 +43,7 @@ public struct Card: Hashable { description: String? = nil, category: String? = nil, createdAt: Date, + readAt: Date?, isFavorite: Bool? = nil, keywords: [Keyword]? = nil, thumbnailImageUrl _: String? = nil, @@ -55,6 +57,7 @@ public struct Card: Hashable { self.description = description self.category = category self.createdAt = createdAt + self.readAt = readAt self.isFavorite = isFavorite self.keywords = keywords self.aiStatus = aiStatus diff --git a/Projects/Core/Services/ResponseDTO/Common/AIClassificationCardDTO.swift b/Projects/Core/Services/ResponseDTO/Common/AIClassificationCardDTO.swift index 83b3ad9a..5ac9f7fb 100644 --- a/Projects/Core/Services/ResponseDTO/Common/AIClassificationCardDTO.swift +++ b/Projects/Core/Services/ResponseDTO/Common/AIClassificationCardDTO.swift @@ -32,6 +32,7 @@ extension AIClassificationCardDTO { title: title, description: description, createdAt: convertISO8601StringToDate(createdAt) ?? .now, + readAt: nil, isFavorite: nil, keywords: keywords.map { Keyword(id: UUID().uuidString, name: $0) }, aiStatus: aiStatus?.toDomain ?? .inProgress diff --git a/Projects/Core/Services/ResponseDTO/Common/CardDTO.swift b/Projects/Core/Services/ResponseDTO/Common/CardDTO.swift index 2b1d2806..ba4c5b3e 100644 --- a/Projects/Core/Services/ResponseDTO/Common/CardDTO.swift +++ b/Projects/Core/Services/ResponseDTO/Common/CardDTO.swift @@ -35,6 +35,7 @@ extension CardDTO { description: description, category: "", createdAt: convertISO8601StringToDate(createdAt ?? "") ?? .now, + readAt: convertISO8601StringToDate(readAt ?? ""), isFavorite: isFavorite, keywords: keywords.map { $0.map(\.toDomain) }, aiStatus: aiStatus?.toDomain diff --git a/Projects/Features/Scene/HomeScene/Home.swift b/Projects/Features/Scene/HomeScene/Home.swift index 910db53f..2c9bb3fb 100644 --- a/Projects/Features/Scene/HomeScene/Home.swift +++ b/Projects/Features/Scene/HomeScene/Home.swift @@ -224,8 +224,16 @@ public struct Home { case let .cards(.cardTapped(item)): guard let url = URL(string: item.urlString) else { return .none } state.isNavigationPushed = true - return .send(.routeToWebScreen(url)) + return .run { send in + await send(.routeToWebScreen(url)) + + if item.readAt == nil { + try await postAPIClient.readPost(item.id) + + } + } + case let .cards(.showModalButtonTapped(postId: postId, folderId: folderId)): var folderList = UserFolder.shared.list folderList.removeValue(forKey: "all")