diff --git a/submodules/Display/Source/WindowContent.swift b/submodules/Display/Source/WindowContent.swift index 917ac3c5b8..ec513047c5 100644 --- a/submodules/Display/Source/WindowContent.swift +++ b/submodules/Display/Source/WindowContent.swift @@ -272,6 +272,7 @@ public class Window1 { private var statusBarChangeObserver: AnyObject? private var keyboardRotationChangeObserver: AnyObject? private var keyboardFrameChangeObserver: AnyObject? + private var keyboardWillHideObserver: AnyObject? private var keyboardTypeChangeObserver: AnyObject? private var voiceOverStatusObserver: AnyObject? @@ -515,6 +516,12 @@ public class Window1 { } }) + #if DEBUG + let testView = UIView() + testView.backgroundColor = .blue + testView.layer.zPosition = 1000.0 + #endif + self.hostView.containerView.addSubview(testView) self.keyboardFrameChangeObserver = NotificationCenter.default.addObserver(forName: UIResponder.keyboardWillChangeFrameNotification, object: nil, queue: nil, using: { [weak self] notification in if let strongSelf = self { var isTablet = false @@ -526,6 +533,10 @@ public class Window1 { if isTablet && keyboardFrame.isEmpty { return } + + #if DEBUG + testView.frame = keyboardFrame.insetBy(dx: -2.0, dy: -2.0) + #endif if #available(iOSApplicationExtension 14.2, iOS 14.2, *), UIAccessibility.prefersCrossFadeTransitions { } else if let keyboardView = strongSelf.statusBarHost?.keyboardView { @@ -641,6 +652,12 @@ public class Window1 { strongSelf.updateLayout { $0.update(inputHeight: keyboardHeight.isLessThanOrEqualTo(0.0) ? nil : keyboardHeight, transition: transition, overrideTransition: false) } } }) + self.keyboardWillHideObserver = NotificationCenter.default.addObserver(forName: UIResponder.keyboardWillHideNotification, object: nil, queue: nil, using: { [weak self] notification in + guard let self else { + return + } + let _ = self + }) if #available(iOSApplicationExtension 11.0, iOS 11.0, *) { self.keyboardTypeChangeObserver = NotificationCenter.default.addObserver(forName: UITextInputMode.currentInputModeDidChangeNotification, object: nil, queue: OperationQueue.main, using: { [weak self] notification in @@ -715,6 +732,9 @@ public class Window1 { if let keyboardFrameChangeObserver = self.keyboardFrameChangeObserver { NotificationCenter.default.removeObserver(keyboardFrameChangeObserver) } + if let keyboardWillHideObserver = self.keyboardWillHideObserver { + NotificationCenter.default.removeObserver(keyboardWillHideObserver) + } if let keyboardTypeChangeObserver = self.keyboardTypeChangeObserver { NotificationCenter.default.removeObserver(keyboardTypeChangeObserver) } @@ -1328,7 +1348,7 @@ public class Window1 { $0.update(upperKeyboardInputPositionBound: self.windowLayout.size.height, transition: transition, overrideTransition: false) } } else { - self.hostView.containerView.endEditing(true) + self.hostView.containerView.findFirstResponder()?.resignFirstResponder() } } diff --git a/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift b/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift index d4a76f0d48..0acf22e0d3 100644 --- a/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift @@ -941,7 +941,7 @@ public func makeDefaultDayPresentationTheme(extendingThemeReference: Presentatio let inputPanel = PresentationThemeChatInputPanel( panelBackgroundColor: rootNavigationBar.blurredBackgroundColor, panelBackgroundColorNoWallpaper: UIColor(rgb: 0xffffff), - panelSeparatorColor: UIColor(white: 1.0, alpha: 0.5), + panelSeparatorColor: UIColor(rgb: 0xbec2c6), panelControlAccentColor: defaultDayAccentColor, panelControlColor: UIColor(rgb: 0x000000, alpha: 1.0), panelControlDisabledColor: UIColor(rgb: 0x727b87, alpha: 0.5), diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift index 73f5c6ea89..68c579f914 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EmojiPagerContentComponent.swift @@ -3164,7 +3164,7 @@ public final class EmojiPagerContentComponent: Component { let (groupHeaderSize, centralContentWidth) = groupHeaderView.update( context: component.context, theme: keyboardChildEnvironment.theme, - forceNeedsVibrancy: component.inputInteractionHolder.inputInteraction?.externalBackground != nil, + forceNeedsVibrancy: false, layoutType: itemLayout.layoutType, hasTopSeparator: hasTopSeparator, actionButtonTitle: actionButtonTitle, @@ -3209,7 +3209,7 @@ public final class EmojiPagerContentComponent: Component { self.mirrorContentScrollView.layer.addSublayer(groupBorderLayer.tintContainerLayer) let borderColor: UIColor - if keyboardChildEnvironment.theme.overallDarkAppearance && component.inputInteractionHolder.inputInteraction?.externalBackground != nil { + if keyboardChildEnvironment.theme.overallDarkAppearance { borderColor = keyboardChildEnvironment.theme.chat.inputMediaPanel.panelContentVibrantOverlayColor.withMultipliedAlpha(0.2) } else { borderColor = keyboardChildEnvironment.theme.chat.inputMediaPanel.panelContentVibrantOverlayColor @@ -4030,13 +4030,13 @@ public final class EmojiPagerContentComponent: Component { return } - if let effectContainerView = externalTintMaskContainer { + if let effectContainerView = externalTintMaskContainer ?? component.inputInteractionHolder.inputInteraction?.externalBackground?.effectContainerView { let mirrorContentClippingView: UIView if let current = self.mirrorContentClippingView { mirrorContentClippingView = current } else { mirrorContentClippingView = UIView() - mirrorContentClippingView.clipsToBounds = true + mirrorContentClippingView.clipsToBounds = false self.mirrorContentClippingView = mirrorContentClippingView if let mirrorContentWarpView = self.mirrorContentWarpView { @@ -4666,7 +4666,7 @@ public final class EmojiPagerContentComponent: Component { } let searchHeaderFrame = CGRect(origin: CGPoint(x: itemLayout.searchInsets.left, y: itemLayout.searchInsets.top), size: CGSize(width: itemLayout.width - itemLayout.searchInsets.left - itemLayout.searchInsets.right, height: itemLayout.searchHeight)) - visibleSearchHeader.update(context: component.context, theme: keyboardChildEnvironment.theme, forceNeedsVibrancy: component.inputInteractionHolder.inputInteraction?.externalBackground != nil, strings: keyboardChildEnvironment.strings, text: displaySearchWithPlaceholder, useOpaqueTheme: useOpaqueTheme, isActive: self.isSearchActivated, size: searchHeaderFrame.size, canFocus: !component.searchIsPlaceholderOnly, searchCategories: component.searchCategories, searchState: component.searchState, transition: transition) + visibleSearchHeader.update(context: component.context, theme: keyboardChildEnvironment.theme, forceNeedsVibrancy: false, strings: keyboardChildEnvironment.strings, text: displaySearchWithPlaceholder, useOpaqueTheme: useOpaqueTheme, isActive: self.isSearchActivated, size: searchHeaderFrame.size, canFocus: !component.searchIsPlaceholderOnly, searchCategories: component.searchCategories, searchState: component.searchState, transition: transition) transition.setFrame(view: visibleSearchHeader, frame: searchHeaderFrame) // Temporary workaround for status selection; use a separate search container (see GIF) diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboard.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboard.swift index 5916d871fa..1f9034b864 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboard.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboard.swift @@ -741,7 +741,7 @@ public final class EntityKeyboardComponent: Component { topPanel: AnyComponent(EntityKeyboardTopContainerPanelComponent( theme: component.theme, overflowHeight: component.hiddenInputHeight, - topInset: 6.0, + topInset: component.externalTopPanelContainer == nil ? 6.0 : 0.0, displayBackground: component.externalTopPanelContainer != nil ? .none : component.displayTopPanelBackground )), externalTopPanelContainer: component.externalTopPanelContainer, diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardBottomPanelComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardBottomPanelComponent.swift index d81a344101..7a62ca691c 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardBottomPanelComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardBottomPanelComponent.swift @@ -163,7 +163,7 @@ final class EntityKeyboardBottomPanelComponent: Component { private var component: EntityKeyboardBottomPanelComponent? override init(frame: CGRect) { - self.backgroundView = BlurredBackgroundView(color: .clear, enableBlur: true, customBlurRadius: 5.0) + self.backgroundView = BlurredBackgroundView(color: .clear, enableBlur: true, customBlurRadius: 10.0) self.separatorView = UIView() self.separatorView.isUserInteractionEnabled = false @@ -187,7 +187,7 @@ final class EntityKeyboardBottomPanelComponent: Component { func update(component: EntityKeyboardBottomPanelComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment, transition: ComponentTransition) -> CGSize { if self.component?.theme !== component.theme { self.separatorView.backgroundColor = component.theme.chat.inputPanel.panelSeparatorColor - self.backgroundView.updateColor(color: component.theme.chat.inputPanel.panelBackgroundColor.withMultipliedAlpha(0.65), transition: .immediate) + self.backgroundView.updateColor(color: component.theme.chat.inputPanel.panelBackgroundColor.withMultipliedAlpha(1.0), transition: .immediate) self.highlightedIconBackgroundView.backgroundColor = component.theme.chat.inputMediaPanel.panelHighlightedIconBackgroundColor } diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopContainerPanelComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopContainerPanelComponent.swift index 85a1fc65ee..28d65064f6 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopContainerPanelComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/EntityKeyboardTopContainerPanelComponent.swift @@ -216,10 +216,11 @@ final class EntityKeyboardTopContainerPanelComponent: Component { backgroundSeparatorView = current } else { backgroundSeparatorView = UIView() + self.backgroundSeparatorView = backgroundSeparatorView self.insertSubview(backgroundSeparatorView, aboveSubview: backgroundView) } - backgroundView.updateColor(color: component.theme.chat.inputPanel.panelBackgroundColor.withMultipliedAlpha(0.65), transition: .immediate) + backgroundView.updateColor(color: component.theme.chat.inputPanel.panelBackgroundColor.withMultipliedAlpha(1.0), transition: .immediate) backgroundView.update(size: CGSize(width: availableSize.width, height: height + component.overflowHeight), transition: transition.containedViewLayoutTransition) transition.setFrame(view: backgroundView, frame: CGRect(origin: CGPoint(x: 0.0, y: -component.overflowHeight), size: CGSize(width: availableSize.width, height: height + component.overflowHeight))) diff --git a/submodules/TelegramUI/Components/EntityKeyboard/Sources/GifPagerContentComponent.swift b/submodules/TelegramUI/Components/EntityKeyboard/Sources/GifPagerContentComponent.swift index 9fa0ec62b8..0899c92b11 100644 --- a/submodules/TelegramUI/Components/EntityKeyboard/Sources/GifPagerContentComponent.swift +++ b/submodules/TelegramUI/Components/EntityKeyboard/Sources/GifPagerContentComponent.swift @@ -466,9 +466,6 @@ public final class GifPagerContentComponent: Component { private let shimmerHostView: PortalSourceView private let standaloneShimmerEffect: StandaloneShimmerEffect - private let backgroundView: BlurredBackgroundView - private let backgroundTintView: UIView - private var vibrancyEffectView: UIView? private let mirrorContentScrollView: UIView private let scrollView: ContentScrollView private let scrollClippingView: UIView @@ -490,9 +487,6 @@ public final class GifPagerContentComponent: Component { private var currentLoadMoreToken: String? override init(frame: CGRect) { - self.backgroundView = BlurredBackgroundView(color: nil) - self.backgroundTintView = UIView() - self.shimmerHostView = PortalSourceView() self.standaloneShimmerEffect = StandaloneShimmerEffect() @@ -514,9 +508,6 @@ public final class GifPagerContentComponent: Component { super.init(frame: frame) - self.backgroundView.addSubview(self.backgroundTintView) - self.addSubview(self.backgroundView) - self.shimmerHostView.alpha = 0.0 self.addSubview(self.shimmerHostView) @@ -877,45 +868,10 @@ public final class GifPagerContentComponent: Component { } public func pagerUpdateBackground(backgroundFrame: CGRect, topPanelHeight: CGFloat, externalTintMaskContainer: UIView?, transition: ComponentTransition) { - guard let theme = self.theme else { - return - } - if theme.overallDarkAppearance { - if let vibrancyEffectView = self.vibrancyEffectView { - self.vibrancyEffectView = nil - vibrancyEffectView.removeFromSuperview() + if let externalTintMaskContainer { + if self.mirrorSearchHeaderContainer.superview !== externalTintMaskContainer { + externalTintMaskContainer.addSubview(self.mirrorSearchHeaderContainer) } - } else { - if self.vibrancyEffectView == nil { - let vibrancyEffectView = UIView() - vibrancyEffectView.backgroundColor = .white - if let filter = CALayer.luminanceToAlpha() { - vibrancyEffectView.layer.filters = [filter] - } - self.vibrancyEffectView = vibrancyEffectView - self.backgroundTintView.mask = vibrancyEffectView - vibrancyEffectView.addSubview(self.mirrorContentScrollView) - vibrancyEffectView.addSubview(self.mirrorSearchHeaderContainer) - } - } - - let hideBackground = self.component?.hideBackground ?? false - var backgroundColor = theme.chat.inputMediaPanel.backgroundColor - if hideBackground { - backgroundColor = backgroundColor.withAlphaComponent(0.01) - } - - self.backgroundTintView.backgroundColor = backgroundColor - transition.setFrame(view: self.backgroundTintView, frame: CGRect(origin: CGPoint(), size: backgroundFrame.size)) - - self.backgroundView.updateColor(color: .clear, enableBlur: true, forceKeepBlur: true, transition: transition.containedViewLayoutTransition) - transition.setFrame(view: self.backgroundView, frame: backgroundFrame) - self.backgroundView.update(size: backgroundFrame.size, transition: transition.containedViewLayoutTransition) - - self.backgroundView.isHidden = hideBackground - - if let vibrancyEffectView = self.vibrancyEffectView { - transition.setFrame(view: vibrancyEffectView, frame: CGRect(origin: CGPoint(x: 0.0, y: -backgroundFrame.minY), size: CGSize(width: backgroundFrame.width, height: backgroundFrame.height + backgroundFrame.minY))) } }