mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Set choosing sticker activity when interacting with search by emoji
This commit is contained in:
parent
d022ad7d91
commit
0f87a813e9
@ -340,7 +340,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
private let recordingActivityPromise = ValuePromise<ChatRecordingActivity>(.none, ignoreRepeated: true)
|
private let recordingActivityPromise = ValuePromise<ChatRecordingActivity>(.none, ignoreRepeated: true)
|
||||||
private var recordingActivityDisposable: Disposable?
|
private var recordingActivityDisposable: Disposable?
|
||||||
private var acquiredRecordingActivityDisposable: Disposable?
|
private var acquiredRecordingActivityDisposable: Disposable?
|
||||||
private let choosingStickerActivityPromise = Promise<Bool>(false)
|
private let choosingStickerActivityPromise = ValuePromise<Bool>(false)
|
||||||
private var choosingStickerActivityDisposable: Disposable?
|
private var choosingStickerActivityDisposable: Disposable?
|
||||||
|
|
||||||
private var searchDisposable: MetaDisposable?
|
private var searchDisposable: MetaDisposable?
|
||||||
@ -2879,6 +2879,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return strongSelf.chatDisplayNode.messageTransitionNode
|
return strongSelf.chatDisplayNode.messageTransitionNode
|
||||||
|
}, updateChoosingSticker: { [weak self] value in
|
||||||
|
if let strongSelf = self {
|
||||||
|
strongSelf.choosingStickerActivityPromise.set(value)
|
||||||
|
}
|
||||||
}, requestMessageUpdate: { [weak self] id in
|
}, requestMessageUpdate: { [weak self] id in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.chatDisplayNode.historyNode.requestMessageUpdate(id)
|
strongSelf.chatDisplayNode.historyNode.requestMessageUpdate(id)
|
||||||
@ -3876,6 +3880,13 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
})
|
})
|
||||||
|
|
||||||
self.choosingStickerActivityDisposable = (self.choosingStickerActivityPromise.get()
|
self.choosingStickerActivityDisposable = (self.choosingStickerActivityPromise.get()
|
||||||
|
|> mapToSignal { value -> Signal<Bool, NoError> in
|
||||||
|
if value {
|
||||||
|
return .single(true)
|
||||||
|
} else {
|
||||||
|
return .single(false) |> delay(2.0, queue: Queue.mainQueue())
|
||||||
|
}
|
||||||
|
}
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] value in
|
|> deliverOnMainQueue).start(next: { [weak self] value in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.context.account.updateLocalInputActivity(peerId: activitySpace, activity: .choosingSticker, isPresent: value)
|
strongSelf.context.account.updateLocalInputActivity(peerId: activitySpace, activity: .choosingSticker, isPresent: value)
|
||||||
@ -4535,8 +4546,6 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
self.chatDisplayNode.historyNode.voicePlaylistItemChanged(nil, currentItem)
|
self.chatDisplayNode.historyNode.voicePlaylistItemChanged(nil, currentItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
self.choosingStickerActivityPromise.set(self.chatDisplayNode.choosingSticker)
|
|
||||||
|
|
||||||
self.chatDisplayNode.historyNode.didScrollWithOffset = { [weak self] offset, transition, itemNode in
|
self.chatDisplayNode.historyNode.didScrollWithOffset = { [weak self] offset, transition, itemNode in
|
||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
return
|
return
|
||||||
|
@ -123,7 +123,8 @@ public final class ChatControllerInteraction {
|
|||||||
let copyText: (String) -> Void
|
let copyText: (String) -> Void
|
||||||
let displayUndo: (UndoOverlayContent) -> Void
|
let displayUndo: (UndoOverlayContent) -> Void
|
||||||
let isAnimatingMessage: (UInt32) -> Bool
|
let isAnimatingMessage: (UInt32) -> Bool
|
||||||
var getMessageTransitionNode: () -> ChatMessageTransitionNode?
|
let getMessageTransitionNode: () -> ChatMessageTransitionNode?
|
||||||
|
let updateChoosingSticker: (Bool) -> Void
|
||||||
|
|
||||||
let requestMessageUpdate: (MessageId) -> Void
|
let requestMessageUpdate: (MessageId) -> Void
|
||||||
let cancelInteractiveKeyboardGestures: () -> Void
|
let cancelInteractiveKeyboardGestures: () -> Void
|
||||||
@ -219,6 +220,7 @@ public final class ChatControllerInteraction {
|
|||||||
displayUndo: @escaping (UndoOverlayContent) -> Void,
|
displayUndo: @escaping (UndoOverlayContent) -> Void,
|
||||||
isAnimatingMessage: @escaping (UInt32) -> Bool,
|
isAnimatingMessage: @escaping (UInt32) -> Bool,
|
||||||
getMessageTransitionNode: @escaping () -> ChatMessageTransitionNode?,
|
getMessageTransitionNode: @escaping () -> ChatMessageTransitionNode?,
|
||||||
|
updateChoosingSticker: @escaping (Bool) -> Void,
|
||||||
requestMessageUpdate: @escaping (MessageId) -> Void,
|
requestMessageUpdate: @escaping (MessageId) -> Void,
|
||||||
cancelInteractiveKeyboardGestures: @escaping () -> Void,
|
cancelInteractiveKeyboardGestures: @escaping () -> Void,
|
||||||
automaticMediaDownloadSettings: MediaAutoDownloadSettings,
|
automaticMediaDownloadSettings: MediaAutoDownloadSettings,
|
||||||
@ -300,6 +302,7 @@ public final class ChatControllerInteraction {
|
|||||||
self.displayUndo = displayUndo
|
self.displayUndo = displayUndo
|
||||||
self.isAnimatingMessage = isAnimatingMessage
|
self.isAnimatingMessage = isAnimatingMessage
|
||||||
self.getMessageTransitionNode = getMessageTransitionNode
|
self.getMessageTransitionNode = getMessageTransitionNode
|
||||||
|
self.updateChoosingSticker = updateChoosingSticker
|
||||||
self.requestMessageUpdate = requestMessageUpdate
|
self.requestMessageUpdate = requestMessageUpdate
|
||||||
self.cancelInteractiveKeyboardGestures = cancelInteractiveKeyboardGestures
|
self.cancelInteractiveKeyboardGestures = cancelInteractiveKeyboardGestures
|
||||||
|
|
||||||
@ -358,6 +361,7 @@ public final class ChatControllerInteraction {
|
|||||||
return false
|
return false
|
||||||
}, getMessageTransitionNode: {
|
}, getMessageTransitionNode: {
|
||||||
return nil
|
return nil
|
||||||
|
}, updateChoosingSticker: { _ in
|
||||||
}, requestMessageUpdate: { _ in
|
}, requestMessageUpdate: { _ in
|
||||||
}, cancelInteractiveKeyboardGestures: {
|
}, cancelInteractiveKeyboardGestures: {
|
||||||
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings,
|
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings,
|
||||||
|
@ -122,11 +122,6 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
private(set) var textInputPanelNode: ChatTextInputPanelNode?
|
private(set) var textInputPanelNode: ChatTextInputPanelNode?
|
||||||
private var inputMediaNode: ChatMediaInputNode?
|
private var inputMediaNode: ChatMediaInputNode?
|
||||||
|
|
||||||
private let choosingStickerPromise = Promise<Bool>(false)
|
|
||||||
var choosingSticker: Signal<Bool, NoError> {
|
|
||||||
return self.choosingStickerPromise.get()
|
|
||||||
}
|
|
||||||
|
|
||||||
let navigateButtons: ChatHistoryNavigationButtons
|
let navigateButtons: ChatHistoryNavigationButtons
|
||||||
|
|
||||||
private var ignoreUpdateHeight = false
|
private var ignoreUpdateHeight = false
|
||||||
@ -865,7 +860,6 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
}
|
}
|
||||||
if let inputMediaNode = inputNode as? ChatMediaInputNode, self.inputMediaNode == nil {
|
if let inputMediaNode = inputNode as? ChatMediaInputNode, self.inputMediaNode == nil {
|
||||||
self.inputMediaNode = inputMediaNode
|
self.inputMediaNode = inputMediaNode
|
||||||
self.choosingStickerPromise.set(inputMediaNode.choosingSticker)
|
|
||||||
inputMediaNode.requestDisableStickerAnimations = { [weak self] disabled in
|
inputMediaNode.requestDisableStickerAnimations = { [weak self] disabled in
|
||||||
self?.controller?.disableStickerAnimations = disabled
|
self?.controller?.disableStickerAnimations = disabled
|
||||||
}
|
}
|
||||||
@ -1961,7 +1955,6 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
self?.controller?.disableStickerAnimations = disabled
|
self?.controller?.disableStickerAnimations = disabled
|
||||||
}
|
}
|
||||||
self.inputMediaNode = inputNode
|
self.inputMediaNode = inputNode
|
||||||
self.choosingStickerPromise.set(inputNode.choosingSticker)
|
|
||||||
if let (validLayout, _) = self.validLayout {
|
if let (validLayout, _) = self.validLayout {
|
||||||
let _ = inputNode.updateLayout(width: validLayout.size.width, leftInset: validLayout.safeInsets.left, rightInset: validLayout.safeInsets.right, bottomInset: validLayout.intrinsicInsets.bottom, standardInputHeight: validLayout.standardInputHeight, inputHeight: validLayout.inputHeight ?? 0.0, maximumHeight: validLayout.standardInputHeight, inputPanelHeight: 44.0, transition: .immediate, interfaceState: self.chatPresentationInterfaceState, deviceMetrics: validLayout.deviceMetrics, isVisible: false)
|
let _ = inputNode.updateLayout(width: validLayout.size.width, leftInset: validLayout.safeInsets.left, rightInset: validLayout.safeInsets.right, bottomInset: validLayout.intrinsicInsets.bottom, standardInputHeight: validLayout.standardInputHeight, inputHeight: validLayout.inputHeight ?? 0.0, maximumHeight: validLayout.standardInputHeight, inputPanelHeight: 44.0, transition: .immediate, interfaceState: self.chatPresentationInterfaceState, deviceMetrics: validLayout.deviceMetrics, isVisible: false)
|
||||||
}
|
}
|
||||||
|
@ -496,17 +496,14 @@ final class ChatMediaInputNode: ChatInputNode {
|
|||||||
private var scrollingStickerPacksListPromise = ValuePromise<Bool>(false)
|
private var scrollingStickerPacksListPromise = ValuePromise<Bool>(false)
|
||||||
private var scrollingStickersGridPromise = ValuePromise<Bool>(false)
|
private var scrollingStickersGridPromise = ValuePromise<Bool>(false)
|
||||||
private var previewingStickersPromise = ValuePromise<Bool>(false)
|
private var previewingStickersPromise = ValuePromise<Bool>(false)
|
||||||
var choosingSticker: Signal<Bool, NoError> {
|
private var choosingSticker: Signal<Bool, NoError> {
|
||||||
return combineLatest(self.scrollingStickerPacksListPromise.get(), self.scrollingStickersGridPromise.get(), self.previewingStickersPromise.get())
|
return combineLatest(self.scrollingStickerPacksListPromise.get(), self.scrollingStickersGridPromise.get(), self.previewingStickersPromise.get())
|
||||||
|> mapToSignal { scrollingStickerPacksList, scrollingStickersGrid, previewingStickers -> Signal<Bool, NoError> in
|
|> map { scrollingStickerPacksList, scrollingStickersGrid, previewingStickers -> Bool in
|
||||||
if scrollingStickerPacksList || scrollingStickersGrid || previewingStickers {
|
return scrollingStickerPacksList || scrollingStickersGrid || previewingStickers
|
||||||
return .single(true)
|
|
||||||
} else {
|
|
||||||
return .single(false) |> delay(2.0, queue: Queue.mainQueue())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|> distinctUntilChanged
|
|> distinctUntilChanged
|
||||||
}
|
}
|
||||||
|
private var choosingStickerDisposable: Disposable?
|
||||||
|
|
||||||
private var panelFocusScrollToIndex: Int?
|
private var panelFocusScrollToIndex: Int?
|
||||||
private var panelFocusInitialPosition: CGPoint?
|
private var panelFocusInitialPosition: CGPoint?
|
||||||
@ -1324,10 +1321,18 @@ final class ChatMediaInputNode: ChatInputNode {
|
|||||||
strongSelf.startCollapseTimer(timeout: decelerated ? 0.5 : 2.5)
|
strongSelf.startCollapseTimer(timeout: decelerated ? 0.5 : 2.5)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.choosingStickerDisposable = (self.choosingSticker
|
||||||
|
|> deliverOnMainQueue).start(next: { [weak self] value in
|
||||||
|
if let strongSelf = self {
|
||||||
|
strongSelf.controllerInteraction.updateChoosingSticker(value)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
self.disposable.dispose()
|
self.disposable.dispose()
|
||||||
|
self.choosingStickerDisposable?.dispose()
|
||||||
self.searchContainerNodeLoadedDisposable.dispose()
|
self.searchContainerNodeLoadedDisposable.dispose()
|
||||||
self.panelFocusTimer?.invalidate()
|
self.panelFocusTimer?.invalidate()
|
||||||
}
|
}
|
||||||
|
@ -529,6 +529,7 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
|
|||||||
return false
|
return false
|
||||||
}, getMessageTransitionNode: {
|
}, getMessageTransitionNode: {
|
||||||
return nil
|
return nil
|
||||||
|
}, updateChoosingSticker: { _ in
|
||||||
}, requestMessageUpdate: { _ in
|
}, requestMessageUpdate: { _ in
|
||||||
}, cancelInteractiveKeyboardGestures: {
|
}, cancelInteractiveKeyboardGestures: {
|
||||||
}, automaticMediaDownloadSettings: self.automaticMediaDownloadSettings,
|
}, automaticMediaDownloadSettings: self.automaticMediaDownloadSettings,
|
||||||
|
@ -155,6 +155,7 @@ private final class DrawingStickersScreenNode: ViewControllerTracingNode {
|
|||||||
return false
|
return false
|
||||||
}, getMessageTransitionNode: {
|
}, getMessageTransitionNode: {
|
||||||
return nil
|
return nil
|
||||||
|
}, updateChoosingSticker: { _ in
|
||||||
}, requestMessageUpdate: { _ in
|
}, requestMessageUpdate: { _ in
|
||||||
}, cancelInteractiveKeyboardGestures: {
|
}, cancelInteractiveKeyboardGestures: {
|
||||||
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings,
|
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings,
|
||||||
|
@ -43,6 +43,16 @@ private final class InlineReactionSearchStickersNode: ASDisplayNode, UIScrollVie
|
|||||||
|
|
||||||
var getControllerInteraction: (() -> ChatControllerInteraction?)?
|
var getControllerInteraction: (() -> ChatControllerInteraction?)?
|
||||||
|
|
||||||
|
private var scrollingStickersGridPromise = ValuePromise<Bool>(false)
|
||||||
|
private var previewingStickersPromise = ValuePromise<Bool>(false)
|
||||||
|
var choosingSticker: Signal<Bool, NoError> {
|
||||||
|
return combineLatest(self.scrollingStickersGridPromise.get(), self.previewingStickersPromise.get())
|
||||||
|
|> map { scrollingStickersGrid, previewingStickers -> Bool in
|
||||||
|
return scrollingStickersGrid || previewingStickers
|
||||||
|
}
|
||||||
|
|> distinctUntilChanged
|
||||||
|
}
|
||||||
|
|
||||||
init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings) {
|
init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings) {
|
||||||
self.context = context
|
self.context = context
|
||||||
self.theme = theme
|
self.theme = theme
|
||||||
@ -146,6 +156,9 @@ private final class InlineReactionSearchStickersNode: ASDisplayNode, UIScrollVie
|
|||||||
let controller = PeekController(presentationData: presentationData, content: content, sourceNode: {
|
let controller = PeekController(presentationData: presentationData, content: content, sourceNode: {
|
||||||
return sourceNode
|
return sourceNode
|
||||||
})
|
})
|
||||||
|
controller.visibilityUpdated = { [weak self] visible in
|
||||||
|
self?.previewingStickersPromise.set(visible)
|
||||||
|
}
|
||||||
strongSelf.getControllerInteraction?()?.presentGlobalOverlayController(controller, nil)
|
strongSelf.getControllerInteraction?()?.presentGlobalOverlayController(controller, nil)
|
||||||
return controller
|
return controller
|
||||||
}
|
}
|
||||||
@ -171,6 +184,20 @@ private final class InlineReactionSearchStickersNode: ASDisplayNode, UIScrollVie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
|
||||||
|
self.scrollingStickersGridPromise.set(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
|
||||||
|
if !decelerate {
|
||||||
|
self.scrollingStickersGridPromise.set(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
|
||||||
|
self.scrollingStickersGridPromise.set(false)
|
||||||
|
}
|
||||||
|
|
||||||
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||||
if !self.ignoreScrolling {
|
if !self.ignoreScrolling {
|
||||||
self.updateVisibleItems(synchronous: false)
|
self.updateVisibleItems(synchronous: false)
|
||||||
@ -402,6 +429,8 @@ final class InlineReactionSearchPanel: ChatInputContextPanelNode {
|
|||||||
private var validLayout: (CGSize, CGFloat)?
|
private var validLayout: (CGSize, CGFloat)?
|
||||||
private var query: String?
|
private var query: String?
|
||||||
|
|
||||||
|
private var choosingStickerDisposable: Disposable?
|
||||||
|
|
||||||
override init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, fontSize: PresentationFontSize) {
|
override init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, fontSize: PresentationFontSize) {
|
||||||
self.containerNode = ASDisplayNode()
|
self.containerNode = ASDisplayNode()
|
||||||
|
|
||||||
@ -491,11 +520,17 @@ final class InlineReactionSearchPanel: ChatInputContextPanelNode {
|
|||||||
|
|
||||||
self.view.disablesInteractiveTransitionGestureRecognizer = true
|
self.view.disablesInteractiveTransitionGestureRecognizer = true
|
||||||
self.view.disablesInteractiveKeyboardGestureRecognizer = true
|
self.view.disablesInteractiveKeyboardGestureRecognizer = true
|
||||||
|
|
||||||
|
self.choosingStickerDisposable = (self.stickersNode.choosingSticker
|
||||||
|
|> deliverOnMainQueue).start(next: { [weak self] value in
|
||||||
|
if let strongSelf = self {
|
||||||
|
strongSelf.controllerInteraction?.updateChoosingSticker(value)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
override func didLoad() {
|
deinit {
|
||||||
super.didLoad()
|
self.choosingStickerDisposable?.dispose()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateResults(results: [TelegramMediaFile], query: String?) {
|
func updateResults(results: [TelegramMediaFile], query: String?) {
|
||||||
|
@ -147,6 +147,7 @@ final class OverlayAudioPlayerControllerNode: ViewControllerTracingNode, UIGestu
|
|||||||
return false
|
return false
|
||||||
}, getMessageTransitionNode: {
|
}, getMessageTransitionNode: {
|
||||||
return nil
|
return nil
|
||||||
|
}, updateChoosingSticker: { _ in
|
||||||
}, requestMessageUpdate: { _ in
|
}, requestMessageUpdate: { _ in
|
||||||
}, cancelInteractiveKeyboardGestures: {
|
}, cancelInteractiveKeyboardGestures: {
|
||||||
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings, pollActionState: ChatInterfacePollActionState(), stickerSettings: ChatInterfaceStickerSettings(loopAnimatedStickers: false), presentationContext: ChatPresentationContext(backgroundNode: nil))
|
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings, pollActionState: ChatInterfacePollActionState(), stickerSettings: ChatInterfaceStickerSettings(loopAnimatedStickers: false), presentationContext: ChatPresentationContext(backgroundNode: nil))
|
||||||
|
@ -2182,6 +2182,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
|||||||
return false
|
return false
|
||||||
}, getMessageTransitionNode: {
|
}, getMessageTransitionNode: {
|
||||||
return nil
|
return nil
|
||||||
|
}, updateChoosingSticker: { _ in
|
||||||
}, requestMessageUpdate: { _ in
|
}, requestMessageUpdate: { _ in
|
||||||
}, cancelInteractiveKeyboardGestures: {
|
}, cancelInteractiveKeyboardGestures: {
|
||||||
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings,
|
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings,
|
||||||
|
@ -1294,6 +1294,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
|||||||
return false
|
return false
|
||||||
}, getMessageTransitionNode: {
|
}, getMessageTransitionNode: {
|
||||||
return nil
|
return nil
|
||||||
|
}, updateChoosingSticker: { _ in
|
||||||
}, requestMessageUpdate: { _ in
|
}, requestMessageUpdate: { _ in
|
||||||
}, cancelInteractiveKeyboardGestures: {
|
}, cancelInteractiveKeyboardGestures: {
|
||||||
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings,
|
}, automaticMediaDownloadSettings: MediaAutoDownloadSettings.defaultSettings,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user