feat(home): 추천 배너 섹션을 연결한다

This commit is contained in:
Yu Sung
2026-06-29 15:39:23 +09:00
parent c441fb0b02
commit 0e31c69be8
10 changed files with 454 additions and 41 deletions

View File

@@ -161,7 +161,8 @@ struct MainView: View {
onTapCreator: handleRecommendationCreatorTap,
onTapContent: handleRecommendationContentTap,
onTapCharacter: handleRecommendationCharacterTap,
onTapCommunity: handleRecommendationCommunityTap
onTapCommunity: handleRecommendationCommunityTap,
onTapBanner: handleRecommendationBannerTap
)
case .content:
MainPlaceholderTabView(title: MainTab.content.title)
@@ -478,6 +479,41 @@ struct MainView: View {
}
}
private func handleRecommendationBannerTap(_ item: RecommendationBannerResponse) {
if let eventItem = item.eventItem {
performRecommendationDetailAction {
appState.setAppStep(step: .eventDetail(event: eventItem))
}
return
}
if let creatorId = item.creatorId {
handleRecommendationCreatorTap(creatorId: creatorId)
return
}
if let seriesId = item.seriesId {
performRecommendationDetailAction {
appState.setAppStep(step: .seriesDetail(seriesId: seriesId))
}
return
}
openRecommendationBannerLink(item.link)
}
private func openRecommendationBannerLink(_ link: String?) {
guard let link = link?.trimmingCharacters(in: .whitespacesAndNewlines),
!link.isEmpty,
let url = URL(string: link),
UIApplication.shared.canOpenURL(url) else {
return
}
UIApplication.shared.open(url)
}
private func performRecommendationDetailAction(
requiresAdultContent: Bool = false,
action: @escaping () -> Void