Various improvements

This commit is contained in:
Ilya Laktyushin
2025-09-23 16:04:39 +04:00
parent e61870dd0d
commit 5d43f14ccb
13 changed files with 237 additions and 224 deletions

View File

@@ -142,7 +142,8 @@ final class VideoChatActionButtonComponent: Component {
let alphaTransition: ComponentTransition = transition.animation.isImmediate ? .immediate : .easeInOut(duration: 0.2)
let genericBackgroundColor = UIColor(rgb: 0x2d2f38)
let genericBackgroundColor = UIColor(rgb: 0x2d2f38, alpha: 0.6)
let blueColor = UIColor(rgb: 0x21477d)
let titleText: String
let backgroundColor: UIColor
@@ -168,7 +169,7 @@ final class VideoChatActionButtonComponent: Component {
case .connecting:
backgroundColor = genericBackgroundColor
case .muted:
backgroundColor = !isActive ? genericBackgroundColor : UIColor(rgb: 0x027FFF)
backgroundColor = !isActive ? genericBackgroundColor : blueColor
case .unmuted:
backgroundColor = !isActive ? genericBackgroundColor : UIColor(rgb: 0x34C659)
case .raiseHand, .scheduled:
@@ -181,7 +182,10 @@ final class VideoChatActionButtonComponent: Component {
case .connecting:
backgroundColor = genericBackgroundColor
case .muted:
backgroundColor = !isActive ? genericBackgroundColor : UIColor(rgb: 0x027FFF)
backgroundColor = !isActive ? genericBackgroundColor : blueColor
if isActive {
tintColorKind = .custom
}
case .unmuted:
backgroundColor = !isActive ? genericBackgroundColor : UIColor(rgb: 0x34C659)
case .raiseHand, .scheduled:
@@ -189,18 +193,19 @@ final class VideoChatActionButtonComponent: Component {
}
iconDiameter = 58.0
case .rotateCamera:
titleText = ""
//TODO:localize
titleText = "rotate"
switch component.microphoneState {
case .connecting:
backgroundColor = genericBackgroundColor
case .muted:
backgroundColor = UIColor(rgb: 0x027FFF)
backgroundColor = blueColor
case .unmuted:
backgroundColor = UIColor(rgb: 0x34C659)
case .raiseHand, .scheduled:
backgroundColor = UIColor(rgb: 0x3252EF)
}
iconDiameter = 60.0
iconDiameter = 44.0
case .message:
//TODO:localize
titleText = "message"
@@ -264,7 +269,9 @@ final class VideoChatActionButtonComponent: Component {
let titleSize = self.title.update(
transition: .immediate,
component: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(string: titleText, font: Font.regular(13.0), textColor: .white))
text: .plain(NSAttributedString(string: titleText, font: Font.regular(13.0), textColor: .white)),
horizontalAlignment: .center,
maximumNumberOfLines: 2
)),
environment: {},
containerSize: CGSize(width: 90.0, height: 100.0)
@@ -287,7 +294,7 @@ final class VideoChatActionButtonComponent: Component {
self.background.update(size: size, cornerRadius: size.width * 0.5, isDark: true, tintColor: .init(kind: tintColorKind, color: backgroundColor), transition: tintTransition)
transition.setFrame(view: self.background, frame: CGRect(origin: CGPoint(), size: size))
let titleFrame = CGRect(origin: CGPoint(x: floor((size.width - titleSize.width) * 0.5), y: size.height + 8.0), size: titleSize)
let titleFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - titleSize.width) * 0.5), y: size.height + 5.0), size: titleSize)
if let titleView = self.title.view {
if titleView.superview == nil {
self.addSubview(titleView)