Various Fixes

This commit is contained in:
Ilya Laktyushin 2021-09-21 20:28:40 +03:00
parent 667aec4df0
commit 9aa4256dbf
4 changed files with 29 additions and 4 deletions

View File

@ -1995,12 +1995,17 @@ public final class VoiceChatController: ViewController {
}
strongSelf.participantsNode.isHidden = !isLivestream
let hadPeer = strongSelf.peer != nil
strongSelf.peer = peer
strongSelf.currentTitleIsCustom = title != nil
strongSelf.currentTitle = title ?? peer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder)
strongSelf.updateTitle(transition: .immediate)
strongSelf.titleNode.isRecording = isRecording
if strongSelf.isScheduling && !hadPeer {
strongSelf.updateScheduleButtonTitle()
}
}
if !strongSelf.didSetDataReady {
strongSelf.didSetDataReady = true

View File

@ -3401,6 +3401,12 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
if !cachedGroupData.botInfos.isEmpty {
hasBots = true
}
let botCommands = cachedGroupData.botInfos.reduce(into: [], { result, info in
result.append(contentsOf: info.botInfo.commands)
})
if !botCommands.isEmpty {
hasBotCommands = true
}
if case let .known(value) = cachedGroupData.autoremoveTimeout {
autoremoveTimeout = value?.effectiveValue
}
@ -3409,6 +3415,12 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
if !cachedChannelData.botInfos.isEmpty {
hasBots = true
}
let botCommands = cachedChannelData.botInfos.reduce(into: [], { result, info in
result.append(contentsOf: info.botInfo.commands)
})
if !botCommands.isEmpty {
hasBotCommands = true
}
}
if case let .known(value) = cachedChannelData.autoremoveTimeout {
autoremoveTimeout = value?.effectiveValue

View File

@ -311,7 +311,7 @@ func inputTextPanelStateForChatPresentationInterfaceState(_ chatPresentationInte
stickersEnabled = false
}
}
if chatPresentationInterfaceState.hasBots {
if chatPresentationInterfaceState.hasBots && chatPresentationInterfaceState.hasBotCommands {
accessoryItems.append(.commands)
}
accessoryItems.append(.stickers(stickersEnabled))

View File

@ -165,7 +165,7 @@ private struct ThemeSettingsThemeItemNodeTransition {
private func ensureThemeVisible(listNode: ListView, emoticon: String?, animated: Bool) -> Bool {
var resultNode: ThemeSettingsThemeItemIconNode?
// var previousNode: ThemeSettingsThemeItemIconNode?
var previousNode: ThemeSettingsThemeItemIconNode?
var nextNode: ThemeSettingsThemeItemIconNode?
listNode.forEachItemNode { node in
guard let node = node as? ThemeSettingsThemeItemIconNode else {
@ -175,14 +175,22 @@ private func ensureThemeVisible(listNode: ListView, emoticon: String?, animated:
if node.item?.emoticon == emoticon {
resultNode = node
} else {
// previousNode = node
previousNode = node
}
} else if nextNode == nil {
nextNode = node
}
}
if let resultNode = resultNode {
listNode.ensureItemNodeVisible(resultNode, animated: animated, overflow: 57.0)
var nodeToEnsure = resultNode
if case let .visible(resultVisibility) = resultNode.visibility, resultVisibility == 1.0 {
if let previousNode = previousNode, case let .visible(previousVisibility) = previousNode.visibility, previousVisibility < 0.5 {
nodeToEnsure = previousNode
} else if let nextNode = nextNode, case let .visible(nextVisibility) = nextNode.visibility, nextVisibility < 0.5 {
nodeToEnsure = nextNode
}
}
listNode.ensureItemNodeVisible(nodeToEnsure, animated: animated, overflow: 57.0)
return true
} else {
return false