Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions submodules/ChatListUI/Sources/ChatListController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
self.requestLayout(transition: .immediate)
}

func tabContextGesture(id: Int32?, sourceNode: ContextExtractedContentContainingNode?, sourceView: ContextExtractedContentContainingView?, gesture: ContextGesture?, keepInPlace: Bool, isDisabled: Bool) {
func tabContextGesture(id: Int32?, sourceNode: ContextExtractedContentContainingNode?, sourceView: ContextExtractedContentContainingView?, gesture: ContextGesture?, keepInPlace: Bool, isDisabled: Bool, sourceActionsPosition: ContextControllerReferenceViewInfo.ActionsPosition = .bottom, sourceKeepInPlace: Bool = true) {
let context = self.context
let filterPeersAreMuted: Signal<(areMuted: Bool, peerIds: [EnginePeer.Id])?, NoError> = self.context.engine.peers.currentChatListFilters()
|> take(1)
Expand Down Expand Up @@ -1331,7 +1331,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
let controller = makeContextController(presentationData: self.presentationData, source: .extracted(ChatListHeaderBarContextExtractedContentSource(controller: self, sourceNode: sourceNode, sourceView: sourceView, keepInPlace: keepInPlace)), items: .single(ContextController.Items(content: .list(items))), recognizer: nil, gesture: gesture)
self.context.sharedContext.mainWindow?.presentInGlobalOverlay(controller)
} else if let sourceView {
let controller = makeContextController(presentationData: self.presentationData, source: .reference(ChatListHeaderBarContextReferenceContentSource(controller: self, sourceView: sourceView)), items: .single(ContextController.Items(content: .list(items))), recognizer: nil, gesture: gesture)
let controller = makeContextController(presentationData: self.presentationData, source: .reference(ChatListHeaderBarContextReferenceContentSource(controller: self, sourceView: sourceView, actionsPosition: sourceActionsPosition, keepInPlace: sourceKeepInPlace)), items: .single(ContextController.Items(content: .list(items))), recognizer: nil, gesture: gesture) // MARK: Swiftgram
self.context.sharedContext.mainWindow?.presentInGlobalOverlay(controller)
}
})
Expand Down Expand Up @@ -6679,22 +6679,25 @@ private final class ChatListTabBarContextReferenceContentSource: ContextReferenc
}

private final class ChatListHeaderBarContextReferenceContentSource: ContextReferenceContentSource {
let keepInPlace: Bool = true
let keepInPlace: Bool
let actionsHorizontalAlignment: ContextActionsHorizontalAlignment = .center

private let controller: ChatListController
private let sourceView: ContextExtractedContentContainingView
private let actionsPosition: ContextControllerReferenceViewInfo.ActionsPosition

init(controller: ChatListController, sourceView: ContextExtractedContentContainingView) {
init(controller: ChatListController, sourceView: ContextExtractedContentContainingView, actionsPosition: ContextControllerReferenceViewInfo.ActionsPosition = .bottom, keepInPlace: Bool = true) {
self.controller = controller
self.sourceView = sourceView
self.actionsPosition = actionsPosition
self.keepInPlace = keepInPlace
}

func transitionInfo() -> ContextControllerReferenceViewInfo? {
return ContextControllerReferenceViewInfo(
referenceView: self.sourceView.contentView,
contentAreaInScreenSpace: UIScreen.main.bounds,
actionsPosition: .bottom
actionsPosition: self.actionsPosition
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion submodules/ChatListUI/Sources/ChatListControllerNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1632,7 +1632,7 @@ final class ChatListControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
}
}

self.controller?.tabContextGesture(id: mappedId, sourceNode: nil, sourceView: sourceView, gesture: gesture, keepInPlace: false, isDisabled: isDisabled)
self.controller?.tabContextGesture(id: mappedId, sourceNode: nil, sourceView: sourceView, gesture: gesture, keepInPlace: false, isDisabled: isDisabled, sourceActionsPosition: tabContainerData.1 ? .top : .bottom, sourceKeepInPlace: !tabContainerData.1) // MARK: Swiftgram
},
deleteAction: (!isEditing || isMainTab) ? nil : { [weak self] in
guard let self else {
Expand Down