diff --git a/today-s-sound/Data/Models/Feed.swift b/today-s-sound/Data/Models/Feed.swift index 4cc7d1d..f1c5c15 100644 --- a/today-s-sound/Data/Models/Feed.swift +++ b/today-s-sound/Data/Models/Feed.swift @@ -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 @@ -15,6 +16,7 @@ struct HomeFeedItemResponse: Codable, Identifiable { case subscriptionId case alias case summaryContent + case postUrl case timeAgo case isUrgent } @@ -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 @@ -60,7 +62,7 @@ struct FeedItemResponse: Codable, Identifiable { case alias case summaryTitle case summaryContent - case url + case postUrl case timeAgo case isUrgent } diff --git a/today-s-sound/Presentation/Features/Feed/FeedModel.swift b/today-s-sound/Presentation/Features/Feed/FeedModel.swift index 1ad5c79..e00edb0 100644 --- a/today-s-sound/Presentation/Features/Feed/FeedModel.swift +++ b/today-s-sound/Presentation/Features/Feed/FeedModel.swift @@ -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시간 전" 등) @@ -21,6 +22,7 @@ struct FeedItem: Identifiable, Hashable { alias: String, summary: String, summaryTitle: String, + postUrl: String, publishedAt: Date, timeAgo: String = "" ) { @@ -28,6 +30,7 @@ struct FeedItem: Identifiable, Hashable { self.alias = alias self.summary = summary self.summaryTitle = summaryTitle + self.postUrl = postUrl self.publishedAt = publishedAt self.timeAgo = timeAgo } diff --git a/today-s-sound/Presentation/Features/Feed/FeedView.swift b/today-s-sound/Presentation/Features/Feed/FeedView.swift index 6be024d..329aac2 100644 --- a/today-s-sound/Presentation/Features/Feed/FeedView.swift +++ b/today-s-sound/Presentation/Features/Feed/FeedView.swift @@ -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) { @@ -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에서 원문 링크를 엽니다") } } diff --git a/today-s-sound/Presentation/Features/Feed/FeedViewModel.swift b/today-s-sound/Presentation/Features/Feed/FeedViewModel.swift index 4da450a..8fda9ae 100644 --- a/today-s-sound/Presentation/Features/Feed/FeedViewModel.swift +++ b/today-s-sound/Presentation/Features/Feed/FeedViewModel.swift @@ -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 ) @@ -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 )