UI improvements

This commit is contained in:
Ali
2023-01-27 02:32:01 +01:00
parent d3aa8f2dc8
commit 2a0ab901ae
9 changed files with 45 additions and 16 deletions

View File

@@ -146,7 +146,7 @@ private final class StickerSelectionComponent: Component {
defaultToEmojiTab: false, defaultToEmojiTab: false,
externalTopPanelContainer: self.panelHostView, externalTopPanelContainer: self.panelHostView,
externalBottomPanelContainer: nil, externalBottomPanelContainer: nil,
displayTopPanelBackground: true, displayTopPanelBackground: .blur,
topPanelExtensionUpdated: { _, _ in }, topPanelExtensionUpdated: { _, _ in },
hideInputUpdated: { _, _, _ in }, hideInputUpdated: { _, _, _ in },
hideTopPanelUpdated: { _, _ in }, hideTopPanelUpdated: { _, _ in },

View File

@@ -712,6 +712,10 @@ public final class ReactionContextNode: ASDisplayNode, UIScrollViewDelegate {
} }
} }
#if DEBUG
loopIdle = true
#endif
var validIndices = Set<Int>() var validIndices = Set<Int>()
var nextX: CGFloat = sideInset var nextX: CGFloat = sideInset
for i in 0 ..< self.items.count { for i in 0 ..< self.items.count {

View File

@@ -1210,7 +1210,7 @@ final class AvatarEditorScreenComponent: Component {
defaultToEmojiTab: true, defaultToEmojiTab: true,
externalTopPanelContainer: self.panelHostView, externalTopPanelContainer: self.panelHostView,
externalBottomPanelContainer: nil, externalBottomPanelContainer: nil,
displayTopPanelBackground: true, displayTopPanelBackground: .blur,
topPanelExtensionUpdated: { _, _ in }, topPanelExtensionUpdated: { _, _ in },
hideInputUpdated: { _, _, _ in }, hideInputUpdated: { _, _, _ in },
hideTopPanelUpdated: { [weak self] hideTopPanel, transition in hideTopPanelUpdated: { [weak self] hideTopPanel, transition in

View File

@@ -244,6 +244,7 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode {
private var currentInputData: InputData private var currentInputData: InputData
private var inputDataDisposable: Disposable? private var inputDataDisposable: Disposable?
private var hasRecentGifsDisposable: Disposable? private var hasRecentGifsDisposable: Disposable?
private let opaqueTopPanelBackground: Bool
private struct EmojiSearchResult { private struct EmojiSearchResult {
var groups: [EmojiPagerContentComponent.ItemGroup] var groups: [EmojiPagerContentComponent.ItemGroup]
@@ -569,10 +570,11 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode {
private weak var currentUndoOverlayController: UndoOverlayController? private weak var currentUndoOverlayController: UndoOverlayController?
public init(context: AccountContext, currentInputData: InputData, updatedInputData: Signal<InputData, NoError>, defaultToEmojiTab: Bool, controllerInteraction: ChatControllerInteraction?, interfaceInteraction: ChatPanelInterfaceInteraction?, chatPeerId: PeerId?) { public init(context: AccountContext, currentInputData: InputData, updatedInputData: Signal<InputData, NoError>, defaultToEmojiTab: Bool, opaqueTopPanelBackground: Bool = false, controllerInteraction: ChatControllerInteraction?, interfaceInteraction: ChatPanelInterfaceInteraction?, chatPeerId: PeerId?) {
self.context = context self.context = context
self.currentInputData = currentInputData self.currentInputData = currentInputData
self.defaultToEmojiTab = defaultToEmojiTab self.defaultToEmojiTab = defaultToEmojiTab
self.opaqueTopPanelBackground = opaqueTopPanelBackground
self.controllerInteraction = controllerInteraction self.controllerInteraction = controllerInteraction
@@ -1771,7 +1773,7 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode {
defaultToEmojiTab: self.defaultToEmojiTab, defaultToEmojiTab: self.defaultToEmojiTab,
externalTopPanelContainer: self.externalTopPanelContainerImpl, externalTopPanelContainer: self.externalTopPanelContainerImpl,
externalBottomPanelContainer: nil, externalBottomPanelContainer: nil,
displayTopPanelBackground: false, displayTopPanelBackground: self.opaqueTopPanelBackground ? .opaque : .none,
topPanelExtensionUpdated: { [weak self] topPanelExtension, transition in topPanelExtensionUpdated: { [weak self] topPanelExtension, transition in
guard let strongSelf = self else { guard let strongSelf = self else {
return return
@@ -2332,17 +2334,19 @@ public final class EntityInputView: UIInputView, AttachmentTextInputPanelInputVi
) )
}, },
defaultToEmojiTab: true, defaultToEmojiTab: true,
opaqueTopPanelBackground: true,
controllerInteraction: nil, controllerInteraction: nil,
interfaceInteraction: nil, interfaceInteraction: nil,
chatPeerId: nil chatPeerId: nil
) )
self.inputNode = inputNode self.inputNode = inputNode
inputNode.clipContentToTopPanel = hideBackground inputNode.clipContentToTopPanel = true
inputNode.emojiInputInteraction = inputInteraction inputNode.emojiInputInteraction = inputInteraction
inputNode.externalTopPanelContainerImpl = nil inputNode.externalTopPanelContainerImpl = nil
inputNode.switchToTextInput = { [weak self] in inputNode.switchToTextInput = { [weak self] in
self?.switchToKeyboard?() self?.switchToKeyboard?()
} }
inputNode.backgroundColor = self.presentationData.theme.chat.inputMediaPanel.backgroundColor
self.addSubnode(inputNode) self.addSubnode(inputNode)
} }
} }

View File

@@ -156,7 +156,7 @@ public final class EmojiStatusSelectionComponent: Component {
let topPanelHeight: CGFloat = component.hideTopPanel ? 0.0 : 42.0 let topPanelHeight: CGFloat = component.hideTopPanel ? 0.0 : 42.0
let keyboardSize = self.keyboardView.update( let keyboardSize = self.keyboardView.update(
transition: transition.withUserData(EmojiPagerContentComponent.SynchronousLoadBehavior(isDisabled: true)), transition: transition,//.withUserData(EmojiPagerContentComponent.SynchronousLoadBehavior(isDisabled: true)),
component: AnyComponent(EntityKeyboardComponent( component: AnyComponent(EntityKeyboardComponent(
theme: component.theme, theme: component.theme,
strings: component.strings, strings: component.strings,
@@ -172,7 +172,7 @@ public final class EmojiStatusSelectionComponent: Component {
defaultToEmojiTab: true, defaultToEmojiTab: true,
externalTopPanelContainer: self.panelHostView, externalTopPanelContainer: self.panelHostView,
externalBottomPanelContainer: nil, externalBottomPanelContainer: nil,
displayTopPanelBackground: true, displayTopPanelBackground: .blur,
topPanelExtensionUpdated: { _, _ in }, topPanelExtensionUpdated: { _, _ in },
hideInputUpdated: { _, _, _ in }, hideInputUpdated: { _, _, _ in },
hideTopPanelUpdated: { [weak self] hideTopPanel, transition in hideTopPanelUpdated: { [weak self] hideTopPanel, transition in

View File

@@ -431,7 +431,7 @@ public final class EmojiSearchContent: ASDisplayNode, EntitySearchContainerNode
defaultToEmojiTab: true, defaultToEmojiTab: true,
externalTopPanelContainer: self.panelHostView, externalTopPanelContainer: self.panelHostView,
externalBottomPanelContainer: nil, externalBottomPanelContainer: nil,
displayTopPanelBackground: true, displayTopPanelBackground: .blur,
topPanelExtensionUpdated: { _, _ in }, topPanelExtensionUpdated: { _, _ in },
hideInputUpdated: { _, _, _ in }, hideInputUpdated: { _, _, _ in },
hideTopPanelUpdated: { _, _ in hideTopPanelUpdated: { _, _ in

View File

@@ -61,6 +61,12 @@ public final class EntityKeyboardComponent: Component {
case masks case masks
} }
public enum DisplayTopPanelBackground {
case none
case blur
case opaque
}
public struct GifSearchEmoji: Equatable { public struct GifSearchEmoji: Equatable {
public var emoji: String public var emoji: String
public var file: TelegramMediaFile public var file: TelegramMediaFile
@@ -100,7 +106,7 @@ public final class EntityKeyboardComponent: Component {
public let defaultToEmojiTab: Bool public let defaultToEmojiTab: Bool
public let externalTopPanelContainer: PagerExternalTopPanelContainer? public let externalTopPanelContainer: PagerExternalTopPanelContainer?
public let externalBottomPanelContainer: PagerExternalTopPanelContainer? public let externalBottomPanelContainer: PagerExternalTopPanelContainer?
public let displayTopPanelBackground: Bool public let displayTopPanelBackground: DisplayTopPanelBackground
public let topPanelExtensionUpdated: (CGFloat, Transition) -> Void public let topPanelExtensionUpdated: (CGFloat, Transition) -> Void
public let hideInputUpdated: (Bool, Bool, Transition) -> Void public let hideInputUpdated: (Bool, Bool, Transition) -> Void
public let hideTopPanelUpdated: (Bool, Transition) -> Void public let hideTopPanelUpdated: (Bool, Transition) -> Void
@@ -132,7 +138,7 @@ public final class EntityKeyboardComponent: Component {
defaultToEmojiTab: Bool, defaultToEmojiTab: Bool,
externalTopPanelContainer: PagerExternalTopPanelContainer?, externalTopPanelContainer: PagerExternalTopPanelContainer?,
externalBottomPanelContainer: PagerExternalTopPanelContainer?, externalBottomPanelContainer: PagerExternalTopPanelContainer?,
displayTopPanelBackground: Bool, displayTopPanelBackground: DisplayTopPanelBackground,
topPanelExtensionUpdated: @escaping (CGFloat, Transition) -> Void, topPanelExtensionUpdated: @escaping (CGFloat, Transition) -> Void,
hideInputUpdated: @escaping (Bool, Bool, Transition) -> Void, hideInputUpdated: @escaping (Bool, Bool, Transition) -> Void,
hideTopPanelUpdated: @escaping (Bool, Transition) -> Void, hideTopPanelUpdated: @escaping (Bool, Transition) -> Void,
@@ -727,7 +733,7 @@ public final class EntityKeyboardComponent: Component {
topPanel: AnyComponent(EntityKeyboardTopContainerPanelComponent( topPanel: AnyComponent(EntityKeyboardTopContainerPanelComponent(
theme: component.theme, theme: component.theme,
overflowHeight: component.hiddenInputHeight, overflowHeight: component.hiddenInputHeight,
displayBackground: component.externalTopPanelContainer == nil && component.displayTopPanelBackground displayBackground: component.externalTopPanelContainer != nil ? .none : component.displayTopPanelBackground
)), )),
externalTopPanelContainer: component.externalTopPanelContainer, externalTopPanelContainer: component.externalTopPanelContainer,
bottomPanel: component.displayBottomPanel ? AnyComponent(EntityKeyboardBottomPanelComponent( bottomPanel: component.displayBottomPanel ? AnyComponent(EntityKeyboardBottomPanelComponent(

View File

@@ -38,12 +38,12 @@ final class EntityKeyboardTopContainerPanelComponent: Component {
let theme: PresentationTheme let theme: PresentationTheme
let overflowHeight: CGFloat let overflowHeight: CGFloat
let displayBackground: Bool let displayBackground: EntityKeyboardComponent.DisplayTopPanelBackground
init( init(
theme: PresentationTheme, theme: PresentationTheme,
overflowHeight: CGFloat, overflowHeight: CGFloat,
displayBackground: Bool displayBackground: EntityKeyboardComponent.DisplayTopPanelBackground
) { ) {
self.theme = theme self.theme = theme
self.overflowHeight = overflowHeight self.overflowHeight = overflowHeight
@@ -193,7 +193,9 @@ final class EntityKeyboardTopContainerPanelComponent: Component {
strongSelf.updateVisibilityFraction(value: fraction, transition: transition) strongSelf.updateVisibilityFraction(value: fraction, transition: transition)
} }
if component.displayBackground { if case .blur = component.displayBackground {
self.backgroundColor = nil
let backgroundView: BlurredBackgroundView let backgroundView: BlurredBackgroundView
if let current = self.backgroundView { if let current = self.backgroundView {
backgroundView = current backgroundView = current
@@ -216,7 +218,9 @@ final class EntityKeyboardTopContainerPanelComponent: Component {
backgroundSeparatorView.backgroundColor = component.theme.chat.inputPanel.panelSeparatorColor backgroundSeparatorView.backgroundColor = component.theme.chat.inputPanel.panelSeparatorColor
transition.setFrame(view: backgroundSeparatorView, frame: CGRect(origin: CGPoint(x: 0.0, y: height), size: CGSize(width: availableSize.width, height: UIScreenPixel))) transition.setFrame(view: backgroundSeparatorView, frame: CGRect(origin: CGPoint(x: 0.0, y: height), size: CGSize(width: availableSize.width, height: UIScreenPixel)))
} else { } else if case .none = component.displayBackground {
self.backgroundColor = nil
if let backgroundView = self.backgroundView { if let backgroundView = self.backgroundView {
self.backgroundView = nil self.backgroundView = nil
backgroundView.removeFromSuperview() backgroundView.removeFromSuperview()
@@ -225,6 +229,17 @@ final class EntityKeyboardTopContainerPanelComponent: Component {
self.backgroundSeparatorView = nil self.backgroundSeparatorView = nil
backgroundSeparatorView.removeFromSuperview() backgroundSeparatorView.removeFromSuperview()
} }
} else if case .opaque = component.displayBackground {
if let backgroundView = self.backgroundView {
self.backgroundView = nil
backgroundView.removeFromSuperview()
}
if let backgroundSeparatorView = self.backgroundSeparatorView {
self.backgroundSeparatorView = nil
backgroundSeparatorView.removeFromSuperview()
}
self.backgroundColor = component.theme.chat.inputMediaPanel.backgroundColor
} }
return CGSize(width: availableSize.width, height: height) return CGSize(width: availableSize.width, height: height)

View File

@@ -408,7 +408,7 @@ private final class TopicIconSelectionComponent: Component {
defaultToEmojiTab: true, defaultToEmojiTab: true,
externalTopPanelContainer: self.panelHostView, externalTopPanelContainer: self.panelHostView,
externalBottomPanelContainer: nil, externalBottomPanelContainer: nil,
displayTopPanelBackground: true, displayTopPanelBackground: .blur,
topPanelExtensionUpdated: { _, _ in }, topPanelExtensionUpdated: { _, _ in },
hideInputUpdated: { _, _, _ in }, hideInputUpdated: { _, _, _ in },
hideTopPanelUpdated: { _, _ in }, hideTopPanelUpdated: { _, _ in },