후원
- 시그니처 후원 적용
This commit is contained in:
		| @@ -15,6 +15,7 @@ struct LiveRoomChatRawMessage: Codable { | ||||
|     let type: LiveRoomChatRawMessageType | ||||
|     let message: String | ||||
|     let can: Int | ||||
|     var signatureImageUrl: String? = nil | ||||
|     let donationMessage: String? | ||||
|     var isActiveRoulette: Bool? = nil | ||||
| } | ||||
|   | ||||
| @@ -143,6 +143,16 @@ final class LiveRoomViewModel: NSObject, ObservableObject { | ||||
|     @Published var rouletteSelectedItem = "" | ||||
|     var rouletteCan = 0 | ||||
|      | ||||
|     @Published var signatureImageUrl = "" { | ||||
|         didSet { | ||||
|             if signatureImageUrl.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 { | ||||
|                 DispatchQueue.main.asyncAfter(deadline: .now() + 3.5) { | ||||
|                     self.signatureImageUrl = "" | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|      | ||||
|     var timer: DispatchSourceTimer? | ||||
|      | ||||
|     func setOriginOffset(_ offset: CGFloat) { | ||||
| @@ -353,7 +363,7 @@ final class LiveRoomViewModel: NSObject, ObservableObject { | ||||
|                      | ||||
|                     do { | ||||
|                         let jsonDecoder = JSONDecoder() | ||||
|                         let decoded = try jsonDecoder.decode(ApiResponseWithoutData.self, from: responseData) | ||||
|                         let decoded = try jsonDecoder.decode(ApiResponse<String>.self, from: responseData) | ||||
|                          | ||||
|                         self.isLoading = false | ||||
|                          | ||||
| @@ -363,6 +373,7 @@ final class LiveRoomViewModel: NSObject, ObservableObject { | ||||
|                                 type: .DONATION, | ||||
|                                 message: rawMessage, | ||||
|                                 can: can, | ||||
|                                 signatureImageUrl: decoded.data, | ||||
|                                 donationMessage: message | ||||
|                             ) | ||||
|                              | ||||
| @@ -384,6 +395,7 @@ final class LiveRoomViewModel: NSObject, ObservableObject { | ||||
|                                         ) | ||||
|                                          | ||||
|                                         totalDonationCan += can | ||||
|                                         signatureImageUrl = decoded.data ?? "" | ||||
|                                          | ||||
|                                         self.messageChangeFlag.toggle() | ||||
|                                         if self.messages.count > 100 { | ||||
| @@ -1708,6 +1720,7 @@ extension LiveRoomViewModel: AgoraRtmChannelDelegate { | ||||
|                     ) | ||||
|                      | ||||
|                     self.totalDonationCan += decoded.can | ||||
|                     self.signatureImageUrl = decoded.signatureImageUrl ?? "" | ||||
|                 } else if decoded.type == .ROULETTE_DONATION { | ||||
|                     self.messages.append( | ||||
|                         LiveRoomRouletteDonationChat( | ||||
|   | ||||
| @@ -7,6 +7,7 @@ | ||||
|  | ||||
| import SwiftUI | ||||
| import Kingfisher | ||||
| import SDWebImageSwiftUI | ||||
|  | ||||
| struct LiveRoomViewV2: View { | ||||
|      | ||||
| @@ -241,6 +242,20 @@ struct LiveRoomViewV2: View { | ||||
|                                         proxy.scrollTo(viewModel.messages.count - 1, anchor: .center) | ||||
|                                     }.padding(.bottom, 70) | ||||
|                                 } | ||||
|                                  | ||||
|                                 if viewModel.signatureImageUrl.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 { | ||||
|                                     VStack(spacing: 0) { | ||||
|                                         Spacer() | ||||
|                                          | ||||
|                                         AnimatedImage(url: URL(string: viewModel.signatureImageUrl)) | ||||
|                                             .resizable() | ||||
|                                             .aspectRatio(contentMode: .fit) | ||||
|                                             .frame(height: 300) | ||||
|                                             .frame(maxWidth: .infinity) | ||||
|                                             .padding(.horizontal, 20) | ||||
|                                             .padding(.bottom, 65) | ||||
|                                     } | ||||
|                                 } | ||||
|                             } | ||||
|                         } | ||||
|                          | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Yu Sung
					Yu Sung