Various fixes

This commit is contained in:
Ilya Laktyushin
2023-01-18 19:44:24 +04:00
parent 86ee12c1c8
commit 71f367027d
17 changed files with 407 additions and 406 deletions

View File

@@ -15,45 +15,15 @@ func inputNodeForChatPresentationIntefaceState(_ chatPresentationInterfaceState:
}
switch chatPresentationInterfaceState.inputMode {
case .media:
if "".isEmpty {
if let currentNode = currentNode as? ChatEntityKeyboardInputNode {
return currentNode
} else if let inputMediaNode = inputMediaNode {
return inputMediaNode
} else if let inputMediaNode = makeMediaInputNode() {
inputMediaNode.interfaceInteraction = interfaceInteraction
return inputMediaNode
} else {
return nil
}
if let currentNode = currentNode as? ChatEntityKeyboardInputNode {
return currentNode
} else if let inputMediaNode = inputMediaNode {
return inputMediaNode
} else if let inputMediaNode = makeMediaInputNode() {
inputMediaNode.interfaceInteraction = interfaceInteraction
return inputMediaNode
} else {
if let currentNode = currentNode as? ChatMediaInputNode {
return currentNode
} else if let inputMediaNode = inputMediaNode {
return inputMediaNode
} else {
var peerId: PeerId?
if case let .peer(id) = chatPresentationInterfaceState.chatLocation {
peerId = id
}
let inputNode = ChatMediaInputNode(context: context, peerId: peerId, chatLocation: chatPresentationInterfaceState.chatLocation, controllerInteraction: controllerInteraction, chatWallpaper: chatPresentationInterfaceState.chatWallpaper, theme: chatPresentationInterfaceState.theme, strings: chatPresentationInterfaceState.strings, fontSize: chatPresentationInterfaceState.fontSize, gifPaneIsActiveUpdated: { [weak interfaceInteraction] value in
if let interfaceInteraction = interfaceInteraction {
interfaceInteraction.updateInputModeAndDismissedButtonKeyboardMessageId { state in
if case let .media(_, expanded, focused) = state.inputMode {
if value {
return (.media(mode: .gif, expanded: expanded, focused: focused), nil)
} else {
return (.media(mode: .other, expanded: expanded, focused: focused), nil)
}
} else {
return (state.inputMode, nil)
}
}
}
})
inputNode.interfaceInteraction = interfaceInteraction
return inputNode
}
return nil
}
case .inputButtons:
if chatPresentationInterfaceState.forceInputCommandsHidden {