Avatar fixes

This commit is contained in:
Ilya Laktyushin 2022-12-19 18:26:34 +04:00
parent bb6f19cac3
commit 43c8c3efdd
2 changed files with 8 additions and 4 deletions

View File

@ -169,7 +169,6 @@ final class PenTool: DrawingElement {
currentRenderLayer.draw(line: self.renderLine, color: self.color.toUIColor(), rect: rect)
}
if state == .ended {
if self.arrow {
let points = self.path?.points ?? []

View File

@ -32,15 +32,20 @@ public func peerInfoProfilePhotos(context: AccountContext, peerId: EnginePeer.Id
|> distinctUntilChanged
|> mapToSignal { entries -> Signal<(Bool, [AvatarGalleryEntry])?, NoError> in
if let entries = entries {
if let firstEntry = entries.first {
if var firstEntry = entries.first {
return context.account.postbox.peerView(id: peerId)
|> mapToSignal { peerView -> Signal<(Bool, [AvatarGalleryEntry])?, NoError>in
if let peer = peerViewMainPeer(peerView) {
var secondEntry: TelegramMediaImage?
var lastEntry: TelegramMediaImage?
if let cachedData = peerView.cachedData as? CachedUserData {
if firstEntry.representations.first?.representation.isPersonal == true, case let .known(photo) = cachedData.photo {
secondEntry = photo
if let firstRepresentation = firstEntry.representations.first, firstRepresentation.representation.isPersonal {
if firstRepresentation.representation.hasVideo, case let .known(photo) = cachedData.personalPhoto, let peerReference = PeerReference(peer) {
firstEntry = .topImage(firstEntry.representations, photo?.videoRepresentations.map { VideoRepresentationWithReference(representation: $0, reference: MediaResourceReference.avatar(peer: peerReference, resource: $0.resource)) } ?? [], firstEntry.peer, firstEntry.indexData, firstEntry.immediateThumbnailData, nil)
}
if case let .known(photo) = cachedData.photo {
secondEntry = photo
}
}
if case let .known(photo) = cachedData.fallbackPhoto {
lastEntry = photo