mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Various fixes
This commit is contained in:
parent
12d5336af9
commit
2c002ba3a7
10 changed files with 35 additions and 39 deletions
|
|
@ -331,7 +331,7 @@ func chatContextMenuItems(context: AccountContext, peerId: PeerId, promoInfo: Ch
|
|||
}
|
||||
return filters
|
||||
}).startStandalone()
|
||||
chatListController?.present(UndoOverlayController( presentationData: presentationData, content: .chatAddedToFolder(context: context, chatTitle: peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), folderTitle: title.rawAttributedString), elevatedLayout: false, animateInAsReplacement: true, action: { _ in
|
||||
chatListController?.present(UndoOverlayController(presentationData: presentationData, content: .chatAddedToFolder(context: context, chatTitle: peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder), folderTitle: title.rawAttributedString), elevatedLayout: false, animateInAsReplacement: true, action: { _ in
|
||||
return false
|
||||
}), in: .current)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1901,12 +1901,12 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||
chatController.canReadHistory.set(false)
|
||||
source = .controller(ContextControllerContentSourceImpl(controller: chatController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController))
|
||||
|
||||
let contextController = makeContextController(presentationData: strongSelf.presentationData, source: source, items: chatForumTopicMenuItems(context: strongSelf.context, peerId: peer.peerId, threadId: threadId, isPinned: nil, isClosed: nil, chatListController: strongSelf, joined: joined, canSelect: false) |> map { ContextController.Items(content: .list($0)) }, gesture: gesture)
|
||||
let contextController = makeContextController(context: strongSelf.context, presentationData: strongSelf.presentationData, source: source, items: chatForumTopicMenuItems(context: strongSelf.context, peerId: peer.peerId, threadId: threadId, isPinned: nil, isClosed: nil, chatListController: strongSelf, joined: joined, canSelect: false) |> map { ContextController.Items(content: .list($0)) }, gesture: gesture)
|
||||
strongSelf.presentInGlobalOverlay(contextController)
|
||||
} else {
|
||||
let chatListController = ChatListControllerImpl(context: strongSelf.context, location: .forum(peerId: channel.id), controlsHistoryPreload: false, hideNetworkActivityStatus: true, previewing: true, enableDebugActions: false)
|
||||
chatListController.navigationPresentation = .master
|
||||
let contextController = makeContextController(presentationData: strongSelf.presentationData, source: .controller(ContextControllerContentSourceImpl(controller: chatListController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController)), items: chatContextMenuItems(context: strongSelf.context, peerId: peer.peerId, promoInfo: promoInfo, source: .chatList(filter: strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.chatListFilter), chatListController: strongSelf, joined: joined) |> map { ContextController.Items(content: .list($0)) }, gesture: gesture)
|
||||
let contextController = makeContextController(context: strongSelf.context, presentationData: strongSelf.presentationData, source: .controller(ContextControllerContentSourceImpl(controller: chatListController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController)), items: chatContextMenuItems(context: strongSelf.context, peerId: peer.peerId, promoInfo: promoInfo, source: .chatList(filter: strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.chatListFilter), chatListController: strongSelf, joined: joined) |> map { ContextController.Items(content: .list($0)) }, gesture: gesture)
|
||||
strongSelf.presentInGlobalOverlay(contextController)
|
||||
}
|
||||
} else if let peer = peer.peer, peer.id == strongSelf.context.account.peerId, peerData.displayAsTopicList {
|
||||
|
|
@ -1918,7 +1918,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||
source = .controller(ContextControllerContentSourceImpl(controller: peerInfoController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController))
|
||||
}
|
||||
|
||||
let contextController = makeContextController(presentationData: strongSelf.presentationData, source: source, items: chatContextMenuItems(context: strongSelf.context, peerId: peer.id, promoInfo: promoInfo, source: .chatList(filter: strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.chatListFilter), chatListController: strongSelf, joined: joined) |> map { ContextController.Items(content: .list($0)) }, gesture: gesture)
|
||||
let contextController = makeContextController(context: strongSelf.context, presentationData: strongSelf.presentationData, source: source, items: chatContextMenuItems(context: strongSelf.context, peerId: peer.id, promoInfo: promoInfo, source: .chatList(filter: strongSelf.chatListDisplayNode.mainContainerNode.currentItemNode.chatListFilter), chatListController: strongSelf, joined: joined) |> map { ContextController.Items(content: .list($0)) }, gesture: gesture)
|
||||
strongSelf.presentInGlobalOverlay(contextController)
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1970,7 +1970,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||
chatController.canReadHistory.set(false)
|
||||
source = .controller(ContextControllerContentSourceImpl(controller: chatController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController))
|
||||
|
||||
let contextController = makeContextController(presentationData: strongSelf.presentationData, source: source, items: chatForumTopicMenuItems(context: strongSelf.context, peerId: peer.peerId, threadId: threadId, isPinned: isPinned, isClosed: threadInfo?.isClosed, chatListController: strongSelf, joined: joined, canSelect: true) |> map { ContextController.Items(content: .list($0)) }, gesture: gesture)
|
||||
let contextController = makeContextController(context: strongSelf.context, presentationData: strongSelf.presentationData, source: source, items: chatForumTopicMenuItems(context: strongSelf.context, peerId: peer.peerId, threadId: threadId, isPinned: isPinned, isClosed: threadInfo?.isClosed, chatListController: strongSelf, joined: joined, canSelect: true) |> map { ContextController.Items(content: .list($0)) }, gesture: gesture)
|
||||
strongSelf.presentInGlobalOverlay(contextController)
|
||||
}
|
||||
}
|
||||
|
|
@ -2005,7 +2005,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||
if case let .channel(channel) = peer, channel.isForumOrMonoForum {
|
||||
let chatListController = ChatListControllerImpl(context: strongSelf.context, location: .forum(peerId: channel.id), controlsHistoryPreload: false, hideNetworkActivityStatus: true, previewing: true, enableDebugActions: false)
|
||||
chatListController.navigationPresentation = .master
|
||||
let contextController = makeContextController(presentationData: strongSelf.presentationData, source: .controller(ContextControllerContentSourceImpl(controller: chatListController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController)), items: chatContextMenuItems(context: strongSelf.context, peerId: peer.id, promoInfo: nil, source: .search(source), chatListController: strongSelf, joined: false) |> map { ContextController.Items(content: .list($0)) }, gesture: gesture)
|
||||
let contextController = makeContextController(context: strongSelf.context, presentationData: strongSelf.presentationData, source: .controller(ContextControllerContentSourceImpl(controller: chatListController, sourceNode: node, navigationController: strongSelf.navigationController as? NavigationController)), items: chatContextMenuItems(context: strongSelf.context, peerId: peer.id, promoInfo: nil, source: .search(source), chatListController: strongSelf, joined: false) |> map { ContextController.Items(content: .list($0)) }, gesture: gesture)
|
||||
strongSelf.presentInGlobalOverlay(contextController)
|
||||
} else {
|
||||
let contextContentSource: ContextContentSource
|
||||
|
|
|
|||
|
|
@ -222,6 +222,7 @@ public final class ChatInputMessageAccessoryPanel: Component {
|
|||
let contents: Contents
|
||||
let chatPeerId: EnginePeer.Id?
|
||||
let action: ((UIView) -> Void)?
|
||||
let longPressAction: ((UIView) -> Void)?
|
||||
let dismiss: (UIView) -> Void
|
||||
|
||||
public init(
|
||||
|
|
@ -229,12 +230,14 @@ public final class ChatInputMessageAccessoryPanel: Component {
|
|||
contents: Contents,
|
||||
chatPeerId: EnginePeer.Id?,
|
||||
action: ((UIView) -> Void)?,
|
||||
longPressAction: ((UIView) -> Void)? = nil,
|
||||
dismiss: @escaping (UIView) -> Void
|
||||
) {
|
||||
self.context = context
|
||||
self.contents = contents
|
||||
self.chatPeerId = chatPeerId
|
||||
self.action = action
|
||||
self.longPressAction = longPressAction
|
||||
self.dismiss = dismiss
|
||||
}
|
||||
|
||||
|
|
@ -251,12 +254,16 @@ public final class ChatInputMessageAccessoryPanel: Component {
|
|||
if (lhs.action == nil) != (rhs.action == nil) {
|
||||
return false
|
||||
}
|
||||
if (lhs.longPressAction == nil) != (rhs.longPressAction == nil) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
public final class View: UIView, ChatInputAccessoryPanelView {
|
||||
private let closeButton: HighlightTrackingButton
|
||||
private let closeButtonIcon: GlassBackgroundView.ContentImageView
|
||||
private let longPressGestureRecognizer: UILongPressGestureRecognizer
|
||||
|
||||
private let lineView: UIImageView
|
||||
private let titleNode: CompositeTextNode
|
||||
|
|
@ -295,6 +302,7 @@ public final class ChatInputMessageAccessoryPanel: Component {
|
|||
|
||||
self.closeButton = HighlightTrackingButton()
|
||||
self.closeButtonIcon = GlassBackgroundView.ContentImageView()
|
||||
self.longPressGestureRecognizer = UILongPressGestureRecognizer()
|
||||
|
||||
self.lineView = UIImageView()
|
||||
self.titleNode = CompositeTextNode()
|
||||
|
|
@ -311,6 +319,10 @@ public final class ChatInputMessageAccessoryPanel: Component {
|
|||
self.closeButton.addTarget(self, action: #selector(self.closeButtonPressed), for: .touchUpInside)
|
||||
|
||||
self.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.tapGesture(_:))))
|
||||
|
||||
self.longPressGestureRecognizer.addTarget(self, action: #selector(self.longPressGesture(_:)))
|
||||
self.longPressGestureRecognizer.isEnabled = false
|
||||
self.addGestureRecognizer(self.longPressGestureRecognizer)
|
||||
}
|
||||
|
||||
required public init?(coder: NSCoder) {
|
||||
|
|
@ -330,6 +342,15 @@ public final class ChatInputMessageAccessoryPanel: Component {
|
|||
}
|
||||
}
|
||||
|
||||
@objc private func longPressGesture(_ recognizer: UILongPressGestureRecognizer) {
|
||||
guard let component = self.component else {
|
||||
return
|
||||
}
|
||||
if case .began = recognizer.state {
|
||||
component.longPressAction?(self)
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func closeButtonPressed() {
|
||||
guard let component = self.component else {
|
||||
return
|
||||
|
|
@ -384,6 +405,7 @@ public final class ChatInputMessageAccessoryPanel: Component {
|
|||
self.component = component
|
||||
self.state = state
|
||||
self.environment = environment
|
||||
self.longPressGestureRecognizer.isEnabled = component.longPressAction != nil
|
||||
|
||||
if self.closeButtonIcon.image == nil {
|
||||
self.closeButtonIcon.image = generateCloseIcon()
|
||||
|
|
|
|||
|
|
@ -772,7 +772,7 @@ public final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
|||
displayTranscribe = false
|
||||
} else if arguments.message.id.peerId.namespace != Namespaces.Peer.SecretChat && !isViewOnceMessage && !arguments.presentationData.isPreview {
|
||||
let premiumConfiguration = PremiumConfiguration.with(appConfiguration: arguments.context.currentAppConfiguration.with { $0 })
|
||||
if arguments.associatedData.isPremium {
|
||||
if arguments.associatedData.isPremium || arguments.associatedData.alwaysDisplayTranscribeButton.providedByGroupBoost {
|
||||
displayTranscribe = true
|
||||
} else if premiumConfiguration.audioTransciptionTrialCount > 0 {
|
||||
if arguments.incoming {
|
||||
|
|
@ -786,8 +786,6 @@ public final class ChatMessageInteractiveFileNode: ASDisplayNode {
|
|||
} else if arguments.incoming && isConsumed == false && arguments.associatedData.alwaysDisplayTranscribeButton.displayForNotConsumed {
|
||||
displayTranscribe = true
|
||||
}
|
||||
} else if arguments.associatedData.alwaysDisplayTranscribeButton.providedByGroupBoost {
|
||||
displayTranscribe = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2227,4 +2225,3 @@ public final class FileMessageSelectionNode: ASDisplayNode {
|
|||
self.checkNode.frame = CGRect(origin: checkOrigin, size: checkSize)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -840,7 +840,7 @@ public class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
|||
var displayTranscribe = false
|
||||
if item.message.id.peerId.namespace != Namespaces.Peer.SecretChat && statusDisplayType == .free && !isViewOnceMessage && !item.presentationData.isPreview {
|
||||
let premiumConfiguration = PremiumConfiguration.with(appConfiguration: item.context.currentAppConfiguration.with { $0 })
|
||||
if item.associatedData.isPremium {
|
||||
if item.associatedData.isPremium || item.associatedData.alwaysDisplayTranscribeButton.providedByGroupBoost {
|
||||
displayTranscribe = true
|
||||
} else if premiumConfiguration.audioTransciptionTrialCount > 0 {
|
||||
if incoming {
|
||||
|
|
@ -852,8 +852,6 @@ public class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
|||
} else {
|
||||
displayTranscribe = false
|
||||
}
|
||||
} else if item.associatedData.alwaysDisplayTranscribeButton.providedByGroupBoost {
|
||||
displayTranscribe = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1498,7 +1498,6 @@ final class ComposePollScreenComponent: Component {
|
|||
pollTextSectionItems.append(AnyComponentWithIdentity(id: 0, component: AnyComponent(ListComposePollOptionComponent(
|
||||
externalState: self.pollTextInputState,
|
||||
context: component.context,
|
||||
style: .glass,
|
||||
theme: theme,
|
||||
strings: environment.strings,
|
||||
resetText: self.resetPollText.flatMap { resetText in
|
||||
|
|
@ -1534,7 +1533,6 @@ final class ComposePollScreenComponent: Component {
|
|||
pollTextSectionItems.append(AnyComponentWithIdentity(id: 1, component: AnyComponent(ListComposePollOptionComponent(
|
||||
externalState: self.pollDescriptionInputState,
|
||||
context: component.context,
|
||||
style: .glass,
|
||||
theme: theme,
|
||||
strings: environment.strings,
|
||||
resetText: nil,
|
||||
|
|
@ -1650,7 +1648,6 @@ final class ComposePollScreenComponent: Component {
|
|||
pollOptionsSectionItems.append(AnyComponentWithIdentity(id: pollOption.id, component: AnyComponent(ListComposePollOptionComponent(
|
||||
externalState: pollOption.textInputState,
|
||||
context: component.context,
|
||||
style: .glass,
|
||||
theme: theme,
|
||||
strings: environment.strings,
|
||||
resetText: pollOption.resetText.flatMap { resetText in
|
||||
|
|
@ -2499,7 +2496,6 @@ final class ComposePollScreenComponent: Component {
|
|||
AnyComponentWithIdentity(id: 0, component: AnyComponent(ListComposePollOptionComponent(
|
||||
externalState: self.quizAnswerTextInputState,
|
||||
context: component.context,
|
||||
style: .glass,
|
||||
theme: theme,
|
||||
strings: environment.strings,
|
||||
resetText: self.resetQuizAnswerText.flatMap { resetText in
|
||||
|
|
|
|||
|
|
@ -784,7 +784,6 @@ final class ComposeTodoScreenComponent: Component {
|
|||
todoTextSectionItems.append(AnyComponentWithIdentity(id: 0, component: AnyComponent(ListComposePollOptionComponent(
|
||||
externalState: self.todoTextInputState,
|
||||
context: component.context,
|
||||
style: .glass,
|
||||
theme: theme,
|
||||
strings: environment.strings,
|
||||
isEnabled: canEdit,
|
||||
|
|
@ -874,7 +873,6 @@ final class ComposeTodoScreenComponent: Component {
|
|||
todoItemsSectionItems.append(AnyComponentWithIdentity(id: todoItem.id, component: AnyComponent(ListComposePollOptionComponent(
|
||||
externalState: todoItem.textInputState,
|
||||
context: component.context,
|
||||
style: .glass,
|
||||
theme: theme,
|
||||
strings: environment.strings,
|
||||
isEnabled: isEnabled,
|
||||
|
|
|
|||
|
|
@ -716,7 +716,6 @@ final class NewContactScreenComponent: Component {
|
|||
ListComposePollOptionComponent(
|
||||
externalState: nil,
|
||||
context: component.context,
|
||||
style: .glass,
|
||||
theme: theme,
|
||||
strings: strings,
|
||||
placeholder: NSAttributedString(string: strings.AddContact_NotePlaceholder, font: Font.regular(17.0), textColor: theme.list.itemPlaceholderTextColor),
|
||||
|
|
|
|||
|
|
@ -22,11 +22,6 @@ import EmojiTextAttachmentView
|
|||
import TextFormat
|
||||
|
||||
public final class ListComposePollOptionComponent: Component {
|
||||
public enum Style {
|
||||
case glass
|
||||
case legacy
|
||||
}
|
||||
|
||||
public final class ResetText: Equatable {
|
||||
public let value: NSAttributedString
|
||||
|
||||
|
|
@ -117,7 +112,6 @@ public final class ListComposePollOptionComponent: Component {
|
|||
|
||||
public let externalState: TextFieldComponent.ExternalState?
|
||||
public let context: AccountContext
|
||||
public let style: Style
|
||||
public let theme: PresentationTheme
|
||||
public let strings: PresentationStrings
|
||||
public let placeholder: NSAttributedString?
|
||||
|
|
@ -148,7 +142,6 @@ public final class ListComposePollOptionComponent: Component {
|
|||
public init(
|
||||
externalState: TextFieldComponent.ExternalState?,
|
||||
context: AccountContext,
|
||||
style: Style = .legacy,
|
||||
theme: PresentationTheme,
|
||||
strings: PresentationStrings,
|
||||
placeholder: NSAttributedString? = nil,
|
||||
|
|
@ -178,7 +171,6 @@ public final class ListComposePollOptionComponent: Component {
|
|||
) {
|
||||
self.externalState = externalState
|
||||
self.context = context
|
||||
self.style = style
|
||||
self.theme = theme
|
||||
self.strings = strings
|
||||
self.placeholder = placeholder
|
||||
|
|
@ -214,9 +206,6 @@ public final class ListComposePollOptionComponent: Component {
|
|||
if lhs.context !== rhs.context {
|
||||
return false
|
||||
}
|
||||
if lhs.style != rhs.style {
|
||||
return false
|
||||
}
|
||||
if lhs.theme !== rhs.theme {
|
||||
return false
|
||||
}
|
||||
|
|
@ -690,10 +679,7 @@ public final class ListComposePollOptionComponent: Component {
|
|||
self.component = component
|
||||
self.state = state
|
||||
|
||||
var verticalInset: CGFloat = 12.0
|
||||
if case .glass = component.style {
|
||||
verticalInset = 16.0
|
||||
}
|
||||
let verticalInset: CGFloat = 16.0
|
||||
var leftInset: CGFloat = 16.0
|
||||
var rightInset: CGFloat = 16.0
|
||||
let modeSelectorSize = CGSize(width: 32.0, height: 32.0)
|
||||
|
|
@ -1372,10 +1358,7 @@ public final class ListComposePollOptionComponent: Component {
|
|||
return
|
||||
}
|
||||
|
||||
var verticalInset: CGFloat = 12.0
|
||||
if case .glass = component.style {
|
||||
verticalInset = 16.0
|
||||
}
|
||||
let verticalInset: CGFloat = 16.0
|
||||
var leftInset: CGFloat = 16.0
|
||||
let rightInset: CGFloat = 16.0
|
||||
|
||||
|
|
|
|||
|
|
@ -230,6 +230,9 @@ func textInputAccessoryPanel(
|
|||
previousTapTimestamp = CFAbsoluteTimeGetCurrent()
|
||||
interfaceInteraction?.presentReplyOptions(sourceView)
|
||||
},
|
||||
longPressAction: { _ in
|
||||
interfaceInteraction?.navigateToMessage(replyMessageSubject.messageId, false, true, ChatLoadingMessageSubject.generic)
|
||||
},
|
||||
dismiss: { _ in
|
||||
interfaceInteraction?.setupReplyMessage(nil, nil, { _, f in f() })
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue