mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Don't generate videos for single frame animated stickers
This commit is contained in:
parent
01067bd1f2
commit
d5ea353b92
@ -145,8 +145,11 @@ public final class DrawingStickerEntityView: DrawingEntityView {
|
||||
self.animationNode = animationNode
|
||||
animationNode.started = { [weak self, weak animationNode] in
|
||||
self?.imageNode.isHidden = true
|
||||
|
||||
|
||||
if let animationNode = animationNode {
|
||||
if animationNode.currentFrameCount == 1 {
|
||||
self?.stickerEntity.isExplicitlyStatic = true
|
||||
}
|
||||
let _ = (animationNode.status
|
||||
|> take(1)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] status in
|
||||
|
@ -62,6 +62,7 @@ public final class DrawingStickerEntity: DrawingEntity, Codable {
|
||||
case scale
|
||||
case rotation
|
||||
case mirrored
|
||||
case isExplicitlyStatic
|
||||
}
|
||||
|
||||
public let uuid: UUID
|
||||
@ -72,6 +73,8 @@ public final class DrawingStickerEntity: DrawingEntity, Codable {
|
||||
public var scale: CGFloat
|
||||
public var rotation: CGFloat
|
||||
public var mirrored: Bool
|
||||
|
||||
public var isExplicitlyStatic: Bool
|
||||
|
||||
public var color: DrawingColor = DrawingColor.clear
|
||||
public var lineWidth: CGFloat = 0.0
|
||||
@ -88,7 +91,11 @@ public final class DrawingStickerEntity: DrawingEntity, Codable {
|
||||
public var isAnimated: Bool {
|
||||
switch self.content {
|
||||
case let .file(file):
|
||||
return file.isAnimatedSticker || file.isVideoSticker || file.mimeType == "video/webm"
|
||||
if self.isExplicitlyStatic {
|
||||
return false
|
||||
} else {
|
||||
return file.isAnimatedSticker || file.isVideoSticker || file.mimeType == "video/webm"
|
||||
}
|
||||
case .image:
|
||||
return false
|
||||
case .video:
|
||||
@ -123,6 +130,8 @@ public final class DrawingStickerEntity: DrawingEntity, Codable {
|
||||
self.scale = 1.0
|
||||
self.rotation = 0.0
|
||||
self.mirrored = false
|
||||
|
||||
self.isExplicitlyStatic = false
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
@ -150,6 +159,7 @@ public final class DrawingStickerEntity: DrawingEntity, Codable {
|
||||
self.scale = try container.decode(CGFloat.self, forKey: .scale)
|
||||
self.rotation = try container.decode(CGFloat.self, forKey: .rotation)
|
||||
self.mirrored = try container.decode(Bool.self, forKey: .mirrored)
|
||||
self.isExplicitlyStatic = try container.decodeIfPresent(Bool.self, forKey: .isExplicitlyStatic) ?? false
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
@ -185,6 +195,7 @@ public final class DrawingStickerEntity: DrawingEntity, Codable {
|
||||
try container.encode(self.scale, forKey: .scale)
|
||||
try container.encode(self.rotation, forKey: .rotation)
|
||||
try container.encode(self.mirrored, forKey: .mirrored)
|
||||
try container.encode(self.isExplicitlyStatic, forKey: .isExplicitlyStatic)
|
||||
}
|
||||
|
||||
public func duplicate() -> DrawingEntity {
|
||||
@ -194,6 +205,7 @@ public final class DrawingStickerEntity: DrawingEntity, Codable {
|
||||
newEntity.scale = self.scale
|
||||
newEntity.rotation = self.rotation
|
||||
newEntity.mirrored = self.mirrored
|
||||
newEntity.isExplicitlyStatic = self.isExplicitlyStatic
|
||||
return newEntity
|
||||
}
|
||||
|
||||
@ -222,6 +234,9 @@ public final class DrawingStickerEntity: DrawingEntity, Codable {
|
||||
if self.mirrored != other.mirrored {
|
||||
return false
|
||||
}
|
||||
if self.isExplicitlyStatic != other.isExplicitlyStatic {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user