Emoji input improvements

This commit is contained in:
Ali
2022-07-22 02:12:10 +02:00
parent 3384d86415
commit 7b663a3445
28 changed files with 1311 additions and 466 deletions

View File

@@ -171,6 +171,8 @@ public final class EntityKeyboardComponent: Component {
}
public final class View: UIView {
private let tintContainerView: UIView
private let pagerView: ComponentHostView<EntityKeyboardChildEnvironment>
private var component: EntityKeyboardComponent?
@@ -191,6 +193,7 @@ public final class EntityKeyboardComponent: Component {
}
override init(frame: CGRect) {
self.tintContainerView = UIView()
self.pagerView = ComponentHostView<EntityKeyboardChildEnvironment>()
super.init(frame: frame)
@@ -392,7 +395,7 @@ public final class EntityKeyboardComponent: Component {
maxSize: nil
)),
action: {
stickerContent.inputInteraction.openStickerSettings()
stickerContent.inputInteractionHolder.inputInteraction?.openStickerSettings()
}
).minSize(CGSize(width: 38.0, height: 38.0)))))
}
@@ -494,7 +497,7 @@ public final class EntityKeyboardComponent: Component {
component.switchToTextInput()
}
).minSize(CGSize(width: 38.0, height: 38.0)))))
let deleteBackwards = component.emojiContent.inputInteraction.deleteBackwards
let deleteBackwards = component.emojiContent.inputInteractionHolder.inputInteraction?.deleteBackwards
contentAccessoryRightButtons.append(AnyComponentWithIdentity(id: "emoji", component: AnyComponent(Button(
content: AnyComponent(BundleIconComponent(
name: "Chat/Input/Media/EntityInputClearIcon",
@@ -502,11 +505,11 @@ public final class EntityKeyboardComponent: Component {
maxSize: nil
)),
action: {
deleteBackwards()
deleteBackwards?()
AudioServicesPlaySystemSound(1155)
}
).withHoldAction({
deleteBackwards()
deleteBackwards?()
AudioServicesPlaySystemSound(1155)
}).minSize(CGSize(width: 38.0, height: 38.0)))))
@@ -529,9 +532,10 @@ public final class EntityKeyboardComponent: Component {
contentAccessoryLeftButtons: contentAccessoryLeftButtons,
contentAccessoryRightButtons: contentAccessoryRightButtons,
defaultId: component.defaultToEmojiTab ? "emoji" : "stickers",
contentBackground: AnyComponent(BlurredBackgroundComponent(
color: component.theme.chat.inputMediaPanel.stickersBackgroundColor.withMultipliedAlpha(0.75)
)),
contentBackground: nil/*AnyComponent(BlurredBackgroundComponent(
color: component.theme.chat.inputMediaPanel.stickersBackgroundColor.withMultipliedAlpha(0.75),
tintContainerView: self.tintContainerView
))*/,
topPanel: AnyComponent(EntityKeyboardTopContainerPanelComponent(
theme: component.theme,
overflowHeight: component.hiddenInputHeight,
@@ -542,7 +546,7 @@ public final class EntityKeyboardComponent: Component {
theme: component.theme,
bottomInset: component.bottomInset,
deleteBackwards: { [weak self] in
self?.component?.emojiContent.inputInteraction.deleteBackwards()
self?.component?.emojiContent.inputInteractionHolder.inputInteraction?.deleteBackwards()
AudioServicesPlaySystemSound(0x451)
}
)),

View File

@@ -213,7 +213,7 @@ public final class GifPagerContentComponent: Component {
return true
}
public final class View: ContextControllerSourceView, UIScrollViewDelegate {
public final class View: ContextControllerSourceView, PagerContentViewWithBackground, UIScrollViewDelegate {
private struct ItemGroupDescription: Equatable {
let hasTitle: Bool
let itemCount: Int
@@ -400,6 +400,8 @@ public final class GifPagerContentComponent: Component {
private final class ContentScrollView: UIScrollView, PagerExpandableScrollView {
}
private let backgroundView: BlurredBackgroundView
private let shimmerHostView: PortalSourceView
private let standaloneShimmerEffect: StandaloneShimmerEffect
@@ -418,6 +420,8 @@ public final class GifPagerContentComponent: Component {
private var currentLoadMoreToken: String?
override init(frame: CGRect) {
self.backgroundView = BlurredBackgroundView(color: nil)
self.shimmerHostView = PortalSourceView()
self.standaloneShimmerEffect = StandaloneShimmerEffect()
@@ -427,6 +431,8 @@ public final class GifPagerContentComponent: Component {
super.init(frame: frame)
self.addSubview(self.backgroundView)
self.shimmerHostView.alpha = 0.0
self.addSubview(self.shimmerHostView)
@@ -745,6 +751,15 @@ public final class GifPagerContentComponent: Component {
}
}
public func pagerUpdateBackground(backgroundFrame: CGRect, transition: Transition) {
guard let theme = self.theme else {
return
}
self.backgroundView.updateColor(color: theme.chat.inputMediaPanel.stickersBackgroundColor.withMultipliedAlpha(0.75), enableBlur: true, forceKeepBlur: false, transition: transition.containedViewLayoutTransition)
transition.setFrame(view: self.backgroundView, frame: backgroundFrame)
self.backgroundView.update(size: backgroundFrame.size, transition: transition.containedViewLayoutTransition)
}
func update(component: GifPagerContentComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<EnvironmentType>, transition: Transition) -> CGSize {
var contentReset = false
if let previousComponent = self.component, previousComponent.subject != component.subject {