Skip to content

Commit e338c4d

Browse files
committed
[fix] #203 링크 읽음 처리 수정
1 parent 56850ea commit e338c4d

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

Projects/Domain/Sources/Base/BaseContentItem.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public struct BaseContentItem: Identifiable, Equatable, PokitLinkCardItem, Sorta
1919
public let data: String
2020
public let domain: String
2121
public let createdAt: String
22-
public let isRead: Bool?
22+
public var isRead: Bool?
2323
public var isFavorite: Bool?
2424
public let keyword: String?
2525

Projects/Feature/FeatureContentCard/Sources/ContentCard/ContentCardFeature.swift

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public struct ContentCardFeature {
5252
public enum InnerAction: Equatable {
5353
case 메타데이터_조회_수행_반영(String)
5454
case 즐겨찾기_API_반영(Bool)
55+
case 컨텐츠_상세_조회_API_반영
5556
}
5657

5758
@CasePathable
@@ -60,6 +61,7 @@ public struct ContentCardFeature {
6061
case 즐겨찾기_API
6162
case 즐겨찾기_취소_API
6263
case 썸네일_수정_API
64+
case 컨텐츠_상세_조회_API
6365
}
6466

6567
public enum ScopeAction: Equatable { case doNothing }
@@ -111,7 +113,10 @@ private extension ContentCardFeature {
111113
guard let url = URL(string: state.content.data) else {
112114
return .none
113115
}
114-
return .run { _ in await openURL(url) }
116+
return .run { send in
117+
await send(.async(.컨텐츠_상세_조회_API))
118+
await openURL(url)
119+
}
115120
case .컨텐츠_항목_케밥_버튼_눌렀을때:
116121
return .send(.delegate(.컨텐츠_항목_케밥_버튼_눌렀을때(content: state.content)))
117122
case .메타데이터_조회:
@@ -137,6 +142,9 @@ private extension ContentCardFeature {
137142
case .즐겨찾기_API_반영(let favorite):
138143
state.content.isFavorite = favorite
139144
return .none
145+
case .컨텐츠_상세_조회_API_반영:
146+
state.content.isRead = true
147+
return .none
140148
}
141149
}
142150

@@ -167,6 +175,11 @@ private extension ContentCardFeature {
167175

168176
try await contentClient.썸네일_수정("\(content.id)", request)
169177
}
178+
case .컨텐츠_상세_조회_API:
179+
return .run { [id = state.content.id] send in
180+
let _ = try await contentClient.컨텐츠_상세_조회("\(id)")
181+
await send(.inner(.컨텐츠_상세_조회_API_반영))
182+
}
170183
}
171184
}
172185

0 commit comments

Comments
 (0)