Various fixes

This commit is contained in:
Ilya Laktyushin 2026-03-01 18:49:55 +04:00
parent 42085036a2
commit 45a9f55b0b
5 changed files with 43 additions and 36 deletions

View file

@ -30,6 +30,8 @@ public func attachmentDefaultTopInset(layout: ContainerViewLayout?) -> CGFloat {
final class AttachmentContainer: ASDisplayNode, ASGestureRecognizerDelegate {
private let glass: Bool
private let hasPill: Bool
let wrappingNode: ASDisplayNode
let clipNode: ASDisplayNode
let bottomClipNode: ASDisplayNode
@ -85,13 +87,14 @@ final class AttachmentContainer: ASDisplayNode, ASGestureRecognizerDelegate {
var isInnerPanGestureEnabled: (() -> Bool)?
var onExpandAnimationCompleted: () -> Void = {}
init(presentationData: PresentationData, isFullSize: Bool, glass: Bool) {
init(presentationData: PresentationData, isFullSize: Bool, glass: Bool, hasPill: Bool) {
self.presentationData = presentationData
self.isFullSize = isFullSize
if isFullSize {
self.isExpanded = true
}
self.glass = glass
self.hasPill = hasPill
self.wrappingNode = ASDisplayNode()
self.clipNode = ASDisplayNode()
@ -147,7 +150,7 @@ final class AttachmentContainer: ASDisplayNode, ASGestureRecognizerDelegate {
self.panGestureRecognizer = panRecognizer
self.wrappingNode.view.addGestureRecognizer(panRecognizer)
if self.glass {
if self.hasPill {
self.clipNode.view.addSubview(self.pillView)
}

View file

@ -553,7 +553,7 @@ public class AttachmentController: ViewController, MinimizableController {
self.wrapperNode = ASDisplayNode()
self.wrapperNode.clipsToBounds = true
self.container = AttachmentContainer(presentationData: self.presentationData, isFullSize: controller.isFullSize, glass: controller.style == .glass)
self.container = AttachmentContainer(presentationData: self.presentationData, isFullSize: controller.isFullSize, glass: controller._hasGlassStyle, hasPill: controller.style == .glass)
self.container.canHaveKeyboardFocus = true
let panelStyle: AttachmentPanel.Style
@ -895,7 +895,7 @@ public class AttachmentController: ViewController, MinimizableController {
let shouldSwitch = self.controller?.requestController(type, { [weak self] controller, mediaPickerContext in
if let strongSelf = self {
if let controller = controller {
if case .glass = strongSelf.controller?.style {
if strongSelf.controller?._hasGlassStyle == true {
controller._hasGlassStyle = true
}
strongSelf.controller?._ready.set(controller.ready.get())
@ -1477,7 +1477,7 @@ public class AttachmentController: ViewController, MinimizableController {
super.init(navigationBarPresentationData: nil)
self._hasGlassStyle = style == .glass
self._hasGlassStyle = true //style == .glass
self.statusBar.statusBarStyle = .Ignore
self.blocksBackgroundWhenInOverlay = true

View file

@ -722,6 +722,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
private var didChangeFromPendingToSent: Bool = false
private var authorNameColor: UIColor?
private var authorRank: CachedChannelAdminRank?
private var tapRecognizer: TapLongTapOrDoubleTapGestureRecognizer?
@ -3619,7 +3620,8 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
disablesComments: disablesComments,
suggestedPostInfoNodeLayout: suggestedPostInfoNodeLayout,
alignment: alignment,
isSidePanelOpen: isSidePanelOpen
isSidePanelOpen: isSidePanelOpen,
authorRank: authorRank
)
})
}
@ -3685,7 +3687,8 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
disablesComments: Bool,
suggestedPostInfoNodeLayout: (CGSize, () -> ChatMessageSuggestedPostInfoNode)?,
alignment: ChatMessageBubbleContentAlignment,
isSidePanelOpen: Bool
isSidePanelOpen: Bool,
authorRank: CachedChannelAdminRank?
) -> Void {
guard let strongSelf = selfReference.value else {
return
@ -3721,6 +3724,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
strongSelf.disablesComments = disablesComments
strongSelf.authorNameColor = authorNameColor
strongSelf.authorRank = authorRank
strongSelf.replyRecognizer?.allowBothDirections = false//!item.context.sharedContext.immediateExperimentalUISettings.unidirectionalSwipeToReply
strongSelf.view.disablesInteractiveTransitionGestureRecognizer = false//!item.context.sharedContext.immediateExperimentalUISettings.unidirectionalSwipeToReply
@ -6651,30 +6655,21 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
item.controllerInteraction.openGroupBoostInfo(peer.id, boostCount)
}
@objc private func rankButtonPressed() {
guard let item = self.item, let peer = item.message.author else {
guard let item = self.item, let peer = item.message.author, let authorRank = self.authorRank else {
return
}
var role: ChatRankInfoScreenRole = .member
var rank: String = ""
if case let .message(message, _, _, attributes, _) = item.content {
switch attributes.rank {
case let .creator(rankValue):
role = .creator
rank = rankValue ?? ""
case let .admin(rankValue):
role = .admin
rank = rankValue ?? ""
case let .member(rankValue):
role = .member
rank = rankValue ?? ""
default:
break
}
if rank.isEmpty, let attribute = message.attributes.first(where: { $0 is ParticipantRankMessageAttribute }) as? ParticipantRankMessageAttribute, !attribute.rank.isEmpty {
rank = attribute.rank
}
var role: ChatRankInfoScreenRole = .member
switch authorRank {
case let .creator(rankValue):
role = .creator
rank = rankValue ?? ""
case let .admin(rankValue):
role = .admin
rank = rankValue ?? ""
case let .member(rankValue):
role = .member
rank = rankValue ?? ""
}
item.controllerInteraction.openRankInfo(EnginePeer(peer), role, rank)
}

View file

@ -239,7 +239,7 @@ public class MinimizedContainerImpl: ASDisplayNode, MinimizedContainer, ASScroll
var navigationHeight: CGFloat = minimizedNavigationHeight
if !isExpanded {
navigationHeight += insets.bottom
navigationHeight += insets.bottom + 3.0
}
let headerFrame = CGRect(origin: .zero, size: CGSize(width: size.width, height: navigationHeight))

View file

@ -3666,14 +3666,14 @@ public final class WebAppController: ViewController, AttachmentContainable {
self.navigationItem.leftBarButtonItem = UIBarButtonItem(customDisplayNode: cancelButtonNode)
}
let morehButtonNode: BarComponentHostNode
let moreButtonNode: BarComponentHostNode
if let current = self.moreBarButtonNode {
morehButtonNode = current
morehButtonNode.component = moreComponent
moreButtonNode = current
moreButtonNode.component = moreComponent
} else {
morehButtonNode = BarComponentHostNode(component: moreComponent, size: barButtonSize)
self.moreBarButtonNode = morehButtonNode
self.navigationItem.rightBarButtonItem = UIBarButtonItem(customDisplayNode: morehButtonNode)
moreButtonNode = BarComponentHostNode(component: moreComponent, size: barButtonSize)
self.moreBarButtonNode = moreButtonNode
self.navigationItem.rightBarButtonItem = UIBarButtonItem(customDisplayNode: moreButtonNode)
}
}
@ -4181,7 +4181,16 @@ public func standaloneWebAppController(
getSourceRect: (() -> CGRect?)? = nil,
verifyAgeCompletion: ((Int) -> Void)? = nil
) -> ViewController {
let controller = AttachmentController(context: context, updatedPresentationData: updatedPresentationData, chatLocation: .peer(id: params.peerId), buttons: [.standalone], initialButton: .standalone, fromMenu: params.source == .menu, hasTextInput: false, isFullSize: params.fullSize, makeEntityInputView: {
let controller = AttachmentController(
context: context,
updatedPresentationData: updatedPresentationData,
chatLocation: .peer(id: params.peerId),
buttons: [.standalone],
initialButton: .standalone,
fromMenu: params.source == .menu,
hasTextInput: false,
isFullSize: params.fullSize,
makeEntityInputView: {
return nil
})
controller.requestController = { _, present in