Various improvements

This commit is contained in:
Ilya Laktyushin
2022-07-16 15:21:52 +02:00
53 changed files with 1527 additions and 337 deletions

View File

@@ -20,7 +20,7 @@ import StickerResources
import AppBundle
import ContextUI
import PremiumUI
import StickerPackPreviewUI
import StickerPeekUI
import UndoUI
import AudioToolbox
import SolidRoundedButtonComponent
@@ -457,12 +457,12 @@ public final class EmojiPagerContentComponent: Component {
}
}
final class ItemPlaceholderView: UIView {
public final class ItemPlaceholderView: UIView {
private let shimmerView: PortalSourceView?
private var placeholderView: PortalView?
private let placeholderMaskLayer: SimpleLayer
init(
public init(
context: AccountContext,
file: TelegramMediaFile,
shimmerView: PortalSourceView?,
@@ -503,7 +503,7 @@ public final class EmojiPagerContentComponent: Component {
fatalError("init(coder:) has not been implemented")
}
func update(size: CGSize) {
public func update(size: CGSize) {
if let placeholderView = self.placeholderView {
placeholderView.view.frame = CGRect(origin: CGPoint(), size: size)
}
@@ -511,11 +511,21 @@ public final class EmojiPagerContentComponent: Component {
}
}
final class ItemLayer: MultiAnimationRenderTarget {
struct Key: Hashable {
public final class ItemLayer: MultiAnimationRenderTarget {
public struct Key: Hashable {
var groupId: AnyHashable
var fileId: MediaId?
var staticEmoji: String?
public init(
groupId: AnyHashable,
fileId: MediaId?,
staticEmoji: String?
) {
self.groupId = groupId
self.fileId = fileId
self.staticEmoji = staticEmoji
}
}
let item: Item
@@ -536,10 +546,10 @@ public final class EmojiPagerContentComponent: Component {
}
}
}
private(set) var displayPlaceholder: Bool = false
let onUpdateDisplayPlaceholder: (Bool) -> Void
public private(set) var displayPlaceholder: Bool = false
public let onUpdateDisplayPlaceholder: (Bool) -> Void
init(
public init(
item: Item,
context: AccountContext,
groupId: String,
@@ -696,7 +706,7 @@ public final class EmojiPagerContentComponent: Component {
self.fetchDisposable?.dispose()
}
override public func action(forKey event: String) -> CAAction? {
public override func action(forKey event: String) -> CAAction? {
if event == kCAOnOrderIn {
self.isInHierarchyValue = true
} else if event == kCAOnOrderOut {
@@ -712,7 +722,7 @@ public final class EmojiPagerContentComponent: Component {
self.shouldBeAnimating = shouldBePlaying
}
override func updateDisplayPlaceholder(displayPlaceholder: Bool) {
public override func updateDisplayPlaceholder(displayPlaceholder: Bool) {
if self.displayPlaceholder == displayPlaceholder {
return
}
@@ -943,7 +953,7 @@ public final class EmojiPagerContentComponent: Component {
switch attribute {
case let .CustomEmoji(_, _, packReference):
if let packReference = packReference {
let controller = StickerPackScreen(context: context, updatedPresentationData: nil, mainStickerPack: packReference, stickerPacks: [packReference], parentNavigationController: component.inputInteraction.navigationController(), sendSticker: { file, sourceView, sourceRect in
let controller = context.sharedContext.makeStickerPackScreen(context: context, updatedPresentationData: nil, mainStickerPack: packReference, stickerPacks: [packReference], parentNavigationController: component.inputInteraction.navigationController(), sendSticker: { file, sourceView, sourceRect in
//return component.inputInteraction.sendSticker(file, false, false, nil, false, sourceNode, sourceRect, nil)
return false
})