mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 11:23:48 +00:00
Emoji improvements
This commit is contained in:
parent
58c7102007
commit
c95c59661a
@ -1205,7 +1205,11 @@ private final class GroupExpandActionButton: UIButton {
|
||||
self.currentTextLayout = (title, color, textConstrainedWidth, textSize)
|
||||
}
|
||||
|
||||
let size = CGSize(width: textSize.width + 10.0 * 2.0, height: 28.0)
|
||||
var sideInset: CGFloat = 10.0
|
||||
if textSize.width > 24.0 {
|
||||
sideInset = 6.0
|
||||
}
|
||||
let size = CGSize(width: textSize.width + sideInset * 2.0, height: 28.0)
|
||||
|
||||
let textFrame = CGRect(origin: CGPoint(x: floor((size.width - textSize.width) / 2.0), y: floor((size.height - textSize.height) / 2.0)), size: textSize)
|
||||
self.textLayer.frame = textFrame
|
||||
@ -2834,6 +2838,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
let groupHeaderPoint = self.scrollView.convert(locationInScrollView, to: groupHeader)
|
||||
if let clearIconLayer = groupHeader.clearIconLayer, clearIconLayer.frame.insetBy(dx: -4.0, dy: -4.0).contains(groupHeaderPoint) {
|
||||
component.inputInteractionHolder.inputInteraction?.clearGroup(id)
|
||||
return
|
||||
} else {
|
||||
if groupHeader.tapGesture(recognizer) {
|
||||
return
|
||||
@ -3019,8 +3024,16 @@ public final class EmojiPagerContentComponent: Component {
|
||||
|
||||
let contentAnimation = transition.userData(ContentAnimation.self)
|
||||
var transitionHintInstalledGroupId: AnyHashable?
|
||||
if let contentAnimation = contentAnimation, case let .groupInstalled(groupId) = contentAnimation.type {
|
||||
var transitionHintExpandedGroupId: AnyHashable?
|
||||
if let contentAnimation = contentAnimation {
|
||||
switch contentAnimation.type {
|
||||
case let .groupInstalled(groupId):
|
||||
transitionHintInstalledGroupId = groupId
|
||||
case let .groupExpanded(groupId):
|
||||
transitionHintExpandedGroupId = groupId
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
for groupItems in itemLayout.visibleItems(for: effectiveVisibleBounds) {
|
||||
@ -3504,10 +3517,21 @@ public final class EmojiPagerContentComponent: Component {
|
||||
for (id, button) in self.visibleGroupExpandActionButtons {
|
||||
if !validGroupExpandActionButtons.contains(id) {
|
||||
removedGroupExpandActionButtonIds.append(id)
|
||||
|
||||
if !transition.animation.isImmediate && transitionHintExpandedGroupId == id {
|
||||
button.alpha = 0.0
|
||||
button.layer.animateScale(from: 1.0, to: 0.5, duration: 0.2)
|
||||
let tintContainerLayer = button.tintContainerLayer
|
||||
button.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, completion: { [weak button, weak tintContainerLayer] _ in
|
||||
button?.removeFromSuperview()
|
||||
tintContainerLayer?.removeFromSuperlayer()
|
||||
})
|
||||
} else {
|
||||
button.removeFromSuperview()
|
||||
button.tintContainerLayer.removeFromSuperlayer()
|
||||
}
|
||||
}
|
||||
}
|
||||
for id in removedGroupExpandActionButtonIds {
|
||||
self.visibleGroupExpandActionButtons.removeValue(forKey: id)
|
||||
}
|
||||
|
@ -700,7 +700,7 @@ final class EntityKeyboardStaticStickersPanelComponent: Component {
|
||||
for i in 0 ..< items.count {
|
||||
if AnyHashable(items[i].rawValue) == scrollToItem {
|
||||
let itemFrame = itemLayout.frame(at: i)
|
||||
self.scrollView.scrollRectToVisible(itemFrame.insetBy(dx: -itemLayout.sideInset, dy: 0.0), animated: true)
|
||||
self.scrollView.scrollRectToVisible(itemFrame.insetBy(dx: -itemLayout.sideInset - (itemLayout.itemSpacing + itemFrame.width) * 2.0, dy: 0.0), animated: true)
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -1898,7 +1898,13 @@ final class EntityKeyboardTopPanelComponent: Component {
|
||||
for i in 0 ..< component.items.count {
|
||||
if component.items[i].id == itemId {
|
||||
let itemFrame = itemLayout.containerFrame(at: i)
|
||||
self.scrollView.scrollRectToVisible(itemFrame.insetBy(dx: -2.0, dy: 0.0), animated: true)
|
||||
let expandedInset: CGFloat
|
||||
if itemLayout.isExpanded {
|
||||
expandedInset = -2.0
|
||||
} else {
|
||||
expandedInset = -itemLayout.sideInset - (itemFrame.width + itemLayout.itemSpacing) * 2.0
|
||||
}
|
||||
self.scrollView.scrollRectToVisible(itemFrame.insetBy(dx: expandedInset, dy: 0.0), animated: true)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -535,26 +535,37 @@ public final class MultiAnimationRendererImpl: MultiAnimationRenderer {
|
||||
|
||||
private var groupContext: GroupContext?
|
||||
private var frameSkip: Int
|
||||
private var displayLink: ConstantDisplayLinkAnimator?
|
||||
private var displayTimer: Foundation.Timer?
|
||||
|
||||
private(set) var isPlaying: Bool = false {
|
||||
didSet {
|
||||
if self.isPlaying != oldValue {
|
||||
if self.isPlaying {
|
||||
if self.displayLink == nil {
|
||||
self.displayLink = ConstantDisplayLinkAnimator { [weak self] in
|
||||
if self.displayTimer == nil {
|
||||
final class TimerTarget: NSObject {
|
||||
private let f: () -> Void
|
||||
|
||||
init(_ f: @escaping () -> Void) {
|
||||
self.f = f
|
||||
}
|
||||
|
||||
@objc func timerEvent() {
|
||||
self.f()
|
||||
}
|
||||
}
|
||||
let displayTimer = Foundation.Timer(timeInterval: CGFloat(self.frameSkip) / 60.0, target: TimerTarget { [weak self] in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.animationTick()
|
||||
}
|
||||
self.displayLink?.frameInterval = self.frameSkip
|
||||
self.displayLink?.isPaused = false
|
||||
}, selector: #selector(TimerTarget.timerEvent), userInfo: nil, repeats: true)
|
||||
self.displayTimer = displayTimer
|
||||
RunLoop.main.add(displayTimer, forMode: .common)
|
||||
}
|
||||
} else {
|
||||
if let displayLink = self.displayLink {
|
||||
self.displayLink = nil
|
||||
displayLink.invalidate()
|
||||
if let displayTimer = self.displayTimer {
|
||||
self.displayTimer = nil
|
||||
displayTimer.invalidate()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -376,8 +376,10 @@ private func updatedContextQueryResultStateForQuery(context: AccountContext, pee
|
||||
switch attribute {
|
||||
case let .CustomEmoji(_, alt, _):
|
||||
if !alt.isEmpty, let keyword = allEmoticons[alt] {
|
||||
if !item.file.isPremiumEmoji || hasPremium {
|
||||
result.append((alt, item.file, keyword))
|
||||
}
|
||||
}
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
@ -84,9 +84,11 @@ private final class AccessoryItemIconButtonNode: HighlightTrackingButtonNode {
|
||||
if highlighted {
|
||||
strongSelf.layer.removeAnimation(forKey: "opacity")
|
||||
strongSelf.alpha = 0.4
|
||||
strongSelf.layer.allowsGroupOpacity = true
|
||||
} else {
|
||||
strongSelf.alpha = 1.0
|
||||
strongSelf.layer.animateAlpha(from: 0.4, to: 1.0, duration: 0.2)
|
||||
strongSelf.layer.allowsGroupOpacity = false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -269,7 +271,7 @@ private final class AccessoryItemIconButtonNode: HighlightTrackingButtonNode {
|
||||
|
||||
var colors: [String: UIColor] = [:]
|
||||
for colorKey in colorKeys {
|
||||
colors[colorKey] = self.theme.chat.inputPanel.inputControlColor
|
||||
colors[colorKey] = self.theme.chat.inputPanel.inputControlColor.blitOver(self.theme.chat.inputPanel.inputBackgroundColor, alpha: 1.0)
|
||||
}
|
||||
|
||||
let _ = animationView.update(
|
||||
|
Loading…
x
Reference in New Issue
Block a user