mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Fix album art in chat bubbles
This commit is contained in:
@@ -777,6 +777,16 @@ public final class SemanticStatusNode: ASControlNode {
|
||||
private var disposable: Disposable?
|
||||
private var backgroundNodeImage: UIImage?
|
||||
|
||||
private let hasLayoutPromise = ValuePromise(false, ignoreRepeated: true)
|
||||
|
||||
public override func layout() {
|
||||
super.layout()
|
||||
|
||||
if !self.bounds.width.isZero {
|
||||
self.hasLayoutPromise.set(true)
|
||||
}
|
||||
}
|
||||
|
||||
public init(backgroundNodeColor: UIColor, foregroundNodeColor: UIColor, image: Signal<(TransformImageArguments) -> DrawingContext?, NoError>? = nil, overlayForegroundNodeColor: UIColor? = nil, cutout: CGRect? = nil) {
|
||||
self.state = .none
|
||||
self.stateContext = self.state.context(current: nil)
|
||||
@@ -789,9 +799,8 @@ public final class SemanticStatusNode: ASControlNode {
|
||||
|
||||
if let image = image {
|
||||
let start = CACurrentMediaTime()
|
||||
self.disposable = (image
|
||||
|> deliverOnMainQueue).start(next: { [weak self] transform in
|
||||
guard let strongSelf = self else {
|
||||
self.disposable = combineLatest(queue: Queue.mainQueue(), image, self.hasLayoutPromise.get()).start(next: { [weak self] transform, ready in
|
||||
guard let strongSelf = self, ready else {
|
||||
return
|
||||
}
|
||||
let context = transform(TransformImageArguments(corners: ImageCorners(radius: strongSelf.bounds.width / 2.0), imageSize: strongSelf.bounds.size, boundingSize: strongSelf.bounds.size, intrinsicInsets: UIEdgeInsets()))
|
||||
|
||||
Reference in New Issue
Block a user