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

This commit is contained in:
overtake 2020-08-25 14:51:23 +03:00
commit e52a513480
4 changed files with 27 additions and 26 deletions

View File

@ -769,7 +769,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
messageTags = .photo
} else if query.hasPrefix("%video ") {
messageTags = .video
} else if query.hasPrefix("%file ") {
} else if query.hasPrefix("%file ") {
messageTags = .file
} else if query.hasPrefix("%music ") {
messageTags = .music

View File

@ -128,10 +128,14 @@ final class ChatVideoGalleryItemScrubberView: UIView {
self.collapsed = collapsed
guard let (size, _, _) = self.containerLayout else {
return
}
let alpha: CGFloat = collapsed ? 0.0 : 1.0
self.leftTimestampNode.alpha = alpha
self.rightTimestampNode.alpha = alpha
self.infoNode.alpha = alpha
self.infoNode.alpha = size.width < size.height && !self.collapsed ? 1.0 : 0.0
self.updateScrubberVisibility(animated: animated)
}
@ -161,7 +165,7 @@ final class ChatVideoGalleryItemScrubberView: UIView {
self.leftTimestampNode.status = mappedStatus
self.rightTimestampNode.status = mappedStatus
if let mappedStatus = mappedStatus {
if let mappedStatus = mappedStatus, false {
self.chapterDisposable.set((mappedStatus
|> deliverOnMainQueue).start(next: { [weak self] status in
if let strongSelf = self, status.duration > 1.0 {

View File

@ -593,25 +593,25 @@ public final class ShareController: ViewController {
}
self.controllerNode.shareExternal = { [weak self] in
if let strongSelf = self {
if case let .messages(messages) = strongSelf.subject, let message = messages.first, let peer = message.peers[message.id.peerId] {
let renderer = MessageStoryRenderer(context: strongSelf.currentContext, messages: messages)
let layout = ContainerViewLayout(size: CGSize(width: 414.0, height: 896.0), metrics: LayoutMetrics(widthClass: .compact, heightClass: .compact), deviceMetrics: .iPhoneX, intrinsicInsets: UIEdgeInsets(), safeInsets: UIEdgeInsets(), statusBarHeight: 0.0, inputHeight: nil, inputHeightIsInteractivellyChanging: false, inVoiceOver: false)
renderer.update(layout: layout) { image in
if let data = image?.pngData() {
let pasteboardItems: [[String: Any]] = [["com.instagram.sharedSticker.backgroundImage": data,
"com.instagram.sharedSticker.contentURL": "https://t.me/\(peer.addressName ?? "")/\(message.id.id)"]]
if #available(iOS 10.0, *) {
UIPasteboard.general.setItems(pasteboardItems, options: [.expirationDate: Date().addingTimeInterval(5 * 60)])
} else {
// UIPasteboard.general.setItems(pasteboardItems)
}
strongSelf.sharedContext.applicationBindings.openUrl("instagram-stories://share")
}
}
return .complete()
}
// if case let .messages(messages) = strongSelf.subject, let message = messages.first, let peer = message.peers[message.id.peerId] {
// let renderer = MessageStoryRenderer(context: strongSelf.currentContext, messages: messages)
//
// let layout = ContainerViewLayout(size: CGSize(width: 414.0, height: 896.0), metrics: LayoutMetrics(widthClass: .compact, heightClass: .compact), deviceMetrics: .iPhoneX, intrinsicInsets: UIEdgeInsets(), safeInsets: UIEdgeInsets(), statusBarHeight: 0.0, inputHeight: nil, inputHeightIsInteractivellyChanging: false, inVoiceOver: false)
// renderer.update(layout: layout) { image in
// if let data = image?.pngData() {
// let pasteboardItems: [[String: Any]] = [["com.instagram.sharedSticker.backgroundImage": data,
// "com.instagram.sharedSticker.contentURL": "https://t.me/\(peer.addressName ?? "")/\(message.id.id)"]]
// if #available(iOS 10.0, *) {
// UIPasteboard.general.setItems(pasteboardItems, options: [.expirationDate: Date().addingTimeInterval(5 * 60)])
// } else {
//// UIPasteboard.general.setItems(pasteboardItems)
// }
// strongSelf.sharedContext.applicationBindings.openUrl("instagram-stories://share")
// }
// }
//
// return .complete()
// }
var collectableItems: [CollectableExternalShareItem] = []

View File

@ -300,15 +300,12 @@ private class CallControllerToastItemNode: ASDisplayNode {
let initialFrame = CGRect(x: floor((self.frame.width - 44.0) / 2.0), y: 0.0, width: 44.0, height: 28.0)
self.clipNode.frame = initialFrame
// self.effectView.frame = CGRect(origin: CGPoint(), size: initialFrame.size)
self.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
self.layer.animateSpring(from: 0.01 as NSNumber, to: 1.0 as NSNumber, keyPath: "transform.scale", duration: 0.45, damping: 105.0, completion: { _ in
self.layer.animateSpring(from: 0.01 as NSNumber, to: 1.0 as NSNumber, keyPath: "transform.scale", duration: 0.3, damping: 105.0, completion: { _ in
self.clipNode.frame = targetFrame
// self.effectView.frame = CGRect(origin: CGPoint(), size: targetFrame.size)
self.clipNode.layer.animateFrame(from: initialFrame, to: targetFrame, duration: 0.35, timingFunction: kCAMediaTimingFunctionSpring)
// self.effectView.layer.animateFrame(from: initialFrame, to: targetFrame, duration: 0.35, timingFunction: kCAMediaTimingFunctionSpring)
})
}