From 54f70609c5392804a3b5f924709effba3a164cea Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Mon, 28 Oct 2024 18:25:22 +0900 Subject: [PATCH] =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=EB=B0=A9=20-=20?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=20=ED=9B=84=EC=9B=90=EB=9E=AD?= =?UTF-8?q?=ED=82=B9=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20-=20=EB=B0=A9?= =?UTF-8?q?=EC=9E=A5=EC=9D=80=20=EC=9D=BC=EB=B0=98=ED=9B=84=EC=9B=90=20/?= =?UTF-8?q?=20=EB=B9=84=EB=B0=80=ED=9B=84=EC=9B=90=20=EC=BA=94=EC=9D=84=20?= =?UTF-8?q?=EB=82=98=EB=88=A0=EC=84=9C=20=EB=B3=B4=EC=9D=B4=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LiveRoomDonationRankingDialog.swift | 4 +- .../LiveRoomDonationRankingItemView.swift | 44 +++++++++++++++++-- .../LiveRoomDonationRankingTotalCanView.swift | 38 +++++++++++++++- .../GetLiveRoomDonationStatusResponse.swift | 2 + .../Sources/Live/Room/LiveRoomViewModel.swift | 2 - 5 files changed, 81 insertions(+), 9 deletions(-) diff --git a/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationRankingDialog.swift b/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationRankingDialog.swift index 650fef8..2e8ce67 100644 --- a/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationRankingDialog.swift +++ b/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationRankingDialog.swift @@ -29,7 +29,7 @@ struct LiveRoomDonationRankingDialog: View { } if let donationStatus = viewModel.donationStatus { - LiveRoomDonationRankingTotalCanView(totalCan: donationStatus.totalCan) + LiveRoomDonationRankingTotalCanView(totalCan: donationStatus.totalCan, totalSecretCan: donationStatus.totalSecretCan) .padding(.top, 25) HStack(spacing: 0) { @@ -42,7 +42,7 @@ struct LiveRoomDonationRankingDialog: View { .foregroundColor(Color.button) .padding(.leading, 6.7) - Text("명") + Text(" 명") .font(.custom(Font.medium.rawValue, size: 12)) .foregroundColor(Color.gray77) diff --git a/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationRankingItemView.swift b/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationRankingItemView.swift index 8465a53..cbc11dd 100644 --- a/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationRankingItemView.swift +++ b/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationRankingItemView.swift @@ -66,10 +66,38 @@ struct LiveRoomDonationRankingItemView: View { Spacer() - if item.can > 0 { - Text("\(item.can) 캔") - .font(.custom(Font.medium.rawValue, size: 13.3)) - .foregroundColor(Color(hex: "eeeeee")) + VStack(alignment: .trailing, spacing: 8) { + if item.can > 0 { + HStack(spacing: 4) { + Text("\(item.can)") + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color.button) + + Text("캔") + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "eeeeee")) + } + } + + if item.secretCan > 0 { + HStack(spacing: 4) { + Text("비밀") + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color.gray11) + .padding(.horizontal, 3.3) + .padding(.vertical, 2.7) + .background(Color(hex: "fedc00")) + .cornerRadius(2.7) + + Text("\(item.secretCan)") + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "fedc00")) + + Text("캔") + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "eeeeee")) + } + } } } .padding(.horizontal, isTop3Index(index: index) ? 20 : 0) @@ -112,3 +140,11 @@ struct LiveRoomDonationRankingItemView: View { } } } + +#Preview { + LiveRoomDonationRankingItemView( + index: 0, + item: GetLiveRoomDonationItem(profileImage: "", nickname: "테스트", userId: 1, can: 10, secretCan: 30), + itemCount: 3 + ) +} diff --git a/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationRankingTotalCanView.swift b/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationRankingTotalCanView.swift index 82312ea..272a4fc 100644 --- a/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationRankingTotalCanView.swift +++ b/SodaLive/Sources/Live/Room/Dialog/LiveRoomDonationRankingTotalCanView.swift @@ -10,6 +10,7 @@ import SwiftUI struct LiveRoomDonationRankingTotalCanView: View { let totalCan: Int + let totalSecretCan: Int var body: some View { HStack(alignment: .center, spacing: 0) { @@ -17,12 +18,43 @@ struct LiveRoomDonationRankingTotalCanView: View { .font(.custom(Font.bold.rawValue, size: 13.3)) .foregroundColor(Color.grayd2) + if totalSecretCan > 0 { + Text(" (") + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color.grayd2) + + Text("일반") + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color.button) + + Text("/") + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color.grayd2) + + Text("비밀") + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "fedc00")) + + Text(")") + .font(.custom(Font.medium.rawValue, size: 13.3)) + .foregroundColor(Color.grayd2) + } + Spacer() Text("\(totalCan)") - .font(.custom(Font.medium.rawValue, size: 16)) + .font(.custom(Font.medium.rawValue, size: 14)) .foregroundColor(Color.button) + if totalSecretCan > 0 { + Text("/") + .font(.custom(Font.medium.rawValue, size: 14)) + .foregroundColor(Color.white) + Text("\(totalSecretCan)") + .font(.custom(Font.medium.rawValue, size: 14)) + .foregroundColor(Color(hex: "fedc00")) + } + Text("캔") .font(.custom(Font.medium.rawValue, size: 10.7)) .foregroundColor(Color.graybb) @@ -34,3 +66,7 @@ struct LiveRoomDonationRankingTotalCanView: View { .cornerRadius(8) } } + +#Preview { + LiveRoomDonationRankingTotalCanView(totalCan: 10, totalSecretCan: 0) +} diff --git a/SodaLive/Sources/Live/Room/GetLiveRoomDonationStatusResponse.swift b/SodaLive/Sources/Live/Room/GetLiveRoomDonationStatusResponse.swift index c969dbd..5565ffe 100644 --- a/SodaLive/Sources/Live/Room/GetLiveRoomDonationStatusResponse.swift +++ b/SodaLive/Sources/Live/Room/GetLiveRoomDonationStatusResponse.swift @@ -11,6 +11,7 @@ struct GetLiveRoomDonationStatusResponse: Decodable { let donationList: [GetLiveRoomDonationItem] let totalCount: Int let totalCan: Int + let totalSecretCan: Int } struct GetLiveRoomDonationItem: Decodable { @@ -18,4 +19,5 @@ struct GetLiveRoomDonationItem: Decodable { let nickname: String let userId: Int let can: Int + let secretCan: Int } diff --git a/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift b/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift index 59461d1..3b82dc1 100644 --- a/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift +++ b/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift @@ -2164,8 +2164,6 @@ extension LiveRoomViewModel: AgoraRtmDelegate { ) ) - self.totalDonationCan += decoded.can - if let signature = decoded.signature { self.addSignature(signature: signature) } else if let imageUrl = decoded.signatureImageUrl {