feat(content): 추천 오디오 탭을 추가한다
This commit is contained in:
@@ -172,7 +172,14 @@ struct MainView: View {
|
||||
onTapFollowingSchedule: handleFollowingScheduleTap
|
||||
)
|
||||
case .content:
|
||||
MainPlaceholderTabView(title: MainTab.content.title)
|
||||
MainContentView(
|
||||
onTapCanCharge: handleHomeCanChargeTap,
|
||||
onTapSearch: handleHomeSearchTap,
|
||||
onTapNotificationList: handleHomeNotificationListTap,
|
||||
onTapContent: handleRecommendationContentTap,
|
||||
onTapBanner: handleContentAudioBannerTap,
|
||||
onTapSeries: handleContentOriginalSeriesTap
|
||||
)
|
||||
case .chat:
|
||||
MainPlaceholderTabView(title: MainTab.chat.title)
|
||||
case .my:
|
||||
@@ -548,10 +555,45 @@ struct MainView: View {
|
||||
openRecommendationBannerLink(item.link)
|
||||
}
|
||||
|
||||
private func handleContentAudioBannerTap(_ item: AudioBannerResponse) {
|
||||
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 {
|
||||
handleContentOriginalSeriesTap(seriesId: seriesId)
|
||||
return
|
||||
}
|
||||
|
||||
openRecommendationBannerLink(item.link)
|
||||
}
|
||||
|
||||
private func handleContentOriginalSeriesTap(seriesId: Int) {
|
||||
guard seriesId > 0 else { return }
|
||||
performRecommendationDetailAction {
|
||||
appState.setAppStep(step: .seriesDetail(seriesId: seriesId))
|
||||
}
|
||||
}
|
||||
|
||||
private func openRecommendationBannerLink(_ link: String?) {
|
||||
guard let link = link?.trimmingCharacters(in: .whitespacesAndNewlines),
|
||||
!link.isEmpty,
|
||||
let url = URL(string: link),
|
||||
!link.isEmpty else {
|
||||
return
|
||||
}
|
||||
|
||||
if AppDeepLinkHandler.handle(urlString: link) {
|
||||
return
|
||||
}
|
||||
|
||||
guard let url = URL(string: link),
|
||||
UIApplication.shared.canOpenURL(url) else {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user