mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Emoji improvements
This commit is contained in:
parent
6b83f7392e
commit
ccdd8efc6e
@ -515,6 +515,7 @@ final class EntityKeyboardStaticStickersPanelComponent: Component {
|
|||||||
self.scrollView.alwaysBounceHorizontal = false
|
self.scrollView.alwaysBounceHorizontal = false
|
||||||
self.scrollView.scrollsToTop = false
|
self.scrollView.scrollsToTop = false
|
||||||
self.scrollView.delegate = self
|
self.scrollView.delegate = self
|
||||||
|
self.scrollView.clipsToBounds = false
|
||||||
|
|
||||||
self.scrollViewContainer.addSubview(self.scrollView)
|
self.scrollViewContainer.addSubview(self.scrollView)
|
||||||
self.addSubview(self.scrollViewContainer)
|
self.addSubview(self.scrollViewContainer)
|
||||||
@ -682,7 +683,7 @@ final class EntityKeyboardStaticStickersPanelComponent: Component {
|
|||||||
transition.setCornerRadius(layer: self.scrollViewContainer.layer, cornerRadius: min(availableSize.width / 2.0, availableSize.height / 2.0))
|
transition.setCornerRadius(layer: self.scrollViewContainer.layer, cornerRadius: min(availableSize.width / 2.0, availableSize.height / 2.0))
|
||||||
|
|
||||||
self.ignoreScrolling = true
|
self.ignoreScrolling = true
|
||||||
self.scrollView.frame = CGRect(origin: CGPoint(), size: CGSize(width: max(availableSize.width, 126.0), height: availableSize.height))
|
self.scrollView.frame = CGRect(origin: CGPoint(), size: CGSize(width: max(availableSize.width, 0.0), height: availableSize.height))
|
||||||
self.scrollView.contentSize = itemLayout.contentSize
|
self.scrollView.contentSize = itemLayout.contentSize
|
||||||
self.ignoreScrolling = false
|
self.ignoreScrolling = false
|
||||||
|
|
||||||
@ -1902,7 +1903,7 @@ final class EntityKeyboardTopPanelComponent: Component {
|
|||||||
if itemLayout.isExpanded {
|
if itemLayout.isExpanded {
|
||||||
expandedInset = -2.0
|
expandedInset = -2.0
|
||||||
} else {
|
} else {
|
||||||
expandedInset = -itemLayout.sideInset - (itemFrame.width + itemLayout.itemSpacing) * 2.0
|
expandedInset = -itemLayout.sideInset - (itemLayout.itemSize.width + itemLayout.itemSpacing) * 2.0
|
||||||
}
|
}
|
||||||
self.scrollView.scrollRectToVisible(itemFrame.insetBy(dx: expandedInset, dy: 0.0), animated: true)
|
self.scrollView.scrollRectToVisible(itemFrame.insetBy(dx: expandedInset, dy: 0.0), animated: true)
|
||||||
break
|
break
|
||||||
|
@ -10940,7 +10940,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return EntityInputView(context: strongSelf.context, isDark: true)
|
return EntityInputView(context: strongSelf.context, isDark: true, isSecret: strongSelf.chatLocation.peerId?.namespace == Namespaces.Peer.SecretChat)
|
||||||
})
|
})
|
||||||
inputPanelNode.interfaceInteraction = interfaceInteraction
|
inputPanelNode.interfaceInteraction = interfaceInteraction
|
||||||
inputPanelNode.effectivePresentationInterfaceState = {
|
inputPanelNode.effectivePresentationInterfaceState = {
|
||||||
@ -11180,7 +11180,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return EntityInputView(context: strongSelf.context, isDark: false)
|
return EntityInputView(context: strongSelf.context, isDark: false, isSecret: strongSelf.chatLocation.peerId?.namespace == Namespaces.Peer.SecretChat)
|
||||||
})
|
})
|
||||||
attachmentController.requestController = { [weak self, weak attachmentController] type, completion in
|
attachmentController.requestController = { [weak self, weak attachmentController] type, completion in
|
||||||
guard let strongSelf = self else {
|
guard let strongSelf = self else {
|
||||||
|
@ -86,7 +86,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static func emojiInputData(context: AccountContext, animationCache: AnimationCache, animationRenderer: MultiAnimationRenderer, isStandalone: Bool) -> Signal<EmojiPagerContentComponent, NoError> {
|
static func emojiInputData(context: AccountContext, animationCache: AnimationCache, animationRenderer: MultiAnimationRenderer, isStandalone: Bool, isSecret: Bool) -> Signal<EmojiPagerContentComponent, NoError> {
|
||||||
let hasPremium = context.engine.data.subscribe(TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId))
|
let hasPremium = context.engine.data.subscribe(TelegramEngine.EngineData.Item.Peer.Peer(id: context.account.peerId))
|
||||||
|> map { peer -> Bool in
|
|> map { peer -> Bool in
|
||||||
guard case let .user(user) = peer else {
|
guard case let .user(user) = peer else {
|
||||||
@ -135,6 +135,10 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if isSecret, case .file = item.content {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
let resultItem: EmojiPagerContentComponent.Item
|
let resultItem: EmojiPagerContentComponent.Item
|
||||||
switch item.content {
|
switch item.content {
|
||||||
case let .file(file):
|
case let .file(file):
|
||||||
@ -186,62 +190,64 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
|
|||||||
installedCollectionIds.insert(id)
|
installedCollectionIds.insert(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
for entry in view.entries {
|
if !isSecret {
|
||||||
guard let item = entry.item as? StickerPackItem else {
|
for entry in view.entries {
|
||||||
continue
|
guard let item = entry.item as? StickerPackItem else {
|
||||||
}
|
|
||||||
let resultItem = EmojiPagerContentComponent.Item(
|
|
||||||
file: item.file,
|
|
||||||
staticEmoji: nil,
|
|
||||||
subgroupId: nil
|
|
||||||
)
|
|
||||||
|
|
||||||
let supergroupId = entry.index.collectionId
|
|
||||||
let groupId: AnyHashable = supergroupId
|
|
||||||
let isPremiumLocked: Bool = item.file.isPremiumEmoji && !hasPremium
|
|
||||||
if isPremiumLocked && isPremiumDisabled {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if let groupIndex = itemGroupIndexById[groupId] {
|
|
||||||
itemGroups[groupIndex].items.append(resultItem)
|
|
||||||
} else {
|
|
||||||
itemGroupIndexById[groupId] = itemGroups.count
|
|
||||||
|
|
||||||
var title = ""
|
|
||||||
inner: for (id, info, _) in view.collectionInfos {
|
|
||||||
if id == entry.index.collectionId, let info = info as? StickerPackCollectionInfo {
|
|
||||||
title = info.title
|
|
||||||
break inner
|
|
||||||
}
|
|
||||||
}
|
|
||||||
itemGroups.append(ItemGroup(supergroupId: supergroupId, id: groupId, title: title, subtitle: nil, isPremiumLocked: isPremiumLocked, isFeatured: false, isExpandable: false, items: [resultItem]))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !isStandalone {
|
|
||||||
for featuredEmojiPack in featuredEmojiPacks {
|
|
||||||
if installedCollectionIds.contains(featuredEmojiPack.info.id) {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
let resultItem = EmojiPagerContentComponent.Item(
|
||||||
|
file: item.file,
|
||||||
|
staticEmoji: nil,
|
||||||
|
subgroupId: nil
|
||||||
|
)
|
||||||
|
|
||||||
for item in featuredEmojiPack.topItems {
|
let supergroupId = entry.index.collectionId
|
||||||
let resultItem = EmojiPagerContentComponent.Item(
|
let groupId: AnyHashable = supergroupId
|
||||||
file: item.file,
|
let isPremiumLocked: Bool = item.file.isPremiumEmoji && !hasPremium
|
||||||
staticEmoji: nil,
|
if isPremiumLocked && isPremiumDisabled {
|
||||||
subgroupId: nil
|
continue
|
||||||
)
|
}
|
||||||
|
if let groupIndex = itemGroupIndexById[groupId] {
|
||||||
|
itemGroups[groupIndex].items.append(resultItem)
|
||||||
|
} else {
|
||||||
|
itemGroupIndexById[groupId] = itemGroups.count
|
||||||
|
|
||||||
let supergroupId = featuredEmojiPack.info.id
|
var title = ""
|
||||||
let groupId: AnyHashable = supergroupId
|
inner: for (id, info, _) in view.collectionInfos {
|
||||||
let isPremiumLocked: Bool = item.file.isPremiumEmoji && !hasPremium
|
if id == entry.index.collectionId, let info = info as? StickerPackCollectionInfo {
|
||||||
if isPremiumLocked && isPremiumDisabled {
|
title = info.title
|
||||||
|
break inner
|
||||||
|
}
|
||||||
|
}
|
||||||
|
itemGroups.append(ItemGroup(supergroupId: supergroupId, id: groupId, title: title, subtitle: nil, isPremiumLocked: isPremiumLocked, isFeatured: false, isExpandable: false, items: [resultItem]))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !isStandalone {
|
||||||
|
for featuredEmojiPack in featuredEmojiPacks {
|
||||||
|
if installedCollectionIds.contains(featuredEmojiPack.info.id) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if let groupIndex = itemGroupIndexById[groupId] {
|
|
||||||
itemGroups[groupIndex].items.append(resultItem)
|
for item in featuredEmojiPack.topItems {
|
||||||
} else {
|
let resultItem = EmojiPagerContentComponent.Item(
|
||||||
itemGroupIndexById[groupId] = itemGroups.count
|
file: item.file,
|
||||||
itemGroups.append(ItemGroup(supergroupId: supergroupId, id: groupId, title: featuredEmojiPack.info.title, subtitle: nil, isPremiumLocked: isPremiumLocked, isFeatured: true, isExpandable: true, items: [resultItem]))
|
staticEmoji: nil,
|
||||||
|
subgroupId: nil
|
||||||
|
)
|
||||||
|
|
||||||
|
let supergroupId = featuredEmojiPack.info.id
|
||||||
|
let groupId: AnyHashable = supergroupId
|
||||||
|
let isPremiumLocked: Bool = item.file.isPremiumEmoji && !hasPremium
|
||||||
|
if isPremiumLocked && isPremiumDisabled {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if let groupIndex = itemGroupIndexById[groupId] {
|
||||||
|
itemGroups[groupIndex].items.append(resultItem)
|
||||||
|
} else {
|
||||||
|
itemGroupIndexById[groupId] = itemGroups.count
|
||||||
|
itemGroups.append(ItemGroup(supergroupId: supergroupId, id: groupId, title: featuredEmojiPack.info.title, subtitle: nil, isPremiumLocked: isPremiumLocked, isFeatured: true, isExpandable: true, items: [resultItem]))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -303,7 +309,7 @@ final class ChatEntityKeyboardInputNode: ChatInputNode {
|
|||||||
animationRenderer = MultiAnimationRendererImpl()
|
animationRenderer = MultiAnimationRendererImpl()
|
||||||
//}
|
//}
|
||||||
|
|
||||||
let emojiItems = emojiInputData(context: context, animationCache: animationCache, animationRenderer: animationRenderer, isStandalone: false)
|
let emojiItems = emojiInputData(context: context, animationCache: animationCache, animationRenderer: animationRenderer, isStandalone: false, isSecret: chatPeerId?.namespace == Namespaces.Peer.SecretChat)
|
||||||
|
|
||||||
let stickerNamespaces: [ItemCollectionId.Namespace] = [Namespaces.ItemCollection.CloudStickerPacks]
|
let stickerNamespaces: [ItemCollectionId.Namespace] = [Namespaces.ItemCollection.CloudStickerPacks]
|
||||||
let stickerOrderedItemListCollectionIds: [Int32] = [Namespaces.OrderedItemList.CloudSavedStickers, Namespaces.OrderedItemList.CloudRecentStickers, Namespaces.OrderedItemList.PremiumStickers, Namespaces.OrderedItemList.CloudPremiumStickers]
|
let stickerOrderedItemListCollectionIds: [Int32] = [Namespaces.OrderedItemList.CloudSavedStickers, Namespaces.OrderedItemList.CloudRecentStickers, Namespaces.OrderedItemList.PremiumStickers, Namespaces.OrderedItemList.CloudPremiumStickers]
|
||||||
@ -1925,7 +1931,8 @@ final class EntityInputView: UIView, AttachmentTextInputPanelInputView, UIInputV
|
|||||||
|
|
||||||
init(
|
init(
|
||||||
context: AccountContext,
|
context: AccountContext,
|
||||||
isDark: Bool
|
isDark: Bool,
|
||||||
|
isSecret: Bool
|
||||||
) {
|
) {
|
||||||
self.context = context
|
self.context = context
|
||||||
|
|
||||||
@ -2039,7 +2046,7 @@ final class EntityInputView: UIView, AttachmentTextInputPanelInputView, UIInputV
|
|||||||
|
|
||||||
let semaphore = DispatchSemaphore(value: 0)
|
let semaphore = DispatchSemaphore(value: 0)
|
||||||
var emojiComponent: EmojiPagerContentComponent?
|
var emojiComponent: EmojiPagerContentComponent?
|
||||||
let _ = ChatEntityKeyboardInputNode.emojiInputData(context: context, animationCache: self.animationCache, animationRenderer: self.animationRenderer, isStandalone: true).start(next: { value in
|
let _ = ChatEntityKeyboardInputNode.emojiInputData(context: context, animationCache: self.animationCache, animationRenderer: self.animationRenderer, isStandalone: true, isSecret: isSecret).start(next: { value in
|
||||||
emojiComponent = value
|
emojiComponent = value
|
||||||
semaphore.signal()
|
semaphore.signal()
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user