Various call UI improvements

This commit is contained in:
Ilya Laktyushin 2020-08-10 16:49:08 +03:00
parent 18b9f405fc
commit d2f712266b
5 changed files with 16 additions and 14 deletions

View File

@ -614,7 +614,7 @@ public final class SemanticStatusNode: ASControlNode {
if parameters.hollow { if parameters.hollow {
context.setBlendMode(.clear) context.setBlendMode(.clear)
context.fillEllipse(in: bounds.insetBy(dx: 7.0 - UIScreenPixel, dy: 7.0 - UIScreenPixel)) context.fillEllipse(in: bounds.insetBy(dx: 8.0, dy: 8.0))
} }
} }
} }

View File

@ -149,7 +149,7 @@ final class CallControllerButtonsNode: ASDisplayNode {
} }
} }
let minSmallButtonSideInset: CGFloat = 34.0 let minSmallButtonSideInset: CGFloat = width > 320.0 ? 34.0 : 16.0
let maxSmallButtonSpacing: CGFloat = 34.0 let maxSmallButtonSpacing: CGFloat = 34.0
let smallButtonSize: CGFloat = 60.0 let smallButtonSize: CGFloat = 60.0
let topBottomSpacing: CGFloat = 84.0 let topBottomSpacing: CGFloat = 84.0

View File

@ -57,7 +57,7 @@ private final class CallVideoNode: ASDisplayNode {
self.videoPausedNode = ImmediateTextNode() self.videoPausedNode = ImmediateTextNode()
self.videoPausedNode.alpha = 0.0 self.videoPausedNode.alpha = 0.0
self.videoPausedNode.maximumNumberOfLines = 2 self.videoPausedNode.maximumNumberOfLines = 3
super.init() super.init()
@ -920,8 +920,8 @@ final class CallControllerNode: ViewControllerTracingNode, CallControllerNodePro
} }
} }
statusValue = .timer({ value in statusValue = .timer({ value, measure in
if isReconnecting { if isReconnecting || (self.outgoingVideoViewRequested && value == "00:00" && !measure) {
return strings.Call_StatusConnecting return strings.Call_StatusConnecting
} else { } else {
return value return value

View File

@ -12,7 +12,7 @@ private let regularStatusFont = Font.regular(18.0)
enum CallControllerStatusValue: Equatable { enum CallControllerStatusValue: Equatable {
case text(string: String, displayLogo: Bool) case text(string: String, displayLogo: Bool)
case timer((String) -> String, Double) case timer((String, Bool) -> String, Double)
static func ==(lhs: CallControllerStatusValue, rhs: CallControllerStatusValue) -> Bool { static func ==(lhs: CallControllerStatusValue, rhs: CallControllerStatusValue) -> Bool {
switch lhs { switch lhs {
@ -175,8 +175,8 @@ final class CallControllerStatusNode: ASDisplayNode {
durationString = String(format: "%02d:%02d", arguments: [(duration / 60) % 60, duration % 60]) durationString = String(format: "%02d:%02d", arguments: [(duration / 60) % 60, duration % 60])
measureDurationString = "00:00" measureDurationString = "00:00"
} }
statusText = format(durationString) statusText = format(durationString, false)
statusMeasureText = format(measureDurationString) statusMeasureText = format(measureDurationString, true)
if self.reception != nil { if self.reception != nil {
statusOffset += 8.0 statusOffset += 8.0
} }

View File

@ -6,6 +6,7 @@ import SwiftSignalKit
import TelegramPresentationData import TelegramPresentationData
private let labelFont = Font.regular(17.0) private let labelFont = Font.regular(17.0)
private let smallLabelFont = Font.regular(15.0)
private enum ToastDescription: Equatable { private enum ToastDescription: Equatable {
enum Key: Hashable { enum Key: Hashable {
@ -73,7 +74,6 @@ final class CallControllerToastContainerNode: ASDisplayNode {
transition = .immediate transition = .immediate
} }
let previousContent = self.appliedContent
self.appliedContent = content self.appliedContent = content
let spacing: CGFloat = 18.0 let spacing: CGFloat = 18.0
@ -249,10 +249,12 @@ private class CallControllerToastItemNode: ASDisplayNode {
} }
func update(width: CGFloat, content: Content, transition: ContainedViewLayoutTransition) -> CGFloat { func update(width: CGFloat, content: Content, transition: ContainedViewLayoutTransition) -> CGFloat {
let inset: CGFloat = 32.0 let inset: CGFloat = 30.0
let isNarrowScreen = width <= 320.0
let font = isNarrowScreen ? smallLabelFont : labelFont
let topInset: CGFloat = isNarrowScreen ? 5.0 : 4.0
if self.currentContent != content || self.currentWidth != width { if self.currentContent != content || self.currentWidth != width {
let previousContent = self.currentContent
self.currentContent = content self.currentContent = content
self.currentWidth = width self.currentWidth = width
@ -273,10 +275,10 @@ private class CallControllerToastItemNode: ASDisplayNode {
self.iconNode.image = image self.iconNode.image = image
} }
self.textNode.attributedText = NSAttributedString(string: content.text, font: Font.regular(17.0), textColor: .white) self.textNode.attributedText = NSAttributedString(string: content.text, font: font, textColor: .white)
let iconSize = CGSize(width: 44.0, height: 28.0) let iconSize = CGSize(width: 44.0, height: 28.0)
let iconSpacing: CGFloat = 2.0 let iconSpacing: CGFloat = isNarrowScreen ? 0.0 : 1.0
let textSize = self.textNode.updateLayout(CGSize(width: width - inset * 2.0 - iconSize.width - iconSpacing, height: 100.0)) let textSize = self.textNode.updateLayout(CGSize(width: width - inset * 2.0 - iconSize.width - iconSpacing, height: 100.0))
let backgroundSize = CGSize(width: iconSize.width + iconSpacing + textSize.width + 6.0 * 2.0, height: max(28.0, textSize.height + 4.0 * 2.0)) let backgroundSize = CGSize(width: iconSize.width + iconSpacing + textSize.width + 6.0 * 2.0, height: max(28.0, textSize.height + 4.0 * 2.0))
@ -286,7 +288,7 @@ private class CallControllerToastItemNode: ASDisplayNode {
transition.updateFrame(view: self.effectView, frame: CGRect(origin: CGPoint(), size: backgroundFrame.size)) transition.updateFrame(view: self.effectView, frame: CGRect(origin: CGPoint(), size: backgroundFrame.size))
self.iconNode.frame = CGRect(origin: CGPoint(), size: iconSize) self.iconNode.frame = CGRect(origin: CGPoint(), size: iconSize)
self.textNode.frame = CGRect(origin: CGPoint(x: iconSize.width + iconSpacing, y: 4.0), size: textSize) self.textNode.frame = CGRect(origin: CGPoint(x: iconSize.width + iconSpacing, y: topInset), size: textSize)
self.currentHeight = backgroundSize.height self.currentHeight = backgroundSize.height
} }