Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin 2023-10-09 12:29:42 +04:00
commit 5b58ad5018
51 changed files with 456 additions and 400 deletions

View File

@ -5,4 +5,5 @@ public typealias EngineTempBox = TempBox
public extension EngineTempBox {
typealias File = TempBoxFile
typealias Directory = TempBoxDirectory
}

View File

@ -350,6 +350,15 @@ swift_library(
"//submodules/TelegramUI/Components/Chat/EditableTokenListNode",
"//submodules/TelegramUI/Components/Chat/ChatInputTextNode",
"//submodules/TelegramUI/Components/Chat/ChatMessageReplyInfoNode",
"//submodules/TelegramUI/Components/Chat/ChatOverscrollControl",
"//submodules/TelegramUI/Components/AudioWaveformNode",
"//submodules/TelegramUI/Components/Chat/ChatBotInfoItem",
"//submodules/TelegramUI/Components/Chat/ChatInputPanelNode",
"//submodules/TelegramUI/Components/Chat/ChatBotStartInputPanelNode",
"//submodules/TelegramUI/Components/Chat/ChatButtonKeyboardInputNode",
"//submodules/TelegramUI/Components/Chat/ChatChannelSubscriberInputPanelNode",
"//submodules/TelegramUI/Components/Chat/ChatContextResultPeekContent",
"//submodules/TelegramUI/Components/Chat/ChatInputContextPanelNode",
] + select({
"@build_bazel_rules_apple//apple:ios_arm64": appcenter_targets,
"//build-system:ios_sim_arm64": [],

View File

@ -0,0 +1,20 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
swift_library(
name = "AudioWaveformNode",
module_name = "AudioWaveformNode",
srcs = glob([
"Sources/**/*.swift",
]),
copts = [
"-warnings-as-errors",
],
deps = [
"//submodules/AsyncDisplayKit",
"//submodules/Display",
"//submodules/ChatPresentationInterfaceState",
],
visibility = [
"//visibility:public",
],
)

View File

@ -20,8 +20,8 @@ private final class AudioWaveformNodeParameters: NSObject {
}
}
final class AudioWaveformNode: ASDisplayNode {
enum Gravity {
public final class AudioWaveformNode: ASDisplayNode {
public enum Gravity {
case bottom
case center
}
@ -30,7 +30,7 @@ final class AudioWaveformNode: ASDisplayNode {
private var color: UIColor?
private var gravity: Gravity?
var progress: CGFloat? {
public var progress: CGFloat? {
didSet {
if self.progress != oldValue {
self.setNeedsDisplay()
@ -38,13 +38,13 @@ final class AudioWaveformNode: ASDisplayNode {
}
}
override init() {
override public init() {
super.init()
self.isOpaque = false
}
override var frame: CGRect {
override public var frame: CGRect {
get {
return super.frame
} set(value) {
@ -57,7 +57,7 @@ final class AudioWaveformNode: ASDisplayNode {
}
}
func setup(color: UIColor, gravity: Gravity, waveform: AudioWaveform?) {
public func setup(color: UIColor, gravity: Gravity, waveform: AudioWaveform?) {
if self.color == nil || !self.color!.isEqual(color) || self.waveform != waveform || self.gravity != gravity {
self.color = color
self.gravity = gravity
@ -66,7 +66,7 @@ final class AudioWaveformNode: ASDisplayNode {
}
}
override func drawParameters(forAsyncLayer layer: _ASDisplayLayer) -> NSObjectProtocol? {
override public func drawParameters(forAsyncLayer layer: _ASDisplayLayer) -> NSObjectProtocol? {
return AudioWaveformNodeParameters(waveform: self.waveform, color: self.color, gravity: self.gravity, progress: self.progress)
}

View File

@ -0,0 +1,32 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
swift_library(
name = "ChatBotInfoItem",
module_name = "ChatBotInfoItem",
srcs = glob([
"Sources/**/*.swift",
]),
copts = [
"-warnings-as-errors",
],
deps = [
"//submodules/Display",
"//submodules/AsyncDisplayKit",
"//submodules/SSignalKit/SwiftSignalKit",
"//submodules/Postbox",
"//submodules/TelegramCore",
"//submodules/TelegramPresentationData",
"//submodules/TextFormat",
"//submodules/UrlEscaping",
"//submodules/PhotoResources",
"//submodules/AccountContext",
"//submodules/MediaPlayer:UniversalMediaPlayer",
"//submodules/TelegramUniversalVideoContent",
"//submodules/WallpaperBackgroundNode",
"//submodules/TelegramUI/Components/ChatControllerInteraction",
"//submodules/TelegramUI/Components/Chat/ChatMessageBubbleContentNode",
],
visibility = [
"//visibility:public",
],
)

View File

@ -22,7 +22,7 @@ private let messageItalicFont = Font.italic(17.0)
private let messageBoldItalicFont = Font.semiboldItalic(17.0)
private let messageFixedFont = UIFont(name: "Menlo-Regular", size: 16.0) ?? UIFont.systemFont(ofSize: 17.0)
final class ChatBotInfoItem: ListViewItem {
public final class ChatBotInfoItem: ListViewItem {
fileprivate let title: String
fileprivate let text: String
fileprivate let photo: TelegramMediaImage?
@ -31,7 +31,7 @@ final class ChatBotInfoItem: ListViewItem {
fileprivate let presentationData: ChatPresentationData
fileprivate let context: AccountContext
init(title: String, text: String, photo: TelegramMediaImage?, video: TelegramMediaFile?, controllerInteraction: ChatControllerInteraction, presentationData: ChatPresentationData, context: AccountContext) {
public init(title: String, text: String, photo: TelegramMediaImage?, video: TelegramMediaFile?, controllerInteraction: ChatControllerInteraction, presentationData: ChatPresentationData, context: AccountContext) {
self.title = title
self.text = text
self.photo = photo
@ -41,7 +41,7 @@ final class ChatBotInfoItem: ListViewItem {
self.context = context
}
func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal<Void, NoError>?, (ListViewItemApply) -> Void)) -> Void) {
public func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal<Void, NoError>?, (ListViewItemApply) -> Void)) -> Void) {
let configure = {
let node = ChatBotInfoItemNode()
@ -66,7 +66,7 @@ final class ChatBotInfoItem: ListViewItem {
}
}
func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) {
public func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) {
Queue.mainQueue().async {
if let nodeValue = node() as? ChatBotInfoItemNode {
let nodeLayout = nodeValue.asyncLayout()
@ -84,20 +84,20 @@ final class ChatBotInfoItem: ListViewItem {
}
}
final class ChatBotInfoItemNode: ListViewItemNode {
var controllerInteraction: ChatControllerInteraction?
public final class ChatBotInfoItemNode: ListViewItemNode {
public var controllerInteraction: ChatControllerInteraction?
let offsetContainer: ASDisplayNode
let backgroundNode: ASImageNode
let imageNode: TransformImageNode
var videoNode: UniversalVideoNode?
let titleNode: TextNode
let textNode: TextNode
public let offsetContainer: ASDisplayNode
public let backgroundNode: ASImageNode
public let imageNode: TransformImageNode
public var videoNode: UniversalVideoNode?
public let titleNode: TextNode
public let textNode: TextNode
private var linkHighlightingNode: LinkHighlightingNode?
private let fetchDisposable = MetaDisposable()
var currentTextAndEntities: (String, [MessageTextEntity])?
public var currentTextAndEntities: (String, [MessageTextEntity])?
private var theme: ChatPresentationThemeData?
@ -108,7 +108,7 @@ final class ChatBotInfoItemNode: ListViewItemNode {
private var item: ChatBotInfoItem?
init() {
public init() {
self.offsetContainer = ASDisplayNode()
self.backgroundNode = ASImageNode()
@ -163,7 +163,7 @@ final class ChatBotInfoItemNode: ListViewItemNode {
videoNode.play()
}
override func didLoad() {
override public func didLoad() {
super.didLoad()
let recognizer = TapLongTapOrDoubleTapGestureRecognizer(target: self, action: #selector(self.tapLongTapOrDoubleTapGesture(_:)))
@ -190,7 +190,7 @@ final class ChatBotInfoItemNode: ListViewItemNode {
self.view.addGestureRecognizer(recognizer)
}
override func updateAbsoluteRect(_ rect: CGRect, within containerSize: CGSize) {
override public func updateAbsoluteRect(_ rect: CGRect, within containerSize: CGSize) {
super.updateAbsoluteRect(rect, within: containerSize)
self.absolutePosition = (rect, containerSize)
@ -202,7 +202,7 @@ final class ChatBotInfoItemNode: ListViewItemNode {
}
}
func asyncLayout() -> (_ item: ChatBotInfoItem, _ width: ListViewItemLayoutParams) -> (ListViewItemNodeLayout, (ListViewItemUpdateAnimation) -> Void) {
public func asyncLayout() -> (_ item: ChatBotInfoItem, _ width: ListViewItemLayoutParams) -> (ListViewItemNodeLayout, (ListViewItemUpdateAnimation) -> Void) {
let makeImageLayout = self.imageNode.asyncLayout()
let makeTitleLayout = TextNode.asyncLayout(self.titleNode)
let makeTextLayout = TextNode.asyncLayout(self.textNode)
@ -351,7 +351,7 @@ final class ChatBotInfoItemNode: ListViewItemNode {
}
}
override func updateTrailingItemSpace(_ height: CGFloat, transition: ContainedViewLayoutTransition) {
override public func updateTrailingItemSpace(_ height: CGFloat, transition: ContainedViewLayoutTransition) {
if height.isLessThanOrEqualTo(0.0) {
transition.updateFrame(node: self.offsetContainer, frame: CGRect(origin: CGPoint(), size: self.offsetContainer.bounds.size))
} else {
@ -359,25 +359,25 @@ final class ChatBotInfoItemNode: ListViewItemNode {
}
}
override func animateAdded(_ currentTimestamp: Double, duration: Double) {
override public func animateAdded(_ currentTimestamp: Double, duration: Double) {
self.layer.animateAlpha(from: 0.0, to: 1.0, duration: duration * 0.5)
}
override func animateInsertion(_ currentTimestamp: Double, duration: Double, short: Bool) {
override public func animateInsertion(_ currentTimestamp: Double, duration: Double, short: Bool) {
self.layer.animateAlpha(from: 0.0, to: 1.0, duration: duration * 0.5)
}
override func animateRemoved(_ currentTimestamp: Double, duration: Double) {
override public func animateRemoved(_ currentTimestamp: Double, duration: Double) {
self.layer.animateAlpha(from: 1.0, to: 0.0, duration: duration * 0.5, removeOnCompletion: false)
}
override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
override public func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
let result = super.point(inside: point, with: event)
let extra = self.offsetContainer.frame.contains(point)
return result || extra
}
func updateTouchesAtPoint(_ point: CGPoint?) {
public func updateTouchesAtPoint(_ point: CGPoint?) {
if let item = self.item {
var rects: [CGRect]?
if let point = point {
@ -419,7 +419,7 @@ final class ChatBotInfoItemNode: ListViewItemNode {
}
}
func tapActionAtPoint(_ point: CGPoint, gesture: TapLongTapOrDoubleTapGesture, isEstimating: Bool) -> ChatMessageBubbleContentTapAction {
public func tapActionAtPoint(_ point: CGPoint, gesture: TapLongTapOrDoubleTapGesture, isEstimating: Bool) -> ChatMessageBubbleContentTapAction {
let textNodeFrame = self.textNode.frame
if let (index, attributes) = self.textNode.attributesAtPoint(CGPoint(x: point.x - self.offsetContainer.frame.minX - textNodeFrame.minX, y: point.y - self.offsetContainer.frame.minY - textNodeFrame.minY)) {
if let url = attributes[NSAttributedString.Key(rawValue: TelegramTextAttributes.URL)] as? String {
@ -444,7 +444,7 @@ final class ChatBotInfoItemNode: ListViewItemNode {
}
}
@objc func tapLongTapOrDoubleTapGesture(_ recognizer: TapLongTapOrDoubleTapGestureRecognizer) {
@objc private func tapLongTapOrDoubleTapGesture(_ recognizer: TapLongTapOrDoubleTapGestureRecognizer) {
switch recognizer.state {
case .ended:
if let (gesture, location) = recognizer.lastRecognizedGestureAndLocation {

View File

@ -0,0 +1,27 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
swift_library(
name = "ChatBotStartInputPanelNode",
module_name = "ChatBotStartInputPanelNode",
srcs = glob([
"Sources/**/*.swift",
]),
copts = [
"-warnings-as-errors",
],
deps = [
"//submodules/AsyncDisplayKit",
"//submodules/Display",
"//submodules/TelegramCore",
"//submodules/Postbox",
"//submodules/SSignalKit/SwiftSignalKit",
"//submodules/TelegramPresentationData",
"//submodules/ChatPresentationInterfaceState",
"//submodules/SolidRoundedButtonNode",
"//submodules/TooltipUI",
"//submodules/TelegramUI/Components/Chat/ChatInputPanelNode",
],
visibility = [
"//visibility:public",
],
)

View File

@ -9,15 +9,16 @@ import TelegramPresentationData
import ChatPresentationInterfaceState
import SolidRoundedButtonNode
import TooltipUI
import ChatInputPanelNode
final class ChatBotStartInputPanelNode: ChatInputPanelNode {
public final class ChatBotStartInputPanelNode: ChatInputPanelNode {
private let button: SolidRoundedButtonNode
private var statusDisposable: Disposable?
private var presentationInterfaceState: ChatPresentationInterfaceState?
override var interfaceInteraction: ChatPanelInterfaceInteraction? {
override public var interfaceInteraction: ChatPanelInterfaceInteraction? {
didSet {
if let _ = self.interfaceInteraction {
if self.statusDisposable == nil {
@ -51,7 +52,7 @@ final class ChatBotStartInputPanelNode: ChatInputPanelNode {
private var tooltipController: TooltipScreen?
private var tooltipDismissed = false
init(theme: PresentationTheme, strings: PresentationStrings) {
public init(theme: PresentationTheme, strings: PresentationStrings) {
self.theme = theme
self.strings = strings
@ -72,7 +73,7 @@ final class ChatBotStartInputPanelNode: ChatInputPanelNode {
self.tooltipController?.dismiss()
}
func updateThemeAndStrings(theme: PresentationTheme, strings: PresentationStrings) {
public func updateThemeAndStrings(theme: PresentationTheme, strings: PresentationStrings) {
if self.theme !== theme || self.strings !== strings {
self.theme = theme
self.strings = strings
@ -81,7 +82,7 @@ final class ChatBotStartInputPanelNode: ChatInputPanelNode {
}
}
@objc func buttonPressed() {
@objc private func buttonPressed() {
guard let _ = self.context, let presentationInterfaceState = self.presentationInterfaceState else {
return
}
@ -95,7 +96,7 @@ final class ChatBotStartInputPanelNode: ChatInputPanelNode {
}
}
override func updateAbsoluteRect(_ rect: CGRect, within containerSize: CGSize, transition: ContainedViewLayoutTransition) {
override public func updateAbsoluteRect(_ rect: CGRect, within containerSize: CGSize, transition: ContainedViewLayoutTransition) {
super.updateAbsoluteRect(rect, within: containerSize, transition: transition)
let absoluteFrame = self.button.view.convert(self.button.bounds, to: nil)
@ -107,7 +108,7 @@ final class ChatBotStartInputPanelNode: ChatInputPanelNode {
}
override func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, additionalSideInsets: UIEdgeInsets, maxHeight: CGFloat, isSecondary: Bool, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics, isMediaInputExpanded: Bool) -> CGFloat {
override public func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, additionalSideInsets: UIEdgeInsets, maxHeight: CGFloat, isSecondary: Bool, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics, isMediaInputExpanded: Bool) -> CGFloat {
if self.presentationInterfaceState != interfaceState {
self.presentationInterfaceState = interfaceState
}
@ -154,7 +155,7 @@ final class ChatBotStartInputPanelNode: ChatInputPanelNode {
return panelHeight
}
override func minimalHeight(interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics) -> CGFloat {
override public func minimalHeight(interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics) -> CGFloat {
return defaultHeight(metrics: metrics) + 27.0
}
}

View File

@ -0,0 +1,28 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
swift_library(
name = "ChatButtonKeyboardInputNode",
module_name = "ChatButtonKeyboardInputNode",
srcs = glob([
"Sources/**/*.swift",
]),
copts = [
"-warnings-as-errors",
],
deps = [
"//submodules/Display",
"//submodules/AsyncDisplayKit",
"//submodules/Postbox",
"//submodules/TelegramCore",
"//submodules/SSignalKit/SwiftSignalKit",
"//submodules/TelegramPresentationData",
"//submodules/AccountContext",
"//submodules/ChatPresentationInterfaceState",
"//submodules/WallpaperBackgroundNode",
"//submodules/TelegramUI/Components/ChatControllerInteraction",
"//submodules/TelegramUI/Components/ChatInputNode",
],
visibility = [
"//visibility:public",
],
)

View File

@ -197,7 +197,7 @@ private final class ChatButtonKeyboardInputButtonNode: HighlightTrackingButtonNo
}
}
final class ChatButtonKeyboardInputNode: ChatInputNode {
public final class ChatButtonKeyboardInputNode: ChatInputNode {
private let context: AccountContext
private let controllerInteraction: ChatControllerInteraction
@ -212,7 +212,7 @@ final class ChatButtonKeyboardInputNode: ChatInputNode {
private var theme: PresentationTheme?
init(context: AccountContext, controllerInteraction: ChatControllerInteraction) {
public init(context: AccountContext, controllerInteraction: ChatControllerInteraction) {
self.context = context
self.controllerInteraction = controllerInteraction
@ -236,7 +236,7 @@ final class ChatButtonKeyboardInputNode: ChatInputNode {
self.addSubnode(self.separatorNode)
}
override func didLoad() {
override public func didLoad() {
super.didLoad()
if #available(iOSApplicationExtension 11.0, iOS 11.0, *) {
@ -245,7 +245,7 @@ final class ChatButtonKeyboardInputNode: ChatInputNode {
}
private var absoluteRect: (CGRect, CGSize)?
override func updateAbsoluteRect(_ rect: CGRect, within containerSize: CGSize, transition: ContainedViewLayoutTransition) {
override public func updateAbsoluteRect(_ rect: CGRect, within containerSize: CGSize, transition: ContainedViewLayoutTransition) {
self.absoluteRect = (rect, containerSize)
if let backgroundNode = self.backgroundNode {
@ -263,7 +263,7 @@ final class ChatButtonKeyboardInputNode: ChatInputNode {
}
}
override func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, standardInputHeight: CGFloat, inputHeight: CGFloat, maximumHeight: CGFloat, inputPanelHeight: CGFloat, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, layoutMetrics: LayoutMetrics, deviceMetrics: DeviceMetrics, isVisible: Bool, isExpanded: Bool) -> (CGFloat, CGFloat) {
override public func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, standardInputHeight: CGFloat, inputHeight: CGFloat, maximumHeight: CGFloat, inputPanelHeight: CGFloat, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, layoutMetrics: LayoutMetrics, deviceMetrics: DeviceMetrics, isVisible: Bool, isExpanded: Bool) -> (CGFloat, CGFloat) {
transition.updateFrame(node: self.separatorNode, frame: CGRect(origin: CGPoint(), size: CGSize(width: width, height: UIScreenPixel)))
if self.backgroundNode == nil {
@ -370,7 +370,7 @@ final class ChatButtonKeyboardInputNode: ChatInputNode {
}
}
@objc func buttonPressed(_ button: ASButtonNode) {
@objc private func buttonPressed(_ button: ASButtonNode) {
if let button = button as? ChatButtonKeyboardInputButtonNode, let markupButton = button.button {
var dismissIfOnce = false
switch markupButton.action {

View File

@ -0,0 +1,29 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
swift_library(
name = "ChatChannelSubscriberInputPanelNode",
module_name = "ChatChannelSubscriberInputPanelNode",
srcs = glob([
"Sources/**/*.swift",
]),
copts = [
"-warnings-as-errors",
],
deps = [
"//submodules/AsyncDisplayKit",
"//submodules/Display",
"//submodules/TelegramCore",
"//submodules/Postbox",
"//submodules/SSignalKit/SwiftSignalKit",
"//submodules/TelegramPresentationData",
"//submodules/AlertUI",
"//submodules/PresentationDataUtils",
"//submodules/PeerInfoUI",
"//submodules/UndoUI",
"//submodules/ChatPresentationInterfaceState",
"//submodules/TelegramUI/Components/Chat/ChatInputPanelNode",
],
visibility = [
"//visibility:public",
],
)

View File

@ -11,6 +11,7 @@ import PresentationDataUtils
import PeerInfoUI
import UndoUI
import ChatPresentationInterfaceState
import ChatInputPanelNode
private enum SubscriberAction: Equatable {
case join
@ -113,7 +114,7 @@ private func actionForPeer(peer: Peer, interfaceState: ChatPresentationInterface
private let badgeFont = Font.regular(14.0)
final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode {
public final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode {
private let button: HighlightableButtonNode
private let discussButton: HighlightableButtonNode
private let discussButtonText: ImmediateTextNode
@ -133,7 +134,7 @@ final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode {
private var layoutData: (CGFloat, CGFloat, CGFloat, CGFloat, UIEdgeInsets, CGFloat, Bool, LayoutMetrics)?
override init() {
public override init() {
self.button = HighlightableButtonNode()
self.discussButton = HighlightableButtonNode()
self.activityIndicator = UIActivityIndicatorView(style: .gray)
@ -176,18 +177,18 @@ final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode {
self.badgeDisposable.dispose()
}
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
override public func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
if !self.bounds.contains(point) {
return nil
}
return super.hitTest(point, with: event)
}
@objc func helpPressed() {
@objc private func helpPressed() {
self.interfaceInteraction?.presentGigagroupHelp()
}
@objc func buttonPressed() {
@objc private func buttonPressed() {
guard let context = self.context, let action = self.action, let presentationInterfaceState = self.presentationInterfaceState, let peer = presentationInterfaceState.renderedPeer?.peer else {
return
}
@ -269,7 +270,7 @@ final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode {
}
}
override func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, additionalSideInsets: UIEdgeInsets, maxHeight: CGFloat, isSecondary: Bool, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics, isMediaInputExpanded: Bool) -> CGFloat {
override public func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, additionalSideInsets: UIEdgeInsets, maxHeight: CGFloat, isSecondary: Bool, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics, isMediaInputExpanded: Bool) -> CGFloat {
return self.updateLayout(width: width, leftInset: leftInset, rightInset: rightInset, bottomInset: bottomInset, additionalSideInsets: additionalSideInsets, maxHeight: maxHeight, isSecondary: isSecondary, transition: transition, interfaceState: interfaceState, metrics: metrics, force: false)
}
@ -361,7 +362,7 @@ final class ChatChannelSubscriberInputPanelNode: ChatInputPanelNode {
return panelHeight
}
override func minimalHeight(interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics) -> CGFloat {
override public func minimalHeight(interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics) -> CGFloat {
return defaultHeight(metrics: metrics)
}
}

View File

@ -0,0 +1,27 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
swift_library(
name = "ChatContextResultPeekContent",
module_name = "ChatContextResultPeekContent",
srcs = glob([
"Sources/**/*.swift",
]),
copts = [
"-warnings-as-errors",
],
deps = [
"//submodules/Display",
"//submodules/AsyncDisplayKit",
"//submodules/Postbox",
"//submodules/TelegramCore",
"//submodules/SSignalKit/SwiftSignalKit",
"//submodules/PhotoResources",
"//submodules/AppBundle",
"//submodules/ContextUI",
"//submodules/SoftwareVideo",
"//submodules/TelegramUI/Components/MultiplexedVideoNode",
],
visibility = [
"//visibility:public",
],
)

View File

@ -12,34 +12,34 @@ import ContextUI
import SoftwareVideo
import MultiplexedVideoNode
final class ChatContextResultPeekContent: PeekControllerContent {
let account: Account
let contextResult: ChatContextResult
let menu: [ContextMenuItem]
public final class ChatContextResultPeekContent: PeekControllerContent {
public let account: Account
public let contextResult: ChatContextResult
public let menu: [ContextMenuItem]
init(account: Account, contextResult: ChatContextResult, menu: [ContextMenuItem]) {
public init(account: Account, contextResult: ChatContextResult, menu: [ContextMenuItem]) {
self.account = account
self.contextResult = contextResult
self.menu = menu
}
func presentation() -> PeekControllerContentPresentation {
public func presentation() -> PeekControllerContentPresentation {
return .contained
}
func menuActivation() -> PeerControllerMenuActivation {
public func menuActivation() -> PeerControllerMenuActivation {
return .drag
}
func menuItems() -> [ContextMenuItem] {
public func menuItems() -> [ContextMenuItem] {
return self.menu
}
func node() -> PeekControllerContentNode & ASDisplayNode {
public func node() -> PeekControllerContentNode & ASDisplayNode {
return ChatContextResultPeekNode(account: self.account, contextResult: self.contextResult)
}
func topAccessoryNode() -> ASDisplayNode? {
public func topAccessoryNode() -> ASDisplayNode? {
let arrowNode = ASImageNode()
if let image = UIImage(bundleImageName: "Peek/Arrow") {
arrowNode.image = image
@ -48,11 +48,11 @@ final class ChatContextResultPeekContent: PeekControllerContent {
return arrowNode
}
func fullScreenAccessoryNode(blurView: UIVisualEffectView) -> (PeekControllerAccessoryNode & ASDisplayNode)? {
public func fullScreenAccessoryNode(blurView: UIVisualEffectView) -> (PeekControllerAccessoryNode & ASDisplayNode)? {
return nil
}
func isEqual(to: PeekControllerContent) -> Bool {
public func isEqual(to: PeekControllerContent) -> Bool {
if let to = to as? ChatContextResultPeekContent {
return self.contextResult == to.contextResult
} else {

View File

@ -0,0 +1,25 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
swift_library(
name = "ChatInputContextPanelNode",
module_name = "ChatInputContextPanelNode",
srcs = glob([
"Sources/**/*.swift",
]),
copts = [
"-warnings-as-errors",
],
deps = [
"//submodules/AsyncDisplayKit",
"//submodules/Display",
"//submodules/TelegramCore",
"//submodules/TelegramPresentationData",
"//submodules/TelegramUIPreferences",
"//submodules/AccountContext",
"//submodules/ChatPresentationInterfaceState",
"//submodules/TelegramUI/Components/ChatControllerInteraction",
],
visibility = [
"//visibility:public",
],
)

View File

@ -0,0 +1,42 @@
import Foundation
import UIKit
import AsyncDisplayKit
import Display
import TelegramCore
import TelegramPresentationData
import TelegramUIPreferences
import AccountContext
import ChatPresentationInterfaceState
import ChatControllerInteraction
public enum ChatInputContextPanelPlacement {
case overPanels
case overTextInput
}
open class ChatInputContextPanelNode: ASDisplayNode {
public let context: AccountContext
open var interfaceInteraction: ChatPanelInterfaceInteraction?
open var placement: ChatInputContextPanelPlacement = .overPanels
open var theme: PresentationTheme
open var fontSize: PresentationFontSize
public init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, fontSize: PresentationFontSize, chatPresentationContext: ChatPresentationContext) {
self.context = context
self.theme = theme
self.fontSize = fontSize
super.init()
}
open func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState) {
}
open func animateOut(completion: @escaping () -> Void) {
completion()
}
open var topItemFrame: CGRect? {
return nil
}
}

View File

@ -0,0 +1,23 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
swift_library(
name = "ChatInputPanelNode",
module_name = "ChatInputPanelNode",
srcs = glob([
"Sources/**/*.swift",
]),
copts = [
"-warnings-as-errors",
],
deps = [
"//submodules/AsyncDisplayKit",
"//submodules/Display",
"//submodules/Postbox",
"//submodules/TelegramCore",
"//submodules/AccountContext",
"//submodules/ChatPresentationInterfaceState",
],
visibility = [
"//visibility:public",
],
)

View File

@ -0,0 +1,43 @@
import Foundation
import UIKit
import AsyncDisplayKit
import Display
import Postbox
import TelegramCore
import AccountContext
import ChatPresentationInterfaceState
public protocol ChatInputPanelViewForOverlayContent: UIView {
func maybeDismissContent(point: CGPoint)
}
open class ChatInputPanelNode: ASDisplayNode {
open var context: AccountContext?
open var interfaceInteraction: ChatPanelInterfaceInteraction?
open var prevInputPanelNode: ChatInputPanelNode?
open var viewForOverlayContent: ChatInputPanelViewForOverlayContent?
open func updateAbsoluteRect(_ rect: CGRect, within containerSize: CGSize, transition: ContainedViewLayoutTransition) {
}
open func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, additionalSideInsets: UIEdgeInsets, maxHeight: CGFloat, isSecondary: Bool, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics, isMediaInputExpanded: Bool) -> CGFloat {
return 0.0
}
open func minimalHeight(interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics) -> CGFloat {
return 0.0
}
open func defaultHeight(metrics: LayoutMetrics) -> CGFloat {
if case .regular = metrics.widthClass, case .regular = metrics.heightClass {
return 49.0
} else {
return 45.0
}
}
open func canHandleTransition(from prevInputPanelNode: ChatInputPanelNode?) -> Bool {
return false
}
}

View File

@ -0,0 +1,27 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
swift_library(
name = "ChatOverscrollControl",
module_name = "ChatOverscrollControl",
srcs = glob([
"Sources/**/*.swift",
]),
copts = [
"-warnings-as-errors",
],
deps = [
"//submodules/AsyncDisplayKit",
"//submodules/ComponentFlow",
"//submodules/Display",
"//submodules/TelegramCore",
"//submodules/Postbox",
"//submodules/AccountContext",
"//submodules/AvatarNode",
"//submodules/TextFormat",
"//submodules/Markdown",
"//submodules/WallpaperBackgroundNode",
],
visibility = [
"//visibility:public",
],
)

View File

@ -984,7 +984,7 @@ final class OverscrollContentsComponent: Component {
}
}
final class ChatOverscrollControl: CombinedComponent {
public final class ChatOverscrollControl: CombinedComponent {
let backgroundColor: UIColor
let foregroundColor: UIColor
let peer: EnginePeer?
@ -997,7 +997,7 @@ final class ChatOverscrollControl: CombinedComponent {
let absoluteSize: CGSize
let wallpaperNode: WallpaperBackgroundNode?
init(
public init(
backgroundColor: UIColor,
foregroundColor: UIColor,
peer: EnginePeer?,
@ -1023,7 +1023,7 @@ final class ChatOverscrollControl: CombinedComponent {
self.wallpaperNode = wallpaperNode
}
static func ==(lhs: ChatOverscrollControl, rhs: ChatOverscrollControl) -> Bool {
public static func ==(lhs: ChatOverscrollControl, rhs: ChatOverscrollControl) -> Bool {
if !lhs.backgroundColor.isEqual(rhs.backgroundColor) {
return false
}
@ -1060,7 +1060,7 @@ final class ChatOverscrollControl: CombinedComponent {
return true
}
static var body: Body {
public static var body: Body {
let contents = Child(OverscrollContentsComponent.self)
return { context in
@ -1093,12 +1093,12 @@ final class ChatOverscrollControl: CombinedComponent {
}
}
final class ChatInputPanelOverscrollNode: ASDisplayNode {
let text: (String, [(Int, NSRange)])
let priority: Int
public final class ChatInputPanelOverscrollNode: ASDisplayNode {
public let text: (String, [(Int, NSRange)])
public let priority: Int
private let titleNode: ImmediateTextNode
init(text: (String, [(Int, NSRange)]), color: UIColor, priority: Int) {
public init(text: (String, [(Int, NSRange)]), color: UIColor, priority: Int) {
self.text = text
self.priority = priority
self.titleNode = ImmediateTextNode()
@ -1113,7 +1113,7 @@ final class ChatInputPanelOverscrollNode: ASDisplayNode {
self.addSubnode(self.titleNode)
}
func update(size: CGSize) {
public func update(size: CGSize) {
let titleSize = self.titleNode.updateLayout(size)
self.titleNode.frame = titleSize.centered(in: CGRect(origin: CGPoint(), size: size))
}

View File

@ -27,6 +27,9 @@ import ChatControllerInteraction
import ChatAvatarNavigationNode
import AccessoryPanelNode
import ForwardAccessoryPanelNode
import ChatOverscrollControl
import ChatInputPanelNode
import ChatInputContextPanelNode
final class VideoNavigationControllerDropContentItem: NavigationControllerDropContentItem {
let itemNode: OverlayMediaItemNode

View File

@ -1,31 +0,0 @@
import Foundation
import SwiftSignalKit
import Postbox
import TelegramCore
import AccountContext
private final class MessageContext {
let disposable: Disposable
init(disposable: Disposable) {
self.disposable = disposable
}
deinit {
self.disposable.dispose()
}
}
final class ChatEditMessageMediaContext {
private let context: AccountContext
private let contexts: [MessageId: MessageContext] = [:]
init(context: AccountContext) {
self.context = context
}
func update(id: MessageId, text: String, entities: TextEntitiesMessageAttribute?, disableUrlPreview: Bool, media: RequestEditMessageMedia) {
}
}

View File

@ -1,75 +0,0 @@
import Foundation
import UIKit
import AsyncDisplayKit
import Display
import TelegramCore
import Postbox
import SwiftSignalKit
import TelegramPresentationData
import ChatPresentationInterfaceState
final class ChatFeedNavigationInputPanelNode: ChatInputPanelNode {
private let button: HighlightableButtonNode
private var presentationInterfaceState: ChatPresentationInterfaceState?
private var theme: PresentationTheme
private var strings: PresentationStrings
init(theme: PresentationTheme, strings: PresentationStrings) {
self.theme = theme
self.strings = strings
self.button = HighlightableButtonNode()
super.init()
self.addSubnode(self.button)
self.button.setAttributedTitle(NSAttributedString(string: "Show Next", font: Font.regular(17.0), textColor: theme.chat.inputPanel.panelControlAccentColor), for: [])
self.button.addTarget(self, action: #selector(self.buttonPressed), forControlEvents: [.touchUpInside])
}
deinit {
}
func updateThemeAndStrings(theme: PresentationTheme, strings: PresentationStrings) {
if self.theme !== theme || self.strings !== strings {
self.theme = theme
self.strings = strings
self.button.setAttributedTitle(NSAttributedString(string: strings.Conversation_Unblock, font: Font.regular(17.0), textColor: theme.chat.inputPanel.panelControlAccentColor), for: [])
}
}
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
if self.bounds.contains(point) {
return self.button.view
} else {
return nil
}
}
@objc func buttonPressed() {
self.interfaceInteraction?.navigateFeed()
}
override func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, additionalSideInsets: UIEdgeInsets, maxHeight: CGFloat, isSecondary: Bool, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics, isMediaInputExpanded: Bool) -> CGFloat {
if self.presentationInterfaceState != interfaceState {
self.presentationInterfaceState = interfaceState
}
let buttonSize = self.button.measure(CGSize(width: width - leftInset - rightInset - 80.0, height: 100.0))
let panelHeight = defaultHeight(metrics: metrics)
self.button.frame = CGRect(origin: CGPoint(x: leftInset + floor((width - leftInset - rightInset - buttonSize.width) / 2.0), y: floor((panelHeight - buttonSize.height) / 2.0)), size: buttonSize)
return panelHeight
}
override func minimalHeight(interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics) -> CGFloat {
return defaultHeight(metrics: metrics)
}
}

View File

@ -24,6 +24,8 @@ import TelegramNotices
import ChatControllerInteraction
import TranslateUI
import ChatHistoryEntry
import ChatOverscrollControl
import ChatBotInfoItem
extension ChatReplyThreadMessage {
var effectiveTopId: MessageId {

View File

@ -1,119 +0,0 @@
import Foundation
import UIKit
import Postbox
import AsyncDisplayKit
import Display
import SwiftSignalKit
import TelegramPresentationData
import ChatMessageItemCommon
private let titleFont = UIFont.systemFont(ofSize: 13.0)
class ChatHoleItem: ListViewItem {
let index: MessageIndex
let presentationData: ChatPresentationData
//let header: ChatMessageDateHeader
init(index: MessageIndex, presentationData: ChatPresentationData) {
self.index = index
self.presentationData = presentationData
//self.header = ChatMessageDateHeader(timestamp: index.timestamp, theme: theme, strings: strings)
}
func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal<Void, NoError>?, (ListViewItemApply) -> Void)) -> Void) {
async {
let node = ChatHoleItemNode()
node.layoutForParams(params, item: self, previousItem: previousItem, nextItem: nextItem)
Queue.mainQueue().async {
completion(node, {
return (nil, { _ in })
})
}
}
}
func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) {
Queue.mainQueue().async {
completion(ListViewItemNodeLayout(contentSize: node().contentSize, insets: node().insets), { _ in
})
}
}
}
class ChatHoleItemNode: ListViewItemNode {
var item: ChatHoleItem?
let backgroundNode: ASImageNode
let labelNode: TextNode
private let layoutConstants = ChatMessageItemLayoutConstants.default
init() {
self.backgroundNode = ASImageNode()
self.backgroundNode.isLayerBacked = true
self.backgroundNode.displayWithoutProcessing = true
self.backgroundNode.displaysAsynchronously = false
self.labelNode = TextNode()
self.labelNode.isUserInteractionEnabled = false
super.init(layerBacked: false)
self.addSubnode(self.backgroundNode)
self.addSubnode(self.labelNode)
self.transform = CATransform3DMakeRotation(CGFloat.pi, 0.0, 0.0, 1.0)
}
override func layoutForParams(_ params: ListViewItemLayoutParams, item: ListViewItem, previousItem: ListViewItem?, nextItem: ListViewItem?) {
if let item = item as? ChatHoleItem {
let dateAtBottom = false//!chatItemsHaveCommonDateHeader(item, nextItem)
let (layout, apply) = self.asyncLayout()(item, params, dateAtBottom)
apply()
self.contentSize = layout.contentSize
self.insets = layout.insets
}
}
func asyncLayout() -> (_ item: ChatHoleItem, _ params: ListViewItemLayoutParams, _ dateAtBottom: Bool) -> (ListViewItemNodeLayout, () -> Void) {
let labelLayout = TextNode.asyncLayout(self.labelNode)
let layoutConstants = self.layoutConstants
let currentItem = self.item
return { item, params, dateAtBottom in
var updatedBackground: UIImage?
if item.presentationData.theme !== currentItem?.presentationData.theme {
let graphics = PresentationResourcesChat.additionalGraphics(item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper, bubbleCorners: item.presentationData.chatBubbleCorners)
updatedBackground = graphics.chatServiceBubbleFillImage
}
let serviceColor = serviceMessageColorComponents(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper)
let (size, apply) = labelLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: item.presentationData.strings.Channel_NotificationLoading, font: titleFont, textColor: serviceColor.primaryText), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: params.width, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
let backgroundSize = CGSize(width: size.size.width + 8.0 + 8.0, height: 20.0)
return (ListViewItemNodeLayout(contentSize: CGSize(width: params.width, height: 20.0), insets: UIEdgeInsets(top: 4.0 + (dateAtBottom ? layoutConstants.timestampHeaderHeight : 0.0), left: 0.0, bottom: 4.0, right: 0.0)), { [weak self] in
if let strongSelf = self {
strongSelf.item = item
if let updatedBackground = updatedBackground {
strongSelf.backgroundNode.image = updatedBackground
}
let _ = apply()
strongSelf.backgroundNode.frame = CGRect(origin: CGPoint(x: floorToScreenPixels((params.width - backgroundSize.width) / 2.0), y: 0.0), size: backgroundSize)
strongSelf.labelNode.frame = CGRect(origin: CGPoint(x: strongSelf.backgroundNode.frame.origin.x + 8.0, y: floorToScreenPixels((backgroundSize.height - size.size.height) / 2.0)), size: size.size)
}
})
}
}
override public func animateAdded(_ currentTimestamp: Double, duration: Double) {
self.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
}
override public func animateRemoved(_ currentTimestamp: Double, duration: Double) {
self.layer.animateAlpha(from: 1.0, to: 0.0, duration: duration * 0.5, removeOnCompletion: false)
}
}

View File

@ -1,42 +0,0 @@
import Foundation
import UIKit
import AsyncDisplayKit
import Display
import TelegramCore
import TelegramPresentationData
import TelegramUIPreferences
import AccountContext
import ChatPresentationInterfaceState
import ChatControllerInteraction
enum ChatInputContextPanelPlacement {
case overPanels
case overTextInput
}
class ChatInputContextPanelNode: ASDisplayNode {
let context: AccountContext
var interfaceInteraction: ChatPanelInterfaceInteraction?
var placement: ChatInputContextPanelPlacement = .overPanels
var theme: PresentationTheme
var fontSize: PresentationFontSize
init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, fontSize: PresentationFontSize, chatPresentationContext: ChatPresentationContext) {
self.context = context
self.theme = theme
self.fontSize = fontSize
super.init()
}
func updateLayout(size: CGSize, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState) {
}
func animateOut(completion: @escaping () -> Void) {
completion()
}
var topItemFrame: CGRect? {
return nil
}
}

View File

@ -1,43 +0,0 @@
import Foundation
import UIKit
import AsyncDisplayKit
import Display
import Postbox
import TelegramCore
import AccountContext
import ChatPresentationInterfaceState
protocol ChatInputPanelViewForOverlayContent: UIView {
func maybeDismissContent(point: CGPoint)
}
class ChatInputPanelNode: ASDisplayNode {
var context: AccountContext?
var interfaceInteraction: ChatPanelInterfaceInteraction?
var prevInputPanelNode: ChatInputPanelNode?
var viewForOverlayContent: ChatInputPanelViewForOverlayContent?
func updateAbsoluteRect(_ rect: CGRect, within containerSize: CGSize, transition: ContainedViewLayoutTransition) {
}
func updateLayout(width: CGFloat, leftInset: CGFloat, rightInset: CGFloat, bottomInset: CGFloat, additionalSideInsets: UIEdgeInsets, maxHeight: CGFloat, isSecondary: Bool, transition: ContainedViewLayoutTransition, interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics, isMediaInputExpanded: Bool) -> CGFloat {
return 0.0
}
func minimalHeight(interfaceState: ChatPresentationInterfaceState, metrics: LayoutMetrics) -> CGFloat {
return 0.0
}
func defaultHeight(metrics: LayoutMetrics) -> CGFloat {
if case .regular = metrics.widthClass, case .regular = metrics.heightClass {
return 49.0
} else {
return 45.0
}
}
func canHandleTransition(from prevInputPanelNode: ChatInputPanelNode?) -> Bool {
return false
}
}

View File

@ -4,6 +4,7 @@ import TelegramCore
import AccountContext
import ChatPresentationInterfaceState
import ChatControllerInteraction
import ChatInputContextPanelNode
private func inputQueryResultPriority(_ result: ChatPresentationInputQueryResult) -> (Int, Bool) {
switch result {

View File

@ -8,6 +8,8 @@ import ChatPresentationInterfaceState
import ChatControllerInteraction
import ChatInputNode
import ChatEntityKeyboardInputNode
import ChatInputPanelNode
import ChatButtonKeyboardInputNode
func inputNodeForChatPresentationIntefaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContext, currentNode: ChatInputNode?, interfaceInteraction: ChatPanelInterfaceInteraction?, controllerInteraction: ChatControllerInteraction, inputPanelNode: ChatInputPanelNode?, makeMediaInputNode: () -> ChatInputNode?) -> ChatInputNode? {
if let inputPanelNode = inputPanelNode, !(inputPanelNode is ChatTextInputPanelNode) {

View File

@ -4,6 +4,9 @@ import AsyncDisplayKit
import TelegramCore
import AccountContext
import ChatPresentationInterfaceState
import ChatInputPanelNode
import ChatBotStartInputPanelNode
import ChatChannelSubscriberInputPanelNode
func inputPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, context: AccountContext, currentPanel: ChatInputPanelNode?, currentSecondaryPanel: ChatInputPanelNode?, textInputPanelNode: ChatTextInputPanelNode?, interfaceInteraction: ChatPanelInterfaceInteraction?) -> (primary: ChatInputPanelNode?, secondary: ChatInputPanelNode?) {
if let renderedPeer = chatPresentationInterfaceState.renderedPeer, renderedPeer.peer?.restrictionText(platform: "ios", contentSettings: context.currentContentSettings.with { $0 }) != nil {

View File

@ -205,8 +205,6 @@ func chatItemsHaveCommonDateHeader(_ lhs: ListViewItem, _ rhs: ListViewItem?) -
let rhsHeader: ChatMessageDateHeader?
if let lhs = lhs as? ChatMessageItem {
lhsHeader = lhs.dateHeader
} else if let _ = lhs as? ChatHoleItem {
lhsHeader = nil
} else if let lhs = lhs as? ChatUnreadItem {
lhsHeader = lhs.header
} else if let lhs = lhs as? ChatReplyCountItem {
@ -217,9 +215,6 @@ func chatItemsHaveCommonDateHeader(_ lhs: ListViewItem, _ rhs: ListViewItem?) -
if let rhs = rhs {
if let rhs = rhs as? ChatMessageItem {
rhsHeader = rhs.dateHeader
} else if let _ = rhs as? ChatHoleItem {
//rhsHeader = rhs.header
rhsHeader = nil
} else if let rhs = rhs as? ChatUnreadItem {
rhsHeader = rhs.header
} else if let rhs = rhs as? ChatReplyCountItem {
@ -564,8 +559,6 @@ public final class ChatMessageItem: ListViewItem, CustomStringConvertible {
if bottom.header.id != self.dateHeader.id {
dateAtBottom = true
}
} else if let _ = bottom as? ChatHoleItem {
dateAtBottom = true
} else {
dateAtBottom = true
}

View File

@ -9,6 +9,7 @@ import TelegramPresentationData
import AccountContext
import AppBundle
import ChatPresentationInterfaceState
import ChatInputPanelNode
final class ChatMessageReportInputPanelNode: ChatInputPanelNode {
private let reportButton: HighlightableButtonNode

View File

@ -9,6 +9,7 @@ import TelegramPresentationData
import AccountContext
import AppBundle
import ChatPresentationInterfaceState
import ChatInputPanelNode
final class ChatMessageSelectionInputPanelNode: ChatInputPanelNode {
private let deleteButton: HighlightableButtonNode

View File

@ -13,9 +13,10 @@ import AnimationUI
import ManagedAnimationNode
import ChatPresentationInterfaceState
import ChatSendButtonRadialStatusNode
import AudioWaveformNode
import ChatInputPanelNode
extension AudioWaveformNode: CustomMediaPlayerScrubbingForegroundNode {
}
final class ChatRecordingPreviewInputPanelNode: ChatInputPanelNode {

View File

@ -8,6 +8,7 @@ import SwiftSignalKit
import TelegramStringFormatting
import ChatPresentationInterfaceState
import TelegramPresentationData
import ChatInputPanelNode
final class ChatRestrictedInputPanelNode: ChatInputPanelNode {
private let textNode: ImmediateTextNode

View File

@ -9,6 +9,7 @@ import TelegramNotices
import TelegramPresentationData
import ActivityIndicator
import ChatPresentationInterfaceState
import ChatInputPanelNode
private let labelFont = Font.regular(15.0)

View File

@ -39,6 +39,7 @@ import TooltipUI
import ChatTextInputMediaRecordingButton
import ChatContextQuery
import ChatInputTextNode
import ChatInputPanelNode
private let accessoryButtonFont = Font.medium(14.0)
private let counterFont = Font.with(size: 14.0, design: .regular, traits: [.monospacedNumbers])

View File

@ -7,6 +7,7 @@ import Postbox
import SwiftSignalKit
import TelegramPresentationData
import ChatPresentationInterfaceState
import ChatInputPanelNode
final class ChatUnblockInputPanelNode: ChatInputPanelNode {
private let button: HighlightableButtonNode

View File

@ -12,6 +12,7 @@ import ChatPresentationInterfaceState
import ChatControllerInteraction
import ItemListUI
import ChatContextQuery
import ChatInputContextPanelNode
private struct CommandChatInputContextPanelEntryStableId: Hashable {
let command: PeerCommand

View File

@ -12,6 +12,7 @@ import AccountContext
import ChatPresentationInterfaceState
import ChatControllerInteraction
import ChatContextQuery
import ChatInputContextPanelNode
private struct CommandMenuChatInputContextPanelEntryStableId: Hashable {
let command: PeerCommand

View File

@ -6,6 +6,7 @@ import TelegramCore
import Postbox
import SwiftSignalKit
import ChatPresentationInterfaceState
import ChatInputPanelNode
final class DeleteChatInputPanelNode: ChatInputPanelNode {
private let button: HighlightableButtonNode

View File

@ -9,6 +9,7 @@ import TelegramUIPreferences
import AccountContext
import ChatPresentationInterfaceState
import ChatControllerInteraction
import ChatInputContextPanelNode
final class DisabledContextResultsChatInputContextPanelNode: ChatInputContextPanelNode {
private let containerNode: ASDisplayNode

View File

@ -21,6 +21,7 @@ import StickerPeekUI
import UndoUI
import Pasteboard
import ChatContextQuery
import ChatInputContextPanelNode
private enum EmojisChatInputContextPanelEntryStableId: Hashable, Equatable {
case symbol(String)

View File

@ -13,6 +13,7 @@ import ItemListUI
import ChatPresentationInterfaceState
import ChatControllerInteraction
import ChatContextQuery
import ChatInputContextPanelNode
private struct HashtagChatInputContextPanelEntryStableId: Hashable {
let text: String

View File

@ -16,6 +16,8 @@ import ChatPresentationInterfaceState
import UndoUI
import PremiumUI
import ChatControllerInteraction
import ChatContextResultPeekContent
import ChatInputContextPanelNode
private struct ChatContextResultStableId: Hashable {
let result: ChatContextResult

View File

@ -16,6 +16,7 @@ import ChatPresentationInterfaceState
import PremiumUI
import UndoUI
import ChatControllerInteraction
import ChatInputContextPanelNode
final class HorizontalStickersChatContextPanelInteraction {
var previewedStickerItem: TelegramMediaFile?

View File

@ -15,6 +15,7 @@ import ChatPresentationInterfaceState
import PremiumUI
import UndoUI
import ChatControllerInteraction
import ChatInputContextPanelNode
private final class InlineReactionSearchStickersNode: ASDisplayNode, UIScrollViewDelegate {
private final class DisplayItem {

View File

@ -13,6 +13,7 @@ import ItemListUI
import ChatPresentationInterfaceState
import ChatControllerInteraction
import ChatContextQuery
import ChatInputContextPanelNode
private struct MentionChatInputContextPanelEntry: Comparable, Identifiable {
let index: Int

View File

@ -7,6 +7,7 @@ import Postbox
import SwiftSignalKit
import LocalizedPeerData
import ChatPresentationInterfaceState
import ChatInputPanelNode
final class SecretChatHandshakeStatusInputPanelNode: ChatInputPanelNode {
private let button: HighlightableButtonNode

View File

@ -10,6 +10,7 @@ import AccountContext
import SwiftSignalKit
import ChatPresentationInterfaceState
import ChatControllerInteraction
import ChatInputContextPanelNode
private enum VerticalChatContextResultsEntryStableId: Hashable {
case action

View File

@ -46,7 +46,7 @@ final class NetworkBroadcastPartSource: BroadcastPartSource {
private var dataSource: AudioBroadcastDataSource?
#if DEBUG
private let debugDumpDirectory = EngineTempBox.shared.tempDirectory()
private let debugDumpDirectory: EngineTempBox.Directory?
#endif
init(queue: Queue, engine: TelegramEngine, callId: Int64, accessHash: Int64, isExternalStream: Bool) {
@ -55,6 +55,10 @@ final class NetworkBroadcastPartSource: BroadcastPartSource {
self.callId = callId
self.accessHash = accessHash
self.isExternalStream = isExternalStream
#if DEBUG && true
self.debugDumpDirectory = EngineTempBox.shared.tempDirectory()
#endif
}
func requestTime(completion: @escaping (Int64) -> Void) -> Disposable {
@ -143,9 +147,10 @@ final class NetworkBroadcastPartSource: BroadcastPartSource {
}
|> deliverOn(self.queue)
/*#if DEBUG
#if DEBUG
let debugDumpDirectory = self.debugDumpDirectory
#endif*/
#endif
return signal.start(next: { result in
guard let result = result else {
completion(OngoingGroupCallBroadcastPart(timestampMilliseconds: timestampIdMilliseconds, responseTimestamp: Double(timestampIdMilliseconds), status: .notReady, oggData: Data()))
@ -154,11 +159,13 @@ final class NetworkBroadcastPartSource: BroadcastPartSource {
let part: OngoingGroupCallBroadcastPart
switch result.status {
case let .data(dataValue):
/*#if DEBUG
#if DEBUG
if let debugDumpDirectory {
let tempFilePath = debugDumpDirectory.path + "/\(timestampMilliseconds).mp4"
let _ = try? dataValue.subdata(in: 32 ..< dataValue.count).write(to: URL(fileURLWithPath: tempFilePath))
print("Dump stream part: \(tempFilePath)")
#endif*/
}
#endif
part = OngoingGroupCallBroadcastPart(timestampMilliseconds: timestampIdMilliseconds, responseTimestamp: result.responseTimestamp, status: .success, oggData: dataValue)
case .notReady:
part = OngoingGroupCallBroadcastPart(timestampMilliseconds: timestampIdMilliseconds, responseTimestamp: result.responseTimestamp, status: .notReady, oggData: Data())