feat(home): 최근 소식 섹션을 추가한다
This commit is contained in:
@@ -273,6 +273,9 @@
|
||||
401C10512FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401C10542FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift */; };
|
||||
401C10522FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401C10542FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift */; };
|
||||
401C10532FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401C10542FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift */; };
|
||||
401C10552FEFD00000A5BBA3 /* MainHomeFollowingNewsSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401C10582FEFD00000A5BBA3 /* MainHomeFollowingNewsSection.swift */; };
|
||||
401C10562FEFD00000A5BBA3 /* MainHomeFollowingNewsSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401C10582FEFD00000A5BBA3 /* MainHomeFollowingNewsSection.swift */; };
|
||||
401C10572FEFD00000A5BBA3 /* MainHomeFollowingNewsSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 401C10582FEFD00000A5BBA3 /* MainHomeFollowingNewsSection.swift */; };
|
||||
40235DED2E3797EB00B09A87 /* RecentContent+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40235DEC2E3797EB00B09A87 /* RecentContent+CoreDataClass.swift */; };
|
||||
40235DEE2E3797EB00B09A87 /* RecentContent+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40235DEC2E3797EB00B09A87 /* RecentContent+CoreDataClass.swift */; };
|
||||
40235DF02E37983D00B09A87 /* PersistenceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40235DEF2E37983D00B09A87 /* PersistenceController.swift */; };
|
||||
@@ -1816,6 +1819,7 @@
|
||||
401C10492FEF900000A5BBA3 /* MainHomeFollowingChatSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainHomeFollowingChatSection.swift; sourceTree = "<group>"; };
|
||||
401C10502FEFA00000A5BBA3 /* MainHomeFollowingScheduleSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainHomeFollowingScheduleSection.swift; sourceTree = "<group>"; };
|
||||
401C10542FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainHomeFollowingRankingNewsCard.swift; sourceTree = "<group>"; };
|
||||
401C10582FEFD00000A5BBA3 /* MainHomeFollowingNewsSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainHomeFollowingNewsSection.swift; sourceTree = "<group>"; };
|
||||
40235DEC2E3797EB00B09A87 /* RecentContent+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RecentContent+CoreDataClass.swift"; sourceTree = "<group>"; };
|
||||
40235DEF2E37983D00B09A87 /* PersistenceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersistenceController.swift; sourceTree = "<group>"; };
|
||||
40235DF22E37987300B09A87 /* RecentContentService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecentContentService.swift; sourceTree = "<group>"; };
|
||||
@@ -2832,6 +2836,7 @@
|
||||
401C10492FEF900000A5BBA3 /* MainHomeFollowingChatSection.swift */,
|
||||
401C10502FEFA00000A5BBA3 /* MainHomeFollowingScheduleSection.swift */,
|
||||
401C10542FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift */,
|
||||
401C10582FEFD00000A5BBA3 /* MainHomeFollowingNewsSection.swift */,
|
||||
);
|
||||
path = Components;
|
||||
sourceTree = "<group>";
|
||||
@@ -5505,6 +5510,7 @@
|
||||
401C104A2FEF900000A5BBA3 /* MainHomeFollowingChatSection.swift in Sources */,
|
||||
401C104D2FEFA00000A5BBA3 /* MainHomeFollowingScheduleSection.swift in Sources */,
|
||||
401C10512FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift in Sources */,
|
||||
401C10552FEFD00000A5BBA3 /* MainHomeFollowingNewsSection.swift in Sources */,
|
||||
409143302A85652F00EEBFB1 /* CanChargeView.swift in Sources */,
|
||||
40975CA32B572298004E2F1B /* LiveRoomOverlayStrokeTextButton.swift in Sources */,
|
||||
40235DED2E3797EB00B09A87 /* RecentContent+CoreDataClass.swift in Sources */,
|
||||
@@ -6274,6 +6280,7 @@
|
||||
401C104B2FEF900000A5BBA3 /* MainHomeFollowingChatSection.swift in Sources */,
|
||||
401C104E2FEFA00000A5BBA3 /* MainHomeFollowingScheduleSection.swift in Sources */,
|
||||
401C10522FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift in Sources */,
|
||||
401C10562FEFD00000A5BBA3 /* MainHomeFollowingNewsSection.swift in Sources */,
|
||||
B3AF650899B8FC84E0C0CDA0 /* MainPlaceholderTabView.swift in Sources */,
|
||||
CA65AD0D677B4A8E9CAC0E15 /* MainTab.swift in Sources */,
|
||||
A0643C829BE7377DC09112CB /* MainTabBarButton.swift in Sources */,
|
||||
@@ -7073,6 +7080,7 @@
|
||||
401C104C2FEF900000A5BBA3 /* MainHomeFollowingChatSection.swift in Sources */,
|
||||
401C104F2FEFA00000A5BBA3 /* MainHomeFollowingScheduleSection.swift in Sources */,
|
||||
401C10532FEFC00000A5BBA3 /* MainHomeFollowingRankingNewsCard.swift in Sources */,
|
||||
401C10572FEFD00000A5BBA3 /* MainHomeFollowingNewsSection.swift in Sources */,
|
||||
ACD71056E97E13E48941ABBB /* MainPlaceholderTabView.swift in Sources */,
|
||||
33BA3AB731849284E62AE04B /* MainTab.swift in Sources */,
|
||||
B11681AC02BF51C6E2FA6FF3 /* MainTabBarButton.swift in Sources */,
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
import SwiftUI
|
||||
|
||||
struct MainHomeFollowingNewsSection: View {
|
||||
let recentNews: [FollowingNewsResponse]
|
||||
let onTapCreator: (Int) -> Void
|
||||
let onTapContent: (Int) -> Void
|
||||
|
||||
init(
|
||||
recentNews: [FollowingNewsResponse],
|
||||
onTapCreator: @escaping (Int) -> Void = { _ in },
|
||||
onTapContent: @escaping (Int) -> Void = { _ in }
|
||||
) {
|
||||
self.recentNews = recentNews
|
||||
self.onTapCreator = onTapCreator
|
||||
self.onTapContent = onTapContent
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
if !recentNews.isEmpty {
|
||||
VStack(alignment: .leading, spacing: SodaSpacing.s14) {
|
||||
SectionTitle(title: I18n.HomeFollowing.recentNewsTitle)
|
||||
|
||||
VStack(alignment: .leading, spacing: SodaSpacing.s8) {
|
||||
ForEach(recentNews) { news in
|
||||
newsItemView(news)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, SodaSpacing.s14)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func newsItemView(_ news: FollowingNewsResponse) -> some View {
|
||||
switch news.type {
|
||||
case .creatorRanking:
|
||||
if let creatorRanking = news.creatorRanking {
|
||||
MainHomeFollowingRankingNewsCard(
|
||||
creatorRanking: creatorRanking,
|
||||
onTapCreator: onTapCreator
|
||||
)
|
||||
}
|
||||
|
||||
case .contentRanking:
|
||||
if let contentRanking = news.contentRanking {
|
||||
MainHomeFollowingRankingNewsCard(
|
||||
contentRanking: contentRanking,
|
||||
onTapContent: onTapContent
|
||||
)
|
||||
}
|
||||
|
||||
case .communityPost:
|
||||
if let communityPost = news.communityPost {
|
||||
CommunityPostCard(
|
||||
postId: communityPost.postId,
|
||||
creatorNickname: communityPost.creatorNickname,
|
||||
creatorProfileImageUrl: communityPost.creatorProfileImage,
|
||||
content: communityPost.content,
|
||||
imageUrl: communityPost.imageUrl,
|
||||
audioUrl: nil,
|
||||
price: 0,
|
||||
existOrdered: true,
|
||||
createdAt: communityPost.relativeCreatedAtText(),
|
||||
isLike: false,
|
||||
likeCount: communityPost.likeCount,
|
||||
commentCount: communityPost.commentCount
|
||||
)
|
||||
}
|
||||
|
||||
case .audioContent, .photoContent, .unknown:
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension FollowingCommunityPostNewsResponse {
|
||||
func relativeCreatedAtText(now: Date = Date()) -> String {
|
||||
DateParser.relativeTimeText(fromUTC: createdAt, fallback: createdAt, now: now)
|
||||
}
|
||||
}
|
||||
|
||||
struct MainHomeFollowingNewsSection_Previews: PreviewProvider {
|
||||
private static let previewImageUrl = "https://picsum.photos/500/500"
|
||||
|
||||
static var previews: some View {
|
||||
MainHomeFollowingNewsSection(
|
||||
recentNews: [
|
||||
FollowingNewsResponse(
|
||||
newsId: "creator-ranking",
|
||||
type: .creatorRanking,
|
||||
visibleFromAtUtc: "2026-07-01T00:00:00Z",
|
||||
creatorRanking: FollowingCreatorRankingNewsResponse(
|
||||
rank: 2,
|
||||
creatorId: 1,
|
||||
nickname: "크리에이터",
|
||||
profileImageUrl: previewImageUrl
|
||||
),
|
||||
audioContent: nil,
|
||||
photoContent: nil,
|
||||
contentRanking: nil,
|
||||
communityPost: nil
|
||||
),
|
||||
FollowingNewsResponse(
|
||||
newsId: "community-post",
|
||||
type: .communityPost,
|
||||
visibleFromAtUtc: "2026-07-01T00:00:00Z",
|
||||
creatorRanking: nil,
|
||||
audioContent: nil,
|
||||
photoContent: nil,
|
||||
contentRanking: nil,
|
||||
communityPost: FollowingCommunityPostNewsResponse(
|
||||
postId: 10,
|
||||
creatorProfileImage: previewImageUrl,
|
||||
creatorNickname: "크리에이터",
|
||||
imageUrl: previewImageUrl,
|
||||
content: "팔로잉 크리에이터의 커뮤니티 게시글입니다.",
|
||||
createdAt: "2026-07-01T00:00:00Z",
|
||||
likeCount: 5,
|
||||
commentCount: 2
|
||||
)
|
||||
)
|
||||
]
|
||||
)
|
||||
.padding(.vertical, SodaSpacing.s20)
|
||||
.background(Color.black)
|
||||
.previewLayout(.sizeThatFits)
|
||||
}
|
||||
}
|
||||
@@ -331,7 +331,7 @@
|
||||
|
||||
### Phase 9: 최근 소식 커뮤니티 카드
|
||||
|
||||
- [ ] **Task 9.1: 최근 소식 커뮤니티 카드 조립**
|
||||
- [x] **Task 9.1: 최근 소식 커뮤니티 카드 조립**
|
||||
- 대상 파일:
|
||||
- 생성 또는 수정: `SodaLive/Sources/V2/Main/Home/Following/Components/MainHomeFollowingNewsSection.swift`
|
||||
- 확인: `SodaLive/Sources/V2/Component/Card/CommunityPostCard.swift`
|
||||
@@ -344,7 +344,7 @@
|
||||
- 실행 명령: `rg "COMMUNITY_POST|communityPost|CommunityPostCard|postId|creatorProfileImage|likeCount|commentCount|audioUrl: nil|price: 0|existOrdered: true" SodaLive/Sources/V2/Main/Home/Following/Components/MainHomeFollowingNewsSection.swift`
|
||||
- 기대 결과: community post payload가 기존 community card 표시값으로 매핑된다.
|
||||
|
||||
- [ ] **Task 9.2: 커뮤니티 게시글 tap 라우팅 제약 처리**
|
||||
- [x] **Task 9.2: 커뮤니티 게시글 tap 라우팅 제약 처리**
|
||||
- 대상 파일:
|
||||
- 확인: `SodaLive/Sources/App/AppState.swift`
|
||||
- 확인: `SodaLive/Sources/App/AppStep.swift`
|
||||
@@ -537,6 +537,13 @@
|
||||
- 2026-07-01: `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug -derivedDataPath "/var/folders/yh/8xsbvpsj5wg2qnxzxdp11_gm0000gn/T/opencode/SodaLiveDerivedDataPhase7" build`를 실행해 timeline 수정 후 빌드 성공을 확인했다. 기존 warning은 남아 있으나 컴파일 오류는 없었다.
|
||||
- 2026-07-01: `MainHomeFollowingView` 및 팔로잉 하위 컴포넌트의 런타임 노출 하드코딩 문구(`팔로잉`, `LIVE`, `Direct`, `오늘`, `On Air`, 스케줄 활동 태그)를 `I18n.HomeFollowing` 참조로 전환했다. Preview 샘플 문자열과 API 응답 기반 동적 문자열은 런타임 고정 문구가 아니므로 유지했다.
|
||||
- 2026-07-01: Phase 8 구현을 진행해 Figma `24:5717` 기준 `MainHomeFollowingRankingNewsCard`를 추가했다. `CREATOR_RANKING`은 `FollowingCreatorRankingNewsResponse`, `CONTENT_RANKING`은 `FollowingContentRankingNewsResponse` initializer로 분리하고, `rank`를 `N위`로 표시하며 `Color.soda400`로 강조했다.
|
||||
- 2026-07-01: Phase 9 구현을 진행해 `MainHomeFollowingNewsSection`을 추가했다. `COMMUNITY_POST`는 `communityPost` payload가 있을 때만 `CommunityPostCard`로 렌더링하고, `postId`, `creatorProfileImage`, `creatorNickname`, `imageUrl`, `content`, `createdAt`, `likeCount`, `commentCount`를 매핑했다. `audioUrl = nil`, `price = 0`, `existOrdered = true`, `isLike = false`로 설정했다.
|
||||
- 2026-07-01: `AppState.setPendingCommunityCommentDeepLink(creatorId:postId:)`, `AppState.consumePendingCommunityCommentPostId(creatorId:)`, `AppStep.creatorCommunityAll(creatorId:)`, `ContentView`의 `CreatorCommunityAllView(creatorId:)`, `CreatorCommunityAllView`의 pending post 처리 흐름을 확인했다. 기존 직접 진입 경로는 `creatorId`를 요구하고 `FollowingCommunityPostNewsResponse`에는 `creatorId`가 없으므로 Phase 9에서는 `COMMUNITY_POST` 상세/댓글 진입을 연결하지 않았다.
|
||||
- 2026-07-01: `rg "COMMUNITY_POST|communityPost|CommunityPostCard|postId|creatorProfileImage|likeCount|commentCount|audioUrl: nil|price: 0|existOrdered: true|isLike: false|relativeCreatedAtText|DateParser.relativeTimeText" SodaLive/Sources/V2/Main/Home/Following/Components/MainHomeFollowingNewsSection.swift`로 Phase 9.1 매핑을 확인했다.
|
||||
- 2026-07-01: `rg "setPendingCommunityCommentDeepLink|consumePendingCommunityCommentPostId|creatorCommunityAll|case chatRoom|case creatorCommunity" SodaLive/Sources/App/AppState.swift SodaLive/Sources/App/AppStep.swift SodaLive/Sources/ContentView.swift SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllView.swift`로 Phase 9.2 라우팅 제약을 확인했다.
|
||||
- 2026-07-01: `rg "localhost:3845|setAppStep\(step: \.creatorCommunityAll|setPendingCommunityCommentDeepLink|onTapComment:" SodaLive/Sources/V2/Main/Home/Following/Components/MainHomeFollowingNewsSection.swift` 결과가 없어 Figma localhost asset 미사용과 `COMMUNITY_POST` 상세/댓글 진입 미연결을 확인했다.
|
||||
- 2026-07-01: `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" test -derivedDataPath "/var/folders/yh/8xsbvpsj5wg2qnxzxdp11_gm0000gn/T/opencode/SodaLiveDerivedDataPhase9Test"`는 `Scheme SodaLive is not currently configured for the test action.`으로 실패해 테스트 액션 미구성 상태를 확인했다.
|
||||
- 2026-07-01: `xcodebuild -workspace "SodaLive.xcworkspace" -scheme "SodaLive" -configuration Debug -derivedDataPath "/var/folders/yh/8xsbvpsj5wg2qnxzxdp11_gm0000gn/T/opencode/SodaLiveDerivedDataPhase9" build`를 실행해 Phase 9 신규 Swift 파일 컴파일과 빌드 성공을 확인했다. 기존 duplicate build file/run script/AppIntents/dependency scan warning은 남아 있으나 컴파일 오류는 없었다.
|
||||
- 2026-07-01: `SodaLive.xcodeproj/project.pbxproj`에 `MainHomeFollowingRankingNewsCard.swift` 파일 참조와 Sources build file을 추가해 Xcode navigator와 target compile sources에서 확인 가능하도록 등록했다.
|
||||
- 2026-07-01: `rg "struct MainHomeFollowingRankingNewsCard|FollowingCreatorRankingNewsResponse|FollowingContentRankingNewsResponse|rank|Color.soda400|onTapCreator|onTapContent|24:5717" SodaLive/Sources/V2/Main/Home/Following/Components/MainHomeFollowingRankingNewsCard.swift docs/20260630_메인_홈_팔로잉_탭/plan-task.md`로 Phase 8 정적 요구사항을 확인했다.
|
||||
- 2026-07-01: `rg "localhost:3845|// Figma|/\*|english\(" SodaLive/Sources/V2/Main/Home/Following/Components/MainHomeFollowingRankingNewsCard.swift` 결과가 없어 Figma localhost asset, 불필요한 주석, 잘못된 font family 호출이 없음을 확인했다.
|
||||
|
||||
Reference in New Issue
Block a user