라이브방 - 라이브 후원랭킹 리스트
- 방장은 일반후원 / 비밀후원 캔을 나눠서 보이도록 수정
This commit is contained in:
		| @@ -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) | ||||
|                          | ||||
|   | ||||
| @@ -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 | ||||
|     ) | ||||
| } | ||||
|   | ||||
| @@ -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) | ||||
| } | ||||
|   | ||||
| @@ -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 | ||||
| } | ||||
|   | ||||
| @@ -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 { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Yu Sung
					Yu Sung