This commit is contained in:
Ilya Laktyushin 2020-08-21 21:36:46 +03:00
parent 3e88d177fd
commit b991ed0a74
3 changed files with 21 additions and 24 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

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