Skip to content

Commit

Permalink
✨ 홈: 링크 클릭 시 읽음 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
AhnSangHee committed Aug 23, 2024
1 parent 5c56d31 commit bbb8b89
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Projects/Core/Models/Card.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand All @@ -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,
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions Projects/Core/Services/ResponseDTO/Common/CardDTO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion Projects/Features/Scene/HomeScene/Home.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit bbb8b89

Please sign in to comment.