mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
29 lines
853 B
Swift
29 lines
853 B
Swift
import Foundation
|
|
#if os(macOS)
|
|
import SwiftSignalKitMac
|
|
import TelegramApiMac
|
|
#else
|
|
import SwiftSignalKit
|
|
import TelegramApi
|
|
#endif
|
|
|
|
import SyncCore
|
|
|
|
public struct DeepLinkInfo {
|
|
public let message: String
|
|
public let entities: [MessageTextEntity]
|
|
public let updateApp: Bool
|
|
}
|
|
|
|
public func getDeepLinkInfo(network: Network, path: String) -> Signal<DeepLinkInfo?, NoError> {
|
|
return network.request(Api.functions.help.getDeepLinkInfo(path: path)) |> retryRequest
|
|
|> map { value -> DeepLinkInfo? in
|
|
switch value {
|
|
case .deepLinkInfoEmpty:
|
|
return nil
|
|
case let .deepLinkInfo(flags, message, entities):
|
|
return DeepLinkInfo(message: message, entities: entities != nil ? messageTextEntitiesFromApiEntities(entities!) : [], updateApp: (flags & (1 << 0)) != 0)
|
|
}
|
|
}
|
|
}
|