Camera and editor improvements

This commit is contained in:
Ilya Laktyushin
2023-06-03 01:19:23 +04:00
parent 3df2d3cad5
commit ab69b9e982
48 changed files with 2154 additions and 557 deletions

View File

@@ -5,9 +5,26 @@ import AccountContext
import TelegramCore
public final class DrawingStickerEntity: DrawingEntity, Codable {
public enum Content {
public enum Content: Equatable {
case file(TelegramMediaFile)
case image(UIImage)
public static func == (lhs: Content, rhs: Content) -> Bool {
switch lhs {
case let .file(lhsFile):
if case let .file(rhsFile) = rhs {
return lhsFile.fileId == rhsFile.fileId
} else {
return false
}
case let .image(lhsImage):
if case let .image(rhsImage) = rhs {
return lhsImage === rhsImage
} else {
return false
}
}
}
}
private enum CodingKeys: String, CodingKey {
case uuid
@@ -110,4 +127,32 @@ public final class DrawingStickerEntity: DrawingEntity, Codable {
newEntity.mirrored = self.mirrored
return newEntity
}
public func isEqual(to other: DrawingEntity) -> Bool {
guard let other = other as? DrawingStickerEntity else {
return false
}
if self.uuid != other.uuid {
return false
}
if self.content != other.content {
return false
}
if self.referenceDrawingSize != other.referenceDrawingSize {
return false
}
if self.position != other.position {
return false
}
if self.scale != other.scale {
return false
}
if self.rotation != other.rotation {
return false
}
if self.mirrored != other.mirrored {
return false
}
return true
}
}