Swiftgram/submodules/TelegramCore/Sources/TelegramMediaGame.swift
2019-10-29 00:13:20 +04:00

24 lines
718 B
Swift

import Foundation
#if os(macOS)
import PostboxMac
import TelegramApiMac
#else
import Postbox
import TelegramApi
#endif
import SyncCore
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)
}
}
}