mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Initial peer id refactoring
This commit is contained in:
@@ -337,7 +337,7 @@ public final class AvatarNode: ASDisplayNode {
|
||||
} else if peer?.restrictionText(platform: "ios", contentSettings: context.currentContentSettings.with { $0 }) == nil {
|
||||
representation = peer?.smallProfileImage
|
||||
}
|
||||
let updatedState: AvatarNodeState = .peerAvatar(peer?.id ?? PeerId(namespace: 0, id: 0), peer?.displayLetters ?? [], representation)
|
||||
let updatedState: AvatarNodeState = .peerAvatar(peer?.id ?? PeerId(0), peer?.displayLetters ?? [], representation)
|
||||
if updatedState != self.state || overrideImage != self.overrideImage || theme !== self.theme {
|
||||
self.state = updatedState
|
||||
self.overrideImage = overrideImage
|
||||
@@ -381,7 +381,7 @@ public final class AvatarNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
self.editOverlayNode?.isHidden = true
|
||||
parameters = AvatarNodeParameters(theme: theme, accountPeerId: context.account.peerId, peerId: peer?.id ?? PeerId(namespace: 0, id: 0), letters: peer?.displayLetters ?? [], font: self.font, icon: icon, explicitColorIndex: nil, hasImage: false, clipStyle: clipStyle)
|
||||
parameters = AvatarNodeParameters(theme: theme, accountPeerId: context.account.peerId, peerId: peer?.id ?? PeerId(0), letters: peer?.displayLetters ?? [], font: self.font, icon: icon, explicitColorIndex: nil, hasImage: false, clipStyle: clipStyle)
|
||||
}
|
||||
if self.parameters == nil || self.parameters != parameters {
|
||||
self.parameters = parameters
|
||||
@@ -453,10 +453,10 @@ public final class AvatarNode: ASDisplayNode {
|
||||
colorIndex = explicitColorIndex
|
||||
} else {
|
||||
if let peerId = parameters.peerId {
|
||||
if peerId.namespace == -1 {
|
||||
if peerId.namespace == .max {
|
||||
colorIndex = -1
|
||||
} else {
|
||||
colorIndex = abs(Int(clamping: peerId.id))
|
||||
colorIndex = abs(Int(clamping: peerId.id._internalGetInt32Value()))
|
||||
}
|
||||
} else {
|
||||
colorIndex = -1
|
||||
@@ -630,10 +630,10 @@ public func drawPeerAvatarLetters(context: CGContext, size: CGSize, font: UIFont
|
||||
context.clip()
|
||||
|
||||
let colorIndex: Int
|
||||
if peerId.namespace == -1 {
|
||||
if peerId.namespace == .max {
|
||||
colorIndex = -1
|
||||
} else {
|
||||
colorIndex = Int(abs(peerId.id))
|
||||
colorIndex = Int(abs(peerId.id._internalGetInt32Value()))
|
||||
}
|
||||
|
||||
let colorsArray: NSArray
|
||||
|
||||
Reference in New Issue
Block a user