[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.addSubnode(self.darkDimNode)
self.containerNode.addSubnode(self.contentNode) self.containerNode.addSubnode(self.contentNode)
self.addSubnode(self.containerNode)
self.addSubnode(self.actionsStackNode) self.addSubnode(self.actionsStackNode)
self.addSubnode(self.containerNode)
if let fullScreenAccessoryNode = self.fullScreenAccessoryNode { if let fullScreenAccessoryNode = self.fullScreenAccessoryNode {
self.fullScreenAccessoryNode?.dismiss = { [weak self] in self.fullScreenAccessoryNode?.dismiss = { [weak self] in

View File

@ -110,7 +110,7 @@ public class DrawingReactionEntityView: DrawingStickerEntityView {
private weak var reactionContextNode: ReactionContextNode? private weak var reactionContextNode: ReactionContextNode?
fileprivate func presentReactionSelection() { 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 return
} }

View File

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

View File

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

View File

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

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 { if let recentEmoji = recentEmoji, hasRecentEmoji {
for item in recentEmoji.items { for item in recentEmoji.items {

View File

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

View File

@ -3396,6 +3396,12 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
} }
return true return true
} else { } 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 return true
} }
} }