From 3ae5ea776ce12bd0b046987399b1ea48256e0fcf Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Fri, 24 May 2024 16:19:43 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BB=A4=EB=AE=A4=EB=8B=88=ED=8B=B0=20?= =?UTF-8?q?=EC=9C=A0=EB=A3=8C=20=EA=B2=8C=EC=8B=9C=EA=B8=80=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C,=20=EA=B5=AC=EB=A7=A4=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ic_lock_bb.imageset/Contents.json | 21 +++ .../ic_lock_bb.imageset/ic_lock_bb.png | Bin 0 -> 2074 bytes .../Dialog/CommunityPostPurchaseDialog.swift | 92 +++++++++++++ .../All/CreatorCommunityAllItemLockView.swift | 39 ++++++ .../All/CreatorCommunityAllItemView.swift | 124 ++++++++++-------- .../All/CreatorCommunityAllView.swift | 15 +++ .../All/CreatorCommunityAllViewModel.swift | 59 +++++++++ .../All/PurchasePostRequest.swift | 14 ++ .../CreatorCommunityApi.swift | 9 +- .../CreatorCommunityItemView.swift | 17 ++- .../CreatorCommunityRepository.swift | 4 + .../GetCommunityPostListResponse.swift | 2 + .../Live/SectionCommunityPostView.swift | 4 + 13 files changed, 337 insertions(+), 63 deletions(-) create mode 100644 SodaLive/Resources/Assets.xcassets/ic_lock_bb.imageset/Contents.json create mode 100644 SodaLive/Resources/Assets.xcassets/ic_lock_bb.imageset/ic_lock_bb.png create mode 100644 SodaLive/Sources/Dialog/CommunityPostPurchaseDialog.swift create mode 100644 SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllItemLockView.swift create mode 100644 SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/PurchasePostRequest.swift diff --git a/SodaLive/Resources/Assets.xcassets/ic_lock_bb.imageset/Contents.json b/SodaLive/Resources/Assets.xcassets/ic_lock_bb.imageset/Contents.json new file mode 100644 index 0000000..4b620b0 --- /dev/null +++ b/SodaLive/Resources/Assets.xcassets/ic_lock_bb.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "ic_lock_bb.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/SodaLive/Resources/Assets.xcassets/ic_lock_bb.imageset/ic_lock_bb.png b/SodaLive/Resources/Assets.xcassets/ic_lock_bb.imageset/ic_lock_bb.png new file mode 100644 index 0000000000000000000000000000000000000000..243d1ec6127a0e69ce95f91e96a93ed9bd8e441e GIT binary patch literal 2074 zcmbVN`8(7L7yk~%GS*>;#u71EDc<7M0l!*DG_x9mhhqPQVL zlE%Ij8Pw1aV=Kdu#L!r;>wWG&@IIaA`JB&l&Uwxc=bYy}pA-kIl{n-m1ONbWj5XTn zkV_8nNLcXDBePym4oM`$+ARzKL}mU55KvGkf0zV?Ia#5Ann6X*VIbgt@jn*doFu}k%nY9Pyo1hoO}&@ z#@;zjQ%k3|j_;1FtJa=hdUjZri?XKl<9tplqndlg(ZVOM>V07o%ZyPVr>gd^l>*wR zgXOuoQnzXsj|TUZ`5?on#DmQ`r%Hp`;8)cH3tZ|1wzjEb`oQ!d_SW}>&vZIHV>s3a zP#JEouCCsXuWf*q8KOqh6{R{wt_D(=I~1vdDNcAV>c9uMc3R%x+v=+1_rQt$Ed!LM zJ+wD0DYS>5NFa>%vaR=$zd2Uas6cypa5&t;%~3}IxjbW5MzRdL$7C{x{CcXKfp>Dv zR$|MWJAZ4Rqw7GC%r}ggmK>wPV-!z;P_-0WbF%y9a5o7V`%DY^{)Pg74t8m@R$FA5 zw`*Ld)GcRTzN&C#_bj&LIL0+o*5LsjFC3Hn$Ey>+8g*E2J4k2a0ngZ5WG|1*TFPWUxtg<8KqaR2NQg(v+Wsv7q>DN`gE^%y(O}R7z+U`KFQI4Kuj`o3N z1oqh-#T@lSL`*Q{08(fdhR+jNBwOq$hKql4Yj9VZnwpaMJtCqgygjPr>gR3lLT~~B zez5%sTyL${IJ7I>w5T()xw#3I*r38H7NcH7>N#0`A<{jyKI%{T;?(2_0IRwo4uGjW1vJ&c$IjQ3orpW{ySp6b(oP1ER{|Vr$09j}U3Ek4dBk6!@xSqoWiAbCzC} zd{-)s4@V8+KSJ)r+WX@celuq&Wd*F}qTN8JPMz{F;$FZ=7~fTXPQAs7=CpbnEYLn>tfTWi>ju%Z_%>t&7;q&W<5eygM}{SUwW}K-t7W@4Dl{n5=y=< zF&z)T>#wZz#t^Jm;22VLXD~AEHi=~R*M!TM7mNAQPlir0DuCQy82CtoODo_f7&3^! z%guTj6a+aS#>-almHp)1M;y}ImIYpBTyoUl6dH>B{cM|-?FXm^A5lBwFXr-z%xZ`s zKCgVERM`6?!t$wOkL$kNKXO1%VOD=V1_cnPa$8JyYa7u6$%~AU|)dw$iF)G8H z7$wg6<^CVt6eodUGxC3F?$zIXXd65-hcn4ENjB=EJ;eI!_S*3q$&0!3c)Zu0_8yu> zBqEI|9LH6Gcq%2$d{u>t{<<`%N8iM zjkzuA-79;qA|d+Z_WW6Lp=*KgdH95AF(?S4q1q2fn}L67|37!NpX%b!*xYTj>6#p} znL~BZo)eu3GNeIm`0mXY&!sd1F3(0Y9HfT}#Cv3lNl3xd&<1z<1htA{g~Q>zYJU~( z396$~*HETw#*j059Npw{U|%sj6)`B8?`^tgWZ)HwFfuJCO`ZImWE?g5*eHgf01L>Kq!Jk zP+y%dOpSYXgmtJUQ~{|nk*kZm-4hi_La6fc*(ffXP8Ez+Sl>=VCMM|8p0fLdLYpt;CS@l zLStj2e{P3|rX`?);!buZk07rHLFSW8j%LwlG{*{C9rVApalZ}dOH-VoBA5FQr5wOm LV$n4y@A!WJv{b;U literal 0 HcmV?d00001 diff --git a/SodaLive/Sources/Dialog/CommunityPostPurchaseDialog.swift b/SodaLive/Sources/Dialog/CommunityPostPurchaseDialog.swift new file mode 100644 index 0000000..8b4d305 --- /dev/null +++ b/SodaLive/Sources/Dialog/CommunityPostPurchaseDialog.swift @@ -0,0 +1,92 @@ +// +// CommunityPostPurchaseDialog.swift +// SodaLive +// +// Created by klaus on 5/24/24. +// + +import SwiftUI + +struct CommunityPostPurchaseDialog: View { + + @Binding var isShowing: Bool + + let can: Int + let confirmAction: () -> Void + + var body: some View { + GeometryReader { geo in + ZStack { + Color.black + .opacity(0.5) + .frame(width: geo.size.width, height: geo.size.height) + + VStack(spacing: 0) { + Text("게시글 보기") + .font(.custom(Font.bold.rawValue, size: 18.3)) + .foregroundColor(Color.graybb) + .padding(.top, 40) + + Text("게시글을\n확인하시겠습니까?") + .font(.custom(Font.medium.rawValue, size: 15)) + .foregroundColor(Color.graybb) + .multilineTextAlignment(.center) + .padding(.top, 12) + .padding(.horizontal, 13.3) + + HStack(spacing: 13.3) { + Text("취소") + .font(.custom(Font.bold.rawValue, size: 15.3)) + .foregroundColor(Color.button) + .padding(.vertical, 16) + .frame(width: (geo.size.width - 66.7) / 3) + .background(Color.bg) + .cornerRadius(8) + .overlay( + RoundedRectangle(cornerRadius: 8) + .stroke(Color.button, lineWidth: 1) + ) + .onTapGesture { + isShowing = false + } + + HStack(spacing: 0) { + Text("\(can)") + .font(.custom(Font.bold.rawValue, size: 15.3)) + .foregroundColor(Color.white) + + Image("ic_can") + .resizable() + .frame(width: 20, height: 20) + + Text("으로 보기") + .font(.custom(Font.bold.rawValue, size: 15.3)) + .foregroundColor(Color.white) + } + .padding(.vertical, 16) + .frame(width: (geo.size.width - 66.7) * 2 / 3) + .background(Color.button) + .cornerRadius(8) + .onTapGesture { + confirmAction() + isShowing = false + } + } + .padding(.top, 26.7) + .padding(.bottom, 16.7) + } + .frame(width: geo.size.width - 26.7, alignment: .center) + .background(Color.gray22) + .cornerRadius(10) + } + } + } +} + +#Preview { + CommunityPostPurchaseDialog( + isShowing: .constant(true), + can: 10, + confirmAction: {} + ) +} diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllItemLockView.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllItemLockView.swift new file mode 100644 index 0000000..de8e7a7 --- /dev/null +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllItemLockView.swift @@ -0,0 +1,39 @@ +// +// CreatorCommunityAllItemLockView.swift +// SodaLive +// +// Created by klaus on 5/24/24. +// + +import SwiftUI + +struct CreatorCommunityAllItemLockView: View { + + let price: Int + let onClickPurchaseContent: () -> Void + + var body: some View { + VStack(spacing: 26.7) { + Image("ic_lock_bb") + + Text("\(price)캔으로 게시글 보기") + .font(.custom(Font.bold.rawValue, size: 12)) + .foregroundColor(Color.button) + .padding(.horizontal, 21) + .padding(.vertical, 11) + .overlay( + RoundedRectangle(cornerRadius: 26.7) + .stroke(Color.button, lineWidth: 1) + ) + .onTapGesture { onClickPurchaseContent() } + } + .frame(width: screenSize().width - 42, height: screenSize().width - 42) + .background(Color.gray33) + .cornerRadius(5.3) + } +} + +#Preview { + CreatorCommunityAllItemLockView(price: 100) { + } +} diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllItemView.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllItemView.swift index a934330..901695e 100644 --- a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllItemView.swift +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllItemView.swift @@ -15,6 +15,7 @@ struct CreatorCommunityAllItemView: View { let onClickComment: () -> Void let onClickWriteComment: (String) -> Void let onClickShowReportMenu: () -> Void + let onClickPurchaseContent: () -> Void @State var isLike = false @State var likeCount = 0 @@ -25,13 +26,15 @@ struct CreatorCommunityAllItemView: View { onClickLike: @escaping () -> Void, onClickComment: @escaping () -> Void, onClickWriteComment: @escaping (String) -> Void, - onClickShowReportMenu: @escaping () -> Void + onClickShowReportMenu: @escaping () -> Void, + onClickPurchaseContent: @escaping () -> Void ) { self.item = item self.onClickLike = onClickLike self.onClickComment = onClickComment self.onClickWriteComment = onClickWriteComment self.onClickShowReportMenu = onClickShowReportMenu + self.onClickPurchaseContent = onClickPurchaseContent self._isLike = State(initialValue: item.isLike) self._likeCount = State(initialValue: item.likeCount) @@ -58,66 +61,74 @@ struct CreatorCommunityAllItemView: View { Spacer() - Image("ic_seemore_vertical") - .padding(.trailing, 8.3) - .onTapGesture { onClickShowReportMenu() } + if item.price <= 0 || item.existOrdered { + Image("ic_seemore_vertical") + .padding(.trailing, 8.3) + .onTapGesture { onClickShowReportMenu() } + } } - DetectableTextView(text: item.content, textSize: 13.3, font: Font.medium.rawValue) - .frame( - width: screenSize().width - 16, - height: textHeight - ) - .onAppear { - self.textHeight = self.estimatedHeight( - for: item.content, - width: screenSize().width - 16 + if item.price <= 0 || item.existOrdered { + DetectableTextView(text: item.content, textSize: 13.3, font: Font.medium.rawValue) + .frame( + width: screenSize().width - 16, + height: textHeight ) - } - .onChange(of: item.content) { newText in - self.textHeight = self.estimatedHeight( - for: newText, - width: screenSize().width - 16 - ) - } - - if let imageUrl = item.imageUrl { - KFImage(URL(string: imageUrl)) - .resizable() - .frame(maxWidth: .infinity) - .scaledToFit() - } - - HStack(spacing: 8) { - IconAndTitleToggleButton( - isChecked: isLike, - title: "\(likeCount)", - normalIconName: "ic_audio_content_heart_normal", - checkedIconName: "ic_audio_content_heart_pressed" - ) { - if isLike { - isLike = false - likeCount -= 1 - } else { - isLike = true - likeCount += 1 + .onAppear { + self.textHeight = self.estimatedHeight( + for: item.content, + width: screenSize().width - 16 + ) } - onClickLike() + .onChange(of: item.content) { newText in + self.textHeight = self.estimatedHeight( + for: newText, + width: screenSize().width - 16 + ) + } + + if let imageUrl = item.imageUrl { + KFImage(URL(string: imageUrl)) + .resizable() + .frame(maxWidth: .infinity) + .scaledToFit() } - } - .frame(maxWidth: .infinity, alignment: .leading) - - if item.isCommentAvailable { - CreatorCommunityCommentView( - commentCount: item.commentCount, - commentItem: item.firstComment, - onClickWriteComment: onClickWriteComment - ) - .onTapGesture { - if item.commentCount > 0 { - onClickComment() + + HStack(spacing: 8) { + IconAndTitleToggleButton( + isChecked: isLike, + title: "\(likeCount)", + normalIconName: "ic_audio_content_heart_normal", + checkedIconName: "ic_audio_content_heart_pressed" + ) { + if isLike { + isLike = false + likeCount -= 1 + } else { + isLike = true + likeCount += 1 + } + onClickLike() } } + .frame(maxWidth: .infinity, alignment: .leading) + + if item.isCommentAvailable { + CreatorCommunityCommentView( + commentCount: item.commentCount, + commentItem: item.firstComment, + onClickWriteComment: onClickWriteComment + ) + .onTapGesture { + if item.commentCount > 0 { + onClickComment() + } + } + } + } else { + CreatorCommunityAllItemLockView( + price: item.price, + onClickPurchaseContent: onClickPurchaseContent) } } .padding(.horizontal, 8) @@ -144,10 +155,12 @@ struct CreatorCommunityAllItemView_Previews: PreviewProvider { creatorProfileUrl: "https://test-cf.sodalive.net/profile/default-profile.png", imageUrl: "https://test-cf.sodalive.net/profile/default-profile.png", content: "너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!", + price: 10, date: "3일전", isCommentAvailable: false, isAdult: false, isLike: true, + existOrdered: false, likeCount: 10, commentCount: 0, firstComment: nil @@ -155,7 +168,8 @@ struct CreatorCommunityAllItemView_Previews: PreviewProvider { onClickLike: {}, onClickComment: {}, onClickWriteComment: { _ in }, - onClickShowReportMenu: {} + onClickShowReportMenu: {}, + onClickPurchaseContent: {} ) } } diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllView.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllView.swift index ae2370f..91357b3 100644 --- a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllView.swift +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllView.swift @@ -41,6 +41,12 @@ struct CreatorCommunityAllView: View { onClickShowReportMenu: { viewModel.postId = item.postId viewModel.isShowReportMenu = true + }, + onClickPurchaseContent: { + viewModel.postId = item.postId + viewModel.postPrice = item.price + viewModel.postIndex = index + viewModel.isShowPostPurchaseView = true } ) .onAppear { @@ -121,6 +127,15 @@ struct CreatorCommunityAllView: View { } ) } + + if viewModel.isShowPostPurchaseView { + CommunityPostPurchaseDialog( + isShowing: $viewModel.isShowPostPurchaseView, + can: viewModel.postPrice + ) { + viewModel.purchaseCommunityPost() + } + } } } .popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) { diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllViewModel.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllViewModel.swift index 124a64e..8bcafcd 100644 --- a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllViewModel.swift +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/CreatorCommunityAllViewModel.swift @@ -21,6 +21,8 @@ class CreatorCommunityAllViewModel: ObservableObject { @Published private(set) var communityPostList = [GetCommunityPostListResponse]() @Published var postId = 0 + @Published var postPrice = 0 + @Published var postIndex = -1 @Published var isShowCommentListView = false { didSet { @@ -46,6 +48,16 @@ class CreatorCommunityAllViewModel: ObservableObject { } } + @Published var isShowPostPurchaseView = false { + didSet { + if !isShowPostPurchaseView { + postId = 0 + postPrice = 0 + postIndex = -1 + } + } + } + var creatorId = 0 var page = 1 @@ -254,4 +266,51 @@ class CreatorCommunityAllViewModel: ObservableObject { self.isLoading = false } } + + func purchaseCommunityPost() { + let postId = postId + let postIndex = postIndex + + if !isLoading { + isLoading = true + + repository + .purchaseCommunityPost(postId: postId) + .sink { result in + switch result { + case .finished: + DEBUG_LOG("finish") + case .failure(let error): + ERROR_LOG(error.localizedDescription) + } + } receiveValue: { [unowned self] response in + let responseData = response.data + + do { + let jsonDecoder = JSONDecoder() + let decoded = try jsonDecoder.decode(ApiResponse.self, from: responseData) + + if let data = decoded.data, decoded.success { + if postIndex >= 0 { + communityPostList[postIndex] = data + } + } else { + if let message = decoded.message { + self.errorMessage = message + } else { + self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." + } + + self.isShowPopup = true + } + } catch { + self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." + self.isShowPopup = true + } + + self.isLoading = false + } + .store(in: &subscription) + } + } } diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/PurchasePostRequest.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/PurchasePostRequest.swift new file mode 100644 index 0000000..390a276 --- /dev/null +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/All/PurchasePostRequest.swift @@ -0,0 +1,14 @@ +// +// PurchasePostRequest.swift +// SodaLive +// +// Created by klaus on 5/24/24. +// + +import Foundation + +struct PurchasePostRequest: Encodable { + let postId: Int + let container: String = "ios" + let timezone: String = TimeZone.current.identifier +} diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityApi.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityApi.swift index a48b6a5..2c06842 100644 --- a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityApi.swift +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityApi.swift @@ -19,6 +19,7 @@ enum CreatorCommunityApi { case getCommentReplyList(commentId: Int, page: Int, size: Int) case modifyComment(request: ModifyCommunityPostCommentRequest) case getLatestPostListFromCreatorsYouFollow + case purchaseCommunityPost(postId: Int) } extension CreatorCommunityApi: TargetType { @@ -48,12 +49,15 @@ extension CreatorCommunityApi: TargetType { case .getLatestPostListFromCreatorsYouFollow: return "/creator-community/latest" + + case .purchaseCommunityPost: + return "/creator-community/purchase" } } var method: Moya.Method { switch self { - case .createCommunityPost, .communityPostLike, .createCommunityPostComment: + case .createCommunityPost, .communityPostLike, .createCommunityPostComment, .purchaseCommunityPost: return .post case .getCommunityPostList, .getCommunityPostCommentList, .getCommentReplyList, .getCommunityPostDetail, .getLatestPostListFromCreatorsYouFollow: @@ -115,6 +119,9 @@ extension CreatorCommunityApi: TargetType { case .getLatestPostListFromCreatorsYouFollow: let parameters = ["timezone": TimeZone.current.identifier] as [String: Any] return .requestParameters(parameters: parameters, encoding: URLEncoding.queryString) + + case .purchaseCommunityPost(let postId): + return .requestJSONEncodable(PurchasePostRequest(postId: postId)) } } diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityItemView.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityItemView.swift index 0c99de2..1ed44bd 100644 --- a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityItemView.swift +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityItemView.swift @@ -22,19 +22,19 @@ struct CreatorCommunityItemView: View { Text(item.creatorNickname) .font(.custom(Font.medium.rawValue, size: 13.3)) - .foregroundColor(Color(hex: "eeeeee")) + .foregroundColor(Color.grayee) Spacer() Text(item.date) .font(.custom(Font.light.rawValue, size: 13.3)) - .foregroundColor(Color(hex: "777777")) + .foregroundColor(Color.gray77) } HStack(spacing: 0) { Text(item.content) .font(.custom(Font.medium.rawValue, size: 12)) - .foregroundColor(Color(hex: "bbbbbb")) + .foregroundColor(Color.graybb) .fixedSize(horizontal: false, vertical: true) .lineLimit(3) @@ -45,9 +45,10 @@ struct CreatorCommunityItemView: View { .resizable() .frame(width: 53.3, height: 53.3) .cornerRadius(4.7) + .blur(radius: item.existOrdered ? 0 : 15) } else { Rectangle() - .foregroundColor(Color(hex: "222222").opacity(0)) + .foregroundColor(Color.gray22.opacity(0)) .frame(width: 53.3, height: 53.3) } } @@ -60,7 +61,7 @@ struct CreatorCommunityItemView: View { Text("\(item.likeCount)") .font(.custom(Font.medium.rawValue, size: 11)) - .foregroundColor(Color(hex: "777777")) + .foregroundColor(Color.gray77) } HStack(spacing: 6) { @@ -70,13 +71,13 @@ struct CreatorCommunityItemView: View { Text("\(item.commentCount)") .font(.custom(Font.medium.rawValue, size: 11)) - .foregroundColor(Color(hex: "777777")) + .foregroundColor(Color.gray77) } } } .frame(maxWidth: .infinity, alignment: .leading) .padding(13.3) - .background(Color(hex: "222222")) + .background(Color.gray22) .cornerRadius(11) } } @@ -91,10 +92,12 @@ struct CreatorCommunityItemView_Previews: PreviewProvider { creatorProfileUrl: "https://test-cf.sodalive.net/profile/default-profile.png", imageUrl: "https://test-cf.sodalive.net/profile/default-profile.png", content: "안녕하세요", + price: 10, date: "3일전", isCommentAvailable: false, isAdult: false, isLike: false, + existOrdered: false, likeCount: 10, commentCount: 0, firstComment: nil diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityRepository.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityRepository.swift index 2504cf3..11ff10e 100644 --- a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityRepository.swift +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/CreatorCommunityRepository.swift @@ -52,4 +52,8 @@ class CreatorCommunityRepository { func getLatestPostListFromCreatorsYouFollow() -> AnyPublisher { return api.requestPublisher(.getLatestPostListFromCreatorsYouFollow) } + + func purchaseCommunityPost(postId: Int) -> AnyPublisher { + return api.requestPublisher(.purchaseCommunityPost(postId: postId)) + } } diff --git a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/GetCommunityPostListResponse.swift b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/GetCommunityPostListResponse.swift index 15afde1..359262e 100644 --- a/SodaLive/Sources/Explorer/Profile/CreatorCommunity/GetCommunityPostListResponse.swift +++ b/SodaLive/Sources/Explorer/Profile/CreatorCommunity/GetCommunityPostListResponse.swift @@ -12,10 +12,12 @@ struct GetCommunityPostListResponse: Decodable { let creatorProfileUrl: String let imageUrl: String? let content: String + let price: Int let date: String let isCommentAvailable: Bool let isAdult: Bool let isLike: Bool + let existOrdered: Bool let likeCount: Int let commentCount: Int let firstComment: GetCommunityPostCommentListItem? diff --git a/SodaLive/Sources/Live/SectionCommunityPostView.swift b/SodaLive/Sources/Live/SectionCommunityPostView.swift index f622ee3..e9b1776 100644 --- a/SodaLive/Sources/Live/SectionCommunityPostView.swift +++ b/SodaLive/Sources/Live/SectionCommunityPostView.swift @@ -38,10 +38,12 @@ struct SectionCommunityPostView_Previews: PreviewProvider { creatorProfileUrl: "https://test-cf.sodalive.net/profile/default-profile.png", imageUrl: "https://test-cf.sodalive.net/profile/default-profile.png", content: "라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!", + price: 10, date: "3일전", isCommentAvailable: false, isAdult: false, isLike: true, + existOrdered: false, likeCount: 10, commentCount: 0, firstComment: nil @@ -53,10 +55,12 @@ struct SectionCommunityPostView_Previews: PreviewProvider { creatorProfileUrl: "https://test-cf.sodalive.net/profile/default-profile.png", imageUrl: "https://test-cf.sodalive.net/profile/default-profile.png", content: "너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!너무 조하유 앞으로도 좋은 라이브 많이 들려주세요!", + price: 10, date: "3일전", isCommentAvailable: false, isAdult: false, isLike: true, + existOrdered: false, likeCount: 20, commentCount: 0, firstComment: nil