[WIP] Video chat v2

This commit is contained in:
Isaac
2024-09-03 22:34:04 +08:00
parent 53cb586691
commit d2b4622ef0
14 changed files with 1544 additions and 165 deletions

View File

@@ -9,13 +9,16 @@ import LottieComponent
final class VideoChatMuteIconComponent: Component {
let color: UIColor
let isFilled: Bool
let isMuted: Bool
init(
color: UIColor,
isFilled: Bool,
isMuted: Bool
) {
self.color = color
self.isFilled = isFilled
self.isMuted = isMuted
}
@@ -23,6 +26,9 @@ final class VideoChatMuteIconComponent: Component {
if lhs.color != rhs.color {
return false
}
if lhs.isFilled != rhs.isFilled {
return false
}
if lhs.isMuted != rhs.isMuted {
return false
}
@@ -37,6 +43,10 @@ final class VideoChatMuteIconComponent: Component {
private var contentImage: UIImage?
var iconView: UIView {
return self.icon.view
}
override init(frame: CGRect) {
self.icon = VoiceChatMicrophoneNode()
@@ -62,7 +72,7 @@ final class VideoChatMuteIconComponent: Component {
self.addSubview(self.icon.view)
}
transition.setFrame(view: self.icon.view, frame: animationFrame)
self.icon.update(state: VoiceChatMicrophoneNode.State(muted: component.isMuted, filled: true, color: component.color), animated: !transition.animation.isImmediate)
self.icon.update(state: VoiceChatMicrophoneNode.State(muted: component.isMuted, filled: component.isFilled, color: component.color), animated: !transition.animation.isImmediate)
return availableSize
}