diff --git a/submodules/Display/Display/KeyboardManager.swift b/submodules/Display/Display/KeyboardManager.swift index 086f578ea0..0a63a1ebb4 100644 --- a/submodules/Display/Display/KeyboardManager.swift +++ b/submodules/Display/Display/KeyboardManager.swift @@ -23,6 +23,26 @@ private func getFirstResponder(_ view: UIView) -> UIView? { } } +private func isViewVisibleInHierarchy(_ view: UIView, _ initial: Bool = true) -> Bool { + guard let window = view.window else { + return false + } + if view.isHidden || view.alpha == 0.0 { + return false + } + if view.superview === window { + return true + } else if let superview = view.superview { + if initial && view.frame.minY >= superview.frame.height { + return false + } else { + return isViewVisibleInHierarchy(superview, false) + } + } else { + return false + } +} + class KeyboardManager { private let host: StatusBarHost @@ -44,6 +64,9 @@ class KeyboardManager { guard let keyboardView = self.host.keyboardView else { return 0.0 } + if !isViewVisibleInHierarchy(keyboardView) { + return 0.0 + } return keyboardView.bounds.height } diff --git a/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift b/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift index 08f500b27e..0f65cb8abe 100644 --- a/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift +++ b/submodules/GalleryUI/Sources/Items/UniversalVideoGalleryItem.swift @@ -287,7 +287,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode { guard let strongSelf = self else { return } - if let result = result { + if let result = result, strongSelf.scrubbingFrames { switch result { case .waitingForData: strongSelf.footerContentNode.setFramePreviewImageIsLoading() diff --git a/submodules/TelegramCore/TelegramCore/SetSecretChatMessageAutoremoveTimeoutInteractively.swift b/submodules/TelegramCore/TelegramCore/SetSecretChatMessageAutoremoveTimeoutInteractively.swift index 8859413bd9..a03dcc3e59 100644 --- a/submodules/TelegramCore/TelegramCore/SetSecretChatMessageAutoremoveTimeoutInteractively.swift +++ b/submodules/TelegramCore/TelegramCore/SetSecretChatMessageAutoremoveTimeoutInteractively.swift @@ -28,7 +28,13 @@ public func setSecretChatMessageAutoremoveTimeoutInteractively(account: Account, public func addSecretChatMessageScreenshot(account: Account, peerId: PeerId) -> Signal { return account.postbox.transaction { transaction -> Void in - if let peer = transaction.getPeer(peerId) as? TelegramSecretChat, let state = transaction.getPeerChatState(peerId) as? SecretChatState { + if let _ = transaction.getPeer(peerId) as? TelegramSecretChat, let state = transaction.getPeerChatState(peerId) as? SecretChatState { + switch state.embeddedState { + case .handshake, .terminated: + return + default: + break + } let _ = enqueueMessages(transaction: transaction, account: account, peerId: peerId, messages: [(true, .message(text: "", attributes: [], mediaReference: .standalone(media: TelegramMediaAction(action: TelegramMediaActionType.historyScreenshot)), replyToMessageId: nil, localGroupingKey: nil))]) } }