mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Voice Chat UI fixes
This commit is contained in:
@@ -206,6 +206,8 @@ public protocol PresentationGroupCall: class {
|
|||||||
func toggleIsMuted()
|
func toggleIsMuted()
|
||||||
func setIsMuted(_ value: Bool)
|
func setIsMuted(_ value: Bool)
|
||||||
func setCurrentAudioOutput(_ output: AudioSessionOutput)
|
func setCurrentAudioOutput(_ output: AudioSessionOutput)
|
||||||
|
|
||||||
|
func invitePeer(_ peerId: PeerId)
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol PresentationCallManager: class {
|
public protocol PresentationCallManager: class {
|
||||||
|
|||||||
@@ -552,4 +552,12 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
|
|||||||
strongSelf.updateSessionState(internalState: .active(value), audioSessionControl: strongSelf.audioSessionControl)
|
strongSelf.updateSessionState(internalState: .active(value), audioSessionControl: strongSelf.audioSessionControl)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func invitePeer(_ peerId: PeerId) {
|
||||||
|
guard case let .estabilished(callInfo, _, _, _, _) = self.internalState else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let _ = inviteToGroupCall(account: self.account, callId: callInfo.id, accessHash: callInfo.accessHash, peerId: peerId).start()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,11 +88,11 @@ private final class Blob {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentShape: CGPath?
|
var currentShape: UIBezierPath?
|
||||||
private var transition: CGFloat = 0 {
|
private var transition: CGFloat = 0 {
|
||||||
didSet {
|
didSet {
|
||||||
if let currentPoints = self.currentPoints {
|
if let currentPoints = self.currentPoints {
|
||||||
self.currentShape = UIBezierPath.smoothCurve(through: currentPoints, length: size.width, smoothness: smoothness).cgPath
|
self.currentShape = UIBezierPath.smoothCurve(through: currentPoints, length: size.width, smoothness: smoothness)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -450,7 +450,6 @@ private class VoiceChatActionButtonBackgroundNode: ASDisplayNode {
|
|||||||
let buttonSize = CGSize(width: 144.0, height: 144.0)
|
let buttonSize = CGSize(width: 144.0, height: 144.0)
|
||||||
let radius = buttonSize.width / 2.0
|
let radius = buttonSize.width / 2.0
|
||||||
|
|
||||||
|
|
||||||
let blue = UIColor(rgb: 0x0078ff)
|
let blue = UIColor(rgb: 0x0078ff)
|
||||||
let lightBlue = UIColor(rgb: 0x59c7f8)
|
let lightBlue = UIColor(rgb: 0x59c7f8)
|
||||||
let green = UIColor(rgb: 0x33c659)
|
let green = UIColor(rgb: 0x33c659)
|
||||||
@@ -512,7 +511,7 @@ private class VoiceChatActionButtonBackgroundNode: ASDisplayNode {
|
|||||||
if let blobsState = parameters.state as? VoiceChatActionButtonBackgroundNodeBlobState {
|
if let blobsState = parameters.state as? VoiceChatActionButtonBackgroundNodeBlobState {
|
||||||
for blob in blobsState.blobs {
|
for blob in blobsState.blobs {
|
||||||
if let path = blob.currentShape {
|
if let path = blob.currentShape {
|
||||||
let uiPath = UIBezierPath(cgPath: path)
|
let uiPath = path
|
||||||
let toOrigin = CGAffineTransform(translationX: -bounds.size.width / 2.0, y: -bounds.size.height / 2.0)
|
let toOrigin = CGAffineTransform(translationX: -bounds.size.width / 2.0, y: -bounds.size.height / 2.0)
|
||||||
let fromOrigin = CGAffineTransform(translationX: bounds.size.width / 2.0, y: bounds.size.height / 2.0)
|
let fromOrigin = CGAffineTransform(translationX: bounds.size.width / 2.0, y: bounds.size.height / 2.0)
|
||||||
|
|
||||||
|
|||||||
@@ -273,6 +273,8 @@ public final class VoiceChatController: ViewController {
|
|||||||
),
|
),
|
||||||
in: .current
|
in: .current
|
||||||
)
|
)
|
||||||
|
|
||||||
|
strongSelf.call.invitePeer(peer.id)
|
||||||
}, peerContextAction: { [weak self] peer, sourceNode, gesture in
|
}, peerContextAction: { [weak self] peer, sourceNode, gesture in
|
||||||
guard let strongSelf = self, let controller = strongSelf.controller, let sourceNode = sourceNode as? ContextExtractedContentContainingNode else {
|
guard let strongSelf = self, let controller = strongSelf.controller, let sourceNode = sourceNode as? ContextExtractedContentContainingNode else {
|
||||||
return
|
return
|
||||||
@@ -639,6 +641,7 @@ public final class VoiceChatController: ViewController {
|
|||||||
let actionButtonTitle: String
|
let actionButtonTitle: String
|
||||||
let actionButtonSubtitle: String
|
let actionButtonSubtitle: String
|
||||||
let audioButtonAppearance: CallControllerButtonItemNode.Content.Appearance
|
let audioButtonAppearance: CallControllerButtonItemNode.Content.Appearance
|
||||||
|
var actionButtonEnabled = true
|
||||||
if let callState = callState {
|
if let callState = callState {
|
||||||
isMicOn = !callState.isMuted
|
isMicOn = !callState.isMuted
|
||||||
|
|
||||||
@@ -648,6 +651,7 @@ public final class VoiceChatController: ViewController {
|
|||||||
actionButtonTitle = self.presentationData.strings.VoiceChat_Connecting
|
actionButtonTitle = self.presentationData.strings.VoiceChat_Connecting
|
||||||
actionButtonSubtitle = ""
|
actionButtonSubtitle = ""
|
||||||
audioButtonAppearance = .color(.custom(0x1c1c1e))
|
audioButtonAppearance = .color(.custom(0x1c1c1e))
|
||||||
|
actionButtonEnabled = false
|
||||||
case .connected:
|
case .connected:
|
||||||
actionButtonState = .active(state: isMicOn ? .on : .muted)
|
actionButtonState = .active(state: isMicOn ? .on : .muted)
|
||||||
if isMicOn {
|
if isMicOn {
|
||||||
@@ -665,8 +669,10 @@ public final class VoiceChatController: ViewController {
|
|||||||
actionButtonTitle = self.presentationData.strings.VoiceChat_Connecting
|
actionButtonTitle = self.presentationData.strings.VoiceChat_Connecting
|
||||||
actionButtonSubtitle = ""
|
actionButtonSubtitle = ""
|
||||||
audioButtonAppearance = .color(.custom(0x1c1c1e))
|
audioButtonAppearance = .color(.custom(0x1c1c1e))
|
||||||
|
actionButtonEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.actionButton.isUserInteractionEnabled = actionButtonEnabled
|
||||||
self.actionButton.update(size: centralButtonSize, buttonSize: CGSize(width: 144.0, height: 144.0), state: actionButtonState, title: actionButtonTitle, subtitle: actionButtonSubtitle, animated: true)
|
self.actionButton.update(size: centralButtonSize, buttonSize: CGSize(width: 144.0, height: 144.0), state: actionButtonState, title: actionButtonTitle, subtitle: actionButtonSubtitle, animated: true)
|
||||||
transition.updateFrame(node: self.actionButton, frame: actionButtonFrame)
|
transition.updateFrame(node: self.actionButton, frame: actionButtonFrame)
|
||||||
|
|
||||||
@@ -703,7 +709,7 @@ public final class VoiceChatController: ViewController {
|
|||||||
soundImage = .speaker
|
soundImage = .speaker
|
||||||
case .speaker:
|
case .speaker:
|
||||||
soundImage = .speaker
|
soundImage = .speaker
|
||||||
// soundAppearance = .blurred(isFilled: false)
|
soundAppearance = .blurred(isFilled: true)
|
||||||
case .headphones:
|
case .headphones:
|
||||||
soundImage = .bluetooth
|
soundImage = .bluetooth
|
||||||
case let .bluetooth(type):
|
case let .bluetooth(type):
|
||||||
|
|||||||
@@ -345,8 +345,8 @@ public class VoiceChatParticipantItemNode: ListViewItemNode {
|
|||||||
let verticalOffset: CGFloat = 0.0
|
let verticalOffset: CGFloat = 0.0
|
||||||
let avatarSize: CGFloat = 40.0
|
let avatarSize: CGFloat = 40.0
|
||||||
|
|
||||||
let (titleLayout, titleApply) = makeTitleLayout(TextNodeLayoutArguments(attributedString: titleAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 12.0 - rightInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
let (titleLayout, titleApply) = makeTitleLayout(TextNodeLayoutArguments(attributedString: titleAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 12.0 - rightInset - 25.0, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||||
let (statusLayout, statusApply) = makeStatusLayout(TextNodeLayoutArguments(attributedString: statusAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 8.0 - rightInset, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
let (statusLayout, statusApply) = makeStatusLayout(TextNodeLayoutArguments(attributedString: statusAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width - leftInset - 8.0 - rightInset - 25.0, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||||
|
|
||||||
let insets = UIEdgeInsets()
|
let insets = UIEdgeInsets()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user