From 8b7d67394234f14cfb78355269bbbe73da3b314e Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Tue, 12 Nov 2024 02:36:21 +0900 Subject: [PATCH] =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=20=EB=B0=A9=20-=20?= =?UTF-8?q?=EB=B9=84=EB=B0=80=20=EB=AF=B8=EC=85=98=20=EC=B1=84=ED=8C=85=20?= =?UTF-8?q?=EB=B0=B0=EA=B2=BD=EC=83=89=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SodaLive/Sources/Live/Room/Chat/LiveRoomChat.swift | 1 + .../Live/Room/Chat/LiveRoomDonationChatItemView.swift | 5 +++-- SodaLive/Sources/Live/Room/LiveRoomViewModel.swift | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/SodaLive/Sources/Live/Room/Chat/LiveRoomChat.swift b/SodaLive/Sources/Live/Room/Chat/LiveRoomChat.swift index 8af0bcc..3c72115 100644 --- a/SodaLive/Sources/Live/Room/Chat/LiveRoomChat.swift +++ b/SodaLive/Sources/Live/Room/Chat/LiveRoomChat.swift @@ -26,6 +26,7 @@ struct LiveRoomNormalChat: LiveRoomChat { } struct LiveRoomDonationChat: LiveRoomChat { + let memberId: Int let profileUrl: String let nickname: String let chat: String diff --git a/SodaLive/Sources/Live/Room/Chat/LiveRoomDonationChatItemView.swift b/SodaLive/Sources/Live/Room/Chat/LiveRoomDonationChatItemView.swift index 45cf2ae..b1e8fe6 100644 --- a/SodaLive/Sources/Live/Room/Chat/LiveRoomDonationChatItemView.swift +++ b/SodaLive/Sources/Live/Room/Chat/LiveRoomDonationChatItemView.swift @@ -50,7 +50,7 @@ struct LiveRoomDonationChatItemView: View { .font(.system(size: 15)) .foregroundColor(Color(hex: "fdca2f")) - Text(chatMessage.chat.contains("비밀") ? "으로 비밀미션을 보냈습니다.💰🪙" : "을 후원하셨습니다.💰🪙") + Text(chatMessage.chat.contains("비밀") ? "으로 비밀미션을 보냈습니다." : "을 후원하셨습니다.💰🪙") .font(.system(size: 15)) .foregroundColor(.white) } @@ -65,7 +65,8 @@ struct LiveRoomDonationChatItemView: View { .padding(13) .frame(width: screenSize().width - 86, alignment: .leading) .background( - chatMessage.chat.contains("비밀") ? Color(hex: "333333").opacity(0.8) : + chatMessage.chat.contains("비밀") ? chatMessage.memberId == UserDefaults.int(forKey: .userId) ? Color(hex: "59548f").opacity(0.8) : + Color(hex: "333333").opacity(0.8) : chatMessage.can >= 10000 ? Color(hex: "c25264").opacity(0.8) : chatMessage.can >= 5000 ? Color(hex: "d85e37").opacity(0.8) : chatMessage.can >= 1000 ? Color(hex: "d38c38").opacity(0.8) : diff --git a/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift b/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift index 70014ef..71024e9 100644 --- a/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift +++ b/SodaLive/Sources/Live/Room/LiveRoomViewModel.swift @@ -495,6 +495,7 @@ final class LiveRoomViewModel: NSObject, ObservableObject { let (nickname, profileUrl) = self.getUserNicknameAndProfileUrl(accountId: UserDefaults.int(forKey: .userId)) self.messages.append( LiveRoomDonationChat( + memberId: UserDefaults.int(forKey: .userId), profileUrl: profileUrl, nickname: nickname, chat: rawMessage, @@ -525,6 +526,7 @@ final class LiveRoomViewModel: NSObject, ObservableObject { let (nickname, profileUrl) = self.getUserNicknameAndProfileUrl(accountId: UserDefaults.int(forKey: .userId)) self.messages.append( LiveRoomDonationChat( + memberId: UserDefaults.int(forKey: .userId), profileUrl: profileUrl, nickname: nickname, chat: rawMessage, @@ -2192,6 +2194,7 @@ extension LiveRoomViewModel: AgoraRtmDelegate { if decoded.type == .SECRET_DONATION { self.messages.append( LiveRoomDonationChat( + memberId: Int(peerId)!, profileUrl: profileUrl, nickname: nickname, chat: decoded.message, @@ -2225,6 +2228,7 @@ extension LiveRoomViewModel: AgoraRtmChannelDelegate { if decoded.type == .DONATION { self.messages.append( LiveRoomDonationChat( + memberId: Int(member.userId)!, profileUrl: profileUrl, nickname: nickname, chat: decoded.message,