Optimizations

This commit is contained in:
Ali 2023-02-21 22:13:21 +04:00
parent fa93c6d791
commit 1bef1f55e4
4 changed files with 7 additions and 5 deletions

View File

@ -172,7 +172,7 @@ public final class MultilineTextWithEntitiesComponent: Component {
self.textNode.longTapAttributeAction = component.longTapAction
if case let .curve(duration, _) = transition.animation, let previousText = previousText, previousText != attributedString.string {
if let snapshotView = self.snapshotView(afterScreenUpdates: false) {
if let snapshotView = self.snapshotContentTree() {
snapshotView.center = self.center
self.superview?.addSubview(snapshotView)

View File

@ -205,7 +205,7 @@
return;
[strongController dismissAnimated:true];
if (strongSelf != nil) {
if (strongSelf != nil && strongSelf.requestAvatarEditor) {
strongSelf.requestAvatarEditor(^(UIImage *image, void (^commit)(void)) {
__strong TGMediaAvatarMenuMixin *strongSelf = weakSelf;
if (strongSelf == nil)

View File

@ -61,8 +61,10 @@ public final class ManagedFile {
if let queue = self.queue {
assert(queue.isCurrent())
}
close(self.fd)
self.isClosed = true
if !self.isClosed {
close(self.fd)
self.isClosed = true
}
}
public func write(_ data: UnsafeRawPointer, count: Int) -> Int {

View File

@ -628,7 +628,7 @@ public final class RollingText: Component {
self.containerView.layer.removeAnimation(forKey: "opacity")
}
if let snapshotView = self.containerView.snapshotView(afterScreenUpdates: true) {
if let snapshotView = self.containerView.snapshotContentTree() {
let horizontalOffset = boundingRect.width - snapshotView.frame.width
let verticalOffset: CGFloat = 12.0