Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
overtake 2019-08-29 22:03:18 +03:00
commit 8466d0fbcc
3 changed files with 31 additions and 2 deletions

View File

@ -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
}

View File

@ -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()

View File

@ -28,7 +28,13 @@ public func setSecretChatMessageAutoremoveTimeoutInteractively(account: Account,
public func addSecretChatMessageScreenshot(account: Account, peerId: PeerId) -> Signal<Void, NoError> {
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))])
}
}