feat(home): 추천 배너 섹션을 연결한다
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user