From bfd34329d726ee79076616e60640803367c866c9 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Sat, 22 Feb 2025 10:45:09 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BD=98=ED=85=90=EC=B8=A0=20=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=20=EB=AC=B4=EB=A3=8C=20=ED=83=AD=20-=20=EC=83=88?= =?UTF-8?q?=EB=A1=9C=EC=9A=B4=20=EB=AC=B4=EB=A3=8C=20=EC=BD=98=ED=85=90?= =?UTF-8?q?=EC=B8=A0=20=EC=A0=84=EC=B2=B4=EB=B3=B4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SodaLive/Sources/App/AppStep.swift | 2 +- SodaLive/Sources/Content/All/ContentNewAllView.swift | 10 +++++++--- .../Sources/Content/All/ContentNewAllViewModel.swift | 3 +++ SodaLive/Sources/Content/ContentApi.swift | 5 +++-- SodaLive/Sources/Content/ContentRepository.swift | 3 ++- .../Main/NewContent/ContentMainNewContentView.swift | 2 +- .../Main/V2/Content/ContentMainTabContentView.swift | 2 +- .../Content/Main/V2/Free/ContentMainTabFreeView.swift | 5 ++++- SodaLive/Sources/ContentView.swift | 4 ++-- 9 files changed, 24 insertions(+), 12 deletions(-) diff --git a/SodaLive/Sources/App/AppStep.swift b/SodaLive/Sources/App/AppStep.swift index 2e01e29..7913104 100644 --- a/SodaLive/Sources/App/AppStep.swift +++ b/SodaLive/Sources/App/AppStep.swift @@ -108,7 +108,7 @@ enum AppStep { case orderListAll - case newContentAll + case newContentAll(isFree: Bool) case curationAll(title: String, curationId: Int) diff --git a/SodaLive/Sources/Content/All/ContentNewAllView.swift b/SodaLive/Sources/Content/All/ContentNewAllView.swift index a92b506..6fba02d 100644 --- a/SodaLive/Sources/Content/All/ContentNewAllView.swift +++ b/SodaLive/Sources/Content/All/ContentNewAllView.swift @@ -17,13 +17,15 @@ struct ContentNewAllView: View { GridItem(.flexible(), alignment: .top) ] + let isFree: Bool + var body: some View { NavigationView { BaseView(isLoading: $viewModel.isLoading) { VStack(alignment: .leading, spacing: 13.3) { - DetailNavigationBar(title: "새로운 단편") + DetailNavigationBar(title: isFree ? "새로운 무료 콘텐츠" : "새로운 단편") - Text("※ 최근 2주간 등록된 새로운 단편 입니다.") + Text("※ 최근 2주간 등록된 새로운 무료 콘텐츠 입니다.") .font(.custom(Font.medium.rawValue, size: 14.7)) .foregroundColor(.graybb) .padding(.horizontal, 13.3) @@ -72,16 +74,18 @@ struct ContentNewAllView: View { } } .onAppear { + viewModel.isFree = isFree viewModel.getThemeList() viewModel.getNewContentList() } } + .navigationBarHidden(true) } } } struct ContentNewAllView_Previews: PreviewProvider { static var previews: some View { - ContentNewAllView() + ContentNewAllView(isFree: false) } } diff --git a/SodaLive/Sources/Content/All/ContentNewAllViewModel.swift b/SodaLive/Sources/Content/All/ContentNewAllViewModel.swift index 270fca0..ee55f67 100644 --- a/SodaLive/Sources/Content/All/ContentNewAllViewModel.swift +++ b/SodaLive/Sources/Content/All/ContentNewAllViewModel.swift @@ -33,11 +33,14 @@ final class ContentNewAllViewModel: ObservableObject { var isLast = false private let pageSize = 10 + var isFree: Bool = false + func getNewContentList() { if (!isLast && !isLoading) { isLoading = true repository.getNewContentAllOfTheme( + isFree: isFree, theme: selectedTheme == "전체" ? "" : selectedTheme, page: page, size: pageSize diff --git a/SodaLive/Sources/Content/ContentApi.swift b/SodaLive/Sources/Content/ContentApi.swift index 7c2d757..31d473f 100644 --- a/SodaLive/Sources/Content/ContentApi.swift +++ b/SodaLive/Sources/Content/ContentApi.swift @@ -30,7 +30,7 @@ enum ContentApi { case donation(request: AudioContentDonationRequest) case modifyComment(request: ModifyCommentRequest) case getNewContentThemeList - case getNewContentAllOfTheme(theme: String, isAdultContentVisible: Bool, contentType: ContentType, page: Int, size: Int) + case getNewContentAllOfTheme(isFree: Bool, theme: String, isAdultContentVisible: Bool, contentType: ContentType, page: Int, size: Int) case getAudioContentListByCurationId(curationId: Int, isAdultContentVisible: Bool, contentType: ContentType, page: Int, size: Int, sort: ContentCurationViewModel.Sort) case getContentRanking(page: Int, size: Int, sortType: String) case getContentRankingSortType @@ -336,8 +336,9 @@ extension ContentApi: TargetType { case .getNewContentThemeList: return .requestPlain - case .getNewContentAllOfTheme(let theme, let isAdultContentVisible, let contentType, let page, let size): + case .getNewContentAllOfTheme(let isFree, let theme, let isAdultContentVisible, let contentType, let page, let size): let parameters = [ + "isFree": isFree, "theme": theme, "isAdultContentVisible": isAdultContentVisible, "contentType": contentType, diff --git a/SodaLive/Sources/Content/ContentRepository.swift b/SodaLive/Sources/Content/ContentRepository.swift index 014a01d..1a105d2 100644 --- a/SodaLive/Sources/Content/ContentRepository.swift +++ b/SodaLive/Sources/Content/ContentRepository.swift @@ -112,9 +112,10 @@ final class ContentRepository { return api.requestPublisher(.getNewContentThemeList) } - func getNewContentAllOfTheme(theme: String, page: Int, size: Int) -> AnyPublisher { + func getNewContentAllOfTheme(isFree: Bool, theme: String, page: Int, size: Int) -> AnyPublisher { return api.requestPublisher( .getNewContentAllOfTheme( + isFree: isFree, theme: theme, isAdultContentVisible: UserDefaults.isAdultContentVisible(), contentType: ContentType(rawValue: UserDefaults.string(forKey: .contentPreference)) ?? ContentType.ALL, diff --git a/SodaLive/Sources/Content/Main/NewContent/ContentMainNewContentView.swift b/SodaLive/Sources/Content/Main/NewContent/ContentMainNewContentView.swift index 8911393..89b4d2d 100644 --- a/SodaLive/Sources/Content/Main/NewContent/ContentMainNewContentView.swift +++ b/SodaLive/Sources/Content/Main/NewContent/ContentMainNewContentView.swift @@ -24,7 +24,7 @@ struct ContentMainNewContentView: View { .resizable() .frame(width: 20, height: 20) .onTapGesture { - AppState.shared.setAppStep(step: .newContentAll) + AppState.shared.setAppStep(step: .newContentAll(isFree: false)) } } diff --git a/SodaLive/Sources/Content/Main/V2/Content/ContentMainTabContentView.swift b/SodaLive/Sources/Content/Main/V2/Content/ContentMainTabContentView.swift index d3c4e6b..b9700ef 100644 --- a/SodaLive/Sources/Content/Main/V2/Content/ContentMainTabContentView.swift +++ b/SodaLive/Sources/Content/Main/V2/Content/ContentMainTabContentView.swift @@ -25,7 +25,7 @@ struct ContentMainTabContentView: View { title: "새로운 단편", onClickMore: { AppState.shared - .setAppStep(step: .newContentAll) + .setAppStep(step: .newContentAll(isFree: false)) }, themeList: viewModel.contentThemeList, contentList: viewModel.newContentList diff --git a/SodaLive/Sources/Content/Main/V2/Free/ContentMainTabFreeView.swift b/SodaLive/Sources/Content/Main/V2/Free/ContentMainTabFreeView.swift index 9c6634f..efccabb 100644 --- a/SodaLive/Sources/Content/Main/V2/Free/ContentMainTabFreeView.swift +++ b/SodaLive/Sources/Content/Main/V2/Free/ContentMainTabFreeView.swift @@ -44,7 +44,10 @@ struct ContentMainTabFreeView: View { if !viewModel.themeList.isEmpty { ContentMainNewContentViewV2( title: "새로운 무료 콘텐츠", - onClickMore: {}, + onClickMore: { + AppState.shared + .setAppStep(step: .newContentAll(isFree: true)) + }, themeList: viewModel.themeList, contentList: viewModel.newFreeContentList ) { diff --git a/SodaLive/Sources/ContentView.swift b/SodaLive/Sources/ContentView.swift index a7d8fc1..2d7e7b9 100644 --- a/SodaLive/Sources/ContentView.swift +++ b/SodaLive/Sources/ContentView.swift @@ -161,8 +161,8 @@ struct ContentView: View { case .userProfileFanTalkAll(let userId): UserProfileFanTalkAllView(userId: userId) - case .newContentAll: - ContentNewAllView() + case .newContentAll(let isFree): + ContentNewAllView(isFree: isFree) case .curationAll(let title, let curationId): ContentCurationView(title: title, curationId: curationId)