Various Improvements

This commit is contained in:
Ilya Laktyushin
2021-08-07 22:55:08 +03:00
parent 6b3103bafc
commit 2e989d1369
46 changed files with 1743 additions and 254 deletions

View File

@@ -819,10 +819,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
} else {
insets = layout.insets(options: [.input])
}
let statusBarHeight = layout.insets(options: [.statusBar]).top
if case .overlay = self.chatPresentationInterfaceState.mode {
insets.top = 44.0
} else {
@@ -1154,7 +1151,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
var displayTopDimNode = false
var ensureTopInsetForOverlayHighlightedItems: CGFloat?
var expandTopDimNode = false
if case let .media(_, expanded) = self.chatPresentationInterfaceState.inputMode, expanded != nil {
if case let .media(_, expanded, _) = self.chatPresentationInterfaceState.inputMode, expanded != nil {
displayTopDimNode = true
expandTopDimNode = true
}
@@ -1233,7 +1230,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
let apparentSecondaryInputPanelFrame = secondaryInputPanelFrame
var apparentInputBackgroundFrame = inputBackgroundFrame
var apparentNavigateButtonsFrame = navigateButtonsFrame
if case let .media(_, maybeExpanded) = self.chatPresentationInterfaceState.inputMode, let expanded = maybeExpanded, case .search = expanded, let inputPanelFrame = inputPanelFrame {
if case let .media(_, maybeExpanded, _) = self.chatPresentationInterfaceState.inputMode, let expanded = maybeExpanded, case .search = expanded, let inputPanelFrame = inputPanelFrame {
let verticalOffset = -inputPanelFrame.height - 41.0
apparentInputPanelFrame = inputPanelFrame.offsetBy(dx: 0.0, dy: verticalOffset)
apparentInputBackgroundFrame.size.height -= verticalOffset
@@ -1862,11 +1859,11 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
let inputNode = ChatMediaInputNode(context: self.context, peerId: peerId, chatLocation: self.chatPresentationInterfaceState.chatLocation, controllerInteraction: self.controllerInteraction, chatWallpaper: self.chatPresentationInterfaceState.chatWallpaper, theme: theme, strings: strings, fontSize: fontSize, gifPaneIsActiveUpdated: { [weak self] value in
if let strongSelf = self, let interfaceInteraction = strongSelf.interfaceInteraction {
interfaceInteraction.updateInputModeAndDismissedButtonKeyboardMessageId { state in
if case let .media(_, expanded) = state.inputMode {
if case let .media(_, expanded, focused) = state.inputMode {
if value {
return (.media(mode: .gif, expanded: expanded), nil)
return (.media(mode: .gif, expanded: expanded, focused: focused), nil)
} else {
return (.media(mode: .other, expanded: expanded), nil)
return (.media(mode: .other, expanded: expanded, focused: focused), nil)
}
} else {
return (state.inputMode, nil)
@@ -2120,8 +2117,8 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
@objc func topDimNodeTapGesture(_ recognizer: UITapGestureRecognizer) {
if case .ended = recognizer.state {
self.interfaceInteraction?.updateInputModeAndDismissedButtonKeyboardMessageId { state in
if case let .media(mode, expanded) = state.inputMode, expanded != nil {
return (.media(mode: mode, expanded: nil), nil)
if case let .media(mode, expanded, focused) = state.inputMode, expanded != nil {
return (.media(mode: mode, expanded: nil, focused: focused), nil)
} else {
return (state.inputMode, nil)
}
@@ -2130,10 +2127,10 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
}
func scrollToTop() {
if case let .media(_, maybeExpanded) = self.chatPresentationInterfaceState.inputMode, maybeExpanded != nil {
if case let .media(_, maybeExpanded, _) = self.chatPresentationInterfaceState.inputMode, maybeExpanded != nil {
self.interfaceInteraction?.updateInputModeAndDismissedButtonKeyboardMessageId { state in
if case let .media(mode, expanded) = state.inputMode, expanded != nil {
return (.media(mode: mode, expanded: expanded), nil)
if case let .media(mode, expanded, focused) = state.inputMode, expanded != nil {
return (.media(mode: mode, expanded: expanded, focused: focused), nil)
} else {
return (state.inputMode, nil)
}
@@ -2267,7 +2264,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|> deliverOnMainQueue).start(next: { [weak self] in
self?.openStickersDisposable = nil
self?.interfaceInteraction?.updateInputModeAndDismissedButtonKeyboardMessageId({ state in
return (.media(mode: .other, expanded: nil), state.interfaceState.messageActionsState.closedButtonKeyboardMessageId)
return (.media(mode: .other, expanded: nil, focused: false), state.interfaceState.messageActionsState.closedButtonKeyboardMessageId)
})
})
}