mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
48 lines
1.4 KiB
Swift
48 lines
1.4 KiB
Swift
import Foundation
|
|
import Postbox
|
|
import TelegramApi
|
|
|
|
import SyncCore
|
|
|
|
extension UnauthorizedAccountTermsOfService {
|
|
init?(apiTermsOfService: Api.help.TermsOfService) {
|
|
switch apiTermsOfService {
|
|
case let .termsOfService(_, id, text, entities, minAgeConfirm):
|
|
let idData: String
|
|
switch id {
|
|
case let .dataJSON(data):
|
|
idData = data
|
|
}
|
|
self.init(id: idData, text: text, entities: messageTextEntitiesFromApiEntities(entities), ageConfirmation: minAgeConfirm)
|
|
}
|
|
}
|
|
}
|
|
|
|
extension SentAuthorizationCodeType {
|
|
init(apiType: Api.auth.SentCodeType) {
|
|
switch apiType {
|
|
case let .sentCodeTypeApp(length):
|
|
self = .otherSession(length: length)
|
|
case let .sentCodeTypeSms(length):
|
|
self = .sms(length: length)
|
|
case let .sentCodeTypeCall(length):
|
|
self = .call(length: length)
|
|
case let .sentCodeTypeFlashCall(pattern):
|
|
self = .flashCall(pattern: pattern)
|
|
}
|
|
}
|
|
}
|
|
|
|
extension AuthorizationCodeNextType {
|
|
init(apiType: Api.auth.CodeType) {
|
|
switch apiType {
|
|
case .codeTypeSms:
|
|
self = .sms
|
|
case .codeTypeCall:
|
|
self = .call
|
|
case .codeTypeFlashCall:
|
|
self = .flashCall
|
|
}
|
|
}
|
|
}
|