mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Various improvements
This commit is contained in:
@@ -33,7 +33,7 @@ public final class EmojiKeyboardItemLayer: MultiAnimationRenderTarget {
|
||||
case locked
|
||||
case featured
|
||||
case text(String)
|
||||
case customFile(TelegramMediaFile)
|
||||
case customFile(TelegramMediaFile.Accessor)
|
||||
}
|
||||
|
||||
public let item: EmojiPagerContentComponent.Item
|
||||
|
||||
@@ -43,10 +43,10 @@ public final class EntityKeyboardAnimationData: Equatable {
|
||||
case gift(String)
|
||||
}
|
||||
|
||||
public enum ItemType {
|
||||
public enum ItemType: Equatable {
|
||||
case still
|
||||
case lottie
|
||||
case video
|
||||
case video(isVP9: Bool)
|
||||
|
||||
var animationCacheAnimationType: AnimationCacheAnimationType {
|
||||
switch self {
|
||||
@@ -54,8 +54,8 @@ public final class EntityKeyboardAnimationData: Equatable {
|
||||
return .still
|
||||
case .lottie:
|
||||
return .lottie
|
||||
case .video:
|
||||
return .video
|
||||
case let .video(isVP9):
|
||||
return .video(isVP9: isVP9)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,9 +105,11 @@ public final class EntityKeyboardAnimationData: Equatable {
|
||||
public convenience init(file: TelegramMediaFile.Accessor, isReaction: Bool = false, partialReference: PartialMediaReference? = nil) {
|
||||
let type: ItemType
|
||||
if file.isVideoSticker || file.isVideoEmoji {
|
||||
type = .video
|
||||
type = .video(isVP9: true)
|
||||
} else if file.isAnimatedSticker {
|
||||
type = .lottie
|
||||
} else if file.isVideo {
|
||||
type = .video(isVP9: false)
|
||||
} else {
|
||||
type = .still
|
||||
}
|
||||
@@ -406,7 +408,7 @@ public final class EmojiPagerContentComponent: Component {
|
||||
case locked
|
||||
case premium
|
||||
case text(String)
|
||||
case customFile(TelegramMediaFile)
|
||||
case customFile(TelegramMediaFile.Accessor)
|
||||
}
|
||||
|
||||
public enum TintMode: Equatable {
|
||||
|
||||
@@ -287,7 +287,9 @@ public extension EmojiPagerContentComponent {
|
||||
if item.file.isAnimatedSticker {
|
||||
type = .lottie
|
||||
} else if item.file.isVideoEmoji || item.file.isVideoSticker {
|
||||
type = .video
|
||||
type = .video(isVP9: true)
|
||||
} else if item.file.isVideo {
|
||||
type = .video(isVP9: false)
|
||||
} else {
|
||||
type = .still
|
||||
}
|
||||
@@ -1390,7 +1392,9 @@ public extension EmojiPagerContentComponent {
|
||||
if item.file.isAnimatedSticker {
|
||||
type = .lottie
|
||||
} else if item.file.isVideoEmoji || item.file.isVideoSticker {
|
||||
type = .video
|
||||
type = .video(isVP9: true)
|
||||
} else if item.file.isVideo {
|
||||
type = .video(isVP9: false)
|
||||
} else {
|
||||
type = .still
|
||||
}
|
||||
@@ -1477,7 +1481,9 @@ public extension EmojiPagerContentComponent {
|
||||
if item.file.isAnimatedSticker {
|
||||
type = .lottie
|
||||
} else if item.file.isVideoEmoji || item.file.isVideoSticker {
|
||||
type = .video
|
||||
type = .video(isVP9: true)
|
||||
} else if item.file.isVideo {
|
||||
type = .video(isVP9: false)
|
||||
} else {
|
||||
type = .still
|
||||
}
|
||||
@@ -1774,7 +1780,9 @@ public extension EmojiPagerContentComponent {
|
||||
if item.file.isAnimatedSticker {
|
||||
type = .lottie
|
||||
} else if item.file.isVideoEmoji || item.file.isVideoSticker {
|
||||
type = .video
|
||||
type = .video(isVP9: true)
|
||||
} else if item.file.isVideo {
|
||||
type = .video(isVP9: false)
|
||||
} else {
|
||||
type = .still
|
||||
}
|
||||
@@ -2011,7 +2019,9 @@ public extension EmojiPagerContentComponent {
|
||||
if item.file.isAnimatedSticker {
|
||||
type = .lottie
|
||||
} else if item.file.isVideoEmoji || item.file.isVideoSticker {
|
||||
type = .video
|
||||
type = .video(isVP9: true)
|
||||
} else if item.file.isVideo {
|
||||
type = .video(isVP9: false)
|
||||
} else {
|
||||
type = .still
|
||||
}
|
||||
@@ -2090,7 +2100,9 @@ public extension EmojiPagerContentComponent {
|
||||
if item.file.isAnimatedSticker {
|
||||
type = .lottie
|
||||
} else if item.file.isVideoEmoji || item.file.isVideoSticker {
|
||||
type = .video
|
||||
type = .video(isVP9: true)
|
||||
} else if item.file.isVideo {
|
||||
type = .video(isVP9: false)
|
||||
} else {
|
||||
type = .still
|
||||
}
|
||||
@@ -2234,7 +2246,7 @@ public extension EmojiPagerContentComponent {
|
||||
continue
|
||||
}
|
||||
|
||||
let itemFile: TelegramMediaFile = item.effectSticker
|
||||
let itemFile = item.effectSticker
|
||||
|
||||
var tintMode: Item.TintMode = .none
|
||||
if itemFile.isCustomTemplateEmoji {
|
||||
@@ -2258,11 +2270,11 @@ public extension EmojiPagerContentComponent {
|
||||
}
|
||||
}
|
||||
|
||||
let animationData = EntityKeyboardAnimationData(file: TelegramMediaFile.Accessor(itemFile), partialReference: .none)
|
||||
let animationData = EntityKeyboardAnimationData(file: itemFile, partialReference: .none)
|
||||
let resultItem = EmojiPagerContentComponent.Item(
|
||||
animationData: animationData,
|
||||
content: .animation(animationData),
|
||||
itemFile: TelegramMediaFile.Accessor(itemFile),
|
||||
itemFile: itemFile,
|
||||
subgroupId: nil,
|
||||
icon: icon,
|
||||
tintMode: tintMode
|
||||
|
||||
@@ -81,7 +81,7 @@ final class PremiumBadgeView: UIView {
|
||||
context: self.context,
|
||||
userLocation: .other,
|
||||
attemptSynchronousLoad: false,
|
||||
file: customFile,
|
||||
file: customFile._parse(),
|
||||
cache: self.context.animationCache,
|
||||
renderer: self.context.animationRenderer,
|
||||
unique: false,
|
||||
|
||||
Reference in New Issue
Block a user