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
6 changes: 4 additions & 2 deletions today-s-sound/Data/Models/Feed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ struct HomeFeedItemResponse: Codable, Identifiable {
let subscriptionId: Int64
let alias: String
let summaryContent: String
let postUrl: String
let timeAgo: String
let isUrgent: Bool

Expand All @@ -15,6 +16,7 @@ struct HomeFeedItemResponse: Codable, Identifiable {
case subscriptionId
case alias
case summaryContent
case postUrl
case timeAgo
case isUrgent
}
Expand Down Expand Up @@ -48,7 +50,7 @@ struct FeedItemResponse: Codable, Identifiable {
let alias: String
let summaryTitle: String
let summaryContent: String
let url: String
let postUrl: String
let timeAgo: String
let isUrgent: Bool

Expand All @@ -60,7 +62,7 @@ struct FeedItemResponse: Codable, Identifiable {
case alias
case summaryTitle
case summaryContent
case url
case postUrl
case timeAgo
case isUrgent
}
Expand Down
3 changes: 3 additions & 0 deletions today-s-sound/Presentation/Features/Feed/FeedModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ struct FeedItem: Identifiable, Hashable {
let alias: String
let summary: String
let summaryTitle: String
let postUrl: String
let publishedAt: Date
let timeAgo: String // 서버에서 받은 시간 문자열 ("2시간 전" 등)

Expand All @@ -21,13 +22,15 @@ struct FeedItem: Identifiable, Hashable {
alias: String,
summary: String,
summaryTitle: String,
postUrl: String,
publishedAt: Date,
timeAgo: String = ""
) {
self.id = id
self.alias = alias
self.summary = summary
self.summaryTitle = summaryTitle
self.postUrl = postUrl
self.publishedAt = publishedAt
self.timeAgo = timeAgo
}
Expand Down
6 changes: 6 additions & 0 deletions today-s-sound/Presentation/Features/Feed/FeedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ struct FeedView: View {
private struct FeedCard: View {
let item: FeedItem
let theme: AppTheme
@Environment(\.openURL) private var openURL

var body: some View {
VStack(alignment: .leading, spacing: 12) {
Expand Down Expand Up @@ -237,10 +238,15 @@ private struct FeedCard: View {
RoundedRectangle(cornerRadius: 16)
.stroke(Color.border(theme), lineWidth: 1)
)
.onTapGesture(count: 2) {
guard let url = URL(string: item.postUrl) else { return }
openURL(url)
}
.accessibilityElement(children: .combine)
.accessibilityLabel(
"\(item.summaryTitle) 새 글, \(item.alias), \(item.summary), \(item.timeAgo)"
)
.accessibilityHint("두 번 탭하면 Safari에서 원문 링크를 엽니다")
}
}

Expand Down
2 changes: 2 additions & 0 deletions today-s-sound/Presentation/Features/Feed/FeedViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ final class FeedViewModel: ObservableObject {
alias: response.alias,
summary: response.summaryContent,
summaryTitle: response.summaryTitle,
postUrl: response.postUrl,
publishedAt: self.parseTimeAgo(response.timeAgo),
timeAgo: response.timeAgo
)
Expand Down Expand Up @@ -186,6 +187,7 @@ final class FeedViewModel: ObservableObject {
alias: response.alias,
summary: response.summaryContent,
summaryTitle: response.summaryTitle,
postUrl: response.postUrl,
publishedAt: self.parseTimeAgo(response.timeAgo),
timeAgo: response.timeAgo
)
Expand Down
Loading