Fix emoji data updates in embedded mode

This commit is contained in:
Ali 2022-07-25 15:58:33 +02:00
parent c7de651aad
commit 51c0888313
2 changed files with 30 additions and 3 deletions

View File

@ -10963,7 +10963,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
} }
}) })
let inputPanelNode = AttachmentTextInputPanelNode(context: self.context, presentationInterfaceState: presentationInterfaceState, isCaption: true, presentController: { _ in }, makeEntityInputView: { [weak self] in let inputPanelNode = AttachmentTextInputPanelNode(context: self.context, presentationInterfaceState: presentationInterfaceState, isCaption: true, presentController: { [weak self] c in
self?.presentInGlobalOverlay(c)
}, makeEntityInputView: { [weak self] in
guard let strongSelf = self else { guard let strongSelf = self else {
return nil return nil
} }

View File

@ -2030,7 +2030,25 @@ final class EntityInputView: UIView, AttachmentTextInputPanelInputView, UIInputV
}, },
addGroupAction: { _, _ in addGroupAction: { _, _ in
}, },
clearGroup: { _ in clearGroup: { [weak self] groupId in
guard let strongSelf = self else {
return
}
if groupId == AnyHashable("recent") {
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let actionSheet = ActionSheetController(theme: ActionSheetControllerTheme(presentationTheme: presentationData.theme, fontSize: presentationData.listsFontSize))
var items: [ActionSheetItem] = []
items.append(ActionSheetButtonItem(title: presentationData.strings.Emoji_ClearRecent, color: .destructive, action: { [weak actionSheet] in
actionSheet?.dismissAnimated()
let _ = context.engine.stickers.clearRecentlyUsedEmoji().start()
}))
actionSheet.setItemGroups([ActionSheetItemGroup(items: items), ActionSheetItemGroup(items: [
ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, color: .accent, font: .bold, action: { [weak actionSheet] in
actionSheet?.dismissAnimated()
})
])])
strongSelf.presentController?(actionSheet)
}
}, },
pushController: { _ in pushController: { _ in
}, },
@ -2062,7 +2080,14 @@ final class EntityInputView: UIView, AttachmentTextInputPanelInputView, UIInputV
gifs: nil, gifs: nil,
availableGifSearchEmojies: [] availableGifSearchEmojies: []
), ),
updatedInputData: .never(), updatedInputData: ChatEntityKeyboardInputNode.emojiInputData(context: context, animationCache: self.animationCache, animationRenderer: self.animationRenderer, isStandalone: true, isSecret: isSecret) |> map { emojiComponent -> ChatEntityKeyboardInputNode.InputData in
return ChatEntityKeyboardInputNode.InputData(
emoji: emojiComponent,
stickers: nil,
gifs: nil,
availableGifSearchEmojies: []
)
},
defaultToEmojiTab: true, defaultToEmojiTab: true,
controllerInteraction: nil, controllerInteraction: nil,
interfaceInteraction: nil, interfaceInteraction: nil,