diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Calls/GroupCalls.swift b/submodules/TelegramCore/Sources/TelegramEngine/Calls/GroupCalls.swift index a2cacc309f..620a02f241 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Calls/GroupCalls.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Calls/GroupCalls.swift @@ -3925,7 +3925,7 @@ public final class GroupCallMessagesContext { if !self.isLiveStream { for i in (0 ..< self.state.messages.count).reversed() { let message = self.state.messages[i] - if (now - message.date) < message.lifetime { + if message.date + message.lifetime < now { if updatedState == nil { updatedState = self.state } @@ -3936,7 +3936,7 @@ public final class GroupCallMessagesContext { for i in (0 ..< self.state.pinnedMessages.count).reversed() { let message = self.state.pinnedMessages[i] - if (now - message.date) < message.lifetime { + if message.date + message.lifetime < now { if updatedState == nil { updatedState = self.state } diff --git a/submodules/TelegramUI/Components/Chat/ChatChannelSubscriberInputPanelNode/Sources/ChatChannelSubscriberInputPanelNode.swift b/submodules/TelegramUI/Components/Chat/ChatChannelSubscriberInputPanelNode/Sources/ChatChannelSubscriberInputPanelNode.swift index cc3438bf17..d5126f3e37 100644 --- a/submodules/TelegramUI/Components/Chat/ChatChannelSubscriberInputPanelNode/Sources/ChatChannelSubscriberInputPanelNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatChannelSubscriberInputPanelNode/Sources/ChatChannelSubscriberInputPanelNode.swift @@ -174,43 +174,44 @@ public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode { self.button = HighlightableButton() self.buttonBackgroundView = GlassBackgroundView() self.buttonBackgroundView.isUserInteractionEnabled = false - self.button.addSubview(self.buttonBackgroundView) self.buttonTitle = ImmediateTextNode() self.buttonTitle.isUserInteractionEnabled = false self.buttonTintTitle = ImmediateTextNode() self.buttonBackgroundView.contentView.addSubview(self.buttonTitle.view) self.buttonBackgroundView.maskContentView.addSubview(self.buttonTintTitle.view) + self.buttonBackgroundView.contentView.addSubview(self.button) self.helpButton = HighlightableButton() - self.helpButton.isHidden = true self.helpButtonBackgroundView = GlassBackgroundView() self.helpButtonBackgroundView.isUserInteractionEnabled = false - self.helpButton.addSubview(self.helpButtonBackgroundView) self.helpButtonIconView = GlassBackgroundView.ContentImageView() self.helpButtonBackgroundView.contentView.addSubview(self.helpButtonIconView) + self.helpButtonBackgroundView.contentView.addSubview(self.helpButton) + self.helpButtonBackgroundView.isHidden = true self.giftButton = HighlightableButton() - self.giftButton.isHidden = true self.giftButtonBackgroundView = GlassBackgroundView() self.giftButtonBackgroundView.isUserInteractionEnabled = false - self.giftButton.addSubview(self.giftButtonBackgroundView) self.giftButtonIconView = GlassBackgroundView.ContentImageView() self.giftButtonBackgroundView.contentView.addSubview(self.giftButtonIconView) + self.giftButtonBackgroundView.contentView.addSubview(self.giftButton) + self.giftButtonBackgroundView.isHidden = true self.suggestedPostButton = HighlightableButton() - self.suggestedPostButton.isHidden = true self.suggestedPostButtonBackgroundView = GlassBackgroundView() self.suggestedPostButtonBackgroundView.isUserInteractionEnabled = false self.suggestedPostButton.addSubview(self.suggestedPostButtonBackgroundView) self.suggestedPostButtonIconView = GlassBackgroundView.ContentImageView() self.suggestedPostButtonBackgroundView.contentView.addSubview(self.suggestedPostButtonIconView) + self.suggestedPostButtonBackgroundView.contentView.addSubview(self.suggestedPostButton) + self.suggestedPostButtonBackgroundView.isHidden = true super.init() - self.view.addSubview(self.button) - self.view.addSubview(self.helpButton) - self.view.addSubview(self.giftButton) - self.view.addSubview(self.suggestedPostButton) + self.view.addSubview(self.buttonBackgroundView) + self.view.addSubview(self.helpButtonBackgroundView) + self.view.addSubview(self.giftButtonBackgroundView) + self.view.addSubview(self.suggestedPostButtonBackgroundView) self.button.addTarget(self, action: #selector(self.buttonPressed), for: .touchUpInside) self.helpButton.addTarget(self, action: #selector(self.helpPressed), for: .touchUpInside) self.giftButton.addTarget(self, action: #selector(self.giftPressed), for: .touchUpInside) @@ -442,36 +443,36 @@ public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode { self.giftButton.layer.animateScale(from: 0.01, to: 1.0, duration: 0.2) } - self.giftButton.isHidden = false - self.helpButton.isHidden = true - self.suggestedPostButton.isHidden = !broadcastInfo.flags.contains(.hasMonoforum) + self.giftButtonBackgroundView.isHidden = false + self.helpButtonBackgroundView.isHidden = true + self.suggestedPostButtonBackgroundView.isHidden = !broadcastInfo.flags.contains(.hasMonoforum) self.presentGiftOrSuggestTooltip() } else if case let .broadcast(broadcastInfo) = peer.info, broadcastInfo.flags.contains(.hasMonoforum) { - self.giftButton.isHidden = true - self.helpButton.isHidden = true - self.suggestedPostButton.isHidden = false + self.giftButtonBackgroundView.isHidden = true + self.helpButtonBackgroundView.isHidden = true + self.suggestedPostButtonBackgroundView.isHidden = false self.presentGiftOrSuggestTooltip() } else if peer.flags.contains(.isGigagroup), self.action == .muteNotifications || self.action == .unmuteNotifications { - self.giftButton.isHidden = true - self.helpButton.isHidden = false - self.suggestedPostButton.isHidden = true + self.giftButtonBackgroundView.isHidden = true + self.helpButtonBackgroundView.isHidden = false + self.suggestedPostButtonBackgroundView.isHidden = true } else { - self.giftButton.isHidden = true - self.helpButton.isHidden = true - self.suggestedPostButton.isHidden = true + self.giftButtonBackgroundView.isHidden = true + self.helpButtonBackgroundView.isHidden = true + self.suggestedPostButtonBackgroundView.isHidden = true } } else { - self.giftButton.isHidden = true - self.helpButton.isHidden = true - self.suggestedPostButton.isHidden = true + self.giftButtonBackgroundView.isHidden = true + self.helpButtonBackgroundView.isHidden = true + self.suggestedPostButtonBackgroundView.isHidden = true } let buttonTitleSize = self.buttonTitle.updateLayout(CGSize(width: width, height: panelHeight)) let _ = self.buttonTintTitle.updateLayout(CGSize(width: width, height: panelHeight)) let buttonSize = CGSize(width: buttonTitleSize.width + 16.0 * 2.0, height: 40.0) let buttonFrame = CGRect(origin: CGPoint(x: floor((width - buttonSize.width) / 2.0), y: floor((panelHeight - buttonSize.height) * 0.5)), size: buttonSize) - transition.updateFrame(view: self.button, frame: buttonFrame) - transition.updateFrame(view: self.buttonBackgroundView, frame: CGRect(origin: CGPoint(), size: buttonFrame.size)) + transition.updateFrame(view: self.buttonBackgroundView, frame: buttonFrame) + transition.updateFrame(view: self.button, frame: CGRect(origin: CGPoint(), size: buttonFrame.size)) let buttonTintColor: GlassBackgroundView.TintColor if case .join = self.action { buttonTintColor = .init(kind: .custom, color: interfaceState.theme.chat.inputPanel.inputBackgroundColor.withMultipliedAlpha(0.7), innerColor: interfaceState.theme.chat.inputPanel.actionControlFillColor) @@ -483,27 +484,27 @@ public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode { self.buttonTintTitle.frame = self.buttonTitle.frame let giftButtonFrame = CGRect(x: width - rightInset - 40.0 - 8.0, y: floor((panelHeight - 40.0) * 0.5), width: 40.0, height: 40.0) - transition.updateFrame(view: self.giftButton, frame: giftButtonFrame) + transition.updateFrame(view: self.giftButtonBackgroundView, frame: giftButtonFrame) if let image = self.giftButtonIconView.image { transition.updateFrame(view: self.giftButtonIconView, frame: image.size.centered(in: CGRect(origin: CGPoint(), size: giftButtonFrame.size))) } - transition.updateFrame(view: self.giftButtonBackgroundView, frame: CGRect(origin: CGPoint(), size: giftButtonFrame.size)) + transition.updateFrame(view: self.giftButton, frame: CGRect(origin: CGPoint(), size: giftButtonFrame.size)) self.giftButtonBackgroundView.update(size: giftButtonFrame.size, cornerRadius: giftButtonFrame.height * 0.5, isDark: interfaceState.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: interfaceState.theme.chat.inputPanel.inputBackgroundColor.withMultipliedAlpha(0.7)), transition: ComponentTransition(transition)) let helpButtonFrame = CGRect(x: width - rightInset - 8.0 - 40.0, y: floor((panelHeight - 40.0) * 0.5), width: 40.0, height: 40.0) - transition.updateFrame(view: self.helpButton, frame: helpButtonFrame) + transition.updateFrame(view: self.helpButtonBackgroundView, frame: helpButtonFrame) if let image = self.helpButtonIconView.image { transition.updateFrame(view: self.helpButtonIconView, frame: image.size.centered(in: CGRect(origin: CGPoint(), size: helpButtonFrame.size))) } - transition.updateFrame(view: self.helpButtonBackgroundView, frame: CGRect(origin: CGPoint(), size: helpButtonFrame.size)) + transition.updateFrame(view: self.helpButton, frame: CGRect(origin: CGPoint(), size: helpButtonFrame.size)) self.helpButtonBackgroundView.update(size: helpButtonFrame.size, cornerRadius: helpButtonFrame.height * 0.5, isDark: interfaceState.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: interfaceState.theme.chat.inputPanel.inputBackgroundColor.withMultipliedAlpha(0.7)), transition: ComponentTransition(transition)) let suggestedPostButtonFrame = CGRect(x: leftInset + 8.0, y: floor((panelHeight - 40.0) * 0.5), width: 40.0, height: 40.0) - transition.updateFrame(view: self.suggestedPostButton, frame: suggestedPostButtonFrame) + transition.updateFrame(view: self.suggestedPostButtonBackgroundView, frame: suggestedPostButtonFrame) if let image = self.suggestedPostButtonIconView.image { transition.updateFrame(view: self.suggestedPostButtonIconView, frame: image.size.centered(in: CGRect(origin: CGPoint(), size: suggestedPostButtonFrame.size))) } - transition.updateFrame(view: self.suggestedPostButtonBackgroundView, frame: CGRect(origin: CGPoint(), size: suggestedPostButtonFrame.size)) + transition.updateFrame(view: self.suggestedPostButton, frame: CGRect(origin: CGPoint(), size: suggestedPostButtonFrame.size)) self.suggestedPostButtonBackgroundView.update(size: suggestedPostButtonFrame.size, cornerRadius: suggestedPostButtonFrame.height * 0.5, isDark: interfaceState.theme.overallDarkAppearance, tintColor: .init(kind: .panel, color: interfaceState.theme.chat.inputPanel.inputBackgroundColor.withMultipliedAlpha(0.7)), transition: ComponentTransition(transition)) return panelHeight diff --git a/submodules/TelegramUI/Components/Chat/ChatTextInputPanelNode/Sources/ChatTextInputPanelComponent.swift b/submodules/TelegramUI/Components/Chat/ChatTextInputPanelNode/Sources/ChatTextInputPanelComponent.swift index 10010331e4..102ddc9fba 100644 --- a/submodules/TelegramUI/Components/Chat/ChatTextInputPanelNode/Sources/ChatTextInputPanelComponent.swift +++ b/submodules/TelegramUI/Components/Chat/ChatTextInputPanelNode/Sources/ChatTextInputPanelComponent.swift @@ -112,6 +112,7 @@ public final class ChatTextInputPanelComponent: Component { let hideKeyboard: Bool let insets: UIEdgeInsets let maxHeight: CGFloat + let maxLength: Int? let sendAction: (() -> Void)? let sendContextAction: ((UIView, ContextGesture) -> Void)? @@ -130,6 +131,7 @@ public final class ChatTextInputPanelComponent: Component { hideKeyboard: Bool, insets: UIEdgeInsets, maxHeight: CGFloat, + maxLength: Int?, sendAction: (() -> Void)?, sendContextAction: ((UIView, ContextGesture) -> Void)? ) { @@ -147,6 +149,7 @@ public final class ChatTextInputPanelComponent: Component { self.hideKeyboard = hideKeyboard self.insets = insets self.maxHeight = maxHeight + self.maxLength = maxLength self.sendAction = sendAction self.sendContextAction = sendContextAction } @@ -194,6 +197,9 @@ public final class ChatTextInputPanelComponent: Component { if lhs.maxHeight != rhs.maxHeight { return false } + if lhs.maxLength != rhs.maxLength { + return false + } if (lhs.sendAction == nil) != (rhs.sendAction == nil) { return false } @@ -783,6 +789,7 @@ public final class ChatTextInputPanelComponent: Component { } panelNode.customSendColor = component.sendColor + panelNode.customInputTextMaxLength = component.maxLength if let resetInputState = component.externalState.resetInputState { component.externalState.resetInputState = nil diff --git a/submodules/TelegramUI/Components/Chat/ChatTextInputPanelNode/Sources/ChatTextInputPanelNode.swift b/submodules/TelegramUI/Components/Chat/ChatTextInputPanelNode/Sources/ChatTextInputPanelNode.swift index 43c31cfe39..8938b1cc3e 100644 --- a/submodules/TelegramUI/Components/Chat/ChatTextInputPanelNode/Sources/ChatTextInputPanelNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatTextInputPanelNode/Sources/ChatTextInputPanelNode.swift @@ -387,6 +387,7 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg public var customLeftAction: LeftAction? public var customRightAction: RightAction? public var customSendColor: UIColor? + public var customInputTextMaxLength: Int? private var starReactionButton: ComponentView? @@ -3580,7 +3581,9 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg private func updateCounterTextNode(transition: ContainedViewLayoutTransition) { var inputTextMaxLength: Int32? - if let presentationInterfaceState = self.presentationInterfaceState { + if let customInputTextMaxLength = self.customInputTextMaxLength { + inputTextMaxLength = Int32(customInputTextMaxLength) + } else if let presentationInterfaceState = self.presentationInterfaceState { if let editMessage = presentationInterfaceState.interfaceState.editMessage, let inputTextMaxLengthValue = editMessage.inputTextMaxLength { inputTextMaxLength = inputTextMaxLengthValue } else if case let .customChatContents(customChatContents) = presentationInterfaceState.subject, case .businessLinkSetup = customChatContents.kind { diff --git a/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift b/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift index 3f194ac47e..b743edfcaa 100644 --- a/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift +++ b/submodules/TelegramUI/Components/GlassBackgroundComponent/Sources/GlassBackgroundComponent.swift @@ -492,6 +492,7 @@ public final class GlassBackgroundContainerView: UIView { } private let legacyView: ContentView? + private let nativeParamsView: EffectSettingsContainerView? private let nativeView: UIVisualEffectView? public var contentView: UIView { @@ -506,17 +507,24 @@ public final class GlassBackgroundContainerView: UIView { if #available(iOS 26.0, *) { let effect = UIGlassContainerEffect() effect.spacing = 7.0 - self.nativeView = UIVisualEffectView(effect: effect) + let nativeView = UIVisualEffectView(effect: effect) + self.nativeView = nativeView + + let nativeParamsView = EffectSettingsContainerView(frame: CGRect()) + self.nativeParamsView = nativeParamsView + nativeParamsView.addSubview(nativeView) + self.legacyView = nil } else { self.nativeView = nil + self.nativeParamsView = nil self.legacyView = ContentView() } super.init(frame: frame) - if let nativeView = self.nativeView { - self.addSubview(nativeView) + if let nativeParamsView = self.nativeParamsView { + self.addSubview(nativeParamsView) } else if let legacyView = self.legacyView { self.addSubview(legacyView) } @@ -529,7 +537,7 @@ public final class GlassBackgroundContainerView: UIView { override public func didAddSubview(_ subview: UIView) { super.didAddSubview(subview) - if subview !== self.nativeView && subview !== self.legacyView { + if subview !== self.nativeParamsView && subview !== self.legacyView { assertionFailure() } } @@ -538,16 +546,21 @@ public final class GlassBackgroundContainerView: UIView { guard let result = self.contentView.hitTest(point, with: event) else { return nil } - if result === self.contentView { - //return nil - } return result } public func update(size: CGSize, isDark: Bool, transition: ComponentTransition) { - if let nativeView = self.nativeView { + if let nativeParamsView = self.nativeParamsView, let nativeView = self.nativeView { nativeView.overrideUserInterfaceStyle = isDark ? .dark : .light + if isDark { + nativeParamsView.lumaMin = 0.0 + nativeParamsView.lumaMax = 0.15 + } else { + nativeParamsView.lumaMin = 0.25 + nativeParamsView.lumaMax = 1.0 + } + transition.setFrame(view: nativeView, frame: CGRect(origin: CGPoint(), size: size)) } else if let legacyView = self.legacyView { transition.setFrame(view: legacyView, frame: CGRect(origin: CGPoint(), size: size)) diff --git a/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift b/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift index ac3a08ea20..7ccc7743ff 100644 --- a/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift +++ b/submodules/TelegramUI/Components/MessageInputPanelComponent/Sources/MessageInputPanelComponent.swift @@ -952,6 +952,7 @@ public final class MessageInputPanelComponent: Component { hideKeyboard: component.hideKeyboard, insets: UIEdgeInsets(top: 0.0, left: 0.0, bottom: component.bottomInset, right: 0.0), maxHeight: availableSize.height, + maxLength: component.maxLength, sendAction: { [weak self] in guard let self, let component = self.component else { return diff --git a/submodules/UIKitRuntimeUtils/Source/UIKitRuntimeUtils/UIViewController+Navigation.m b/submodules/UIKitRuntimeUtils/Source/UIKitRuntimeUtils/UIViewController+Navigation.m index 46a531594a..04298f70af 100644 --- a/submodules/UIKitRuntimeUtils/Source/UIKitRuntimeUtils/UIViewController+Navigation.m +++ b/submodules/UIKitRuntimeUtils/Source/UIKitRuntimeUtils/UIViewController+Navigation.m @@ -174,11 +174,11 @@ static bool notyfyingShiftState = false; @end static EffectSettingsContainerView *findTopmostEffectSuperview(UIView *view, int depth) { - if (depth > 5) { + if (depth > 10) { return nil; } if ([view isKindOfClass:[EffectSettingsContainerView class]]) { - return (EffectSettingsContainerView* )view; + return (EffectSettingsContainerView *)view; } if (view.superview != nil) { return findTopmostEffectSuperview(view.superview, depth + 1);