Merge commit 'f8890b9734747aba09ab7a965857ff8f42b22dd0' into beta

This commit is contained in:
Ali 2021-06-22 22:12:39 +04:00
commit 98f0622c2a
14 changed files with 102 additions and 81 deletions

View File

@ -160,7 +160,7 @@ public func peerAvatarImage(account: Account, peerReference: PeerReference?, aut
shouldBlur = true
}
if shouldBlur {
let imageContextSize = CGSize(width: 64.0, height: 64.0)
let imageContextSize = size.width > 200.0 ? CGSize(width: 192.0, height: 192.0) : CGSize(width: 64.0, height: 64.0)
let imageContext = DrawingContext(size: imageContextSize, scale: 1.0, clear: true)
imageContext.withFlippedContext { c in
c.draw(dataImage, in: CGRect(origin: CGPoint(), size: imageContextSize))
@ -172,7 +172,13 @@ public func peerAvatarImage(account: Account, peerReference: PeerReference?, aut
}
telegramFastBlurMore(Int32(imageContext.size.width * imageContext.scale), Int32(imageContext.size.height * imageContext.scale), Int32(imageContext.bytesPerRow), imageContext.bytes)
if size.width > 200.0 {
telegramFastBlurMore(Int32(imageContext.size.width * imageContext.scale), Int32(imageContext.size.height * imageContext.scale), Int32(imageContext.bytesPerRow), imageContext.bytes)
telegramFastBlurMore(Int32(imageContext.size.width * imageContext.scale), Int32(imageContext.size.height * imageContext.scale), Int32(imageContext.bytesPerRow), imageContext.bytes)
telegramFastBlurMore(Int32(imageContext.size.width * imageContext.scale), Int32(imageContext.size.height * imageContext.scale), Int32(imageContext.bytesPerRow), imageContext.bytes)
telegramFastBlurMore(Int32(imageContext.size.width * imageContext.scale), Int32(imageContext.size.height * imageContext.scale), Int32(imageContext.bytesPerRow), imageContext.bytes)
}
dataImage = imageContext.generateImage()!.cgImage!
}

View File

@ -92,14 +92,19 @@ public func imageRequiresInversion(_ cgImage: CGImage) -> Bool {
}
if hasAlpha {
let probingContext = DrawingContext(size: CGSize(width: cgImage.width, height: cgImage.height))
probingContext.withContext { c in
c.draw(cgImage, in: CGRect(origin: CGPoint(), size: probingContext.size))
}
var matching: Int = 0
var total: Int = 0
for y in 0 ..< Int(context.size.height) {
for x in 0 ..< Int(context.size.width) {
for y in 0 ..< Int(probingContext.size.height) {
for x in 0 ..< Int(probingContext.size.width) {
var saturation: CGFloat = 0.0
var brightness: CGFloat = 0.0
var alpha: CGFloat = 0.0
if context.colorAt(CGPoint(x: x, y: y)).getHue(nil, saturation: &saturation, brightness: &brightness, alpha: &alpha) {
if probingContext.colorAt(CGPoint(x: x, y: y)).getHue(nil, saturation: &saturation, brightness: &brightness, alpha: &alpha) {
if alpha < 1.0 {
hasAlpha = true
}

View File

@ -632,8 +632,8 @@ final class ImportStickerPackControllerNode: ViewControllerTracingNode, UIScroll
firstItem = StickerPackItem(index: ItemCollectionItemIndex(index: 0, id: 0), file: TelegramMediaFile(fileId: MediaId(namespace: 0, id: 0), partialReference: nil, resource: resource, previewRepresentations: [], videoThumbnails: [], immediateThumbnailData: nil, mimeType: stickerPack.isAnimated ? "application/x-tgsticker": "image/png", size: nil, attributes: [.FileName(fileName: stickerPack.isAnimated ? "sticker.tgs" : "sticker.png"), .ImageSize(size: firstStickerItem.dimensions)]), indexKeys: [])
}
strongSelf.presentInGlobalOverlay?(UndoOverlayController(presentationData: strongSelf.presentationData, content: .stickersModified(title: strongSelf.presentationData.strings.StickerPackActionInfo_AddedTitle, text: strongSelf.presentationData.strings.StickerPackActionInfo_AddedText(info.title).0, undo: false, info: info, topItem: firstItem ?? items.first, context: strongSelf.context), elevatedLayout: false, action: { _ in
(navigationController?.viewControllers.last as? ViewController)?.present(StickerPackScreen(context: context, mode: .settings, mainStickerPack: .id(id: info.id.id, accessHash: info.accessHash), stickerPacks: [], parentNavigationController: navigationController, actionPerformed: { _, _, _ in
}), in: .window(.root))
// (navigationController?.viewControllers.last as? ViewController)?.present(StickerPackScreen(context: context, mode: .settings, mainStickerPack: .id(id: info.id.id, accessHash: info.accessHash), stickerPacks: [], parentNavigationController: navigationController, actionPerformed: { _, _, _ in
// }), in: .window(.root))
return true
}), nil)
strongSelf.cancel?()

View File

@ -195,12 +195,12 @@ private class TextField: UITextField, UIScrollViewDelegate {
let textRect = self.textRect(forBounds: bounds)
let labelSize = self.placeholderLabel.updateLayout(textRect.size)
self.placeholderLabel.frame = CGRect(origin: CGPoint(x: textRect.minX, y: floorToScreenPixels((bounds.height - labelSize.height) / 2.0)), size: labelSize)
self.placeholderLabel.frame = CGRect(origin: CGPoint(x: textRect.minX + 3.0, y: floorToScreenPixels((bounds.height - labelSize.height) / 2.0)), size: labelSize)
let prefixSize = self.prefixLabel.updateLayout(CGSize(width: floor(bounds.size.width * 0.7), height: bounds.size.height))
let prefixBounds = bounds.insetBy(dx: 4.0, dy: 4.0)
self.prefixLabel.frame = CGRect(origin: CGPoint(x: prefixBounds.minX, y: floorToScreenPixels((bounds.height - prefixSize.height) / 2.0)), size: prefixSize)
self.updatePrefixWidth(prefixSize.width)
self.updatePrefixWidth(prefixSize.width + 3.0)
}
}

View File

@ -298,7 +298,7 @@ public class ItemListVenueItemNode: ListViewItemNode, ItemListItemNode {
strongSelf.topStripeNode.removeFromSupernode()
}
if strongSelf.bottomStripeNode.supernode == nil {
strongSelf.addSubnode(strongSelf.bottomStripeNode)
strongSelf.insertSubnode(strongSelf.bottomStripeNode, at: 0)
}
if strongSelf.maskNode.supernode != nil {
strongSelf.maskNode.removeFromSupernode()

View File

@ -19,6 +19,7 @@ final class GroupVideoNode: ASDisplayNode {
case fillOrFitToSquare
case fillHorizontal
case fillVertical
case fit
}
let sourceContainerNode: PinchSourceContainerNode
@ -252,6 +253,8 @@ final class GroupVideoNode: ASDisplayNode {
let filledToSquareSize = rotatedVideoSize.aspectFilled(CGSize(width: squareSide, height: squareSide))
switch layoutMode {
case .fit:
rotatedVideoSize = fittedSize
case .fillOrFitToSquare:
rotatedVideoSize = filledToSquareSize
case .fillHorizontal:

View File

@ -1179,7 +1179,7 @@ public final class VoiceChatController: ViewController {
self.itemInteraction = Interaction(updateIsMuted: { [weak self] peerId, isMuted in
let _ = self?.call.updateMuteState(peerId: peerId, isMuted: isMuted)
}, switchToPeer: { [weak self] peerId, videoEndpointId, expand in
if let strongSelf = self {
if let strongSelf = self, strongSelf.connectedOnce {
if expand, let videoEndpointId = videoEndpointId {
strongSelf.currentDominantSpeaker = (peerId, videoEndpointId, CACurrentMediaTime() + 3.0)
strongSelf.updateDisplayMode(.fullscreen(controlsHidden: false))
@ -3711,7 +3711,7 @@ public final class VoiceChatController: ViewController {
forceUpdate = true
}
leftBorderFrame = CGRect(origin: CGPoint(x: -additionalInset - additionalLeftInset, y: topPanelFrame.maxY - additionalInset * (isFullscreen ? 0.95 : 0.8)), size: CGSize(width: sideInset + additionalInset + additionalLeftInset + (contentLeftInset.isZero ? additionalSideInset : contentLeftInset), height: layout.size.height))
rightBorderFrame = CGRect(origin: CGPoint(x: size.width - sideInset - (contentLeftInset.isZero ? additionalSideInset : 0.0), y: topPanelFrame.maxY - additionalInset * (isFullscreen ? 0.95 : 0.8)), size: CGSize(width: sideInset + additionalInset + additionalSideInset, height: layout.size.height))
rightBorderFrame = CGRect(origin: CGPoint(x: size.width - sideInset - (contentLeftInset.isZero ? additionalSideInset : 0.0), y: topPanelFrame.maxY - additionalInset * (isFullscreen ? 0.95 : 0.8)), size: CGSize(width: sideInset + additionalInset + additionalLeftInset + additionalSideInset, height: layout.size.height))
}
let topCornersFrame = CGRect(x: sideInset + (contentLeftInset.isZero ? floorToScreenPixels((size.width - contentWidth) / 2.0) : contentLeftInset), y: topPanelFrame.maxY - 60.0, width: contentWidth - sideInset * 2.0, height: 50.0 + 60.0)
@ -3722,23 +3722,31 @@ public final class VoiceChatController: ViewController {
let previousRightBorderFrame = self.rightBorderNode.frame
if !topPanelFrame.equalTo(previousTopPanelFrame) || forceUpdate {
self.topPanelNode.frame = topPanelFrame
let positionDelta = CGPoint(x: 0.0, y: topPanelFrame.minY - previousTopPanelFrame.minY)
transition.animateOffsetAdditive(layer: self.topPanelNode.layer, offset: positionDelta.y, completion: completion)
if topPanelFrame.width != previousTopPanelFrame.width {
transition.updateFrame(node: self.topPanelNode, frame: topPanelFrame)
transition.updateFrame(node: self.topCornersNode, frame: topCornersFrame)
transition.updateFrame(node: self.backgroundNode, frame: backgroundFrame)
transition.updateFrame(node: self.leftBorderNode, frame: leftBorderFrame)
transition.updateFrame(node: self.rightBorderNode, frame: rightBorderFrame)
} else {
self.topPanelNode.frame = topPanelFrame
let positionDelta = CGPoint(x: 0.0, y: topPanelFrame.minY - previousTopPanelFrame.minY)
transition.animateOffsetAdditive(layer: self.topPanelNode.layer, offset: positionDelta.y, completion: completion)
transition.updateFrame(node: self.topCornersNode, frame: topCornersFrame)
transition.updateFrame(node: self.topCornersNode, frame: topCornersFrame)
self.backgroundNode.frame = backgroundFrame
let backgroundPositionDelta = CGPoint(x: 0.0, y: previousBackgroundFrame.minY - backgroundFrame.minY)
transition.animatePositionAdditive(node: self.backgroundNode, offset: backgroundPositionDelta)
self.leftBorderNode.frame = leftBorderFrame
let leftBorderPositionDelta = CGPoint(x: previousLeftBorderFrame.maxX - leftBorderFrame.maxX, y: previousLeftBorderFrame.minY - leftBorderFrame.minY)
transition.animatePositionAdditive(node: self.leftBorderNode, offset: leftBorderPositionDelta)
self.rightBorderNode.frame = rightBorderFrame
let rightBorderPositionDelta = CGPoint(x: previousRightBorderFrame.minX - rightBorderFrame.minX, y: previousRightBorderFrame.minY - rightBorderFrame.minY)
transition.animatePositionAdditive(node: self.rightBorderNode, offset: rightBorderPositionDelta)
self.backgroundNode.frame = backgroundFrame
let backgroundPositionDelta = CGPoint(x: 0.0, y: previousBackgroundFrame.minY - backgroundFrame.minY)
transition.animatePositionAdditive(node: self.backgroundNode, offset: backgroundPositionDelta)
self.leftBorderNode.frame = leftBorderFrame
let leftBorderPositionDelta = CGPoint(x: previousLeftBorderFrame.maxX - leftBorderFrame.maxX, y: previousLeftBorderFrame.minY - leftBorderFrame.minY)
transition.animatePositionAdditive(node: self.leftBorderNode, offset: leftBorderPositionDelta)
self.rightBorderNode.frame = rightBorderFrame
let rightBorderPositionDelta = CGPoint(x: previousRightBorderFrame.minX - rightBorderFrame.minX, y: previousRightBorderFrame.minY - rightBorderFrame.minY)
transition.animatePositionAdditive(node: self.rightBorderNode, offset: rightBorderPositionDelta)
}
} else {
completion?()
}
@ -3749,14 +3757,20 @@ public final class VoiceChatController: ViewController {
let bottomOffset = min(0.0, bottomEdge - listMaxY) + layout.size.height - bottomPanelHeight
let bottomCornersFrame = CGRect(origin: CGPoint(x: sideInset + floorToScreenPixels((size.width - contentWidth) / 2.0), y: -50.0 + bottomOffset + bottomGradientHeight), size: CGSize(width: contentWidth - sideInset * 2.0, height: 50.0 + 60.0))
let bottomPanelBackgroundFrame = CGRect(x: 0.0, y: bottomOffset + bottomGradientHeight, width: size.width, height: 2000.0)
let previousBottomCornersFrame = self.bottomCornersNode.frame
if !bottomCornersFrame.equalTo(previousBottomCornersFrame) {
self.bottomCornersNode.frame = bottomCornersFrame
self.bottomPanelBackgroundNode.frame = CGRect(x: 0.0, y: bottomOffset + bottomGradientHeight, width: size.width, height: 2000.0)
let positionDelta = CGPoint(x: 0.0, y: previousBottomCornersFrame.minY - bottomCornersFrame.minY)
transition.animatePositionAdditive(node: self.bottomCornersNode, offset: positionDelta)
transition.animatePositionAdditive(node: self.bottomPanelBackgroundNode, offset: positionDelta)
if bottomCornersFrame.width != previousBottomCornersFrame.width {
transition.updateFrame(node: self.bottomCornersNode, frame: bottomCornersFrame)
transition.updateFrame(node: self.bottomPanelBackgroundNode, frame: bottomPanelBackgroundFrame)
} else {
self.bottomCornersNode.frame = bottomCornersFrame
self.bottomPanelBackgroundNode.frame = bottomPanelBackgroundFrame
let positionDelta = CGPoint(x: 0.0, y: previousBottomCornersFrame.minY - bottomCornersFrame.minY)
transition.animatePositionAdditive(node: self.bottomCornersNode, offset: positionDelta)
transition.animatePositionAdditive(node: self.bottomPanelBackgroundNode, offset: positionDelta)
}
}
}
@ -4975,7 +4989,7 @@ public final class VoiceChatController: ViewController {
self.joinedVideo = joinedVideo
if !joinedVideo && !tileItems.isEmpty || !gridTileItems.isEmpty, let peer = self.peer {
if !joinedVideo && (!tileItems.isEmpty || !gridTileItems.isEmpty), let peer = self.peer {
tileItems.removeAll()
gridTileItems.removeAll()

View File

@ -724,7 +724,7 @@ final class VoiceChatMainStageNode: ASDisplayNode {
let peer = peerEntry.peer
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
if !arePeersEqual(previousPeerEntry?.peer, peerEntry.peer) {
self.backdropAvatarNode.setSignal(peerAvatarCompleteImage(account: self.context.account, peer: peer, size: CGSize(width: 180.0, height: 180.0), round: false, font: avatarPlaceholderFont(size: 78.0), drawLetters: false, blurred: true))
self.backdropAvatarNode.setSignal(peerAvatarCompleteImage(account: self.context.account, peer: peer, size: CGSize(width: 240.0, height: 240.0), round: false, font: avatarPlaceholderFont(size: 78.0), drawLetters: false, blurred: true))
self.avatarNode.setSignal(peerAvatarCompleteImage(account: self.context.account, peer: peer, size: CGSize(width: 180.0, height: 180.0), font: avatarPlaceholderFont(size: 78.0), fullSize: true))
}
@ -1098,7 +1098,11 @@ final class VoiceChatMainStageNode: ASDisplayNode {
layoutMode = .fillOrFitToSquare
bottomInset = 0.0
} else {
layoutMode = isLandscape ? .fillHorizontal : .fillVertical
if let (_, _, _, isPresentation, _) = self.currentPeer, isPresentation {
layoutMode = .fit
} else {
layoutMode = isLandscape ? .fillHorizontal : .fillVertical
}
}
if let currentVideoNode = self.currentVideoNode {

View File

@ -133,14 +133,11 @@ final class VoiceChatTileGridNode: ASDisplayNode {
}
if let itemNode = itemNode {
itemNode.visibility = self.visibility
if wasAdded {
itemNode.frame = itemFrame
if !isFirstTime {
itemNode.layer.animateScale(from: 0.0, to: 1.0, duration: wasEmpty ? 0.4 : 0.3)
itemNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
}
} else {
transition.updateFrame(node: itemNode, frame: itemFrame)
let itemTransition: ContainedViewLayoutTransition = wasAdded ? .immediate : transition
itemTransition.updateFrameAsPositionAndBounds(node: itemNode, frame: itemFrame)
if wasAdded && !isFirstTime {
itemNode.layer.animateScale(from: 0.0, to: 1.0, duration: wasEmpty ? 0.4 : 0.3)
itemNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
}
if let (rect, containerSize) = self.absoluteLocation {
@ -160,7 +157,7 @@ final class VoiceChatTileGridNode: ASDisplayNode {
}
for id in removeIds {
if let itemNode = self.itemNodes.removeValue(forKey: id) {
itemNode.layer.animateScale(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false)
itemNode.layer.animateScale(from: 1.0, to: 0.0, duration: 0.3, removeOnCompletion: false, additive: true)
itemNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak itemNode] _ in
itemNode?.removeFromSupernode()
})

View File

@ -30,11 +30,9 @@ private func managedRecentMedia(postbox: Postbox, network: Network, collectionId
|> mapToSignal { sourceItems in
var items: [OrderedItemListEntry] = []
if let sourceItems = sourceItems {
var existingIds = Set<MediaId>()
var existingIds = Set<Data>()
for item in sourceItems {
guard let id = (item.contents as? RecentMediaItem)?.media.id else {
continue
}
let id = item.id.makeData()
if !existingIds.contains(id) {
existingIds.insert(id)
items.append(item)

View File

@ -1009,12 +1009,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
strongSelf.updateChatPresentationInterfaceState(animated: true, interactive: true, { $0.updatedInterfaceState { $0.withToggledSelectedMessages(ids, value: value) } })
if let selectionState = strongSelf.presentationInterfaceState.interfaceState.selectionState {
let count = selectionState.selectedIds.count
let text: String
if count == 1 {
text = "1 message selected"
} else {
text = "\(count) messages selected"
}
let text = strongSelf.presentationData.strings.VoiceOver_Chat_MessagesSelected(Int32(count))
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1, execute: {
UIAccessibility.post(notification: UIAccessibility.Notification.announcement, argument: text as NSString)
})

View File

@ -453,10 +453,12 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
self.menuButton = HighlightTrackingButtonNode()
self.menuButton.clipsToBounds = true
self.menuButton.cornerRadius = 16.0
self.menuButton.accessibilityLabel = presentationInterfaceState.strings.Conversation_InputMenu
self.menuButtonBackgroundNode = ASDisplayNode()
self.menuButtonClippingNode = ASDisplayNode()
self.menuButtonClippingNode.clipsToBounds = true
self.menuButtonIconNode = AnimationNode(animation: "anim_menuclose", colors: [:])
self.menuButtonIconNode = AnimationNode(animation: "anim_menuclose", colors: ["1.1.Обводка 1": presentationInterfaceState.theme.chat.inputPanel.actionControlForegroundColor, "2.2.Обводка 1": presentationInterfaceState.theme.chat.inputPanel.actionControlForegroundColor, "3.1.Обводка 1": presentationInterfaceState.theme.chat.inputPanel.actionControlForegroundColor])
self.menuButtonTextNode = ImmediateTextNode()
self.attachmentButton = HighlightableButtonNode(pointerStyle: .circle)
@ -478,14 +480,12 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
self.menuButton.addTarget(self, action: #selector(self.menuButtonPressed), forControlEvents: .touchUpInside)
self.menuButton.highligthedChanged = { [weak self] highlighted in
if let strongSelf = self {
if let strongSelf = self {
if highlighted {
let transition: ContainedViewLayoutTransition = .animated(duration: 0.3, curve: .spring)
transition.updateTransformScale(node: strongSelf.menuButton, scale: 0.85)
} else {
let transition: ContainedViewLayoutTransition = .animated(duration: 0.5, curve: .spring)
transition.updateTransformScale(node: strongSelf.menuButton, scale: 1.0)
}
if highlighted {
let transition: ContainedViewLayoutTransition = .animated(duration: 0.3, curve: .spring)
transition.updateTransformScale(node: strongSelf.menuButton, scale: 0.85)
} else {
let transition: ContainedViewLayoutTransition = .animated(duration: 0.5, curve: .spring)
transition.updateTransformScale(node: strongSelf.menuButton, scale: 1.0)
}
}
}
@ -810,9 +810,9 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
if let previousShowCommands = previousState?.showCommands, previousShowCommands != interfaceState.showCommands {
if interfaceState.showCommands {
self.menuButtonIconNode.setAnimation(name: "anim_menuclose", colors: [:])
self.menuButtonIconNode.setAnimation(name: "anim_menuclose", colors: ["1.1.Обводка 1": interfaceState.theme.chat.inputPanel.actionControlForegroundColor, "2.2.Обводка 1": interfaceState.theme.chat.inputPanel.actionControlForegroundColor, "3.1.Обводка 1": interfaceState.theme.chat.inputPanel.actionControlForegroundColor])
} else {
self.menuButtonIconNode.setAnimation(name: "anim_closemenu", colors: [:])
self.menuButtonIconNode.setAnimation(name: "anim_closemenu", colors: ["1.1.Обводка 1": interfaceState.theme.chat.inputPanel.actionControlForegroundColor, "2.2.Обводка 1": interfaceState.theme.chat.inputPanel.actionControlForegroundColor, "3.1.Обводка 1": interfaceState.theme.chat.inputPanel.actionControlForegroundColor])
}
self.menuButtonIconNode.playOnce()
}
@ -851,6 +851,7 @@ class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDelegate {
self.menuButtonBackgroundNode.backgroundColor = interfaceState.theme.chat.inputPanel.actionControlFillColor
self.menuButtonTextNode.attributedText = NSAttributedString(string: interfaceState.strings.Conversation_InputMenu, font: Font.with(size: 16.0, design: .round, weight: .medium, traits: []), textColor: interfaceState.theme.chat.inputPanel.actionControlForegroundColor)
self.menuButton.accessibilityLabel = interfaceState.strings.Conversation_InputMenu
menuTextSize = self.menuButtonTextNode.updateLayout(CGSize(width: width, height: 44.0))
if isEditingMedia {

View File

@ -1050,7 +1050,7 @@ func peerInfoHeaderButtons(peer: Peer?, cachedData: CachedPeerData?, isOpenedFro
result.append(.discussion)
}
result.append(.search)
if displayLeave {
if displayLeave && result.count < 4 {
result.append(.leave)
}
var canReport = true

View File

@ -3689,19 +3689,17 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
self?.openDeletePeer()
})))
} else {
if filteredButtons.contains(.leave) {
if case .member = channel.participationStatus {
if !items.isEmpty {
items.append(.separator)
}
items.append(.action(ContextMenuActionItem(text: presentationData.strings.Channel_LeaveChannel, textColor: .destructive, icon: { theme in
generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor)
}, action: { [weak self] _, f in
f(.dismissWithoutContent)
self?.openLeavePeer()
})))
if case .member = channel.participationStatus, !headerButtons.contains(.leave) {
if !items.isEmpty {
items.append(.separator)
}
items.append(.action(ContextMenuActionItem(text: presentationData.strings.Channel_LeaveChannel, textColor: .destructive, icon: { theme in
generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor)
}, action: { [weak self] _, f in
f(.dismissWithoutContent)
self?.openLeavePeer()
})))
}
}
case .group:
@ -3717,7 +3715,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
self?.openDeletePeer()
})))
} else {
if case .member = channel.participationStatus {
if case .member = channel.participationStatus, !headerButtons.contains(.leave) {
if !items.isEmpty {
items.append(.separator)
}
@ -3732,7 +3730,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
}
}
} else if let group = peer as? TelegramGroup {
if case .Member = group.membership {
if case .Member = group.membership, !headerButtons.contains(.leave) {
if !items.isEmpty {
items.append(.separator)
}