Skip to content

Commit a7385ad

Browse files
author
Isaac
committed
Update
1 parent b5e8c89 commit a7385ad

File tree

11 files changed

+78
-34
lines changed

11 files changed

+78
-34
lines changed

submodules/ComposePollUI/Sources/ComposePollScreen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ final class ComposePollScreenComponent: Component {
707707
hasStickers: false,
708708
hasGifs: false,
709709
hideBackground: true,
710-
maskEdge: true,
710+
maskEdge: .fade,
711711
sendGif: nil
712712
)
713713
)

submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ public func makeDefaultDayPresentationTheme(extendingThemeReference: Presentatio
950950
inputStrokeColor: UIColor(rgb: 0x000000, alpha: 0.1),
951951
inputPlaceholderColor: UIColor(rgb: 0x000000, alpha: 0.4),
952952
inputTextColor: UIColor(rgb: 0x000000),
953-
inputControlColor: UIColor(rgb: 0x000000, alpha: 0.4),
953+
inputControlColor: UIColor(rgb: 0x000000, alpha: 0.5),
954954
actionControlFillColor: defaultDayAccentColor,
955955
actionControlForegroundColor: UIColor(rgb: 0xffffff),
956956
primaryTextColor: UIColor(rgb: 0x000000, alpha: 1.0),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ public final class ChatInputMessageAccessoryPanel: Component {
402402
}
403403
self.closeButtonIcon.tintColor = environment.theme.chat.inputPanel.inputControlColor
404404

405-
let secondaryTextColor = environment.theme.chat.inputPanel.inputControlColor.withMultipliedBrightnessBy(0.5)
405+
let secondaryTextColor = environment.theme.chat.inputPanel.inputPlaceholderColor
406406

407407
var textString: NSAttributedString
408408
var isPhoto = false
@@ -492,7 +492,7 @@ public final class ChatInputMessageAccessoryPanel: Component {
492492
isMedia = false
493493
isText = true
494494
default:
495-
isMedia = true
495+
isMedia = effectiveMessage.text.isEmpty
496496
isText = false
497497
}
498498

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,7 +1958,7 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
19581958
}
19591959
}
19601960

1961-
self.updateActionButtons(hasText: inputHasText, hideMicButton: hideMicButton, animated: transition.isAnimated)
1961+
self.updateActionButtons(hasText: inputHasText, hideMicButton: hideMicButton, hideMicButtonBackground: mediaRecordingState != nil, animated: transition.isAnimated)
19621962

19631963
var actionButtonsSize = CGSize(width: 40.0, height: 40.0)
19641964
if let presentationInterfaceState = self.presentationInterfaceState {
@@ -1995,8 +1995,6 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
19951995
audioRecordingItemsAlpha = 0.0
19961996
}
19971997

1998-
transition.updateAlpha(layer: self.actionButtons.micButtonBackgroundView.layer, alpha: mediaRecordingState != nil ? 0.01 : 1.0)
1999-
20001998
if let mediaRecordingState {
20011999
audioRecordingItemsAlpha = 0.0
20022000

@@ -3675,7 +3673,7 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
36753673
self.updateTextHeight(animated: animated)
36763674
}
36773675

3678-
private func updateActionButtons(hasText: Bool, hideMicButton: Bool, animated: Bool) {
3676+
private func updateActionButtons(hasText: Bool, hideMicButton: Bool, hideMicButtonBackground: Bool, animated: Bool) {
36793677
var hideMicButton = hideMicButton
36803678

36813679
var mediaInputIsActive = false
@@ -3832,19 +3830,15 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
38323830
}
38333831
}
38343832

3833+
let alphaTransition: ContainedViewLayoutTransition = .animated(duration: 0.2, curve: .easeInOut)
3834+
38353835
if hideMicButton {
38363836
if !self.actionButtons.micButton.alpha.isZero {
3837-
self.actionButtons.micButton.alpha = 0.0
3838-
if animated {
3839-
self.actionButtons.micButton.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2)
3840-
}
3841-
3842-
self.actionButtons.micButtonBackgroundView.alpha = 0.0
3843-
if animated {
3844-
self.actionButtons.micButtonBackgroundView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2)
3845-
}
3837+
alphaTransition.updateAlpha(layer: self.actionButtons.micButton.layer, alpha: 0.0)
38463838
}
3839+
alphaTransition.updateAlpha(layer: self.actionButtons.micButtonBackgroundView.layer, alpha: 0.0)
38473840
} else {
3841+
alphaTransition.updateAlpha(layer: self.actionButtons.micButtonBackgroundView.layer, alpha: hideMicButtonBackground ? 0.0 : 1.0)
38483842
let micAlpha: CGFloat = self.actionButtons.micButton.fadeDisabled ? 0.5 : 1.0
38493843
if !self.actionButtons.micButton.alpha.isEqual(to: micAlpha) {
38503844
self.actionButtons.micButton.alpha = micAlpha

submodules/TelegramUI/Components/ChatEntityKeyboardInputNode/Sources/ChatEntityKeyboardInputNode.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode {
169169
hasStickers: Bool = true,
170170
hasGifs: Bool = true,
171171
hideBackground: Bool = false,
172-
maskEdge: Bool = false,
172+
maskEdge: EmojiPagerContentComponent.MaskEdgeMode = .none,
173173
forceHasPremium: Bool = false,
174174
sendGif: ((FileMediaReference, UIView, CGRect, Bool, Bool) -> Bool)?
175175
) -> Signal<InputData, NoError> {
@@ -213,7 +213,8 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode {
213213
hasEdit: hasEdit,
214214
hasAdd: hasEdit,
215215
subject: .chatStickers,
216-
hideBackground: hideBackground
216+
hideBackground: hideBackground,
217+
maskEdge: maskEdge
217218
)
218219
|> map(Optional.init)
219220
} else {
@@ -1915,7 +1916,7 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode {
19151916
externalTopPanelContainer: self.externalTopPanelContainerImpl,
19161917
externalBottomPanelContainer: nil,
19171918
externalTintMaskContainer: self.backgroundTintMaskContentView,
1918-
displayTopPanelBackground: self.opaqueTopPanelBackground ? .opaque : .blur,
1919+
displayTopPanelBackground: self.opaqueTopPanelBackground ? .opaque : .none,
19191920
topPanelExtensionUpdated: { [weak self] topPanelExtension, transition in
19201921
guard let strongSelf = self else {
19211922
return

submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,12 @@ public final class EmojiPagerContentComponent: Component {
610610
}
611611
}
612612

613+
public enum MaskEdgeMode {
614+
case none
615+
case fade
616+
case clip
617+
}
618+
613619
public let id: AnyHashable
614620
public let context: AccountContext
615621
public let avatarPeer: EnginePeer?
@@ -623,7 +629,7 @@ public final class EmojiPagerContentComponent: Component {
623629
public let searchState: SearchState
624630
public let warpContentsOnEdges: Bool
625631
public let hideBackground: Bool
626-
public let maskEdge: Bool
632+
public let maskEdge: MaskEdgeMode
627633
public let displaySearchWithPlaceholder: String?
628634
public let searchCategories: EmojiSearchCategories?
629635
public let searchInitiallyHidden: Bool
@@ -649,7 +655,7 @@ public final class EmojiPagerContentComponent: Component {
649655
searchState: SearchState,
650656
warpContentsOnEdges: Bool,
651657
hideBackground: Bool,
652-
maskEdge: Bool,
658+
maskEdge: MaskEdgeMode,
653659
displaySearchWithPlaceholder: String?,
654660
searchCategories: EmojiSearchCategories?,
655661
searchInitiallyHidden: Bool,
@@ -1383,6 +1389,7 @@ public final class EmojiPagerContentComponent: Component {
13831389
private let backgroundView: BlurredBackgroundView
13841390
private let backgroundTintView: UIView
13851391
private var fadingMaskLayer: FadingMaskLayer?
1392+
private var tintFadingMaskLayer: FadingMaskLayer?
13861393
private var vibrancyClippingView: UIView
13871394
private var vibrancyEffectView: UIView?
13881395
public private(set) var mirrorContentClippingView: UIView?
@@ -4007,6 +4014,9 @@ public final class EmojiPagerContentComponent: Component {
40074014
if let fadingMaskLayer = self.fadingMaskLayer {
40084015
fadingMaskLayer.internalAlpha = max(0.0, min(1.0, self.scrollView.contentOffset.y / 30.0))
40094016
}
4017+
if let tintFadingMaskLayer = self.tintFadingMaskLayer {
4018+
tintFadingMaskLayer.internalAlpha = max(0.0, min(1.0, self.scrollView.contentOffset.y / 30.0))
4019+
}
40104020
}
40114021

40124022
private func updateShimmerIfNeeded() {
@@ -4075,18 +4085,31 @@ public final class EmojiPagerContentComponent: Component {
40754085
if component.hideBackground {
40764086
self.backgroundView.isHidden = true
40774087

4078-
if component.maskEdge {
4088+
if component.maskEdge != .none {
40794089
let maskLayer: FadingMaskLayer
40804090
if let current = self.fadingMaskLayer {
40814091
maskLayer = current
40824092
} else {
4083-
maskLayer = FadingMaskLayer()
4093+
maskLayer = FadingMaskLayer(isHard: component.maskEdge == .clip)
40844094
self.fadingMaskLayer = maskLayer
40854095
}
4096+
4097+
let tintFadingMaskLayer: FadingMaskLayer
4098+
if let current = self.tintFadingMaskLayer {
4099+
tintFadingMaskLayer = current
4100+
} else {
4101+
tintFadingMaskLayer = FadingMaskLayer(isHard: component.maskEdge == .clip)
4102+
self.tintFadingMaskLayer = tintFadingMaskLayer
4103+
}
4104+
40864105
if self.layer.mask == nil {
40874106
self.layer.mask = maskLayer
40884107
}
4089-
maskLayer.frame = CGRect(origin: CGPoint(x: 0.0, y: floorToScreenPixels((topPanelHeight - 34.0) * 0.75)), size: backgroundFrame.size)
4108+
if self.mirrorContentClippingView?.layer.mask != tintFadingMaskLayer {
4109+
self.mirrorContentClippingView?.layer.mask = tintFadingMaskLayer
4110+
}
4111+
maskLayer.frame = CGRect(origin: CGPoint(x: 0.0, y: topPanelHeight - 40.0), size: backgroundFrame.size)
4112+
tintFadingMaskLayer.frame = maskLayer.frame
40904113
}
40914114
} else if component.warpContentsOnEdges {
40924115
self.backgroundView.isHidden = true
@@ -4910,18 +4933,38 @@ private final class FadingMaskLayer: SimpleLayer {
49104933
let fillLayer = SimpleLayer()
49114934
let gradientFillLayer = SimpleLayer()
49124935

4936+
private let isHard: Bool
4937+
49134938
var internalAlpha: CGFloat = 1.0 {
49144939
didSet {
49154940
self.gradientFillLayer.opacity = Float(1.0 - self.internalAlpha)
49164941
}
49174942
}
49184943

4944+
init(isHard: Bool) {
4945+
self.isHard = isHard
4946+
super.init()
4947+
}
4948+
4949+
override init(layer: Any) {
4950+
self.isHard = false
4951+
super.init(layer: layer)
4952+
}
4953+
4954+
required init?(coder: NSCoder) {
4955+
fatalError("init(coder:) has not been implemented")
4956+
}
4957+
49194958
override func layoutSublayers() {
49204959
let gradientHeight: CGFloat = 66.0
49214960
if self.gradientLayer.contents == nil {
4922-
self.addSublayer(self.gradientLayer)
4961+
if !self.isHard {
4962+
self.addSublayer(self.gradientLayer)
4963+
}
49234964
self.addSublayer(self.fillLayer)
4924-
self.addSublayer(self.gradientFillLayer)
4965+
if !self.isHard {
4966+
self.addSublayer(self.gradientFillLayer)
4967+
}
49254968

49264969
let gradientImage = generateGradientImage(size: CGSize(width: 1.0, height: gradientHeight), colors: [UIColor.white.withAlphaComponent(0.0), UIColor.white.withAlphaComponent(0.0), UIColor.white, UIColor.white], locations: [0.0, 0.4, 0.9, 1.0], direction: .vertical)
49274970
self.gradientLayer.contents = gradientImage?.cgImage
@@ -4932,7 +4975,12 @@ private final class FadingMaskLayer: SimpleLayer {
49324975

49334976
self.gradientLayer.frame = CGRect(origin: .zero, size: CGSize(width: self.bounds.width, height: gradientHeight))
49344977
self.gradientFillLayer.frame = self.gradientLayer.frame
4935-
self.fillLayer.frame = CGRect(origin: CGPoint(x: 0.0, y: gradientHeight), size: CGSize(width: self.bounds.width, height: self.bounds.height - gradientHeight))
4978+
if self.isHard {
4979+
let hardHeight: CGFloat = 40.0
4980+
self.fillLayer.frame = CGRect(origin: CGPoint(x: 0.0, y: hardHeight), size: CGSize(width: self.bounds.width, height: self.bounds.height - hardHeight))
4981+
} else {
4982+
self.fillLayer.frame = CGRect(origin: CGPoint(x: 0.0, y: gradientHeight), size: CGSize(width: self.bounds.width, height: self.bounds.height - gradientHeight))
4983+
}
49364984
}
49374985
}
49384986

submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentSignals.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public extension EmojiPagerContentComponent {
6666
forceHasPremium: Bool = false,
6767
premiumIfSavedMessages: Bool = true,
6868
hideBackground: Bool = false,
69-
maskEdge: Bool = false
69+
maskEdge: EmojiPagerContentComponent.MaskEdgeMode = .none
7070
) -> Signal<EmojiPagerContentComponent, NoError> {
7171
let premiumConfiguration = PremiumConfiguration.with(appConfiguration: context.currentAppConfiguration.with { $0 })
7272
let isPremiumDisabled = premiumConfiguration.isPremiumDisabled
@@ -1635,7 +1635,7 @@ public extension EmojiPagerContentComponent {
16351635
searchIsPlaceholderOnly: Bool = true,
16361636
subject: StickersSubject = .chatStickers,
16371637
hideBackground: Bool = false,
1638-
maskEdge: Bool = false
1638+
maskEdge: EmojiPagerContentComponent.MaskEdgeMode = .none
16391639
) -> Signal<EmojiPagerContentComponent, NoError> {
16401640
let premiumConfiguration = PremiumConfiguration.with(appConfiguration: context.currentAppConfiguration.with { $0 })
16411641
let isPremiumDisabled = premiumConfiguration.isPremiumDisabled
@@ -2202,7 +2202,7 @@ public extension EmojiPagerContentComponent {
22022202
animationRenderer: MultiAnimationRenderer,
22032203
hasSearch: Bool,
22042204
hideBackground: Bool = false,
2205-
maskEdge: Bool = false
2205+
maskEdge: EmojiPagerContentComponent.MaskEdgeMode = .none
22062206
) -> Signal<EmojiPagerContentComponent, NoError> {
22072207
let premiumConfiguration = PremiumConfiguration.with(appConfiguration: context.currentAppConfiguration.with { $0 })
22082208
let isPremiumDisabled = premiumConfiguration.isPremiumDisabled

submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiSearchContent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ public final class EmojiSearchContent: ASDisplayNode, EntitySearchContainerNode
469469
searchState: .empty(hasResults: false),
470470
warpContentsOnEdges: false,
471471
hideBackground: false,
472-
maskEdge: false,
472+
maskEdge: .none,
473473
displaySearchWithPlaceholder: self.presentationData.strings.EmojiSearch_SearchEmojiPlaceholder,
474474
searchCategories: nil,
475475
searchInitiallyHidden: false,

submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ public extension GlassBackgroundView {
696696
fillColor.getHue(nil, saturation: &s, brightness: &b, alpha: &a)
697697

698698
let innerImage: UIImage
699-
if size == CGSize(width: 40.0 + inset * 2.0, height: 40.0 + inset * 2.0) {
699+
if size == CGSize(width: 40.0 + inset * 2.0, height: 40.0 + inset * 2.0), b >= 0.2 {
700700
innerImage = UIGraphicsImageRenderer(size: size).image { ctx in
701701
let context = ctx.cgContext
702702

submodules/TelegramUI/Components/MediaEditorScreen/Sources/MediaEditorScreen.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ final class MediaEditorScreenComponent: Component {
407407
areCustomEmojiEnabled: true,
408408
hasSearch: true,
409409
hideBackground: true,
410-
maskEdge: true,
410+
maskEdge: .fade,
411411
sendGif: nil
412412
) |> map { inputData -> ChatEntityKeyboardInputNode.InputData in
413413
return ChatEntityKeyboardInputNode.InputData(

0 commit comments

Comments
 (0)