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

This commit is contained in:
Ilya Laktyushin 2020-10-26 12:47:35 +04:00
commit a4214ad972
23 changed files with 80 additions and 49 deletions

View File

@ -628,9 +628,9 @@ final class ChatListFilterTabContainerNode: ASDisplayNode {
self.selectedLineNode.image = generateImage(CGSize(width: 5.0, height: 3.0), rotatedContext: { size, context in
context.clear(CGRect(origin: CGPoint(), size: size))
context.setFillColor(presentationData.theme.list.itemAccentColor.cgColor)
context.fillEllipse(in: CGRect(origin: CGPoint(), size: CGSize(width: 3.0, height: 3.0)))
context.fillEllipse(in: CGRect(origin: CGPoint(x: size.width - 3.0, y: 0.0), size: CGSize(width: 3.0, height: 3.0)))
context.fill(CGRect(x: 1.5, y: 0.0, width: size.width - 3.0, height: 3.0))
context.fillEllipse(in: CGRect(origin: CGPoint(), size: CGSize(width: 4.0, height: 4.0)))
context.fillEllipse(in: CGRect(origin: CGPoint(x: size.width - 4.0, y: 0.0), size: CGSize(width: 4.0, height: 4.0)))
context.fill(CGRect(x: 2.0, y: 0.0, width: size.width - 4.0, height: 4.0))
context.fill(CGRect(x: 0.0, y: 2.0, width: size.width, height: 2.0))
})?.resizableImage(withCapInsets: UIEdgeInsets(top: 3.0, left: 3.0, bottom: 0.0, right: 3.0), resizingMode: .stretch)
}

View File

@ -51,7 +51,7 @@ final class ChatListBadgeNode: ASDisplayNode {
self.textNode = TextNode()
self.textNode.isUserInteractionEnabled = false
self.textNode.displaysAsynchronously = true
self.textNode.displaysAsynchronously = false
self.measureTextNode = TextNode()

View File

@ -95,6 +95,9 @@ public enum TabBarItemContextActionType {
if !self.lockOrientation {
self.lockedOrientation = nil
}
if let window = self.window {
window.invalidateSupportedOrientations()
}
}
}
}

View File

@ -738,12 +738,12 @@ private enum DebugControllerEntry: ItemListNodeEntry {
})
case .voiceConference:
return ItemListDisclosureItem(presentationData: presentationData, title: "Voice Conference (Test)", label: "", sectionId: self.section, style: .blocks, action: {
guard let context = arguments.context else {
/*guard let context = arguments.context else {
return
}
let controller = GroupCallController(context: context)
controller.navigationPresentation = .modal
arguments.pushController(controller)
arguments.pushController(controller)*/
})
case let .preferredVideoCodec(_, title, value, isSelected):
return ItemListCheckboxItem(presentationData: presentationData, title: title, style: .right, checked: isSelected, zeroSeparatorInsets: false, sectionId: self.section, action: {
@ -824,7 +824,7 @@ private func debugControllerEntries(presentationData: PresentationData, loggingS
entries.append(.playerEmbedding(experimentalSettings.playerEmbedding))
entries.append(.playlistPlayback(experimentalSettings.playlistPlayback))
entries.append(.voiceConference)
//entries.append(.voiceConference)
let codecs: [(String, String?)] = [
("No Preference", nil),

View File

@ -10,7 +10,8 @@ import TelegramAudio
import AccountContext
public final class GroupCallController: ViewController {
private final class Node: ViewControllerTracingNode {
}
/* private final class Node: ViewControllerTracingNode {
private let context: AccountContext
private let presentationData: PresentationData
@ -145,3 +146,4 @@ public final class GroupCallController: ViewController {
self.controllerNode.containerLayoutUpdated(layout, transition: transition)
}
}
*/

View File

@ -2992,6 +2992,9 @@ func replayFinalState(accountManager: AccountManager, postbox: Postbox, accountP
}
if upperId >= messageId.id {
transaction.addHole(peerId: messageId.peerId, namespace: messageId.namespace, space: .everywhere, range: messageId.id ... upperId)
transaction.addHole(peerId: messageId.peerId, namespace: messageId.namespace, space: .tag(.pinned), range: 1 ... upperId)
Logger.shared.log("State", "adding hole for peer \(messageId.peerId), \(messageId.id) ... \(upperId)")
} else {
Logger.shared.log("State", "not adding hole for peer \(messageId.peerId), \(upperId) >= \(messageId.id) = false")

View File

@ -601,9 +601,18 @@ func contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState:
var threadId: Int64?
var threadMessageCount: Int = 0
if case .peer = chatPresentationInterfaceState.chatLocation, let channel = chatPresentationInterfaceState.renderedPeer?.peer as? TelegramChannel, case .group = channel.info, let cachedData = cachedData as? CachedChannelData, case let .known(maybeValue) = cachedData.linkedDiscussionPeerId, let _ = maybeValue {
if let value = messages[0].threadId {
threadId = value
if case .peer = chatPresentationInterfaceState.chatLocation, let channel = chatPresentationInterfaceState.renderedPeer?.peer as? TelegramChannel, case .group = channel.info {
if let cachedData = cachedData as? CachedChannelData, case let .known(maybeValue) = cachedData.linkedDiscussionPeerId, let _ = maybeValue {
if let value = messages[0].threadId {
threadId = value
} else {
for attribute in messages[0].attributes {
if let attribute = attribute as? ReplyThreadMessageAttribute, attribute.count > 0 {
threadId = makeMessageThreadId(messages[0].id)
threadMessageCount = Int(attribute.count)
}
}
}
} else {
for attribute in messages[0].attributes {
if let attribute = attribute as? ReplyThreadMessageAttribute, attribute.count > 0 {
@ -612,13 +621,6 @@ func contextMenuForChatPresentationIntefaceState(chatPresentationInterfaceState:
}
}
}
} else {
for attribute in messages[0].attributes {
if let attribute = attribute as? ReplyThreadMessageAttribute, attribute.count > 0 {
threadId = makeMessageThreadId(messages[0].id)
threadMessageCount = Int(attribute.count)
}
}
}
if let _ = threadId, !isPinnedMessages {

View File

@ -37,7 +37,7 @@ class ChatMessageActionBubbleContentNode: ChatMessageBubbleContentNode {
required init() {
self.labelNode = TextNode()
self.labelNode.isUserInteractionEnabled = false
self.labelNode.displaysAsynchronously = true
self.labelNode.displaysAsynchronously = false
self.filledBackgroundNode = LinkHighlightingNode(color: .clear)

View File

@ -252,7 +252,7 @@ final class ChatMessageAttachedContentNode: ASDisplayNode {
self.textNode = TextNode()
self.textNode.isUserInteractionEnabled = false
self.textNode.displaysAsynchronously = true
self.textNode.displaysAsynchronously = false
self.textNode.contentsScale = UIScreenScale
self.textNode.contentMode = .topLeft

View File

@ -39,13 +39,13 @@ class ChatMessageCallBubbleContentNode: ChatMessageBubbleContentNode {
self.titleNode.isUserInteractionEnabled = false
self.titleNode.contentMode = .topLeft
self.titleNode.contentsScale = UIScreenScale
self.titleNode.displaysAsynchronously = true
self.titleNode.displaysAsynchronously = false
self.addSubnode(self.titleNode)
self.labelNode.isUserInteractionEnabled = false
self.labelNode.contentMode = .topLeft
self.labelNode.contentsScale = UIScreenScale
self.labelNode.displaysAsynchronously = true
self.labelNode.displaysAsynchronously = false
self.addSubnode(self.labelNode)
self.addSubnode(self.iconNode)

View File

@ -173,7 +173,7 @@ class ChatMessageDateAndStatusNode: ASDisplayNode {
override init() {
self.dateNode = TextNode()
self.dateNode.isUserInteractionEnabled = false
self.dateNode.displaysAsynchronously = true
self.dateNode.displaysAsynchronously = false
super.init()

View File

@ -94,17 +94,17 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
override init() {
self.titleNode = TextNode()
self.titleNode.displaysAsynchronously = true
self.titleNode.displaysAsynchronously = false
self.titleNode.isUserInteractionEnabled = false
self.descriptionNode = TextNode()
self.descriptionNode.displaysAsynchronously = true
self.descriptionNode.displaysAsynchronously = false
self.descriptionNode.isUserInteractionEnabled = false
self.descriptionMeasuringNode = TextNode()
self.fetchingTextNode = ImmediateTextNode()
self.fetchingTextNode.displaysAsynchronously = true
self.fetchingTextNode.displaysAsynchronously = false
self.fetchingTextNode.isUserInteractionEnabled = false
self.fetchingTextNode.maximumNumberOfLines = 1
self.fetchingTextNode.contentMode = .left
@ -112,7 +112,7 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode {
self.fetchingTextNode.isHidden = true
self.fetchingCompactTextNode = ImmediateTextNode()
self.fetchingCompactTextNode.displaysAsynchronously = true
self.fetchingCompactTextNode.displaysAsynchronously = false
self.fetchingCompactTextNode.isUserInteractionEnabled = false
self.fetchingCompactTextNode.maximumNumberOfLines = 1
self.fetchingCompactTextNode.contentMode = .left

View File

@ -862,13 +862,13 @@ class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode {
self.textNode.isUserInteractionEnabled = false
self.textNode.contentMode = .topLeft
self.textNode.contentsScale = UIScreenScale
self.textNode.displaysAsynchronously = true
self.textNode.displaysAsynchronously = false
self.typeNode = TextNode()
self.typeNode.isUserInteractionEnabled = false
self.typeNode.contentMode = .topLeft
self.typeNode.contentsScale = UIScreenScale
self.typeNode.displaysAsynchronously = true
self.typeNode.displaysAsynchronously = false
self.avatarsNode = MergedAvatarsNode()
@ -876,7 +876,7 @@ class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode {
self.votersNode.isUserInteractionEnabled = false
self.votersNode.contentMode = .topLeft
self.votersNode.contentsScale = UIScreenScale
self.votersNode.displaysAsynchronously = true
self.votersNode.displaysAsynchronously = false
var displaySolution: (() -> Void)?
self.solutionButtonNode = SolutionButtonNode(pressed: {
@ -888,19 +888,19 @@ class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode {
self.buttonSubmitInactiveTextNode.isUserInteractionEnabled = false
self.buttonSubmitInactiveTextNode.contentMode = .topLeft
self.buttonSubmitInactiveTextNode.contentsScale = UIScreenScale
self.buttonSubmitInactiveTextNode.displaysAsynchronously = true
self.buttonSubmitInactiveTextNode.displaysAsynchronously = false
self.buttonSubmitActiveTextNode = TextNode()
self.buttonSubmitActiveTextNode.isUserInteractionEnabled = false
self.buttonSubmitActiveTextNode.contentMode = .topLeft
self.buttonSubmitActiveTextNode.contentsScale = UIScreenScale
self.buttonSubmitActiveTextNode.displaysAsynchronously = true
self.buttonSubmitActiveTextNode.displaysAsynchronously = false
self.buttonViewResultsTextNode = TextNode()
self.buttonViewResultsTextNode.isUserInteractionEnabled = false
self.buttonViewResultsTextNode.contentMode = .topLeft
self.buttonViewResultsTextNode.contentsScale = UIScreenScale
self.buttonViewResultsTextNode.displaysAsynchronously = true
self.buttonViewResultsTextNode.displaysAsynchronously = false
self.buttonNode = HighlightableButtonNode()

View File

@ -28,7 +28,7 @@ class ChatMessageReplyInfoNode: ASDisplayNode {
override init() {
self.contentNode = ASDisplayNode()
self.contentNode.isUserInteractionEnabled = false
self.contentNode.displaysAsynchronously = true
self.contentNode.displaysAsynchronously = false
self.contentNode.contentMode = .left
self.contentNode.contentsScale = UIScreenScale

View File

@ -22,7 +22,7 @@ class ChatMessageRestrictedBubbleContentNode: ChatMessageBubbleContentNode {
self.textNode.isUserInteractionEnabled = false
self.textNode.contentMode = .topLeft
self.textNode.contentsScale = UIScreenScale
self.textNode.displaysAsynchronously = true
self.textNode.displaysAsynchronously = false
self.addSubnode(self.textNode)
}

View File

@ -59,7 +59,7 @@ class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
self.textNode.isUserInteractionEnabled = false
self.textNode.contentMode = .topLeft
self.textNode.contentsScale = UIScreenScale
self.textNode.displaysAsynchronously = true
self.textNode.displaysAsynchronously = false
self.addSubnode(self.textNode)
self.addSubnode(self.textAccessibilityOverlayNode)

View File

@ -317,7 +317,7 @@ final class ChatPinnedMessageTitlePanelNode: ChatTitleAccessoryPanelNode {
} else {
titleStrings.append(.text(0, NSAttributedString(string: "\(strings.Conversation_PinnedMessage) ", font: Font.medium(15.0), textColor: theme.chat.inputPanel.panelControlAccentColor)))
}
} else if pinnedMessage.totalCount > 1 || pinnedMessage.index == pinnedMessage.totalCount - 1 {
} else if pinnedMessage.totalCount > 1 && pinnedMessage.index != pinnedMessage.totalCount - 1 {
titleStrings.append(.text(0, NSAttributedString(string: "\(strings.Conversation_PinnedMessage)", font: Font.medium(15.0), textColor: theme.chat.inputPanel.panelControlAccentColor)))
titleStrings.append(.text(1, NSAttributedString(string: " #", font: Font.medium(15.0), textColor: theme.chat.inputPanel.panelControlAccentColor)))
titleStrings.append(.number(pinnedMessage.index + 1, NSAttributedString(string: "\(pinnedMessage.index + 1)", font: Font.medium(15.0), textColor: theme.chat.inputPanel.panelControlAccentColor)))

View File

@ -414,10 +414,22 @@ final class ChatReportPeerTitlePanelNode: ChatTitleAccessoryPanelNode {
var nextButtonOrigin = maxInset + floor((areaWidth - updatedButtonsWidth) / 2.0)
let buttonWidth = floor(updatedButtonsWidth / CGFloat(self.buttons.count))
for (_, view) in self.buttons {
view.frame = CGRect(origin: CGPoint(x: nextButtonOrigin, y: 0.0), size: CGSize(width: buttonWidth, height: panelHeight))
var buttonFrames: [CGRect] = []
for _ in 0 ..< self.buttons.count {
buttonFrames.append(CGRect(origin: CGPoint(x: nextButtonOrigin, y: 0.0), size: CGSize(width: buttonWidth, height: panelHeight)))
nextButtonOrigin += buttonWidth
}
if buttonFrames[buttonFrames.count - 1].maxX >= width - 20.0 {
for i in 0 ..< buttonFrames.count {
buttonFrames[i].origin.x -= 16.0
}
}
for i in 0 ..< self.buttons.count {
self.buttons[i].1.frame = buttonFrames[i]
}
}
}

View File

@ -931,7 +931,7 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
interaction.requestLayout()
}))
} else if let about = cachedData.about, !about.isEmpty {
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: user.botInfo == nil ? presentationData.strings.Profile_About : presentationData.strings.Profile_BotInfo, text: about, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: []), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
items[.peerInfo]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: user.botInfo == nil ? presentationData.strings.Profile_About : presentationData.strings.Profile_BotInfo, text: about, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: enabledBioEntities), action: nil, longTapAction: bioContextAction, linkItemAction: bioLinkAction, requestLayout: {
interaction.requestLayout()
}))
}
@ -3159,9 +3159,6 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
self.controller?.present(shareController, in: .window(.root))
}
private let groupCallDisposable = MetaDisposable()
private var groupCall: GroupCallContext?
private func requestCall(isVideo: Bool) {
guard let peer = self.data?.peer as? TelegramUser, let cachedUserData = self.data?.cachedData as? CachedUserData else {
return

View File

@ -108,7 +108,12 @@ final class PeerSelectionControllerNode: ASDisplayNode {
}
self.chatListNode.contentOffsetChanged = { [weak self] offset in
self?.contentOffsetChanged?(offset)
guard let strongSelf = self else {
return
}
if strongSelf.chatListNode.supernode != nil {
strongSelf.contentOffsetChanged?(offset)
}
}
self.chatListNode.contentScrollingEnded = { [weak self] listView in
@ -293,7 +298,7 @@ final class PeerSelectionControllerNode: ASDisplayNode {
if self.chatListNode.supernode != nil {
self.chatListNode.scrollToPosition(.top)
} else if let contactListNode = self.contactListNode, contactListNode.supernode != nil {
contactListNode.scrollToTop()
//contactListNode.scrollToTop()
}
}
@ -331,7 +336,12 @@ final class PeerSelectionControllerNode: ASDisplayNode {
}
}
contactListNode.contentOffsetChanged = { [weak self] offset in
self?.contentOffsetChanged?(offset)
guard let strongSelf = self else {
return
}
if strongSelf.contactListNode?.supernode != nil {
strongSelf.contentOffsetChanged?(offset)
}
}
contactListNode.contentScrollingEnded = { [weak self] listView in

View File

@ -2,7 +2,7 @@ import Foundation
import SwiftSignalKit
import TgVoipWebrtc
private final class ContextQueueImpl: NSObject, OngoingCallThreadLocalContextQueueWebrtc {
/*private final class ContextQueueImpl: NSObject, OngoingCallThreadLocalContextQueueWebrtc {
private let queue: Queue
init(queue: Queue) {
@ -1467,3 +1467,4 @@ public final class GroupCallContext {
}
}
}
*/

View File

@ -1,7 +1,7 @@
#import <TgVoipWebrtc/GroupCallThreadLocalContext.h>
#import "group/GroupInstanceImpl.h"
/*#import "group/GroupInstanceImpl.h"
@interface GroupCallThreadLocalContext () {
id<OngoingCallThreadLocalContextQueueWebrtc> _queue;
@ -55,3 +55,4 @@
}
@end
*/

@ -1 +1 @@
Subproject commit 4f7501d281b851e6302b2a2d7298c733eee82414
Subproject commit 64f96a1b4fcfb8afdb0fb7749082cb42cdad7901