Skip to content

Commit ba58f0c

Browse files
committed
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
2 parents 6de357d + 948a99a commit ba58f0c

File tree

15 files changed

+428
-185
lines changed

15 files changed

+428
-185
lines changed

submodules/ChatSendMessageActionUI/Sources/SendButton.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ final class SendButton: HighlightTrackingButton {
2828
private let kind: Kind
2929

3030
private let containerView: UIView
31-
private let backgroundView: GlassBackgroundView
31+
private let backgroundView: UIImageView
3232
private let iconView: UIImageView
3333
private var activityIndicator: RadialStatusNode?
3434

@@ -41,7 +41,8 @@ final class SendButton: HighlightTrackingButton {
4141
self.containerView = UIView()
4242
self.containerView.isUserInteractionEnabled = false
4343

44-
self.backgroundView = GlassBackgroundView()
44+
self.backgroundView = UIImageView()
45+
self.backgroundView.image = generateStretchableFilledCircleImage(diameter: 34.0, color: .white)?.withRenderingMode(.alwaysTemplate)
4546

4647
self.iconView = UIImageView()
4748
self.iconView.isUserInteractionEnabled = false
@@ -69,12 +70,12 @@ final class SendButton: HighlightTrackingButton {
6970
size: CGSize,
7071
transition: ComponentTransition
7172
) {
72-
let innerSize = CGSize(width: size.width, height: size.height)
73+
let innerSize = CGSize(width: size.width - 3.0 * 2.0, height: size.height - 3.0 * 2.0)
7374
let containerFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - innerSize.width) * 0.5), y: floorToScreenPixels((size.height - innerSize.height) * 0.5)), size: innerSize)
7475
transition.setFrame(view: self.containerView, frame: containerFrame)
7576
transition.setCornerRadius(layer: self.containerView.layer, cornerRadius: innerSize.height * 0.5)
7677

77-
self.backgroundView.update(size: innerSize, cornerRadius: innerSize.height * 0.5, isDark: presentationData.theme.overallDarkAppearance, tintColor: .init(kind: .custom, color: presentationData.theme.chat.inputPanel.actionControlFillColor), transition: .immediate)
78+
self.backgroundView.tintColor = presentationData.theme.chat.inputPanel.actionControlFillColor
7879
transition.setFrame(view: self.backgroundView, frame: CGRect(origin: CGPoint(), size: innerSize))
7980

8081
if self.previousIsAnimatedIn != isAnimatedIn {

submodules/Components/PagerComponent/Sources/PagerComponent.swift

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ open class PagerExternalTopPanelContainer: SparseContainerView {
1414
}
1515

1616
public protocol PagerContentViewWithBackground: UIView {
17-
func pagerUpdateBackground(backgroundFrame: CGRect, topPanelHeight: CGFloat, externalTintMaskContainer: UIView?, transition: ComponentTransition)
17+
func pagerUpdateBackground(backgroundFrame: CGRect, topPanelHeight: CGFloat, bottomPanelHeight: CGFloat, externalTintMaskContainer: UIView?, transition: ComponentTransition)
1818
}
1919

2020
public protocol PagerTopPanelView: UIView {
@@ -721,6 +721,7 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
721721
}
722722

723723
var bottomPanelOffset: CGFloat = 0.0
724+
var bottomPanelHeight: CGFloat = 0.0
724725
if let bottomPanel = component.bottomPanel {
725726
let bottomPanelView: ComponentHostView<PagerComponentPanelEnvironment<TopPanelEnvironment>>
726727
var bottomPanelTransition = panelStateTransition
@@ -767,14 +768,27 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
767768
bottomPanelOffset = bottomPanelSize.height
768769
}
769770

770-
panelStateTransition.setFrame(view: bottomPanelView, frame: CGRect(origin: CGPoint(x: 0.0, y: availableSize.height - bottomPanelSize.height + bottomPanelOffset), size: bottomPanelSize))
771+
let bottomPanelFrame = CGRect(origin: CGPoint(x: 0.0, y: availableSize.height - bottomPanelSize.height + bottomPanelOffset), size: bottomPanelSize)
772+
773+
panelStateTransition.setFrame(view: bottomPanelView, frame: bottomPanelFrame)
774+
775+
if let externalTintMaskContainer = component.externalTintMaskContainer, let bottomPanelView = bottomPanelView.componentView as? PagerTopPanelView {
776+
if bottomPanelView.tintContentMask !== externalTintMaskContainer {
777+
externalTintMaskContainer.addSubview(bottomPanelView.tintContentMask)
778+
}
779+
panelStateTransition.setFrame(view: bottomPanelView.tintContentMask, frame: bottomPanelFrame)
780+
}
771781

772782
contentInsets.bottom += bottomPanelSize.height
783+
bottomPanelHeight = max(0.0, bottomPanelSize.height - bottomPanelOffset)
773784
} else {
774785
if let bottomPanelView = self.bottomPanelView {
775786
self.bottomPanelView = nil
776787

777788
bottomPanelView.removeFromSuperview()
789+
if let bottomPanelView = bottomPanelView.componentView as? PagerTopPanelView {
790+
bottomPanelView.tintContentMask.removeFromSuperview()
791+
}
778792
}
779793

780794
self.bottomPanelHeight = 0.0
@@ -961,7 +975,7 @@ public final class PagerComponent<ChildEnvironmentType: Equatable, TopPanelEnvir
961975
}
962976

963977
if let contentViewWithBackground = contentView.view.componentView as? PagerContentViewWithBackground {
964-
contentViewWithBackground.pagerUpdateBackground(backgroundFrame: backgroundFrame, topPanelHeight: topPanelHeight, externalTintMaskContainer: component.externalTintMaskContainer == nil ? nil : contentView.tintMaskContainer, transition: contentTransition)
978+
contentViewWithBackground.pagerUpdateBackground(backgroundFrame: CGRect(origin: CGPoint(), size: CGSize(width: backgroundFrame.width, height: availableSize.height)), topPanelHeight: topPanelHeight, bottomPanelHeight: bottomPanelHeight, externalTintMaskContainer: component.externalTintMaskContainer == nil ? nil : contentView.tintMaskContainer, transition: contentTransition)
965979
}
966980
}
967981
}

submodules/TelegramPresentationData/Sources/Resources/PresentationResourcesChat.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -382,21 +382,23 @@ public struct PresentationResourcesChat {
382382

383383
public static func chatInputPanelSendIconImage(_ theme: PresentationTheme) -> UIImage? {
384384
return theme.image(PresentationResourceKey.chatInputPanelSendIconImage.rawValue, { theme in
385-
return generateImage(CGSize(width: 33.0, height: 33.0), rotatedContext: { size, context in
385+
return generateImage(CGSize(width: 34.0, height: 34.0), rotatedContext: { size, context in
386+
UIGraphicsPushContext(context)
387+
defer {
388+
UIGraphicsPopContext()
389+
}
390+
386391
context.clear(CGRect(origin: CGPoint(), size: size))
387392
let color: UIColor
388393
if [.day, .night].contains(theme.referenceTheme.baseTheme) && !theme.chat.message.outgoing.bubble.withWallpaper.hasSingleFillColor {
389394
color = .white
390395
} else {
391396
color = theme.chat.inputPanel.actionControlForegroundColor
392397
}
393-
context.setStrokeColor(color.cgColor)
394-
context.setFillColor(color.cgColor)
395-
context.setLineWidth(2.0)
396-
context.setLineCap(.round)
397-
context.setLineJoin(.round)
398-
let _ = try? drawSvgPath(context, path: "M11,14.6666667 L16.4310816,9.40016333 L16.4310816,9.40016333 C16.4694824,9.36292619 16.5305176,9.36292619 16.5689184,9.40016333 L22,14.6666667 S ")
399-
let _ = try? drawSvgPath(context, path: "M16.5,9.33333333 C17.0522847,9.33333333 17.5,9.78104858 17.5,10.3333333 L17.5,24 C17.5,24.5522847 17.0522847,25 16.5,25 C15.9477153,25 15.5,24.5522847 15.5,24 L15.5,10.3333333 C15.5,9.78104858 15.9477153,9.33333333 16.5,9.33333333 Z ")
398+
399+
if let image = generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/SendIcon"), color: color) {
400+
image.draw(in: CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - image.size.width) * 0.5), y: floorToScreenPixels((size.height - image.size.height) * 0.5)), size: image.size))
401+
}
400402
})
401403
})
402404
}

submodules/TelegramUI/Components/Chat/ChatRecordingPreviewInputPanelNode/Sources/ChatRecordingPreviewInputPanelNode.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ public final class ChatRecordingPreviewInputPanelNodeImpl: ChatInputPanelNode {
388388
}
389389

390390
override public func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, additionalSideInsets: UIEdgeInsets, maxHeight: CGFloat, maxOverlayHeight: CGFloat, isSecondary: Bool, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics, isMediaInputExpanded: Bool) -> CGFloat {
391-
let waveformBackgroundFrame = CGRect(origin: CGPoint(x: 2.0, y: 2.0), size: CGSize(width: width - 2.0 * 2.0, height: 40.0 - 2.0 * 2.0))
391+
let waveformBackgroundFrame = CGRect(origin: CGPoint(x: 3.0, y: 3.0), size: CGSize(width: width - 3.0 * 2.0, height: 40.0 - 3.0 * 2.0))
392392

393393
if self.presentationInterfaceState != interfaceState {
394394
var updateWaveform = false
@@ -479,7 +479,7 @@ public final class ChatRecordingPreviewInputPanelNodeImpl: ChatInputPanelNode {
479479
transition: .immediate
480480
)
481481

482-
let waveformForegroundFrame = CGRect(origin: CGPoint(x: 2.0 + leftHandleFrame.minX, y: 2.0), size: CGSize(width: rightHandleFrame.maxX - leftHandleFrame.minX, height: 40.0 - 2.0 * 2.0))
482+
let waveformForegroundFrame = CGRect(origin: CGPoint(x: 3.0 + leftHandleFrame.minX, y: 3.0), size: CGSize(width: rightHandleFrame.maxX - leftHandleFrame.minX, height: 40.0 - 3.0 * 2.0))
483483
transition.updateFrame(node: self.waveformBackgroundNodeImpl, frame: waveformForegroundFrame)
484484

485485
self.waveformNode.updateClipping(minX: leftHandleFrame.minX - 19.0, maxX: rightHandleFrame.maxX - 19.0, transition: transition)
@@ -563,7 +563,7 @@ public final class ChatRecordingPreviewInputPanelNodeImpl: ChatInputPanelNode {
563563
if view.superview == nil {
564564
self.view.addSubview(view)
565565
}
566-
view.frame = CGRect(origin: CGPoint(x: 2.0, y: 2.0), size: scrubberSize)
566+
view.frame = CGRect(origin: CGPoint(x: 3.0, y: 3.0), size: scrubberSize)
567567
}
568568
}
569569
}

submodules/TelegramUI/Components/Chat/ChatRecordingViewOnceButtonNode/Sources/ChatRecordingViewOnceButtonNode.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ public final class ChatRecordingViewOnceButtonNode: HighlightTrackingButtonNode
8888
case .recordMore:
8989
self.iconView.image = generateTintedImage(image: UIImage(bundleImageName: "Chat/Input/Text/IconMicrophone"), color: .white)?.withRenderingMode(.alwaysTemplate)
9090
}
91+
92+
self.iconView.tintColor = theme.chat.inputPanel.panelControlColor
9193
}
9294

9395
let backgroundFrame = CGRect(origin: CGPoint(x: floorToScreenPixels(size.width / 2.0 - innerSize.width / 2.0), y: floorToScreenPixels(size.height / 2.0 - innerSize.height / 2.0)), size: innerSize)

0 commit comments

Comments
 (0)