시그니처 후원 이미지 표시
- 이미지 URL을 배열에 저장 후 순서대로 표시하도록 수정
This commit is contained in:
@@ -147,11 +147,20 @@ final class LiveRoomViewModel: NSObject, ObservableObject {
|
|||||||
didSet {
|
didSet {
|
||||||
if signatureImageUrl.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 {
|
if signatureImageUrl.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 {
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + 3.5) {
|
DispatchQueue.main.asyncAfter(deadline: .now() + 3.5) {
|
||||||
|
if let imageUrl = self.signatureImageUrls.first {
|
||||||
|
self.signatureImageUrl = imageUrl
|
||||||
|
self.signatureImageUrls.removeFirst()
|
||||||
|
} else {
|
||||||
self.signatureImageUrl = ""
|
self.signatureImageUrl = ""
|
||||||
|
self.isShowSignatureImage = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var signatureImageUrls = [String]()
|
||||||
|
var isShowSignatureImage = false
|
||||||
|
|
||||||
var timer: DispatchSourceTimer?
|
var timer: DispatchSourceTimer?
|
||||||
|
|
||||||
@@ -395,7 +404,7 @@ final class LiveRoomViewModel: NSObject, ObservableObject {
|
|||||||
)
|
)
|
||||||
|
|
||||||
totalDonationCan += can
|
totalDonationCan += can
|
||||||
signatureImageUrl = decoded.data ?? ""
|
showSignatureImage(imageUrl: decoded.data ?? "")
|
||||||
|
|
||||||
self.messageChangeFlag.toggle()
|
self.messageChangeFlag.toggle()
|
||||||
if self.messages.count > 100 {
|
if self.messages.count > 100 {
|
||||||
@@ -1556,6 +1565,17 @@ final class LiveRoomViewModel: NSObject, ObservableObject {
|
|||||||
}
|
}
|
||||||
.store(in: &subscription)
|
.store(in: &subscription)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func showSignatureImage(imageUrl: String) {
|
||||||
|
if imageUrl.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 {
|
||||||
|
if !isShowSignatureImage {
|
||||||
|
isShowSignatureImage = true
|
||||||
|
signatureImageUrl = imageUrl
|
||||||
|
} else {
|
||||||
|
signatureImageUrls.append(imageUrl)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension LiveRoomViewModel: AgoraRtcEngineDelegate {
|
extension LiveRoomViewModel: AgoraRtcEngineDelegate {
|
||||||
@@ -1720,7 +1740,7 @@ extension LiveRoomViewModel: AgoraRtmChannelDelegate {
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.totalDonationCan += decoded.can
|
self.totalDonationCan += decoded.can
|
||||||
self.signatureImageUrl = decoded.signatureImageUrl ?? ""
|
self.showSignatureImage(imageUrl: decoded.signatureImageUrl ?? "")
|
||||||
} else if decoded.type == .ROULETTE_DONATION {
|
} else if decoded.type == .ROULETTE_DONATION {
|
||||||
self.messages.append(
|
self.messages.append(
|
||||||
LiveRoomRouletteDonationChat(
|
LiveRoomRouletteDonationChat(
|
||||||
|
Reference in New Issue
Block a user