mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Various fixes
This commit is contained in:
parent
7d3a497db6
commit
e3bf0cd30c
5 changed files with 61 additions and 4 deletions
|
|
@ -1969,6 +1969,10 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
|
|||
profilePhoto = maybePhoto
|
||||
isKnown = true
|
||||
}
|
||||
if profilePhoto == nil, case let .known(maybePhoto) = cachedPeerData.fallbackPhoto {
|
||||
profilePhoto = maybePhoto
|
||||
isKnown = true
|
||||
}
|
||||
}
|
||||
|
||||
if isKnown {
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ final class LocationViewControllerNode: ViewControllerTracingNode, CLLocationMan
|
|||
|
||||
super.init()
|
||||
|
||||
self.backgroundColor = .red // self.presentationData.theme.list.plainBackgroundColor
|
||||
self.backgroundColor = self.presentationData.theme.list.plainBackgroundColor
|
||||
|
||||
if !self.isPreview {
|
||||
self.addSubnode(self.listNode)
|
||||
|
|
@ -656,7 +656,7 @@ final class LocationViewControllerNode: ViewControllerTracingNode, CLLocationMan
|
|||
let transition = preparedTransition(from: previousEntries ?? [], to: entries, context: context, presentationData: presentationData, interaction: strongSelf.interaction, gotTravelTimes: !travelTimes.isEmpty && !previousHadTravelTimes, animated: animated)
|
||||
strongSelf.enqueueTransition(transition)
|
||||
|
||||
strongSelf.headerNode.updateState(mapMode: state.mapMode, trackingMode: state.trackingMode, displayingMapModeOptions: state.displayingMapModeOptions, displayingPlacesButton: false, proximityNotification: proximityNotification, animated: false)
|
||||
strongSelf.headerNode.updateState(mapMode: state.mapMode, trackingMode: state.trackingMode, displayingMapModeOptions: state.displayingMapModeOptions, displayingPlacesButton: false, proximityNotification: proximityNotification, animated: true)
|
||||
|
||||
if let proximityNotification = proximityNotification, !proximityNotification && !strongSelf.displayedProximityAlertTooltip {
|
||||
strongSelf.displayedProximityAlertTooltip = true
|
||||
|
|
@ -813,7 +813,7 @@ final class LocationViewControllerNode: ViewControllerTracingNode, CLLocationMan
|
|||
self.presentationData = presentationData
|
||||
self.presentationDataPromise.set(.single(presentationData))
|
||||
|
||||
self.backgroundColor = .red //self.presentationData.theme.list.plainBackgroundColor
|
||||
self.backgroundColor = self.presentationData.theme.list.plainBackgroundColor
|
||||
self.listNode.backgroundColor = .clear // self.presentationData.theme.list.plainBackgroundColor
|
||||
self.headerNode.updatePresentationData(self.presentationData)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,28 @@ public enum AvatarGalleryEntryId: Hashable {
|
|||
case resource(String)
|
||||
}
|
||||
|
||||
private func avatarGalleryEntryMatchesImage(_ entry: AvatarGalleryEntry, _ image: TelegramMediaImage) -> Bool {
|
||||
guard
|
||||
let entryRepresentation = largestImageRepresentation(entry.representations.map({ $0.representation })),
|
||||
let imageRepresentation = largestImageRepresentation(image.representations)
|
||||
else {
|
||||
return false
|
||||
}
|
||||
guard let entryResource = entryRepresentation.resource as? CloudPeerPhotoSizeMediaResource, let imageResource = imageRepresentation.resource as? CloudPhotoSizeMediaResource else {
|
||||
return false
|
||||
}
|
||||
return entryResource.photoId == imageResource.photoId
|
||||
}
|
||||
|
||||
private func avatarGalleryEntryWithVideoRepresentations(_ entry: AvatarGalleryEntry, videoRepresentations: [VideoRepresentationWithReference], immediateThumbnailData: Data?) -> AvatarGalleryEntry {
|
||||
switch entry {
|
||||
case let .topImage(representations, _, peer, indexData, _, category):
|
||||
return .topImage(representations, videoRepresentations, peer, indexData, immediateThumbnailData, category)
|
||||
default:
|
||||
return entry
|
||||
}
|
||||
}
|
||||
|
||||
public func peerInfoProfilePhotos(context: AccountContext, peerId: EnginePeer.Id) -> Signal<Any, NoError> {
|
||||
return context.engine.data.subscribe(TelegramEngine.EngineData.Item.Peer.Peer(id: peerId))
|
||||
|> mapToSignal { peer -> Signal<[AvatarGalleryEntry]?, NoError> in
|
||||
|
|
@ -48,6 +70,12 @@ public func peerInfoProfilePhotos(context: AccountContext, peerId: EnginePeer.Id
|
|||
}
|
||||
if case let .known(photo) = cachedData.fallbackPhoto {
|
||||
lastEntry = photo
|
||||
if let photo, firstEntry.videoRepresentations.isEmpty, !photo.videoRepresentations.isEmpty, avatarGalleryEntryMatchesImage(firstEntry, photo), let peerReference = PeerReference(peer) {
|
||||
let videoRepresentations = photo.videoRepresentations.map {
|
||||
VideoRepresentationWithReference(representation: $0, reference: MediaResourceReference.avatar(peer: peerReference, resource: $0.resource))
|
||||
}
|
||||
firstEntry = avatarGalleryEntryWithVideoRepresentations(firstEntry, videoRepresentations: videoRepresentations, immediateThumbnailData: firstEntry.immediateThumbnailData ?? photo.immediateThumbnailData)
|
||||
}
|
||||
}
|
||||
}
|
||||
return fetchedAvatarGalleryEntries(engine: context.engine, account: context.account, peer: EnginePeer(peer), firstEntry: firstEntry, secondEntry: secondEntry, lastEntry: lastEntry)
|
||||
|
|
@ -311,6 +339,12 @@ public func fetchedAvatarGalleryEntries(engine: TelegramEngine, account: Account
|
|||
let initialEntries = [firstEntry]
|
||||
if photos.isEmpty {
|
||||
result = initialEntries
|
||||
if let lastEntry, let firstEntry = result.first, firstEntry.videoRepresentations.isEmpty, !lastEntry.videoRepresentations.isEmpty, avatarGalleryEntryMatchesImage(firstEntry, lastEntry), let peerReference = PeerReference(peer._asPeer()) {
|
||||
let videoRepresentations = lastEntry.videoRepresentations.map {
|
||||
VideoRepresentationWithReference(representation: $0, reference: MediaResourceReference.avatar(peer: peerReference, resource: $0.resource))
|
||||
}
|
||||
result[0] = avatarGalleryEntryWithVideoRepresentations(firstEntry, videoRepresentations: videoRepresentations, immediateThumbnailData: firstEntry.immediateThumbnailData ?? lastEntry.immediateThumbnailData)
|
||||
}
|
||||
} else if let peerReference = PeerReference(peer._asPeer()) {
|
||||
var index: Int32 = 0
|
||||
|
||||
|
|
|
|||
|
|
@ -112,7 +112,18 @@ public final class ChatAvatarNavigationNode: ASDisplayNode {
|
|||
self.avatarNode.isHidden = true
|
||||
}
|
||||
|
||||
public func setPeer(context: AccountContext, theme: PresentationTheme, peer: EnginePeer?, authorOfMessage: MessageReference? = nil, overrideImage: AvatarNodeImageOverride? = nil, emptyColor: UIColor? = nil, clipStyle: AvatarNodeClipStyle = .round, synchronousLoad: Bool = false, displayDimensions: CGSize = CGSize(width: 60.0, height: 60.0), storeUnrounded: Bool = false) {
|
||||
public func setPeer(
|
||||
context: AccountContext,
|
||||
theme: PresentationTheme,
|
||||
peer: EnginePeer?,
|
||||
authorOfMessage: MessageReference? = nil,
|
||||
overrideImage: AvatarNodeImageOverride? = nil,
|
||||
emptyColor: UIColor? = nil,
|
||||
clipStyle: AvatarNodeClipStyle = .round,
|
||||
synchronousLoad: Bool = false,
|
||||
displayDimensions: CGSize = CGSize(width: 60.0, height: 60.0),
|
||||
storeUnrounded: Bool = false
|
||||
) {
|
||||
self.context = context
|
||||
|
||||
if let statusComponentView = self.statusView.view {
|
||||
|
|
@ -162,6 +173,10 @@ public final class ChatAvatarNavigationNode: ASDisplayNode {
|
|||
profilePhoto = maybePhoto
|
||||
isKnown = true
|
||||
}
|
||||
if profilePhoto == nil, case let .known(maybePhoto) = cachedPeerData.fallbackPhoto {
|
||||
profilePhoto = maybePhoto
|
||||
isKnown = true
|
||||
}
|
||||
}
|
||||
|
||||
if isKnown {
|
||||
|
|
|
|||
|
|
@ -1102,6 +1102,10 @@ public final class ChatMessageAvatarHeaderNodeImpl: ListViewItemHeaderNode, Chat
|
|||
profilePhoto = maybePhoto
|
||||
isKnown = true
|
||||
}
|
||||
if profilePhoto == nil, case let .known(maybePhoto) = cachedPeerData.fallbackPhoto {
|
||||
profilePhoto = maybePhoto
|
||||
isKnown = true
|
||||
}
|
||||
}
|
||||
|
||||
if isKnown {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue