mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
UI improvements
This commit is contained in:
@@ -146,7 +146,7 @@ private final class StickerSelectionComponent: Component {
|
||||
defaultToEmojiTab: false,
|
||||
externalTopPanelContainer: self.panelHostView,
|
||||
externalBottomPanelContainer: nil,
|
||||
displayTopPanelBackground: true,
|
||||
displayTopPanelBackground: .blur,
|
||||
topPanelExtensionUpdated: { _, _ in },
|
||||
hideInputUpdated: { _, _, _ in },
|
||||
hideTopPanelUpdated: { _, _ in },
|
||||
|
||||
@@ -712,6 +712,10 @@ public final class ReactionContextNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
loopIdle = true
|
||||
#endif
|
||||
|
||||
var validIndices = Set<Int>()
|
||||
var nextX: CGFloat = sideInset
|
||||
for i in 0 ..< self.items.count {
|
||||
|
||||
@@ -1210,7 +1210,7 @@ final class AvatarEditorScreenComponent: Component {
|
||||
defaultToEmojiTab: true,
|
||||
externalTopPanelContainer: self.panelHostView,
|
||||
externalBottomPanelContainer: nil,
|
||||
displayTopPanelBackground: true,
|
||||
displayTopPanelBackground: .blur,
|
||||
topPanelExtensionUpdated: { _, _ in },
|
||||
hideInputUpdated: { _, _, _ in },
|
||||
hideTopPanelUpdated: { [weak self] hideTopPanel, transition in
|
||||
|
||||
@@ -244,6 +244,7 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode {
|
||||
private var currentInputData: InputData
|
||||
private var inputDataDisposable: Disposable?
|
||||
private var hasRecentGifsDisposable: Disposable?
|
||||
private let opaqueTopPanelBackground: Bool
|
||||
|
||||
private struct EmojiSearchResult {
|
||||
var groups: [EmojiPagerContentComponent.ItemGroup]
|
||||
@@ -569,10 +570,11 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode {
|
||||
|
||||
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.currentInputData = currentInputData
|
||||
self.defaultToEmojiTab = defaultToEmojiTab
|
||||
self.opaqueTopPanelBackground = opaqueTopPanelBackground
|
||||
|
||||
self.controllerInteraction = controllerInteraction
|
||||
|
||||
@@ -1771,7 +1773,7 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode {
|
||||
defaultToEmojiTab: self.defaultToEmojiTab,
|
||||
externalTopPanelContainer: self.externalTopPanelContainerImpl,
|
||||
externalBottomPanelContainer: nil,
|
||||
displayTopPanelBackground: false,
|
||||
displayTopPanelBackground: self.opaqueTopPanelBackground ? .opaque : .none,
|
||||
topPanelExtensionUpdated: { [weak self] topPanelExtension, transition in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
@@ -2332,17 +2334,19 @@ public final class EntityInputView: UIInputView, AttachmentTextInputPanelInputVi
|
||||
)
|
||||
},
|
||||
defaultToEmojiTab: true,
|
||||
opaqueTopPanelBackground: true,
|
||||
controllerInteraction: nil,
|
||||
interfaceInteraction: nil,
|
||||
chatPeerId: nil
|
||||
)
|
||||
self.inputNode = inputNode
|
||||
inputNode.clipContentToTopPanel = hideBackground
|
||||
inputNode.clipContentToTopPanel = true
|
||||
inputNode.emojiInputInteraction = inputInteraction
|
||||
inputNode.externalTopPanelContainerImpl = nil
|
||||
inputNode.switchToTextInput = { [weak self] in
|
||||
self?.switchToKeyboard?()
|
||||
}
|
||||
inputNode.backgroundColor = self.presentationData.theme.chat.inputMediaPanel.backgroundColor
|
||||
self.addSubnode(inputNode)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public final class EmojiStatusSelectionComponent: Component {
|
||||
let topPanelHeight: CGFloat = component.hideTopPanel ? 0.0 : 42.0
|
||||
|
||||
let keyboardSize = self.keyboardView.update(
|
||||
transition: transition.withUserData(EmojiPagerContentComponent.SynchronousLoadBehavior(isDisabled: true)),
|
||||
transition: transition,//.withUserData(EmojiPagerContentComponent.SynchronousLoadBehavior(isDisabled: true)),
|
||||
component: AnyComponent(EntityKeyboardComponent(
|
||||
theme: component.theme,
|
||||
strings: component.strings,
|
||||
@@ -172,7 +172,7 @@ public final class EmojiStatusSelectionComponent: Component {
|
||||
defaultToEmojiTab: true,
|
||||
externalTopPanelContainer: self.panelHostView,
|
||||
externalBottomPanelContainer: nil,
|
||||
displayTopPanelBackground: true,
|
||||
displayTopPanelBackground: .blur,
|
||||
topPanelExtensionUpdated: { _, _ in },
|
||||
hideInputUpdated: { _, _, _ in },
|
||||
hideTopPanelUpdated: { [weak self] hideTopPanel, transition in
|
||||
|
||||
@@ -431,7 +431,7 @@ public final class EmojiSearchContent: ASDisplayNode, EntitySearchContainerNode
|
||||
defaultToEmojiTab: true,
|
||||
externalTopPanelContainer: self.panelHostView,
|
||||
externalBottomPanelContainer: nil,
|
||||
displayTopPanelBackground: true,
|
||||
displayTopPanelBackground: .blur,
|
||||
topPanelExtensionUpdated: { _, _ in },
|
||||
hideInputUpdated: { _, _, _ in },
|
||||
hideTopPanelUpdated: { _, _ in
|
||||
|
||||
@@ -61,6 +61,12 @@ public final class EntityKeyboardComponent: Component {
|
||||
case masks
|
||||
}
|
||||
|
||||
public enum DisplayTopPanelBackground {
|
||||
case none
|
||||
case blur
|
||||
case opaque
|
||||
}
|
||||
|
||||
public struct GifSearchEmoji: Equatable {
|
||||
public var emoji: String
|
||||
public var file: TelegramMediaFile
|
||||
@@ -100,7 +106,7 @@ public final class EntityKeyboardComponent: Component {
|
||||
public let defaultToEmojiTab: Bool
|
||||
public let externalTopPanelContainer: PagerExternalTopPanelContainer?
|
||||
public let externalBottomPanelContainer: PagerExternalTopPanelContainer?
|
||||
public let displayTopPanelBackground: Bool
|
||||
public let displayTopPanelBackground: DisplayTopPanelBackground
|
||||
public let topPanelExtensionUpdated: (CGFloat, Transition) -> Void
|
||||
public let hideInputUpdated: (Bool, Bool, Transition) -> Void
|
||||
public let hideTopPanelUpdated: (Bool, Transition) -> Void
|
||||
@@ -132,7 +138,7 @@ public final class EntityKeyboardComponent: Component {
|
||||
defaultToEmojiTab: Bool,
|
||||
externalTopPanelContainer: PagerExternalTopPanelContainer?,
|
||||
externalBottomPanelContainer: PagerExternalTopPanelContainer?,
|
||||
displayTopPanelBackground: Bool,
|
||||
displayTopPanelBackground: DisplayTopPanelBackground,
|
||||
topPanelExtensionUpdated: @escaping (CGFloat, Transition) -> Void,
|
||||
hideInputUpdated: @escaping (Bool, Bool, Transition) -> Void,
|
||||
hideTopPanelUpdated: @escaping (Bool, Transition) -> Void,
|
||||
@@ -727,7 +733,7 @@ public final class EntityKeyboardComponent: Component {
|
||||
topPanel: AnyComponent(EntityKeyboardTopContainerPanelComponent(
|
||||
theme: component.theme,
|
||||
overflowHeight: component.hiddenInputHeight,
|
||||
displayBackground: component.externalTopPanelContainer == nil && component.displayTopPanelBackground
|
||||
displayBackground: component.externalTopPanelContainer != nil ? .none : component.displayTopPanelBackground
|
||||
)),
|
||||
externalTopPanelContainer: component.externalTopPanelContainer,
|
||||
bottomPanel: component.displayBottomPanel ? AnyComponent(EntityKeyboardBottomPanelComponent(
|
||||
|
||||
@@ -38,12 +38,12 @@ final class EntityKeyboardTopContainerPanelComponent: Component {
|
||||
|
||||
let theme: PresentationTheme
|
||||
let overflowHeight: CGFloat
|
||||
let displayBackground: Bool
|
||||
let displayBackground: EntityKeyboardComponent.DisplayTopPanelBackground
|
||||
|
||||
init(
|
||||
theme: PresentationTheme,
|
||||
overflowHeight: CGFloat,
|
||||
displayBackground: Bool
|
||||
displayBackground: EntityKeyboardComponent.DisplayTopPanelBackground
|
||||
) {
|
||||
self.theme = theme
|
||||
self.overflowHeight = overflowHeight
|
||||
@@ -193,7 +193,9 @@ final class EntityKeyboardTopContainerPanelComponent: Component {
|
||||
strongSelf.updateVisibilityFraction(value: fraction, transition: transition)
|
||||
}
|
||||
|
||||
if component.displayBackground {
|
||||
if case .blur = component.displayBackground {
|
||||
self.backgroundColor = nil
|
||||
|
||||
let backgroundView: BlurredBackgroundView
|
||||
if let current = self.backgroundView {
|
||||
backgroundView = current
|
||||
@@ -216,7 +218,9 @@ final class EntityKeyboardTopContainerPanelComponent: Component {
|
||||
|
||||
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)))
|
||||
} else {
|
||||
} else if case .none = component.displayBackground {
|
||||
self.backgroundColor = nil
|
||||
|
||||
if let backgroundView = self.backgroundView {
|
||||
self.backgroundView = nil
|
||||
backgroundView.removeFromSuperview()
|
||||
@@ -225,6 +229,17 @@ final class EntityKeyboardTopContainerPanelComponent: Component {
|
||||
self.backgroundSeparatorView = nil
|
||||
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)
|
||||
|
||||
@@ -408,7 +408,7 @@ private final class TopicIconSelectionComponent: Component {
|
||||
defaultToEmojiTab: true,
|
||||
externalTopPanelContainer: self.panelHostView,
|
||||
externalBottomPanelContainer: nil,
|
||||
displayTopPanelBackground: true,
|
||||
displayTopPanelBackground: .blur,
|
||||
topPanelExtensionUpdated: { _, _ in },
|
||||
hideInputUpdated: { _, _, _ in },
|
||||
hideTopPanelUpdated: { _, _ in },
|
||||
|
||||
Reference in New Issue
Block a user