mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
[WIP] Video chats
This commit is contained in:
@@ -34,13 +34,16 @@ final class VideoChatActionButtonComponent: Component {
|
||||
|
||||
let content: Content
|
||||
let microphoneState: MicrophoneState
|
||||
let isCollapsed: Bool
|
||||
|
||||
init(
|
||||
content: Content,
|
||||
microphoneState: MicrophoneState
|
||||
microphoneState: MicrophoneState,
|
||||
isCollapsed: Bool
|
||||
) {
|
||||
self.content = content
|
||||
self.microphoneState = microphoneState
|
||||
self.isCollapsed = isCollapsed
|
||||
}
|
||||
|
||||
static func ==(lhs: VideoChatActionButtonComponent, rhs: VideoChatActionButtonComponent) -> Bool {
|
||||
@@ -50,6 +53,9 @@ final class VideoChatActionButtonComponent: Component {
|
||||
if lhs.microphoneState != rhs.microphoneState {
|
||||
return false
|
||||
}
|
||||
if lhs.isCollapsed != rhs.isCollapsed {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -80,6 +86,8 @@ final class VideoChatActionButtonComponent: Component {
|
||||
let previousComponent = self.component
|
||||
self.component = component
|
||||
|
||||
let alphaTransition: ComponentTransition = transition.animation.isImmediate ? .immediate : .easeInOut(duration: 0.2)
|
||||
|
||||
let titleText: String
|
||||
let backgroundColor: UIColor
|
||||
let iconDiameter: CGFloat
|
||||
@@ -138,9 +146,10 @@ final class VideoChatActionButtonComponent: Component {
|
||||
|
||||
let _ = self.background.update(
|
||||
transition: transition,
|
||||
component: AnyComponent(RoundedRectangle(
|
||||
component: AnyComponent(FilledRoundedRectangleComponent(
|
||||
color: backgroundColor,
|
||||
cornerRadius: nil
|
||||
cornerRadius: size.width * 0.5,
|
||||
smoothCorners: false
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: size
|
||||
@@ -159,6 +168,7 @@ final class VideoChatActionButtonComponent: Component {
|
||||
}
|
||||
transition.setPosition(view: titleView, position: titleFrame.center)
|
||||
titleView.bounds = CGRect(origin: CGPoint(), size: titleFrame.size)
|
||||
alphaTransition.setAlpha(view: titleView, alpha: component.isCollapsed ? 0.0 : 1.0)
|
||||
}
|
||||
|
||||
let iconSize = self.icon.update(
|
||||
|
||||
Reference in New Issue
Block a user