parent
86d4bc1c1e
commit
95ba74b862
|
@ -147,12 +147,21 @@ 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) {
|
||||||
self.signatureImageUrl = ""
|
if let imageUrl = self.signatureImageUrls.first {
|
||||||
|
self.signatureImageUrl = imageUrl
|
||||||
|
self.signatureImageUrls.removeFirst()
|
||||||
|
} else {
|
||||||
|
self.signatureImageUrl = ""
|
||||||
|
self.isShowSignatureImage = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var signatureImageUrls = [String]()
|
||||||
|
var isShowSignatureImage = false
|
||||||
|
|
||||||
var timer: DispatchSourceTimer?
|
var timer: DispatchSourceTimer?
|
||||||
|
|
||||||
func setOriginOffset(_ offset: CGFloat) {
|
func setOriginOffset(_ offset: CGFloat) {
|
||||||
|
@ -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(
|
||||||
|
|
Loading…
Reference in New Issue