feat(recommendation): 추천 서브 배너와 연속 순환을 추가한다
This commit is contained in:
@@ -32,6 +32,12 @@ struct MainContentRecommendationView: View {
|
||||
onTapBanner: onTapBanner
|
||||
)
|
||||
|
||||
if !recommendations.eligibleSubBanners.isEmpty {
|
||||
SubBannerCarousel(items: recommendations.eligibleSubBanners) {
|
||||
SubBannerLinkOpener.open($0)
|
||||
}
|
||||
}
|
||||
|
||||
MainContentVoiceOnOnlySection(
|
||||
title: I18n.MainContentRecommendation.sodaLiveOnlySectionTitle,
|
||||
items: recommendations.originalSeries,
|
||||
|
||||
+8
@@ -43,6 +43,14 @@ final class MainContentRecommendationViewModel: ObservableObject {
|
||||
} receiveValue: { [weak self] response in
|
||||
guard let self else { return }
|
||||
|
||||
guard response.statusCode == 200 else {
|
||||
self.errorMessage = I18n.MainContentRecommendation.loadFailedMessage
|
||||
self.isShowPopup = true
|
||||
self.isLoading = false
|
||||
self.hasLoaded = true
|
||||
return
|
||||
}
|
||||
|
||||
let responseData = response.data
|
||||
|
||||
do {
|
||||
|
||||
+6
@@ -2,6 +2,7 @@ import Foundation
|
||||
|
||||
struct AudioRecommendationsResponse: Decodable {
|
||||
let banners: [AudioBannerResponse]
|
||||
let subBanners: [SubBanner]
|
||||
let originalSeries: [OriginalSeriesResponse]
|
||||
let latestAudios: [AudioCardResponse]
|
||||
let newAndHotAudios: [AudioCardResponse]
|
||||
@@ -10,8 +11,13 @@ struct AudioRecommendationsResponse: Decodable {
|
||||
let mostCommentedAudios: [CommentedAudioResponse]
|
||||
let recommendedAudios: [AudioCardResponse]
|
||||
|
||||
var eligibleSubBanners: [SubBanner] {
|
||||
subBanners.filter { $0.placement == .contentRecommendation && $0.isEligible }
|
||||
}
|
||||
|
||||
var isEmpty: Bool {
|
||||
banners.isEmpty &&
|
||||
eligibleSubBanners.isEmpty &&
|
||||
originalSeries.isEmpty &&
|
||||
latestAudios.isEmpty &&
|
||||
newAndHotAudios.isEmpty &&
|
||||
|
||||
+3
-1
@@ -32,6 +32,8 @@ extension MainContentRecommendationApi: TargetType {
|
||||
}
|
||||
|
||||
var headers: [String: String]? {
|
||||
return ["Authorization": "Bearer \(UserDefaults.string(forKey: UserDefaultsKey.token))"]
|
||||
let token = UserDefaults.string(forKey: .token)
|
||||
guard !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty else { return nil }
|
||||
return ["Authorization": "Bearer \(token)"]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user