From c84f1042e3a770fc751086e106a557302fed6591 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Fri, 15 Dec 2023 00:25:13 +0900 Subject: [PATCH] =?UTF-8?q?=ED=81=AC=EB=A6=AC=EC=97=90=EC=9D=B4=ED=84=B0?= =?UTF-8?q?=20=EC=B1=84=EB=84=90=20-=20=ED=81=AC=EB=A6=AC=EC=97=90?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=BB=A4=EB=AE=A4=EB=8B=88=ED=8B=B0=20?= =?UTF-8?q?=EC=98=81=EC=97=AD=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SodaLive/Sources/App/AppStep.swift | 2 - SodaLive/Sources/ContentView.swift | 3 - .../CreatorCommunityItemView.swift | 78 +++++++++++++++++++ .../CreatorCommunityMoreItemView.swift | 28 +++++++ .../CreatorCommunityNoPostsItemView.swift | 36 +++++++++ .../CreatorCommunityWriteItemView.swift | 28 +++++++ .../Profile/CreatorNoticeWriteView.swift | 72 ----------------- .../Profile/CreatorNoticeWriteViewModel.swift | 63 --------------- .../Explorer/Profile/UserProfileView.swift | 46 +++++------ .../Profile/UserProfileViewModel.swift | 2 - 10 files changed, 189 insertions(+), 169 deletions(-) create mode 100644 SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityItemView.swift create mode 100644 SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityMoreItemView.swift create mode 100644 SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityNoPostsItemView.swift create mode 100644 SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityWriteItemView.swift delete mode 100644 SodaLive/Sources/Explorer/Profile/CreatorNoticeWriteView.swift delete mode 100644 SodaLive/Sources/Explorer/Profile/CreatorNoticeWriteViewModel.swift diff --git a/SodaLive/Sources/App/AppStep.swift b/SodaLive/Sources/App/AppStep.swift index 2e63d8f..b73ffe9 100644 --- a/SodaLive/Sources/App/AppStep.swift +++ b/SodaLive/Sources/App/AppStep.swift @@ -72,8 +72,6 @@ enum AppStep { case userProfileFanTalkAll(userId: Int) - case creatorNoticeWrite(notice: String) - case createLive( timeSettingMode: LiveRoomCreateViewModel.TimeSettingMode, onSuccess: (CreateLiveRoomResponse) -> Void diff --git a/SodaLive/Sources/ContentView.swift b/SodaLive/Sources/ContentView.swift index 19242b5..757bc19 100644 --- a/SodaLive/Sources/ContentView.swift +++ b/SodaLive/Sources/ContentView.swift @@ -95,9 +95,6 @@ struct ContentView: View { case .followerList(let userId): FollowerListView(userId: userId) - case .creatorNoticeWrite(let notice): - CreatorNoticeWriteView(notice: notice) - case .modifyContent(let contentId): ContentModifyView(contentId: contentId) diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityItemView.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityItemView.swift new file mode 100644 index 0000000..f21969b --- /dev/null +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityItemView.swift @@ -0,0 +1,78 @@ +// +// CreatorCommunityItemView.swift +// SodaLive +// +// Created by klaus on 2023/12/14. +// + +import SwiftUI + +struct CreatorCommunityItemView: View { + var body: some View { + VStack(alignment: .leading, spacing: 8) { + HStack(spacing: 11) { + Image("ic_place_holder") + .resizable() + .frame(width: 40, height: 40) + .clipShape(Circle()) + + Text("민하나") + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "eeeeee")) + + Spacer() + + Text("1일") + .font(.custom(Font.light.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "777777")) + } + + HStack(spacing: 0) { + Text("너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!") + .font(.custom(Font.medium.rawValue, size: 12)) + .foregroundColor(Color(hex: "bbbbbb")) + .fixedSize(horizontal: false, vertical: true) + .lineLimit(3) + + Spacer() + + Image("btn_plus_round_rect") + .resizable() + .frame(width: 53.3, height: 53.3) + .cornerRadius(4.7) + } + + HStack(spacing: 13.3) { + HStack(spacing: 6) { + Image("ic_heart_777") + .resizable() + .frame(width: 13.3, height: 13.3) + + Text("7,680") + .font(.custom(Font.medium.rawValue, size: 11)) + .foregroundColor(Color(hex: "777777")) + } + + HStack(spacing: 6) { + Image("ic_message_square_777") + .resizable() + .frame(width: 13.3, height: 13.3) + + Text("150") + .font(.custom(Font.medium.rawValue, size: 11)) + .foregroundColor(Color(hex: "777777")) + } + } + } + .frame(maxWidth: .infinity, alignment: .leading) + .padding(13.3) + .background(Color(hex: "222222")) + .cornerRadius(11) + } +} + +struct CreatorCommunityItemView_Previews: PreviewProvider { + static var previews: some View { + CreatorCommunityItemView() + } +} diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityMoreItemView.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityMoreItemView.swift new file mode 100644 index 0000000..9da6481 --- /dev/null +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityMoreItemView.swift @@ -0,0 +1,28 @@ +// +// CreatorCommunityMoreItemView.swift +// SodaLive +// +// Created by klaus on 2023/12/14. +// + +import SwiftUI + +struct CreatorCommunityMoreItemView: View { + var body: some View { + VStack(spacing: 11) { + Image("btn_item_more") + .resizable() + .frame(width: 40, height: 40) + + Text("더보기") + .font(.custom(Font.light.rawValue, size: 11)) + .foregroundColor(Color(hex: "bbbbbb")) + } + } +} + +struct CreatorCommunityMoreItemView_Previews: PreviewProvider { + static var previews: some View { + CreatorCommunityMoreItemView() + } +} diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityNoPostsItemView.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityNoPostsItemView.swift new file mode 100644 index 0000000..099fd76 --- /dev/null +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityNoPostsItemView.swift @@ -0,0 +1,36 @@ +// +// CreatorCommunityNoPostsItemView.swift +// SodaLive +// +// Created by klaus on 2023/12/14. +// + +import SwiftUI + +struct CreatorCommunityNoPostsItemView: View { + var body: some View { + VStack(spacing: 10.3) { + CreatorCommunityWriteItemView() + + Text("게시물 등록") + .font(.custom(Font.bold.rawValue, size: 14.7)) + .foregroundColor(Color(hex: "eeeeee")) + + Text("게시 후에 게시물이 여기에 표시되고\n커뮤니티에 공개됩니다.") + .font(.custom(Font.medium.rawValue, size: 12)) + .foregroundColor(Color(hex: "777777")) + .fixedSize(horizontal: false, vertical: true) + .multilineTextAlignment(.center) + } + .padding(.vertical, 16.7) + .frame(maxWidth: .infinity) + .background(Color(hex: "222222")) + .cornerRadius(10.3) + } +} + +struct CreatorCommunityNoPostsItemView_Previews: PreviewProvider { + static var previews: some View { + CreatorCommunityNoPostsItemView() + } +} diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityWriteItemView.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityWriteItemView.swift new file mode 100644 index 0000000..1113a90 --- /dev/null +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityWriteItemView.swift @@ -0,0 +1,28 @@ +// +// CreatorCommunityWriteItemView.swift +// SodaLive +// +// Created by klaus on 2023/12/14. +// + +import SwiftUI + +struct CreatorCommunityWriteItemView: View { + var body: some View { + Image("ic_make_message") + .padding(13) + .background(Color(hex: "333333")) + .cornerRadius(13.3) + .overlay( + RoundedRectangle(cornerRadius: 13.3) + .stroke(lineWidth: 1) + .foregroundColor(Color(hex: "555555")) + ) + } +} + +struct CreatorCommunityWriteItemView_Previews: PreviewProvider { + static var previews: some View { + CreatorCommunityWriteItemView() + } +} diff --git a/SodaLive/Sources/Explorer/Profile/CreatorNoticeWriteView.swift b/SodaLive/Sources/Explorer/Profile/CreatorNoticeWriteView.swift deleted file mode 100644 index fd2d478..0000000 --- a/SodaLive/Sources/Explorer/Profile/CreatorNoticeWriteView.swift +++ /dev/null @@ -1,72 +0,0 @@ -// -// CreatorNoticeWriteView.swift -// SodaLive -// -// Created by klaus on 2023/08/11. -// - -import SwiftUI -import Combine - -struct CreatorNoticeWriteView: View { - - let notice: String - - @ObservedObject var viewModel = CreatorNoticeWriteViewModel() - - var body: some View { - BaseView(isLoading: $viewModel.isLoading) { - VStack(spacing: 0) { - DetailNavigationBar(title: "공지사항 쓰기") - - TextViewWrapper( - text: $viewModel.writeNotice, - placeholder: viewModel.placeholder, - textColorHex: "eeeeee", - backgroundColorHex: "222222", - notice: notice - ) - .frame(width: screenSize().width - 26.7, height: 300) - .padding(.top, 13.3) - - Text("저장") - .font(.custom(Font.bold.rawValue, size: 18.3)) - .foregroundColor(Color(hex: "ffffff")) - .padding(.vertical, 11.7) - .frame(width: screenSize().width - 26.7) - .background(Color(hex: "9970ff")) - .cornerRadius(5.3) - .padding(.top, 20) - .onTapGesture { - hideKeyboard() - viewModel.writeCreatorNotice() - } - - Spacer() - } - } - .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .bottom, autohideIn: 2) { - HStack { - Spacer() - Text(viewModel.errorMessage) - .padding(.vertical, 13.3) - .frame(width: screenSize().width - 66.7, alignment: .center) - .font(.custom(Font.medium.rawValue, size: 12)) - .background(Color(hex: "9970ff")) - .foregroundColor(Color.white) - .multilineTextAlignment(.leading) - .cornerRadius(20) - .padding(.bottom, 66.7) - Spacer() - } - } - .onTapGesture { - hideKeyboard() - } - .onAppear { - DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { - viewModel.writeNotice = notice - } - } - } -} diff --git a/SodaLive/Sources/Explorer/Profile/CreatorNoticeWriteViewModel.swift b/SodaLive/Sources/Explorer/Profile/CreatorNoticeWriteViewModel.swift deleted file mode 100644 index 0ebbbd9..0000000 --- a/SodaLive/Sources/Explorer/Profile/CreatorNoticeWriteViewModel.swift +++ /dev/null @@ -1,63 +0,0 @@ -// -// CreatorNoticeWriteViewModel.swift -// SodaLive -// -// Created by klaus on 2023/08/11. -// - -import Foundation -import Combine - -final class CreatorNoticeWriteViewModel: ObservableObject { - let repository = ExplorerRepository() - private var subscription = Set() - - @Published var isLoading = false - @Published var errorMessage = "" - @Published var isShowPopup = false - - @Published var writeNotice = "" - - var placeholder = "공지사항을 입력해 주세요" - - func writeCreatorNotice() { - isLoading = true - - repository.writeCreatorNotice(notice: writeNotice.trimmingCharacters(in: .whitespacesAndNewlines) != placeholder ? writeNotice : "") - .sink { result in - switch result { - case .finished: - DEBUG_LOG("finish") - case .failure(let error): - ERROR_LOG(error.localizedDescription) - } - } receiveValue: { response in - let responseData = response.data - - do { - let jsonDecoder = JSONDecoder() - let decoded = try jsonDecoder.decode(ApiResponseWithoutData.self, from: responseData) - - if let message = decoded.message { - self.errorMessage = message - } else { - self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." - } - - self.isShowPopup = true - - if decoded.success { - DispatchQueue.main.asyncAfter(deadline: .now() + 1) { - AppState.shared.back() - } - } - } catch { - self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." - self.isShowPopup = true - } - - self.isLoading = false - } - .store(in: &subscription) - } -} diff --git a/SodaLive/Sources/Explorer/Profile/UserProfileView.swift b/SodaLive/Sources/Explorer/Profile/UserProfileView.swift index 7c326f7..20c0242 100644 --- a/SodaLive/Sources/Explorer/Profile/UserProfileView.swift +++ b/SodaLive/Sources/Explorer/Profile/UserProfileView.swift @@ -59,35 +59,27 @@ struct UserProfileView: View { .padding(.top, 13.3) .padding(.horizontal, 13.3) - HStack(spacing: 0) { - Text( - creatorProfile.notice.trimmingCharacters(in: .whitespaces).isEmpty ? - "공지사항이 없습니다." : - creatorProfile.notice - ) - .font(.custom(Font.medium.rawValue, size: 13.3)) - .foregroundColor(Color(hex: "000000")) - .lineLimit(viewModel.isExpandNotice ? Int.max : 1) - - Spacer() - - if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) { - Image("ic_review") - .resizable() - .frame(width: 20, height: 20) - } - } - .padding(.horizontal, 26.7) - .padding(.vertical, 13.3) - .background(Color(hex: "fdca2f")) - .padding(.top, 13.3) - .onTapGesture { - if creatorProfile.creator.creatorId == UserDefaults.int(forKey: .userId) { - AppState.shared.setAppStep(step: .creatorNoticeWrite(notice: creatorProfile.notice)) - } else { - viewModel.isExpandNotice.toggle() + ScrollView(.horizontal, showsIndicators: false) { + LazyHStack(spacing: 13.3) { + if UserDefaults.int(forKey: .userId) == creatorProfile.creator.creatorId { + CreatorCommunityWriteItemView() + } + + CreatorCommunityItemView() + .frame(width: 320) + + CreatorCommunityItemView() + .frame(width: 320) + + CreatorCommunityItemView() + .frame(width: 320) + + CreatorCommunityMoreItemView() } + .padding(.horizontal, 15) } + .frame(minHeight: 146) + .padding(.top, 26.7) } if creatorProfile.contentList.count > 0 || diff --git a/SodaLive/Sources/Explorer/Profile/UserProfileViewModel.swift b/SodaLive/Sources/Explorer/Profile/UserProfileViewModel.swift index 8e52eae..c3e352e 100644 --- a/SodaLive/Sources/Explorer/Profile/UserProfileViewModel.swift +++ b/SodaLive/Sources/Explorer/Profile/UserProfileViewModel.swift @@ -22,8 +22,6 @@ final class UserProfileViewModel: ObservableObject { @Published var isShowPopup = false @Published var isLoading = false - @Published var isExpandNotice = false - @Published var paymentDialogTitle = "" @Published var paymentDialogDesc = "" @Published var isShowPaymentDialog = false