mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
no message
This commit is contained in:
29
TelegramCore/TermsOfService.swift
Normal file
29
TelegramCore/TermsOfService.swift
Normal file
@@ -0,0 +1,29 @@
|
||||
import Foundation
|
||||
#if os(macOS)
|
||||
import PostboxMac
|
||||
import SwiftSignalKitMac
|
||||
import MtProtoKitMac
|
||||
#else
|
||||
import Postbox
|
||||
import SwiftSignalKit
|
||||
import MtProtoKitDynamic
|
||||
#endif
|
||||
|
||||
public func requestTermsOfService(network: Network, countryCode: String) -> Signal<String, NoError> {
|
||||
let langCode: String
|
||||
if let langPackCode = network.context.apiEnvironment.langPackCode, !langPackCode.isEmpty {
|
||||
langCode = langPackCode
|
||||
} else {
|
||||
langCode = "en"
|
||||
}
|
||||
return network.request(Api.functions.help.getTermsOfService(countryIso2: countryCode, langCode: langCode))
|
||||
|> `catch` { _ -> Signal<Api.help.TermsOfService, NoError> in
|
||||
return .single(.termsOfService(text: ""))
|
||||
}
|
||||
|> map { result -> String in
|
||||
switch result {
|
||||
case let .termsOfService(text):
|
||||
return text
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user