mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20: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)
|
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)
|
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
|
self.textLayer.frame = textFrame
|
||||||
@ -2834,6 +2838,7 @@ public final class EmojiPagerContentComponent: Component {
|
|||||||
let groupHeaderPoint = self.scrollView.convert(locationInScrollView, to: groupHeader)
|
let groupHeaderPoint = self.scrollView.convert(locationInScrollView, to: groupHeader)
|
||||||
if let clearIconLayer = groupHeader.clearIconLayer, clearIconLayer.frame.insetBy(dx: -4.0, dy: -4.0).contains(groupHeaderPoint) {
|
if let clearIconLayer = groupHeader.clearIconLayer, clearIconLayer.frame.insetBy(dx: -4.0, dy: -4.0).contains(groupHeaderPoint) {
|
||||||
component.inputInteractionHolder.inputInteraction?.clearGroup(id)
|
component.inputInteractionHolder.inputInteraction?.clearGroup(id)
|
||||||
|
return
|
||||||
} else {
|
} else {
|
||||||
if groupHeader.tapGesture(recognizer) {
|
if groupHeader.tapGesture(recognizer) {
|
||||||
return
|
return
|
||||||
@ -3019,8 +3024,16 @@ public final class EmojiPagerContentComponent: Component {
|
|||||||
|
|
||||||
let contentAnimation = transition.userData(ContentAnimation.self)
|
let contentAnimation = transition.userData(ContentAnimation.self)
|
||||||
var transitionHintInstalledGroupId: AnyHashable?
|
var transitionHintInstalledGroupId: AnyHashable?
|
||||||
if let contentAnimation = contentAnimation, case let .groupInstalled(groupId) = contentAnimation.type {
|
var transitionHintExpandedGroupId: AnyHashable?
|
||||||
transitionHintInstalledGroupId = groupId
|
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) {
|
for groupItems in itemLayout.visibleItems(for: effectiveVisibleBounds) {
|
||||||
@ -3504,8 +3517,19 @@ public final class EmojiPagerContentComponent: Component {
|
|||||||
for (id, button) in self.visibleGroupExpandActionButtons {
|
for (id, button) in self.visibleGroupExpandActionButtons {
|
||||||
if !validGroupExpandActionButtons.contains(id) {
|
if !validGroupExpandActionButtons.contains(id) {
|
||||||
removedGroupExpandActionButtonIds.append(id)
|
removedGroupExpandActionButtonIds.append(id)
|
||||||
button.removeFromSuperview()
|
|
||||||
button.tintContainerLayer.removeFromSuperlayer()
|
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 {
|
for id in removedGroupExpandActionButtonIds {
|
||||||
|
@ -700,7 +700,7 @@ final class EntityKeyboardStaticStickersPanelComponent: Component {
|
|||||||
for i in 0 ..< items.count {
|
for i in 0 ..< items.count {
|
||||||
if AnyHashable(items[i].rawValue) == scrollToItem {
|
if AnyHashable(items[i].rawValue) == scrollToItem {
|
||||||
let itemFrame = itemLayout.frame(at: i)
|
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
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1898,7 +1898,13 @@ final class EntityKeyboardTopPanelComponent: Component {
|
|||||||
for i in 0 ..< component.items.count {
|
for i in 0 ..< component.items.count {
|
||||||
if component.items[i].id == itemId {
|
if component.items[i].id == itemId {
|
||||||
let itemFrame = itemLayout.containerFrame(at: i)
|
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
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -535,26 +535,37 @@ public final class MultiAnimationRendererImpl: MultiAnimationRenderer {
|
|||||||
|
|
||||||
private var groupContext: GroupContext?
|
private var groupContext: GroupContext?
|
||||||
private var frameSkip: Int
|
private var frameSkip: Int
|
||||||
private var displayLink: ConstantDisplayLinkAnimator?
|
private var displayTimer: Foundation.Timer?
|
||||||
|
|
||||||
private(set) var isPlaying: Bool = false {
|
private(set) var isPlaying: Bool = false {
|
||||||
didSet {
|
didSet {
|
||||||
if self.isPlaying != oldValue {
|
if self.isPlaying != oldValue {
|
||||||
if self.isPlaying {
|
if self.isPlaying {
|
||||||
if self.displayLink == nil {
|
if self.displayTimer == nil {
|
||||||
self.displayLink = ConstantDisplayLinkAnimator { [weak self] in
|
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 {
|
guard let strongSelf = self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
strongSelf.animationTick()
|
strongSelf.animationTick()
|
||||||
}
|
}, selector: #selector(TimerTarget.timerEvent), userInfo: nil, repeats: true)
|
||||||
self.displayLink?.frameInterval = self.frameSkip
|
self.displayTimer = displayTimer
|
||||||
self.displayLink?.isPaused = false
|
RunLoop.main.add(displayTimer, forMode: .common)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if let displayLink = self.displayLink {
|
if let displayTimer = self.displayTimer {
|
||||||
self.displayLink = nil
|
self.displayTimer = nil
|
||||||
displayLink.invalidate()
|
displayTimer.invalidate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,9 @@ private func updatedContextQueryResultStateForQuery(context: AccountContext, pee
|
|||||||
switch attribute {
|
switch attribute {
|
||||||
case let .CustomEmoji(_, alt, _):
|
case let .CustomEmoji(_, alt, _):
|
||||||
if !alt.isEmpty, let keyword = allEmoticons[alt] {
|
if !alt.isEmpty, let keyword = allEmoticons[alt] {
|
||||||
result.append((alt, item.file, keyword))
|
if !item.file.isPremiumEmoji || hasPremium {
|
||||||
|
result.append((alt, item.file, keyword))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
|
@ -60,11 +60,11 @@ private final class AccessoryItemIconButtonNode: HighlightTrackingButtonNode {
|
|||||||
self.addSubnode(self.iconImageNode)
|
self.addSubnode(self.iconImageNode)
|
||||||
|
|
||||||
switch item {
|
switch item {
|
||||||
case .input, .botInput:
|
case .input, .botInput:
|
||||||
self.iconImageNode.isHidden = true
|
self.iconImageNode.isHidden = true
|
||||||
self.animationView = ComponentView<Empty>()
|
self.animationView = ComponentView<Empty>()
|
||||||
default:
|
default:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if let text = text {
|
if let text = text {
|
||||||
@ -84,9 +84,11 @@ private final class AccessoryItemIconButtonNode: HighlightTrackingButtonNode {
|
|||||||
if highlighted {
|
if highlighted {
|
||||||
strongSelf.layer.removeAnimation(forKey: "opacity")
|
strongSelf.layer.removeAnimation(forKey: "opacity")
|
||||||
strongSelf.alpha = 0.4
|
strongSelf.alpha = 0.4
|
||||||
|
strongSelf.layer.allowsGroupOpacity = true
|
||||||
} else {
|
} else {
|
||||||
strongSelf.alpha = 1.0
|
strongSelf.alpha = 1.0
|
||||||
strongSelf.layer.animateAlpha(from: 0.4, to: 1.0, duration: 0.2)
|
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] = [:]
|
var colors: [String: UIColor] = [:]
|
||||||
for colorKey in colorKeys {
|
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(
|
let _ = animationView.update(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user