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),
panelHighlightedIconBackgroundColor: UIColor(rgb: 0x858e99, alpha: 0.2),
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),
stickersSectionTextColor: UIColor(rgb: 0x9099a2),
stickersSearchBackgroundColor: UIColor(rgb: 0xd9dbe1),

View File

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

View File

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