GIFs in media editor

Image search in media editor
This commit is contained in:
Ilya Laktyushin
2023-08-07 08:38:02 +02:00
parent 9ddb8fa2d6
commit b71304a3d2
24 changed files with 1231 additions and 686 deletions

View File

@@ -791,18 +791,29 @@ class WebSearchControllerNode: ASDisplayNode {
}
}
} else {
presentLegacyWebSearchEditor(context: self.context, theme: self.theme, result: currentResult, initialLayout: self.containerLayout?.0, updateHiddenMedia: { [weak self] id in
self?.hiddenMediaId.set(.single(id))
}, transitionHostView: { [weak self] in
return self?.gridNode.view
}, transitionView: { [weak self] result in
return self?.transitionNode(for: result)?.transitionView()
}, completed: { [weak self] result in
if let strongSelf = self {
strongSelf.controllerInteraction.avatarCompleted(result)
strongSelf.cancel?()
if let mode = self.controller?.mode, case let .editor(completion) = mode {
if let item = legacyWebSearchItem(account: self.context.account, result: currentResult) {
let _ = (item.originalImage
|> deliverOnMainQueue).start(next: { image in
if !image.degraded() {
completion(image)
}
})
}
}, present: present)
} else {
presentLegacyWebSearchEditor(context: self.context, theme: self.theme, result: currentResult, initialLayout: self.containerLayout?.0, updateHiddenMedia: { [weak self] id in
self?.hiddenMediaId.set(.single(id))
}, transitionHostView: { [weak self] in
return self?.gridNode.view
}, transitionView: { [weak self] result in
return self?.transitionNode(for: result)?.transitionView()
}, completed: { [weak self] result in
if let strongSelf = self {
strongSelf.controllerInteraction.avatarCompleted(result)
strongSelf.cancel?()
}
}, present: present)
}
}
}