Emoji improvements

This commit is contained in:
Ali
2022-07-24 16:23:12 +02:00
parent d7a851d61f
commit 99207385b1
3 changed files with 16 additions and 5 deletions

View File

@@ -863,7 +863,7 @@ public func makeDefaultDayPresentationTheme(extendingThemeReference: Presentatio
panelIconColor: UIColor(rgb: 0x858e99), panelIconColor: UIColor(rgb: 0x858e99),
panelHighlightedIconBackgroundColor: UIColor(rgb: 0x858e99, alpha: 0.2), panelHighlightedIconBackgroundColor: UIColor(rgb: 0x858e99, alpha: 0.2),
panelHighlightedIconColor: UIColor(rgb: 0x4D5561), panelHighlightedIconColor: UIColor(rgb: 0x4D5561),
panelContentVibrantOverlayColor: day ? UIColor(white: 0.0, alpha: 0.3) : UIColor(white: 0.6, alpha: 0.65), panelContentVibrantOverlayColor: day ? UIColor(white: 0.0, alpha: 0.3) : UIColor(white: 0.65, alpha: 0.65),
stickersBackgroundColor: UIColor(rgb: 0xe8ebf0), stickersBackgroundColor: UIColor(rgb: 0xe8ebf0),
stickersSectionTextColor: UIColor(rgb: 0x9099a2), stickersSectionTextColor: UIColor(rgb: 0x9099a2),
stickersSearchBackgroundColor: UIColor(rgb: 0xd9dbe1), stickersSearchBackgroundColor: UIColor(rgb: 0xd9dbe1),

View File

@@ -285,6 +285,7 @@ public final class EntityKeyboardComponent: Component {
contentTopPanels.append(AnyComponentWithIdentity(id: "gifs", component: AnyComponent(EntityKeyboardTopPanelComponent( contentTopPanels.append(AnyComponentWithIdentity(id: "gifs", component: AnyComponent(EntityKeyboardTopPanelComponent(
theme: component.theme, theme: component.theme,
items: topGifItems, items: topGifItems,
containerSideInset: component.containerInsets.left,
forceActiveItemId: defaultActiveGifItemId, forceActiveItemId: defaultActiveGifItemId,
activeContentItemIdUpdated: gifsContentItemIdUpdated, activeContentItemIdUpdated: gifsContentItemIdUpdated,
reorderItems: { _ in reorderItems: { _ in
@@ -352,7 +353,7 @@ public final class EntityKeyboardComponent: Component {
if let file = itemGroup.items[0].file { if let file = itemGroup.items[0].file {
topStickerItems.append(EntityKeyboardTopPanelComponent.Item( topStickerItems.append(EntityKeyboardTopPanelComponent.Item(
id: itemGroup.supergroupId, id: itemGroup.supergroupId,
isReorderable: true, isReorderable: !itemGroup.isFeatured,
content: AnyComponent(EntityKeyboardAnimationTopPanelComponent( content: AnyComponent(EntityKeyboardAnimationTopPanelComponent(
context: stickerContent.context, context: stickerContent.context,
file: file, file: file,
@@ -375,6 +376,7 @@ public final class EntityKeyboardComponent: Component {
contentTopPanels.append(AnyComponentWithIdentity(id: "stickers", component: AnyComponent(EntityKeyboardTopPanelComponent( contentTopPanels.append(AnyComponentWithIdentity(id: "stickers", component: AnyComponent(EntityKeyboardTopPanelComponent(
theme: component.theme, theme: component.theme,
items: topStickerItems, items: topStickerItems,
containerSideInset: component.containerInsets.left,
defaultActiveItemId: stickerContent.itemGroups.first?.groupId, defaultActiveItemId: stickerContent.itemGroups.first?.groupId,
activeContentItemIdUpdated: stickersContentItemIdUpdated, activeContentItemIdUpdated: stickersContentItemIdUpdated,
reorderItems: { [weak self] items in reorderItems: { [weak self] items in
@@ -478,6 +480,7 @@ public final class EntityKeyboardComponent: Component {
contentTopPanels.append(AnyComponentWithIdentity(id: "emoji", component: AnyComponent(EntityKeyboardTopPanelComponent( contentTopPanels.append(AnyComponentWithIdentity(id: "emoji", component: AnyComponent(EntityKeyboardTopPanelComponent(
theme: component.theme, theme: component.theme,
items: topEmojiItems, items: topEmojiItems,
containerSideInset: component.containerInsets.left,
activeContentItemIdUpdated: emojiContentItemIdUpdated, activeContentItemIdUpdated: emojiContentItemIdUpdated,
reorderItems: { [weak self] items in reorderItems: { [weak self] items in
guard let strongSelf = self else { guard let strongSelf = self else {

View File

@@ -1010,6 +1010,7 @@ final class EntityKeyboardTopPanelComponent: Component {
let theme: PresentationTheme let theme: PresentationTheme
let items: [Item] let items: [Item]
let containerSideInset: CGFloat
let defaultActiveItemId: AnyHashable? let defaultActiveItemId: AnyHashable?
let forceActiveItemId: AnyHashable? let forceActiveItemId: AnyHashable?
let activeContentItemIdUpdated: ActionSlot<(AnyHashable, AnyHashable?, Transition)> let activeContentItemIdUpdated: ActionSlot<(AnyHashable, AnyHashable?, Transition)>
@@ -1018,6 +1019,7 @@ final class EntityKeyboardTopPanelComponent: Component {
init( init(
theme: PresentationTheme, theme: PresentationTheme,
items: [Item], items: [Item],
containerSideInset: CGFloat,
defaultActiveItemId: AnyHashable? = nil, defaultActiveItemId: AnyHashable? = nil,
forceActiveItemId: AnyHashable? = nil, forceActiveItemId: AnyHashable? = nil,
activeContentItemIdUpdated: ActionSlot<(AnyHashable, AnyHashable?, Transition)>, activeContentItemIdUpdated: ActionSlot<(AnyHashable, AnyHashable?, Transition)>,
@@ -1025,6 +1027,7 @@ final class EntityKeyboardTopPanelComponent: Component {
) { ) {
self.theme = theme self.theme = theme
self.items = items self.items = items
self.containerSideInset = containerSideInset
self.defaultActiveItemId = defaultActiveItemId self.defaultActiveItemId = defaultActiveItemId
self.forceActiveItemId = forceActiveItemId self.forceActiveItemId = forceActiveItemId
self.activeContentItemIdUpdated = activeContentItemIdUpdated self.activeContentItemIdUpdated = activeContentItemIdUpdated
@@ -1038,6 +1041,9 @@ final class EntityKeyboardTopPanelComponent: Component {
if lhs.items != rhs.items { if lhs.items != rhs.items {
return false return false
} }
if lhs.containerSideInset != rhs.containerSideInset {
return false
}
if lhs.defaultActiveItemId != rhs.defaultActiveItemId { if lhs.defaultActiveItemId != rhs.defaultActiveItemId {
return false return false
} }
@@ -1064,7 +1070,7 @@ final class EntityKeyboardTopPanelComponent: Component {
} }
let topInset: CGFloat = -3.0 let topInset: CGFloat = -3.0
let sideInset: CGFloat = 7.0 let sideInset: CGFloat
let itemSize: CGSize let itemSize: CGSize
let staticItemSize: CGSize let staticItemSize: CGSize
let staticExpandedItemSize: CGSize let staticExpandedItemSize: CGSize
@@ -1074,7 +1080,9 @@ final class EntityKeyboardTopPanelComponent: Component {
let isExpanded: Bool let isExpanded: Bool
let items: [Item] let items: [Item]
init(isExpanded: Bool, height: CGFloat, items: [ItemDescription]) { init(isExpanded: Bool, containerSideInset: CGFloat, height: CGFloat, items: [ItemDescription]) {
self.sideInset = containerSideInset + 7.0
self.isExpanded = isExpanded self.isExpanded = isExpanded
self.itemSize = self.isExpanded ? CGSize(width: 54.0, height: 68.0) : CGSize(width: 28.0, height: 28.0) self.itemSize = self.isExpanded ? CGSize(width: 54.0, height: 68.0) : CGSize(width: 28.0, height: 28.0)
self.staticItemSize = self.itemSize self.staticItemSize = self.itemSize
@@ -1665,7 +1673,7 @@ final class EntityKeyboardTopPanelComponent: Component {
} }
let previousItemLayout = self.itemLayout let previousItemLayout = self.itemLayout
let itemLayout = ItemLayout(isExpanded: isExpanded, height: availableSize.height, items: self.items.map { item -> ItemLayout.ItemDescription in let itemLayout = ItemLayout(isExpanded: isExpanded, containerSideInset: component.containerSideInset, height: availableSize.height, items: self.items.map { item -> ItemLayout.ItemDescription in
let isStatic = item.id == AnyHashable("static") let isStatic = item.id == AnyHashable("static")
return ItemLayout.ItemDescription( return ItemLayout.ItemDescription(
isStatic: isStatic, isStatic: isStatic,