mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
18 lines
619 B
Swift
18 lines
619 B
Swift
import Foundation
|
|
import Postbox
|
|
import TelegramApi
|
|
|
|
|
|
extension TelegramMediaGame {
|
|
convenience init(apiGame: Api.Game) {
|
|
switch apiGame {
|
|
case let .game(_, id, accessHash, shortName, title, description, photo, document):
|
|
var file: TelegramMediaFile?
|
|
if let document = document {
|
|
file = telegramMediaFileFromApiDocument(document)
|
|
}
|
|
self.init(gameId: id, accessHash: accessHash, name: shortName, title: title, description: description, image: telegramMediaImageFromApiPhoto(photo), file: file)
|
|
}
|
|
}
|
|
}
|