[WIP] Stickers editor

This commit is contained in:
Ilya Laktyushin 2024-04-11 18:00:26 +04:00
parent a56710f91f
commit fce792b02f
8 changed files with 32 additions and 34 deletions

View File

@ -134,8 +134,9 @@ final class PeekControllerNode: ViewControllerTracingNode {
self.addSubnode(self.darkDimNode)
self.containerNode.addSubnode(self.contentNode)
self.addSubnode(self.containerNode)
self.addSubnode(self.actionsStackNode)
self.addSubnode(self.containerNode)
if let fullScreenAccessoryNode = self.fullScreenAccessoryNode {
self.fullScreenAccessoryNode?.dismiss = { [weak self] in

View File

@ -110,7 +110,7 @@ public class DrawingReactionEntityView: DrawingStickerEntityView {
private weak var reactionContextNode: ReactionContextNode?
fileprivate func presentReactionSelection() {
guard let containerView = self.containerView, let superview = containerView.superview?.superview?.superview?.superview, self.reactionContextNode == nil else {
guard let containerView = self.containerView, let superview = containerView.superview?.superview?.superview?.superview?.superview?.superview, self.reactionContextNode == nil else {
return
}

View File

@ -2144,6 +2144,7 @@ public final class ReactionContextNode: ASDisplayNode, ASScrollViewDelegate {
itemDelay = mainCircleDelay + Double(i) * 0.06
}
itemNode.willAppear(animated: true)
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + itemDelay * UIView.animationDurationFactor(), execute: { [weak itemNode] in
guard let itemNode = itemNode else {
return

View File

@ -47,6 +47,7 @@ protocol ReactionItemNode: ASDisplayNode {
var maskNode: ASDisplayNode? { get }
func willAppear(animated: Bool)
func appear(animated: Bool)
func updateLayout(size: CGSize, isExpanded: Bool, largeExpanded: Bool, isPreviewing: Bool, transition: ContainedViewLayoutTransition)
}
@ -181,6 +182,10 @@ public final class ReactionNode: ASDisplayNode, ReactionItemNode {
return nil
}
func willAppear(animated: Bool) {
}
func appear(animated: Bool) {
if animated {
if self.item.isCustom {
@ -556,6 +561,10 @@ final class PremiumReactionsNode: ASDisplayNode, ReactionItemNode {
self.starsNode = starsNode
}
func willAppear(animated: Bool) {
}
func appear(animated: Bool) {
if animated {
let delay: Double = 0.1
@ -624,6 +633,13 @@ final class EmojiItemNode: ASDisplayNode, ReactionItemNode {
self.addSubnode(self.imageNode)
}
func willAppear(animated: Bool) {
if animated {
let initialScale: CGFloat = 0.25
self.imageNode.transform = CATransform3DMakeScale(initialScale, initialScale, 1.0)
}
}
func appear(animated: Bool) {
if animated {
let delay: Double = 0.1
@ -631,6 +647,7 @@ final class EmojiItemNode: ASDisplayNode, ReactionItemNode {
let damping: CGFloat = 60.0
let initialScale: CGFloat = 0.25
self.imageNode.transform = CATransform3DIdentity
self.imageNode.layer.animateSpring(from: initialScale as NSNumber, to: 1.0 as NSNumber, keyPath: "transform.scale", duration: duration, delay: delay, damping: damping)
self.selectionView?.layer.animateAlpha(from: 0.0, to: self.selectionView?.alpha ?? 1.0, duration: 0.2)

View File

@ -2815,8 +2815,10 @@ public class CameraScreen: ViewController {
self.requestAudioSession()
if case .story = mode {
self.postingAvailabilityPromise.set(self.context.engine.messages.checkStoriesUploadAvailability(target: .myStories))
}
}
required public init(coder: NSCoder) {
preconditionFailure()

View File

@ -1190,7 +1190,7 @@ public extension EmojiPagerContentComponent {
}
}
let hasRecentEmoji = ![.reaction(onlyTop: true), .reaction(onlyTop: false), .quickReaction, .status, .profilePhoto, .groupPhoto, .topicIcon, .backgroundIcon, .reactionList, .messageTag].contains(subject)
let hasRecentEmoji = ![.reaction(onlyTop: true), .reaction(onlyTop: false), .quickReaction, .status, .profilePhoto, .groupPhoto, .topicIcon, .backgroundIcon, .reactionList, .messageTag, .stickerAlt].contains(subject)
if let recentEmoji = recentEmoji, hasRecentEmoji {
for item in recentEmoji.items {

View File

@ -51,8 +51,6 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"accordion": "🪗",
"acorn": "🌰",
"acrobat": "🤸",
"adult": "🧑",
"adult_cat": "🐈",
"agriculture": "🌾",
"aircraft": "✈️",
"airplane": "✈️",
@ -237,7 +235,6 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"canyon": "🏞️",
"caprese": "🥗",
"car": "🚗",
"car_seat": "🚗",
"caramel": "🍬",
"cardboard_box": "📦",
"carnation": "🌺",
@ -311,9 +308,7 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"clock": "",
"clock_tower": "🕰️",
"closet": "🚪",
"clothesline": "👚",
"clothespin": "📌",
"clothing": "👕",
"cloudy": "☁️",
"clover": "🍀",
"clown": "🤡",
@ -336,13 +331,10 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"conch": "🐚",
"condiment": "🧂",
"conference": "🏢",
"consumer_electronics": "📱",
"container": "📦",
"convertible": "🚗",
"cookie": "🍪",
"cookware": "🍳",
"coral_reef": "🐠",
"cord": "🔌",
"corgi": "🐕",
"corkscrew": "🍾",
"corn": "🌽",
@ -460,7 +452,6 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"falafel": "🧆",
"farm": "🚜",
"fedora": "🎩",
"feline": "🐱",
"fencing_sport": "🤺",
"ferns": "🌿",
"ferret": "🐾",
@ -508,9 +499,7 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"frog": "🐸",
"frozen": "❄️",
"frozen_dessert": "🍨",
"fruit": "🍉",
"fruitcake": "🍰",
"furniture": "🛋️",
"gamepad": "🎮",
"games": "🕹️",
"garage": "🚗",
@ -718,7 +707,6 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"lychee": "🍈",
"lynx": "🐈",
"macadamia": "🌰",
"machine": "🏭",
"mackerel": "🐟",
"magazine": "📰",
"mailbox": "📫",
@ -743,13 +731,11 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"mast": "",
"mastiff": "🐕",
"matches": "🔥",
"material": "🧵",
"matzo": "🍪",
"measuring_tape": "📏",
"meat": "🍖",
"meatball": "🍝",
"medal": "🏅",
"media": "📺",
"medicine": "💊",
"megalith": "🪨",
"megaphone": "📣",
@ -768,7 +754,6 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"money": "💵",
"monitor_lizard": "🦎",
"monorail": "🚝",
"monument": "🏛️",
"moon": "🌕",
"moose": "🦌",
"mop": "🧹",
@ -785,7 +770,6 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"mug": "",
"museum": "🏛️",
"mushroom": "🍄",
"music": "🎵",
"musical_instrument": "🎸",
"mussel": "🐚",
"mustard": "🌭",
@ -795,7 +779,6 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"necktie": "👔",
"nectarine": "🍑",
"nest": "🐦",
"newfoundland": "🐕",
"newspaper": "📰",
"night_sky": "🌌",
"nightclub": "🎤",
@ -805,7 +788,6 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"oatmeal": "🥣",
"obelisk": "🗿",
"ocean": "🌊",
"office_supplies": "🖇️",
"omelet": "🍳",
"onion": "🧅",
"optical_equipment": "🔭",
@ -817,7 +799,6 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"origami": "🔖",
"ostrich": "🦢",
"otter": "🦦",
"outdoor": "🌲",
"oven": "🍳",
"owl": "🦉",
"oyster": "🦪",
@ -875,7 +856,6 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"pillow": "🛌",
"pineapple": "🍍",
"ping_pong": "🏓",
"pipe": "🚬",
"pistachio": "🥜",
"pita": "🥙",
"pitbull": "🐕",
@ -884,14 +864,12 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"plate": "🍽️",
"play_card": "🃏",
"playground": "🎠",
"pliers": "🔧",
"plum": "🍑",
"podium": "🏆",
"poinsettia": "🌺",
"poker": "🃏",
"pole": "🚩",
"police_car": "🚓",
"polka_dots": "🔘",
"poncho": "🧥",
"pool": "🏊",
"popcorn": "🍿",
@ -911,14 +889,12 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"pyramid": "🔺",
"rabbit": "🐰",
"raccoon": "🦝",
"radish": "🍆",
"rainbow": "🌈",
"rake": "🍂",
"raspberry": "🍇",
"rat": "🐀",
"raven": "🦅",
"record": "💿",
"refrigerator": "🧊",
"rhinoceros": "🦏",
"rice": "🍚",
"river": "🌊",
@ -995,20 +971,16 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"sprinkler": "💦",
"squirrel": "🐿️",
"stadium": "🏟️",
"stained_glass": "🖼️",
"starfish": "🌟",
"statue": "🗿",
"steak": "🥩",
"stethoscope": "🩺",
"stingray": "🐟",
"stool": "💺",
"stove": "🔥",
"straw_drinking": "🥤",
"street": "🛣️",
"streetcar": "🚋",
"string_instrument": "🎻",
"stroller": "👶",
"structure": "🏗️",
"suit": "👔",
"suitcase": "🧳",
"sun": "☀️",
@ -1028,12 +1000,11 @@ public func emojiForClasses(_ classes: [String]) -> [String] {
"television": "📺",
"tennis": "🎾",
"tent": "",
"terrier": "🐕",
"theater": "🎭",
"thermometer": "🌡️",
"tiara": "👑",
"ticket": "🎫",
"tiger": "🐅",
"tiger": "🐯",
"tire": "🚗",
"toad": "🐸",
"toaster": "🍞",

View File

@ -3396,6 +3396,12 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
}
return true
} else {
let location = gestureRecognizer.location(in: self.view)
if let reactionNode = self.view.subviews.last?.asyncdisplaykit_node as? ReactionContextNode {
if let hitTestResult = self.view.hitTest(location, with: nil), hitTestResult.isDescendant(of: reactionNode.view) {
return false
}
}
return true
}
}