mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Story location picking
This commit is contained in:
@@ -10,6 +10,7 @@ public enum CodableDrawingEntity: Equatable {
|
||||
case simpleShape(DrawingSimpleShapeEntity)
|
||||
case bubble(DrawingBubbleEntity)
|
||||
case vector(DrawingVectorEntity)
|
||||
case location(DrawingLocationEntity)
|
||||
|
||||
public init?(entity: DrawingEntity) {
|
||||
if let entity = entity as? DrawingStickerEntity {
|
||||
@@ -22,6 +23,8 @@ public enum CodableDrawingEntity: Equatable {
|
||||
self = .bubble(entity)
|
||||
} else if let entity = entity as? DrawingVectorEntity {
|
||||
self = .vector(entity)
|
||||
} else if let entity = entity as? DrawingLocationEntity {
|
||||
self = .location(entity)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
@@ -39,6 +42,8 @@ public enum CodableDrawingEntity: Equatable {
|
||||
return entity
|
||||
case let .vector(entity):
|
||||
return entity
|
||||
case let .location(entity):
|
||||
return entity
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,6 +60,7 @@ extension CodableDrawingEntity: Codable {
|
||||
case simpleShape
|
||||
case bubble
|
||||
case vector
|
||||
case location
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
@@ -71,6 +77,8 @@ extension CodableDrawingEntity: Codable {
|
||||
self = .bubble(try container.decode(DrawingBubbleEntity.self, forKey: .entity))
|
||||
case .vector:
|
||||
self = .vector(try container.decode(DrawingVectorEntity.self, forKey: .entity))
|
||||
case .location:
|
||||
self = .location(try container.decode(DrawingLocationEntity.self, forKey: .entity))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +100,9 @@ extension CodableDrawingEntity: Codable {
|
||||
case let .vector(payload):
|
||||
try container.encode(EntityType.vector, forKey: .type)
|
||||
try container.encode(payload, forKey: .entity)
|
||||
case let .location(payload):
|
||||
try container.encode(EntityType.location, forKey: .type)
|
||||
try container.encode(payload, forKey: .entity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user