Various improvements

This commit is contained in:
Ilya Laktyushin
2024-12-22 17:16:14 +04:00
parent 26ff9da7d1
commit 5451053195
133 changed files with 5419 additions and 1692 deletions

View File

@@ -19,7 +19,6 @@ import PremiumUI
import AudioToolbox
import UndoUI
import ContextUI
import GalleryUI
import TelegramPresentationData
import TelegramNotices
import StickerPeekUI
@@ -29,7 +28,6 @@ import MultiplexedVideoNode
import ChatControllerInteraction
import FeaturedStickersScreen
import Pasteboard
import StickerPackPreviewUI
import EntityKeyboardGifContent
import LegacyMessageInputPanelInputView
import AttachmentTextInputPanelNode
@@ -647,25 +645,6 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode {
parentInputInteraction: emojiInputInteraction
))
}
/*let controller = StickerPackScreen(
context: context,
updatedPresentationData: controllerInteraction.updatedPresentationData,
mode: .default,
mainStickerPack: .id(id: featuredStickerPack.info.id.id, accessHash: featuredStickerPack.info.accessHash),
stickerPacks: [.id(id: featuredStickerPack.info.id.id, accessHash: featuredStickerPack.info.accessHash)],
loadedStickerPacks: [.result(info: featuredStickerPack.info, items: featuredStickerPack.topItems, installed: false)],
parentNavigationController: controllerInteraction.navigationController(),
sendSticker: nil,
sendEmoji: { [weak interfaceInteraction] text, emojiAttribute in
guard let interfaceInteraction else {
return
}
interfaceInteraction.insertText(NSAttributedString(string: text, attributes: [ChatTextInputAttributes.customEmoji: emojiAttribute]))
}
)
controllerInteraction.presentController(controller, nil)*/
break
}
}
@@ -1395,6 +1374,7 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode {
mainStickerPack: packReference,
stickerPacks: [packReference],
loadedStickerPacks: [],
actionTitle: nil,
isEditing: true,
expandIfNeeded: true,
parentNavigationController: interaction.getNavigationController(),
@@ -2131,9 +2111,7 @@ public final class ChatEntityKeyboardInputNode: ChatInputNode {
let message = Message(stableId: 0, stableVersion: 0, id: MessageId(peerId: PeerId(0), namespace: Namespaces.Message.Local, id: 0), globallyUniqueId: nil, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: 0, flags: [], tags: [], globalTags: [], localTags: [], customTags: [], forwardInfo: nil, author: nil, text: "", attributes: [], media: [file.media], peers: SimpleDictionary(), associatedMessages: SimpleDictionary(), associatedMessageIds: [], associatedMedia: [:], associatedThreadInfo: nil, associatedStories: [:])
let gallery = GalleryController(context: strongSelf.context, source: .standaloneMessage(message, nil), streamSingleVideo: true, replaceRootController: { _, _ in
}, baseNavigationController: nil)
gallery.setHintWillBePresentedInPreviewingContext(true)
let gallery = strongSelf.context.sharedContext.makeGalleryController(context: strongSelf.context, source: .standaloneMessage(message, nil), streamSingleVideo: true, isPreview: true)
var items: [ContextMenuItem] = []
items.append(.action(ContextMenuActionItem(text: presentationData.strings.MediaPicker_Send, icon: { theme in
@@ -2282,7 +2260,7 @@ private final class ContextControllerContentSourceImpl: ContextControllerContent
}
func animatedIn() {
if let controller = self.controller as? GalleryController {
if let controller = self.controller as? GalleryControllerProtocol {
controller.viewDidAppear(false)
}
}
@@ -2883,7 +2861,7 @@ public final class EmojiContentPeekBehaviorImpl: EmojiContentPeekBehavior {
return
}
let controller = strongSelf.context.sharedContext.makeStickerPackScreen(context: context, updatedPresentationData: nil, mainStickerPack: packReference, stickerPacks: [packReference], loadedStickerPacks: [], isEditing: false, expandIfNeeded: false, parentNavigationController: interaction.navigationController(), sendSticker: { file, sourceView, sourceRect in
let controller = strongSelf.context.sharedContext.makeStickerPackScreen(context: context, updatedPresentationData: nil, mainStickerPack: packReference, stickerPacks: [packReference], loadedStickerPacks: [], actionTitle: nil, isEditing: false, expandIfNeeded: false, parentNavigationController: interaction.navigationController(), sendSticker: { file, sourceView, sourceRect in
sendSticker(file, false, false, nil, false, sourceView, sourceRect, nil)
return true
}, actionPerformed: nil)

View File

@@ -10,7 +10,6 @@ import PresentationDataUtils
import LegacyComponents
import MergeLists
import AccountContext
import StickerPackPreviewUI
import StickerPeekUI
import Emoji
import AppBundle
@@ -19,6 +18,7 @@ import UndoUI
import ChatControllerInteraction
import FeaturedStickersScreen
import ChatPresentationInterfaceState
import StickerResources
private enum StickerSearchEntryId: Equatable, Hashable {
case sticker(String?, Int64)
@@ -224,13 +224,25 @@ final class StickerPaneSearchContentNode: ASDisplayNode, PaneSearchContentNode {
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }.withUpdated(theme: theme)
let controller = StickerPackScreen(context: strongSelf.context, updatedPresentationData: (presentationData, .single(presentationData)), mainStickerPack: packReference, stickerPacks: [packReference], actionTitle: stickerActionTitle, parentNavigationController: strongSelf.interaction.getNavigationController(), sendSticker: { [weak self] fileReference, sourceNode, sourceRect in
if let strongSelf = self {
return strongSelf.interaction.sendSticker(fileReference, false, false, nil, false, sourceNode, sourceRect, nil, [])
} else {
return false
}
})
let controller = strongSelf.context.sharedContext.makeStickerPackScreen(
context: strongSelf.context,
updatedPresentationData: (presentationData, .single(presentationData)),
mainStickerPack: packReference,
stickerPacks: [packReference],
loadedStickerPacks: [],
actionTitle: stickerActionTitle,
isEditing: false,
expandIfNeeded: false,
parentNavigationController: strongSelf.interaction.getNavigationController(),
sendSticker: { [weak self] fileReference, sourceView, sourceRect in
if let strongSelf = self {
return strongSelf.interaction.sendSticker(fileReference, false, false, nil, false, sourceView, sourceRect, nil, [])
} else {
return false
}
},
actionPerformed: nil
)
strongSelf.interaction.presentController(controller, nil)
}
}, install: { [weak self] info, items, install in