mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
- forwarded from improvements
- sticker categories
This commit is contained in:
parent
66d88f8c9b
commit
e9f4fd3a25
@ -313,7 +313,7 @@ public final class ListMessageSnippetItemNode: ListMessageNode {
|
||||
}
|
||||
} else if let file = content.file {
|
||||
if content.type == "telegram_background" {
|
||||
if let wallpaper = parseWallpaperUrl(content.url) {
|
||||
if let wallpaper = parseWallpaperUrl(sharedContext: item.context.sharedContext, url: content.url) {
|
||||
switch wallpaper {
|
||||
case let .slug(slug, _, colors, intensity, angle):
|
||||
previewWallpaperFileReference = .message(message: MessageReference(message), media: file)
|
||||
|
@ -310,10 +310,10 @@ public enum ProxySettingsControllerMode {
|
||||
|
||||
public func proxySettingsController(context: AccountContext, mode: ProxySettingsControllerMode = .default) -> ViewController {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
return proxySettingsController(accountManager: context.sharedContext.accountManager, context: context, postbox: context.account.postbox, network: context.account.network, mode: mode, presentationData: presentationData, updatedPresentationData: context.sharedContext.presentationData)
|
||||
return proxySettingsController(accountManager: context.sharedContext.accountManager, sharedContext: context.sharedContext, context: context, postbox: context.account.postbox, network: context.account.network, mode: mode, presentationData: presentationData, updatedPresentationData: context.sharedContext.presentationData)
|
||||
}
|
||||
|
||||
public func proxySettingsController(accountManager: AccountManager<TelegramAccountManagerTypes>, context: AccountContext? = nil, postbox: Postbox, network: Network, mode: ProxySettingsControllerMode, presentationData: PresentationData, updatedPresentationData: Signal<PresentationData, NoError>) -> ViewController {
|
||||
public func proxySettingsController(accountManager: AccountManager<TelegramAccountManagerTypes>, sharedContext: SharedAccountContext, context: AccountContext? = nil, postbox: Postbox, network: Network, mode: ProxySettingsControllerMode, presentationData: PresentationData, updatedPresentationData: Signal<PresentationData, NoError>) -> ViewController {
|
||||
var pushControllerImpl: ((ViewController) -> Void)?
|
||||
var dismissImpl: (() -> Void)?
|
||||
let stateValue = Atomic(value: ProxySettingsControllerState())
|
||||
@ -341,7 +341,7 @@ public func proxySettingsController(accountManager: AccountManager<TelegramAccou
|
||||
return current
|
||||
}).start()
|
||||
}, addNewServer: {
|
||||
pushControllerImpl?(proxyServerSettingsController(presentationData: presentationData, updatedPresentationData: updatedPresentationData, accountManager: accountManager, network: network, currentSettings: nil))
|
||||
pushControllerImpl?(proxyServerSettingsController(sharedContext: sharedContext, presentationData: presentationData, updatedPresentationData: updatedPresentationData, accountManager: accountManager, network: network, currentSettings: nil))
|
||||
}, activateServer: { server in
|
||||
let _ = updateProxySettingsInteractively(accountManager: accountManager, { current in
|
||||
var current = current
|
||||
@ -354,7 +354,7 @@ public func proxySettingsController(accountManager: AccountManager<TelegramAccou
|
||||
return current
|
||||
}).start()
|
||||
}, editServer: { server in
|
||||
pushControllerImpl?(proxyServerSettingsController(presentationData: presentationData, updatedPresentationData: updatedPresentationData, accountManager: accountManager, network: network, currentSettings: server))
|
||||
pushControllerImpl?(proxyServerSettingsController(sharedContext: sharedContext, presentationData: presentationData, updatedPresentationData: updatedPresentationData, accountManager: accountManager, network: network, currentSettings: server))
|
||||
}, removeServer: { server in
|
||||
let _ = updateProxySettingsInteractively(accountManager: accountManager, { current in
|
||||
var current = current
|
||||
|
@ -265,10 +265,10 @@ private func proxyServerSettings(with state: ProxyServerSettingsControllerState)
|
||||
|
||||
public func proxyServerSettingsController(context: AccountContext, currentSettings: ProxyServerSettings? = nil) -> ViewController {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
return proxyServerSettingsController(context: context, presentationData: presentationData, updatedPresentationData: context.sharedContext.presentationData, accountManager: context.sharedContext.accountManager, network: context.account.network, currentSettings: currentSettings)
|
||||
return proxyServerSettingsController(sharedContext: context.sharedContext, context: context, presentationData: presentationData, updatedPresentationData: context.sharedContext.presentationData, accountManager: context.sharedContext.accountManager, network: context.account.network, currentSettings: currentSettings)
|
||||
}
|
||||
|
||||
func proxyServerSettingsController(context: AccountContext? = nil, presentationData: PresentationData, updatedPresentationData: Signal<PresentationData, NoError>, accountManager: AccountManager<TelegramAccountManagerTypes>, network: Network, currentSettings: ProxyServerSettings?) -> ViewController {
|
||||
func proxyServerSettingsController(sharedContext: SharedAccountContext, context: AccountContext? = nil, presentationData: PresentationData, updatedPresentationData: Signal<PresentationData, NoError>, accountManager: AccountManager<TelegramAccountManagerTypes>, network: Network, currentSettings: ProxyServerSettings?) -> ViewController {
|
||||
var currentMode: ProxyServerSettingsControllerMode = .socks5
|
||||
var currentUsername: String?
|
||||
var currentPassword: String?
|
||||
@ -285,7 +285,7 @@ func proxyServerSettingsController(context: AccountContext? = nil, presentationD
|
||||
currentMode = .mtp
|
||||
}
|
||||
} else {
|
||||
if let proxy = parseProxyUrl(UIPasteboard.general.string ?? "") {
|
||||
if let proxy = parseProxyUrl(sharedContext: sharedContext, url: UIPasteboard.general.string ?? "") {
|
||||
if let secret = proxy.secret, let parsedSecret = MTProxySecret.parseData(secret) {
|
||||
pasteboardSettings = ProxyServerSettings(host: proxy.host, port: proxy.port, connection: .mtp(secret: parsedSecret.serialize()))
|
||||
} else {
|
||||
|
@ -105,6 +105,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[-944407322] = { return Api.BotMenuButton.parse_botMenuButton($0) }
|
||||
dict[1113113093] = { return Api.BotMenuButton.parse_botMenuButtonCommands($0) }
|
||||
dict[1966318984] = { return Api.BotMenuButton.parse_botMenuButtonDefault($0) }
|
||||
dict[-2076642874] = { return Api.BroadcastRevenueBalances.parse_broadcastRevenueBalances($0) }
|
||||
dict[1434332356] = { return Api.BroadcastRevenueTransaction.parse_broadcastRevenueTransactionProceeds($0) }
|
||||
dict[1121127726] = { return Api.BroadcastRevenueTransaction.parse_broadcastRevenueTransactionRefund($0) }
|
||||
dict[1515784568] = { return Api.BroadcastRevenueTransaction.parse_broadcastRevenueTransactionWithdrawal($0) }
|
||||
@ -251,6 +252,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[1128644211] = { return Api.EmailVerifyPurpose.parse_emailVerifyPurposeLoginSetup($0) }
|
||||
dict[-1141565819] = { return Api.EmailVerifyPurpose.parse_emailVerifyPurposePassport($0) }
|
||||
dict[2056961449] = { return Api.EmojiGroup.parse_emojiGroup($0) }
|
||||
dict[-2133693241] = { return Api.EmojiGroup.parse_emojiGroupGreeting($0) }
|
||||
dict[154914612] = { return Api.EmojiGroup.parse_emojiGroupPremium($0) }
|
||||
dict[-709641735] = { return Api.EmojiKeyword.parse_emojiKeyword($0) }
|
||||
dict[594408994] = { return Api.EmojiKeyword.parse_emojiKeywordDeleted($0) }
|
||||
dict[1556570557] = { return Api.EmojiKeywordsDifference.parse_emojiKeywordsDifference($0) }
|
||||
@ -925,6 +928,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[-997782967] = { return Api.Update.parse_updateBotStopped($0) }
|
||||
dict[-2095595325] = { return Api.Update.parse_updateBotWebhookJSON($0) }
|
||||
dict[-1684914010] = { return Api.Update.parse_updateBotWebhookJSONQuery($0) }
|
||||
dict[1550177112] = { return Api.Update.parse_updateBroadcastRevenueTransactions($0) }
|
||||
dict[1666927625] = { return Api.Update.parse_updateChannel($0) }
|
||||
dict[-1304443240] = { return Api.Update.parse_updateChannelAvailableMessages($0) }
|
||||
dict[-761649164] = { return Api.Update.parse_updateChannelMessageForwards($0) }
|
||||
@ -1301,7 +1305,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[-1696454430] = { return Api.premium.MyBoosts.parse_myBoosts($0) }
|
||||
dict[-594852657] = { return Api.smsjobs.EligibilityToJoin.parse_eligibleToJoin($0) }
|
||||
dict[720277905] = { return Api.smsjobs.Status.parse_status($0) }
|
||||
dict[-797226067] = { return Api.stats.BroadcastRevenueStats.parse_broadcastRevenueStats($0) }
|
||||
dict[1409802903] = { return Api.stats.BroadcastRevenueStats.parse_broadcastRevenueStats($0) }
|
||||
dict[-2028632986] = { return Api.stats.BroadcastRevenueTransactions.parse_broadcastRevenueTransactions($0) }
|
||||
dict[-328886473] = { return Api.stats.BroadcastRevenueWithdrawalUrl.parse_broadcastRevenueWithdrawalUrl($0) }
|
||||
dict[963421692] = { return Api.stats.BroadcastStats.parse_broadcastStats($0) }
|
||||
@ -1452,6 +1456,8 @@ public extension Api {
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.BotMenuButton:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.BroadcastRevenueBalances:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.BroadcastRevenueTransaction:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.BusinessAwayMessage:
|
||||
|
@ -724,6 +724,50 @@ public extension Api {
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum BroadcastRevenueBalances: TypeConstructorDescription {
|
||||
case broadcastRevenueBalances(currentBalance: Int64, availableBalance: Int64, overallRevenue: Int64)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .broadcastRevenueBalances(let currentBalance, let availableBalance, let overallRevenue):
|
||||
if boxed {
|
||||
buffer.appendInt32(-2076642874)
|
||||
}
|
||||
serializeInt64(currentBalance, buffer: buffer, boxed: false)
|
||||
serializeInt64(availableBalance, buffer: buffer, boxed: false)
|
||||
serializeInt64(overallRevenue, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .broadcastRevenueBalances(let currentBalance, let availableBalance, let overallRevenue):
|
||||
return ("broadcastRevenueBalances", [("currentBalance", currentBalance as Any), ("availableBalance", availableBalance as Any), ("overallRevenue", overallRevenue as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_broadcastRevenueBalances(_ reader: BufferReader) -> BroadcastRevenueBalances? {
|
||||
var _1: Int64?
|
||||
_1 = reader.readInt64()
|
||||
var _2: Int64?
|
||||
_2 = reader.readInt64()
|
||||
var _3: Int64?
|
||||
_3 = reader.readInt64()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
if _c1 && _c2 && _c3 {
|
||||
return Api.BroadcastRevenueBalances.broadcastRevenueBalances(currentBalance: _1!, availableBalance: _2!, overallRevenue: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum BroadcastRevenueTransaction: TypeConstructorDescription {
|
||||
case broadcastRevenueTransactionProceeds(amount: Int64, fromDate: Int32, toDate: Int32)
|
||||
@ -1166,49 +1210,3 @@ public extension Api {
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum BusinessLocation: TypeConstructorDescription {
|
||||
case businessLocation(flags: Int32, geoPoint: Api.GeoPoint?, address: String)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .businessLocation(let flags, let geoPoint, let address):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1403249929)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 0) != 0 {geoPoint!.serialize(buffer, true)}
|
||||
serializeString(address, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .businessLocation(let flags, let geoPoint, let address):
|
||||
return ("businessLocation", [("flags", flags as Any), ("geoPoint", geoPoint as Any), ("address", address as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_businessLocation(_ reader: BufferReader) -> BusinessLocation? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Api.GeoPoint?
|
||||
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
|
||||
_2 = Api.parse(reader, signature: signature) as? Api.GeoPoint
|
||||
} }
|
||||
var _3: String?
|
||||
_3 = parseString(reader)
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
if _c1 && _c2 && _c3 {
|
||||
return Api.BusinessLocation.businessLocation(flags: _1!, geoPoint: _2, address: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ public extension Api {
|
||||
case updateBotStopped(userId: Int64, date: Int32, stopped: Api.Bool, qts: Int32)
|
||||
case updateBotWebhookJSON(data: Api.DataJSON)
|
||||
case updateBotWebhookJSONQuery(queryId: Int64, data: Api.DataJSON, timeout: Int32)
|
||||
case updateBroadcastRevenueTransactions(balances: Api.BroadcastRevenueBalances)
|
||||
case updateChannel(channelId: Int64)
|
||||
case updateChannelAvailableMessages(channelId: Int64, availableMinId: Int32)
|
||||
case updateChannelMessageForwards(channelId: Int64, id: Int32, forwards: Int32)
|
||||
@ -395,6 +396,12 @@ public extension Api {
|
||||
data.serialize(buffer, true)
|
||||
serializeInt32(timeout, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .updateBroadcastRevenueTransactions(let balances):
|
||||
if boxed {
|
||||
buffer.appendInt32(1550177112)
|
||||
}
|
||||
balances.serialize(buffer, true)
|
||||
break
|
||||
case .updateChannel(let channelId):
|
||||
if boxed {
|
||||
buffer.appendInt32(1666927625)
|
||||
@ -1406,6 +1413,8 @@ public extension Api {
|
||||
return ("updateBotWebhookJSON", [("data", data as Any)])
|
||||
case .updateBotWebhookJSONQuery(let queryId, let data, let timeout):
|
||||
return ("updateBotWebhookJSONQuery", [("queryId", queryId as Any), ("data", data as Any), ("timeout", timeout as Any)])
|
||||
case .updateBroadcastRevenueTransactions(let balances):
|
||||
return ("updateBroadcastRevenueTransactions", [("balances", balances as Any)])
|
||||
case .updateChannel(let channelId):
|
||||
return ("updateChannel", [("channelId", channelId as Any)])
|
||||
case .updateChannelAvailableMessages(let channelId, let availableMinId):
|
||||
@ -2098,6 +2107,19 @@ public extension Api {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_updateBroadcastRevenueTransactions(_ reader: BufferReader) -> Update? {
|
||||
var _1: Api.BroadcastRevenueBalances?
|
||||
if let signature = reader.readInt32() {
|
||||
_1 = Api.parse(reader, signature: signature) as? Api.BroadcastRevenueBalances
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
if _c1 {
|
||||
return Api.Update.updateBroadcastRevenueTransactions(balances: _1!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_updateChannel(_ reader: BufferReader) -> Update? {
|
||||
var _1: Int64?
|
||||
_1 = reader.readInt64()
|
||||
|
@ -1,3 +1,49 @@
|
||||
public extension Api {
|
||||
enum BusinessLocation: TypeConstructorDescription {
|
||||
case businessLocation(flags: Int32, geoPoint: Api.GeoPoint?, address: String)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .businessLocation(let flags, let geoPoint, let address):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1403249929)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 0) != 0 {geoPoint!.serialize(buffer, true)}
|
||||
serializeString(address, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .businessLocation(let flags, let geoPoint, let address):
|
||||
return ("businessLocation", [("flags", flags as Any), ("geoPoint", geoPoint as Any), ("address", address as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_businessLocation(_ reader: BufferReader) -> BusinessLocation? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Api.GeoPoint?
|
||||
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
|
||||
_2 = Api.parse(reader, signature: signature) as? Api.GeoPoint
|
||||
} }
|
||||
var _3: String?
|
||||
_3 = parseString(reader)
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
if _c1 && _c2 && _c3 {
|
||||
return Api.BusinessLocation.businessLocation(flags: _1!, geoPoint: _2, address: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum BusinessRecipients: TypeConstructorDescription {
|
||||
case businessRecipients(flags: Int32, users: [Int64]?)
|
||||
|
@ -104,19 +104,17 @@ public extension Api.smsjobs {
|
||||
}
|
||||
public extension Api.stats {
|
||||
enum BroadcastRevenueStats: TypeConstructorDescription {
|
||||
case broadcastRevenueStats(topHoursGraph: Api.StatsGraph, revenueGraph: Api.StatsGraph, currentBalance: Int64, availableBalance: Int64, overallRevenue: Int64, usdRate: Double)
|
||||
case broadcastRevenueStats(topHoursGraph: Api.StatsGraph, revenueGraph: Api.StatsGraph, balances: Api.BroadcastRevenueBalances, usdRate: Double)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .broadcastRevenueStats(let topHoursGraph, let revenueGraph, let currentBalance, let availableBalance, let overallRevenue, let usdRate):
|
||||
case .broadcastRevenueStats(let topHoursGraph, let revenueGraph, let balances, let usdRate):
|
||||
if boxed {
|
||||
buffer.appendInt32(-797226067)
|
||||
buffer.appendInt32(1409802903)
|
||||
}
|
||||
topHoursGraph.serialize(buffer, true)
|
||||
revenueGraph.serialize(buffer, true)
|
||||
serializeInt64(currentBalance, buffer: buffer, boxed: false)
|
||||
serializeInt64(availableBalance, buffer: buffer, boxed: false)
|
||||
serializeInt64(overallRevenue, buffer: buffer, boxed: false)
|
||||
balances.serialize(buffer, true)
|
||||
serializeDouble(usdRate, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
@ -124,8 +122,8 @@ public extension Api.stats {
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .broadcastRevenueStats(let topHoursGraph, let revenueGraph, let currentBalance, let availableBalance, let overallRevenue, let usdRate):
|
||||
return ("broadcastRevenueStats", [("topHoursGraph", topHoursGraph as Any), ("revenueGraph", revenueGraph as Any), ("currentBalance", currentBalance as Any), ("availableBalance", availableBalance as Any), ("overallRevenue", overallRevenue as Any), ("usdRate", usdRate as Any)])
|
||||
case .broadcastRevenueStats(let topHoursGraph, let revenueGraph, let balances, let usdRate):
|
||||
return ("broadcastRevenueStats", [("topHoursGraph", topHoursGraph as Any), ("revenueGraph", revenueGraph as Any), ("balances", balances as Any), ("usdRate", usdRate as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,22 +136,18 @@ public extension Api.stats {
|
||||
if let signature = reader.readInt32() {
|
||||
_2 = Api.parse(reader, signature: signature) as? Api.StatsGraph
|
||||
}
|
||||
var _3: Int64?
|
||||
_3 = reader.readInt64()
|
||||
var _4: Int64?
|
||||
_4 = reader.readInt64()
|
||||
var _5: Int64?
|
||||
_5 = reader.readInt64()
|
||||
var _6: Double?
|
||||
_6 = reader.readDouble()
|
||||
var _3: Api.BroadcastRevenueBalances?
|
||||
if let signature = reader.readInt32() {
|
||||
_3 = Api.parse(reader, signature: signature) as? Api.BroadcastRevenueBalances
|
||||
}
|
||||
var _4: Double?
|
||||
_4 = reader.readDouble()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||
return Api.stats.BroadcastRevenueStats.broadcastRevenueStats(topHoursGraph: _1!, revenueGraph: _2!, currentBalance: _3!, availableBalance: _4!, overallRevenue: _5!, usdRate: _6!)
|
||||
if _c1 && _c2 && _c3 && _c4 {
|
||||
return Api.stats.BroadcastRevenueStats.broadcastRevenueStats(topHoursGraph: _1!, revenueGraph: _2!, balances: _3!, usdRate: _4!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
|
@ -5783,6 +5783,21 @@ public extension Api.functions.messages {
|
||||
})
|
||||
}
|
||||
}
|
||||
public extension Api.functions.messages {
|
||||
static func getEmojiStickerGroups(hash: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.EmojiGroups>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(500711669)
|
||||
serializeInt32(hash, buffer: buffer, boxed: false)
|
||||
return (FunctionDescription(name: "messages.getEmojiStickerGroups", parameters: [("hash", String(describing: hash))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.EmojiGroups? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.messages.EmojiGroups?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.messages.EmojiGroups
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
}
|
||||
public extension Api.functions.messages {
|
||||
static func getEmojiStickers(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.AllStickers>) {
|
||||
let buffer = Buffer()
|
||||
|
@ -231,6 +231,8 @@ public extension Api {
|
||||
public extension Api {
|
||||
enum EmojiGroup: TypeConstructorDescription {
|
||||
case emojiGroup(title: String, iconEmojiId: Int64, emoticons: [String])
|
||||
case emojiGroupGreeting(title: String, iconEmojiId: Int64, emoticons: [String])
|
||||
case emojiGroupPremium(title: String, iconEmojiId: Int64)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
@ -246,6 +248,25 @@ public extension Api {
|
||||
serializeString(item, buffer: buffer, boxed: false)
|
||||
}
|
||||
break
|
||||
case .emojiGroupGreeting(let title, let iconEmojiId, let emoticons):
|
||||
if boxed {
|
||||
buffer.appendInt32(-2133693241)
|
||||
}
|
||||
serializeString(title, buffer: buffer, boxed: false)
|
||||
serializeInt64(iconEmojiId, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(emoticons.count))
|
||||
for item in emoticons {
|
||||
serializeString(item, buffer: buffer, boxed: false)
|
||||
}
|
||||
break
|
||||
case .emojiGroupPremium(let title, let iconEmojiId):
|
||||
if boxed {
|
||||
buffer.appendInt32(154914612)
|
||||
}
|
||||
serializeString(title, buffer: buffer, boxed: false)
|
||||
serializeInt64(iconEmojiId, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@ -253,6 +274,10 @@ public extension Api {
|
||||
switch self {
|
||||
case .emojiGroup(let title, let iconEmojiId, let emoticons):
|
||||
return ("emojiGroup", [("title", title as Any), ("iconEmojiId", iconEmojiId as Any), ("emoticons", emoticons as Any)])
|
||||
case .emojiGroupGreeting(let title, let iconEmojiId, let emoticons):
|
||||
return ("emojiGroupGreeting", [("title", title as Any), ("iconEmojiId", iconEmojiId as Any), ("emoticons", emoticons as Any)])
|
||||
case .emojiGroupPremium(let title, let iconEmojiId):
|
||||
return ("emojiGroupPremium", [("title", title as Any), ("iconEmojiId", iconEmojiId as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,6 +300,39 @@ public extension Api {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_emojiGroupGreeting(_ reader: BufferReader) -> EmojiGroup? {
|
||||
var _1: String?
|
||||
_1 = parseString(reader)
|
||||
var _2: Int64?
|
||||
_2 = reader.readInt64()
|
||||
var _3: [String]?
|
||||
if let _ = reader.readInt32() {
|
||||
_3 = Api.parseVector(reader, elementSignature: -1255641564, elementType: String.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
if _c1 && _c2 && _c3 {
|
||||
return Api.EmojiGroup.emojiGroupGreeting(title: _1!, iconEmojiId: _2!, emoticons: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_emojiGroupPremium(_ reader: BufferReader) -> EmojiGroup? {
|
||||
var _1: String?
|
||||
_1 = parseString(reader)
|
||||
var _2: Int64?
|
||||
_2 = reader.readInt64()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.EmojiGroup.emojiGroupPremium(title: _1!, iconEmojiId: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -1032,97 +1090,3 @@ public extension Api {
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum ExportedChatlistInvite: TypeConstructorDescription {
|
||||
case exportedChatlistInvite(flags: Int32, title: String, url: String, peers: [Api.Peer])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .exportedChatlistInvite(let flags, let title, let url, let peers):
|
||||
if boxed {
|
||||
buffer.appendInt32(206668204)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(title, buffer: buffer, boxed: false)
|
||||
serializeString(url, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(peers.count))
|
||||
for item in peers {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .exportedChatlistInvite(let flags, let title, let url, let peers):
|
||||
return ("exportedChatlistInvite", [("flags", flags as Any), ("title", title as Any), ("url", url as Any), ("peers", peers as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_exportedChatlistInvite(_ reader: BufferReader) -> ExportedChatlistInvite? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _3: String?
|
||||
_3 = parseString(reader)
|
||||
var _4: [Api.Peer]?
|
||||
if let _ = reader.readInt32() {
|
||||
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 {
|
||||
return Api.ExportedChatlistInvite.exportedChatlistInvite(flags: _1!, title: _2!, url: _3!, peers: _4!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum ExportedContactToken: TypeConstructorDescription {
|
||||
case exportedContactToken(url: String, expires: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .exportedContactToken(let url, let expires):
|
||||
if boxed {
|
||||
buffer.appendInt32(1103040667)
|
||||
}
|
||||
serializeString(url, buffer: buffer, boxed: false)
|
||||
serializeInt32(expires, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .exportedContactToken(let url, let expires):
|
||||
return ("exportedContactToken", [("url", url as Any), ("expires", expires as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_exportedContactToken(_ reader: BufferReader) -> ExportedContactToken? {
|
||||
var _1: String?
|
||||
_1 = parseString(reader)
|
||||
var _2: Int32?
|
||||
_2 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.ExportedContactToken.exportedContactToken(url: _1!, expires: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,97 @@
|
||||
public extension Api {
|
||||
enum ExportedChatlistInvite: TypeConstructorDescription {
|
||||
case exportedChatlistInvite(flags: Int32, title: String, url: String, peers: [Api.Peer])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .exportedChatlistInvite(let flags, let title, let url, let peers):
|
||||
if boxed {
|
||||
buffer.appendInt32(206668204)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(title, buffer: buffer, boxed: false)
|
||||
serializeString(url, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(peers.count))
|
||||
for item in peers {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .exportedChatlistInvite(let flags, let title, let url, let peers):
|
||||
return ("exportedChatlistInvite", [("flags", flags as Any), ("title", title as Any), ("url", url as Any), ("peers", peers as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_exportedChatlistInvite(_ reader: BufferReader) -> ExportedChatlistInvite? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _3: String?
|
||||
_3 = parseString(reader)
|
||||
var _4: [Api.Peer]?
|
||||
if let _ = reader.readInt32() {
|
||||
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 {
|
||||
return Api.ExportedChatlistInvite.exportedChatlistInvite(flags: _1!, title: _2!, url: _3!, peers: _4!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum ExportedContactToken: TypeConstructorDescription {
|
||||
case exportedContactToken(url: String, expires: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .exportedContactToken(let url, let expires):
|
||||
if boxed {
|
||||
buffer.appendInt32(1103040667)
|
||||
}
|
||||
serializeString(url, buffer: buffer, boxed: false)
|
||||
serializeInt32(expires, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .exportedContactToken(let url, let expires):
|
||||
return ("exportedContactToken", [("url", url as Any), ("expires", expires as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_exportedContactToken(_ reader: BufferReader) -> ExportedContactToken? {
|
||||
var _1: String?
|
||||
_1 = parseString(reader)
|
||||
var _2: Int32?
|
||||
_2 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.ExportedContactToken.exportedContactToken(url: _1!, expires: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum ExportedMessageLink: TypeConstructorDescription {
|
||||
case exportedMessageLink(link: String, html: String)
|
||||
@ -1190,367 +1284,3 @@ public extension Api {
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum InputBotInlineMessage: TypeConstructorDescription {
|
||||
case inputBotInlineMessageGame(flags: Int32, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaAuto(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaContact(flags: Int32, phoneNumber: String, firstName: String, lastName: String, vcard: String, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaGeo(flags: Int32, geoPoint: Api.InputGeoPoint, heading: Int32?, period: Int32?, proximityNotificationRadius: Int32?, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaInvoice(flags: Int32, title: String, description: String, photo: Api.InputWebDocument?, invoice: Api.Invoice, payload: Buffer, provider: String, providerData: Api.DataJSON, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaVenue(flags: Int32, geoPoint: Api.InputGeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaWebPage(flags: Int32, message: String, entities: [Api.MessageEntity]?, url: String, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageText(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .inputBotInlineMessageGame(let flags, let replyMarkup):
|
||||
if boxed {
|
||||
buffer.appendInt32(1262639204)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
|
||||
break
|
||||
case .inputBotInlineMessageMediaAuto(let flags, let message, let entities, let replyMarkup):
|
||||
if boxed {
|
||||
buffer.appendInt32(864077702)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(message, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(entities!.count))
|
||||
for item in entities! {
|
||||
item.serialize(buffer, true)
|
||||
}}
|
||||
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
|
||||
break
|
||||
case .inputBotInlineMessageMediaContact(let flags, let phoneNumber, let firstName, let lastName, let vcard, let replyMarkup):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1494368259)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(phoneNumber, buffer: buffer, boxed: false)
|
||||
serializeString(firstName, buffer: buffer, boxed: false)
|
||||
serializeString(lastName, buffer: buffer, boxed: false)
|
||||
serializeString(vcard, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
|
||||
break
|
||||
case .inputBotInlineMessageMediaGeo(let flags, let geoPoint, let heading, let period, let proximityNotificationRadius, let replyMarkup):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1768777083)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
geoPoint.serialize(buffer, true)
|
||||
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(heading!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(period!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 3) != 0 {serializeInt32(proximityNotificationRadius!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
|
||||
break
|
||||
case .inputBotInlineMessageMediaInvoice(let flags, let title, let description, let photo, let invoice, let payload, let provider, let providerData, let replyMarkup):
|
||||
if boxed {
|
||||
buffer.appendInt32(-672693723)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(title, buffer: buffer, boxed: false)
|
||||
serializeString(description, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 0) != 0 {photo!.serialize(buffer, true)}
|
||||
invoice.serialize(buffer, true)
|
||||
serializeBytes(payload, buffer: buffer, boxed: false)
|
||||
serializeString(provider, buffer: buffer, boxed: false)
|
||||
providerData.serialize(buffer, true)
|
||||
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
|
||||
break
|
||||
case .inputBotInlineMessageMediaVenue(let flags, let geoPoint, let title, let address, let provider, let venueId, let venueType, let replyMarkup):
|
||||
if boxed {
|
||||
buffer.appendInt32(1098628881)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
geoPoint.serialize(buffer, true)
|
||||
serializeString(title, buffer: buffer, boxed: false)
|
||||
serializeString(address, buffer: buffer, boxed: false)
|
||||
serializeString(provider, buffer: buffer, boxed: false)
|
||||
serializeString(venueId, buffer: buffer, boxed: false)
|
||||
serializeString(venueType, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
|
||||
break
|
||||
case .inputBotInlineMessageMediaWebPage(let flags, let message, let entities, let url, let replyMarkup):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1109605104)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(message, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(entities!.count))
|
||||
for item in entities! {
|
||||
item.serialize(buffer, true)
|
||||
}}
|
||||
serializeString(url, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
|
||||
break
|
||||
case .inputBotInlineMessageText(let flags, let message, let entities, let replyMarkup):
|
||||
if boxed {
|
||||
buffer.appendInt32(1036876423)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(message, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(entities!.count))
|
||||
for item in entities! {
|
||||
item.serialize(buffer, true)
|
||||
}}
|
||||
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .inputBotInlineMessageGame(let flags, let replyMarkup):
|
||||
return ("inputBotInlineMessageGame", [("flags", flags as Any), ("replyMarkup", replyMarkup as Any)])
|
||||
case .inputBotInlineMessageMediaAuto(let flags, let message, let entities, let replyMarkup):
|
||||
return ("inputBotInlineMessageMediaAuto", [("flags", flags as Any), ("message", message as Any), ("entities", entities as Any), ("replyMarkup", replyMarkup as Any)])
|
||||
case .inputBotInlineMessageMediaContact(let flags, let phoneNumber, let firstName, let lastName, let vcard, let replyMarkup):
|
||||
return ("inputBotInlineMessageMediaContact", [("flags", flags as Any), ("phoneNumber", phoneNumber as Any), ("firstName", firstName as Any), ("lastName", lastName as Any), ("vcard", vcard as Any), ("replyMarkup", replyMarkup as Any)])
|
||||
case .inputBotInlineMessageMediaGeo(let flags, let geoPoint, let heading, let period, let proximityNotificationRadius, let replyMarkup):
|
||||
return ("inputBotInlineMessageMediaGeo", [("flags", flags as Any), ("geoPoint", geoPoint as Any), ("heading", heading as Any), ("period", period as Any), ("proximityNotificationRadius", proximityNotificationRadius as Any), ("replyMarkup", replyMarkup as Any)])
|
||||
case .inputBotInlineMessageMediaInvoice(let flags, let title, let description, let photo, let invoice, let payload, let provider, let providerData, let replyMarkup):
|
||||
return ("inputBotInlineMessageMediaInvoice", [("flags", flags as Any), ("title", title as Any), ("description", description as Any), ("photo", photo as Any), ("invoice", invoice as Any), ("payload", payload as Any), ("provider", provider as Any), ("providerData", providerData as Any), ("replyMarkup", replyMarkup as Any)])
|
||||
case .inputBotInlineMessageMediaVenue(let flags, let geoPoint, let title, let address, let provider, let venueId, let venueType, let replyMarkup):
|
||||
return ("inputBotInlineMessageMediaVenue", [("flags", flags as Any), ("geoPoint", geoPoint as Any), ("title", title as Any), ("address", address as Any), ("provider", provider as Any), ("venueId", venueId as Any), ("venueType", venueType as Any), ("replyMarkup", replyMarkup as Any)])
|
||||
case .inputBotInlineMessageMediaWebPage(let flags, let message, let entities, let url, let replyMarkup):
|
||||
return ("inputBotInlineMessageMediaWebPage", [("flags", flags as Any), ("message", message as Any), ("entities", entities as Any), ("url", url as Any), ("replyMarkup", replyMarkup as Any)])
|
||||
case .inputBotInlineMessageText(let flags, let message, let entities, let replyMarkup):
|
||||
return ("inputBotInlineMessageText", [("flags", flags as Any), ("message", message as Any), ("entities", entities as Any), ("replyMarkup", replyMarkup as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_inputBotInlineMessageGame(_ reader: BufferReader) -> InputBotInlineMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Api.ReplyMarkup?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_2 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = (Int(_1!) & Int(1 << 2) == 0) || _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.InputBotInlineMessage.inputBotInlineMessageGame(flags: _1!, replyMarkup: _2)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputBotInlineMessageMediaAuto(_ reader: BufferReader) -> InputBotInlineMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _3: [Api.MessageEntity]?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
|
||||
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
|
||||
} }
|
||||
var _4: Api.ReplyMarkup?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_4 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
|
||||
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 {
|
||||
return Api.InputBotInlineMessage.inputBotInlineMessageMediaAuto(flags: _1!, message: _2!, entities: _3, replyMarkup: _4)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputBotInlineMessageMediaContact(_ reader: BufferReader) -> InputBotInlineMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _3: String?
|
||||
_3 = parseString(reader)
|
||||
var _4: String?
|
||||
_4 = parseString(reader)
|
||||
var _5: String?
|
||||
_5 = parseString(reader)
|
||||
var _6: Api.ReplyMarkup?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_6 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||
return Api.InputBotInlineMessage.inputBotInlineMessageMediaContact(flags: _1!, phoneNumber: _2!, firstName: _3!, lastName: _4!, vcard: _5!, replyMarkup: _6)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputBotInlineMessageMediaGeo(_ reader: BufferReader) -> InputBotInlineMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Api.InputGeoPoint?
|
||||
if let signature = reader.readInt32() {
|
||||
_2 = Api.parse(reader, signature: signature) as? Api.InputGeoPoint
|
||||
}
|
||||
var _3: Int32?
|
||||
if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() }
|
||||
var _4: Int32?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {_4 = reader.readInt32() }
|
||||
var _5: Int32?
|
||||
if Int(_1!) & Int(1 << 3) != 0 {_5 = reader.readInt32() }
|
||||
var _6: Api.ReplyMarkup?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_6 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
|
||||
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
|
||||
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
|
||||
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||
return Api.InputBotInlineMessage.inputBotInlineMessageMediaGeo(flags: _1!, geoPoint: _2!, heading: _3, period: _4, proximityNotificationRadius: _5, replyMarkup: _6)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputBotInlineMessageMediaInvoice(_ reader: BufferReader) -> InputBotInlineMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _3: String?
|
||||
_3 = parseString(reader)
|
||||
var _4: Api.InputWebDocument?
|
||||
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
|
||||
_4 = Api.parse(reader, signature: signature) as? Api.InputWebDocument
|
||||
} }
|
||||
var _5: Api.Invoice?
|
||||
if let signature = reader.readInt32() {
|
||||
_5 = Api.parse(reader, signature: signature) as? Api.Invoice
|
||||
}
|
||||
var _6: Buffer?
|
||||
_6 = parseBytes(reader)
|
||||
var _7: String?
|
||||
_7 = parseString(reader)
|
||||
var _8: Api.DataJSON?
|
||||
if let signature = reader.readInt32() {
|
||||
_8 = Api.parse(reader, signature: signature) as? Api.DataJSON
|
||||
}
|
||||
var _9: Api.ReplyMarkup?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_9 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
let _c7 = _7 != nil
|
||||
let _c8 = _8 != nil
|
||||
let _c9 = (Int(_1!) & Int(1 << 2) == 0) || _9 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
|
||||
return Api.InputBotInlineMessage.inputBotInlineMessageMediaInvoice(flags: _1!, title: _2!, description: _3!, photo: _4, invoice: _5!, payload: _6!, provider: _7!, providerData: _8!, replyMarkup: _9)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputBotInlineMessageMediaVenue(_ reader: BufferReader) -> InputBotInlineMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Api.InputGeoPoint?
|
||||
if let signature = reader.readInt32() {
|
||||
_2 = Api.parse(reader, signature: signature) as? Api.InputGeoPoint
|
||||
}
|
||||
var _3: String?
|
||||
_3 = parseString(reader)
|
||||
var _4: String?
|
||||
_4 = parseString(reader)
|
||||
var _5: String?
|
||||
_5 = parseString(reader)
|
||||
var _6: String?
|
||||
_6 = parseString(reader)
|
||||
var _7: String?
|
||||
_7 = parseString(reader)
|
||||
var _8: Api.ReplyMarkup?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_8 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
let _c7 = _7 != nil
|
||||
let _c8 = (Int(_1!) & Int(1 << 2) == 0) || _8 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
|
||||
return Api.InputBotInlineMessage.inputBotInlineMessageMediaVenue(flags: _1!, geoPoint: _2!, title: _3!, address: _4!, provider: _5!, venueId: _6!, venueType: _7!, replyMarkup: _8)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputBotInlineMessageMediaWebPage(_ reader: BufferReader) -> InputBotInlineMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _3: [Api.MessageEntity]?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
|
||||
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
|
||||
} }
|
||||
var _4: String?
|
||||
_4 = parseString(reader)
|
||||
var _5: Api.ReplyMarkup?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_5 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||
return Api.InputBotInlineMessage.inputBotInlineMessageMediaWebPage(flags: _1!, message: _2!, entities: _3, url: _4!, replyMarkup: _5)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputBotInlineMessageText(_ reader: BufferReader) -> InputBotInlineMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _3: [Api.MessageEntity]?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
|
||||
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
|
||||
} }
|
||||
var _4: Api.ReplyMarkup?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_4 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
|
||||
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 {
|
||||
return Api.InputBotInlineMessage.inputBotInlineMessageText(flags: _1!, message: _2!, entities: _3, replyMarkup: _4)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,367 @@
|
||||
public extension Api {
|
||||
enum InputBotInlineMessage: TypeConstructorDescription {
|
||||
case inputBotInlineMessageGame(flags: Int32, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaAuto(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaContact(flags: Int32, phoneNumber: String, firstName: String, lastName: String, vcard: String, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaGeo(flags: Int32, geoPoint: Api.InputGeoPoint, heading: Int32?, period: Int32?, proximityNotificationRadius: Int32?, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaInvoice(flags: Int32, title: String, description: String, photo: Api.InputWebDocument?, invoice: Api.Invoice, payload: Buffer, provider: String, providerData: Api.DataJSON, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaVenue(flags: Int32, geoPoint: Api.InputGeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageMediaWebPage(flags: Int32, message: String, entities: [Api.MessageEntity]?, url: String, replyMarkup: Api.ReplyMarkup?)
|
||||
case inputBotInlineMessageText(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .inputBotInlineMessageGame(let flags, let replyMarkup):
|
||||
if boxed {
|
||||
buffer.appendInt32(1262639204)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
|
||||
break
|
||||
case .inputBotInlineMessageMediaAuto(let flags, let message, let entities, let replyMarkup):
|
||||
if boxed {
|
||||
buffer.appendInt32(864077702)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(message, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(entities!.count))
|
||||
for item in entities! {
|
||||
item.serialize(buffer, true)
|
||||
}}
|
||||
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
|
||||
break
|
||||
case .inputBotInlineMessageMediaContact(let flags, let phoneNumber, let firstName, let lastName, let vcard, let replyMarkup):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1494368259)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(phoneNumber, buffer: buffer, boxed: false)
|
||||
serializeString(firstName, buffer: buffer, boxed: false)
|
||||
serializeString(lastName, buffer: buffer, boxed: false)
|
||||
serializeString(vcard, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
|
||||
break
|
||||
case .inputBotInlineMessageMediaGeo(let flags, let geoPoint, let heading, let period, let proximityNotificationRadius, let replyMarkup):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1768777083)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
geoPoint.serialize(buffer, true)
|
||||
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(heading!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(period!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 3) != 0 {serializeInt32(proximityNotificationRadius!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
|
||||
break
|
||||
case .inputBotInlineMessageMediaInvoice(let flags, let title, let description, let photo, let invoice, let payload, let provider, let providerData, let replyMarkup):
|
||||
if boxed {
|
||||
buffer.appendInt32(-672693723)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(title, buffer: buffer, boxed: false)
|
||||
serializeString(description, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 0) != 0 {photo!.serialize(buffer, true)}
|
||||
invoice.serialize(buffer, true)
|
||||
serializeBytes(payload, buffer: buffer, boxed: false)
|
||||
serializeString(provider, buffer: buffer, boxed: false)
|
||||
providerData.serialize(buffer, true)
|
||||
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
|
||||
break
|
||||
case .inputBotInlineMessageMediaVenue(let flags, let geoPoint, let title, let address, let provider, let venueId, let venueType, let replyMarkup):
|
||||
if boxed {
|
||||
buffer.appendInt32(1098628881)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
geoPoint.serialize(buffer, true)
|
||||
serializeString(title, buffer: buffer, boxed: false)
|
||||
serializeString(address, buffer: buffer, boxed: false)
|
||||
serializeString(provider, buffer: buffer, boxed: false)
|
||||
serializeString(venueId, buffer: buffer, boxed: false)
|
||||
serializeString(venueType, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
|
||||
break
|
||||
case .inputBotInlineMessageMediaWebPage(let flags, let message, let entities, let url, let replyMarkup):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1109605104)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(message, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(entities!.count))
|
||||
for item in entities! {
|
||||
item.serialize(buffer, true)
|
||||
}}
|
||||
serializeString(url, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
|
||||
break
|
||||
case .inputBotInlineMessageText(let flags, let message, let entities, let replyMarkup):
|
||||
if boxed {
|
||||
buffer.appendInt32(1036876423)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(message, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(entities!.count))
|
||||
for item in entities! {
|
||||
item.serialize(buffer, true)
|
||||
}}
|
||||
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .inputBotInlineMessageGame(let flags, let replyMarkup):
|
||||
return ("inputBotInlineMessageGame", [("flags", flags as Any), ("replyMarkup", replyMarkup as Any)])
|
||||
case .inputBotInlineMessageMediaAuto(let flags, let message, let entities, let replyMarkup):
|
||||
return ("inputBotInlineMessageMediaAuto", [("flags", flags as Any), ("message", message as Any), ("entities", entities as Any), ("replyMarkup", replyMarkup as Any)])
|
||||
case .inputBotInlineMessageMediaContact(let flags, let phoneNumber, let firstName, let lastName, let vcard, let replyMarkup):
|
||||
return ("inputBotInlineMessageMediaContact", [("flags", flags as Any), ("phoneNumber", phoneNumber as Any), ("firstName", firstName as Any), ("lastName", lastName as Any), ("vcard", vcard as Any), ("replyMarkup", replyMarkup as Any)])
|
||||
case .inputBotInlineMessageMediaGeo(let flags, let geoPoint, let heading, let period, let proximityNotificationRadius, let replyMarkup):
|
||||
return ("inputBotInlineMessageMediaGeo", [("flags", flags as Any), ("geoPoint", geoPoint as Any), ("heading", heading as Any), ("period", period as Any), ("proximityNotificationRadius", proximityNotificationRadius as Any), ("replyMarkup", replyMarkup as Any)])
|
||||
case .inputBotInlineMessageMediaInvoice(let flags, let title, let description, let photo, let invoice, let payload, let provider, let providerData, let replyMarkup):
|
||||
return ("inputBotInlineMessageMediaInvoice", [("flags", flags as Any), ("title", title as Any), ("description", description as Any), ("photo", photo as Any), ("invoice", invoice as Any), ("payload", payload as Any), ("provider", provider as Any), ("providerData", providerData as Any), ("replyMarkup", replyMarkup as Any)])
|
||||
case .inputBotInlineMessageMediaVenue(let flags, let geoPoint, let title, let address, let provider, let venueId, let venueType, let replyMarkup):
|
||||
return ("inputBotInlineMessageMediaVenue", [("flags", flags as Any), ("geoPoint", geoPoint as Any), ("title", title as Any), ("address", address as Any), ("provider", provider as Any), ("venueId", venueId as Any), ("venueType", venueType as Any), ("replyMarkup", replyMarkup as Any)])
|
||||
case .inputBotInlineMessageMediaWebPage(let flags, let message, let entities, let url, let replyMarkup):
|
||||
return ("inputBotInlineMessageMediaWebPage", [("flags", flags as Any), ("message", message as Any), ("entities", entities as Any), ("url", url as Any), ("replyMarkup", replyMarkup as Any)])
|
||||
case .inputBotInlineMessageText(let flags, let message, let entities, let replyMarkup):
|
||||
return ("inputBotInlineMessageText", [("flags", flags as Any), ("message", message as Any), ("entities", entities as Any), ("replyMarkup", replyMarkup as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_inputBotInlineMessageGame(_ reader: BufferReader) -> InputBotInlineMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Api.ReplyMarkup?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_2 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = (Int(_1!) & Int(1 << 2) == 0) || _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.InputBotInlineMessage.inputBotInlineMessageGame(flags: _1!, replyMarkup: _2)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputBotInlineMessageMediaAuto(_ reader: BufferReader) -> InputBotInlineMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _3: [Api.MessageEntity]?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
|
||||
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
|
||||
} }
|
||||
var _4: Api.ReplyMarkup?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_4 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
|
||||
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 {
|
||||
return Api.InputBotInlineMessage.inputBotInlineMessageMediaAuto(flags: _1!, message: _2!, entities: _3, replyMarkup: _4)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputBotInlineMessageMediaContact(_ reader: BufferReader) -> InputBotInlineMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _3: String?
|
||||
_3 = parseString(reader)
|
||||
var _4: String?
|
||||
_4 = parseString(reader)
|
||||
var _5: String?
|
||||
_5 = parseString(reader)
|
||||
var _6: Api.ReplyMarkup?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_6 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||
return Api.InputBotInlineMessage.inputBotInlineMessageMediaContact(flags: _1!, phoneNumber: _2!, firstName: _3!, lastName: _4!, vcard: _5!, replyMarkup: _6)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputBotInlineMessageMediaGeo(_ reader: BufferReader) -> InputBotInlineMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Api.InputGeoPoint?
|
||||
if let signature = reader.readInt32() {
|
||||
_2 = Api.parse(reader, signature: signature) as? Api.InputGeoPoint
|
||||
}
|
||||
var _3: Int32?
|
||||
if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() }
|
||||
var _4: Int32?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {_4 = reader.readInt32() }
|
||||
var _5: Int32?
|
||||
if Int(_1!) & Int(1 << 3) != 0 {_5 = reader.readInt32() }
|
||||
var _6: Api.ReplyMarkup?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_6 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
|
||||
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
|
||||
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
|
||||
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||
return Api.InputBotInlineMessage.inputBotInlineMessageMediaGeo(flags: _1!, geoPoint: _2!, heading: _3, period: _4, proximityNotificationRadius: _5, replyMarkup: _6)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputBotInlineMessageMediaInvoice(_ reader: BufferReader) -> InputBotInlineMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _3: String?
|
||||
_3 = parseString(reader)
|
||||
var _4: Api.InputWebDocument?
|
||||
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
|
||||
_4 = Api.parse(reader, signature: signature) as? Api.InputWebDocument
|
||||
} }
|
||||
var _5: Api.Invoice?
|
||||
if let signature = reader.readInt32() {
|
||||
_5 = Api.parse(reader, signature: signature) as? Api.Invoice
|
||||
}
|
||||
var _6: Buffer?
|
||||
_6 = parseBytes(reader)
|
||||
var _7: String?
|
||||
_7 = parseString(reader)
|
||||
var _8: Api.DataJSON?
|
||||
if let signature = reader.readInt32() {
|
||||
_8 = Api.parse(reader, signature: signature) as? Api.DataJSON
|
||||
}
|
||||
var _9: Api.ReplyMarkup?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_9 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
let _c7 = _7 != nil
|
||||
let _c8 = _8 != nil
|
||||
let _c9 = (Int(_1!) & Int(1 << 2) == 0) || _9 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
|
||||
return Api.InputBotInlineMessage.inputBotInlineMessageMediaInvoice(flags: _1!, title: _2!, description: _3!, photo: _4, invoice: _5!, payload: _6!, provider: _7!, providerData: _8!, replyMarkup: _9)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputBotInlineMessageMediaVenue(_ reader: BufferReader) -> InputBotInlineMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Api.InputGeoPoint?
|
||||
if let signature = reader.readInt32() {
|
||||
_2 = Api.parse(reader, signature: signature) as? Api.InputGeoPoint
|
||||
}
|
||||
var _3: String?
|
||||
_3 = parseString(reader)
|
||||
var _4: String?
|
||||
_4 = parseString(reader)
|
||||
var _5: String?
|
||||
_5 = parseString(reader)
|
||||
var _6: String?
|
||||
_6 = parseString(reader)
|
||||
var _7: String?
|
||||
_7 = parseString(reader)
|
||||
var _8: Api.ReplyMarkup?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_8 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
let _c7 = _7 != nil
|
||||
let _c8 = (Int(_1!) & Int(1 << 2) == 0) || _8 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
|
||||
return Api.InputBotInlineMessage.inputBotInlineMessageMediaVenue(flags: _1!, geoPoint: _2!, title: _3!, address: _4!, provider: _5!, venueId: _6!, venueType: _7!, replyMarkup: _8)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputBotInlineMessageMediaWebPage(_ reader: BufferReader) -> InputBotInlineMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _3: [Api.MessageEntity]?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
|
||||
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
|
||||
} }
|
||||
var _4: String?
|
||||
_4 = parseString(reader)
|
||||
var _5: Api.ReplyMarkup?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_5 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||
return Api.InputBotInlineMessage.inputBotInlineMessageMediaWebPage(flags: _1!, message: _2!, entities: _3, url: _4!, replyMarkup: _5)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputBotInlineMessageText(_ reader: BufferReader) -> InputBotInlineMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _3: [Api.MessageEntity]?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
|
||||
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
|
||||
} }
|
||||
var _4: Api.ReplyMarkup?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_4 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
|
||||
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 {
|
||||
return Api.InputBotInlineMessage.inputBotInlineMessageText(flags: _1!, message: _2!, entities: _3, replyMarkup: _4)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum InputBotInlineMessageID: TypeConstructorDescription {
|
||||
case inputBotInlineMessageID(dcId: Int32, id: Int64, accessHash: Int64)
|
||||
@ -928,317 +1292,3 @@ public extension Api {
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum InputContact: TypeConstructorDescription {
|
||||
case inputPhoneContact(clientId: Int64, phone: String, firstName: String, lastName: String)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .inputPhoneContact(let clientId, let phone, let firstName, let lastName):
|
||||
if boxed {
|
||||
buffer.appendInt32(-208488460)
|
||||
}
|
||||
serializeInt64(clientId, buffer: buffer, boxed: false)
|
||||
serializeString(phone, buffer: buffer, boxed: false)
|
||||
serializeString(firstName, buffer: buffer, boxed: false)
|
||||
serializeString(lastName, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .inputPhoneContact(let clientId, let phone, let firstName, let lastName):
|
||||
return ("inputPhoneContact", [("clientId", clientId as Any), ("phone", phone as Any), ("firstName", firstName as Any), ("lastName", lastName as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_inputPhoneContact(_ reader: BufferReader) -> InputContact? {
|
||||
var _1: Int64?
|
||||
_1 = reader.readInt64()
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _3: String?
|
||||
_3 = parseString(reader)
|
||||
var _4: String?
|
||||
_4 = parseString(reader)
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 {
|
||||
return Api.InputContact.inputPhoneContact(clientId: _1!, phone: _2!, firstName: _3!, lastName: _4!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
indirect enum InputDialogPeer: TypeConstructorDescription {
|
||||
case inputDialogPeer(peer: Api.InputPeer)
|
||||
case inputDialogPeerFolder(folderId: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .inputDialogPeer(let peer):
|
||||
if boxed {
|
||||
buffer.appendInt32(-55902537)
|
||||
}
|
||||
peer.serialize(buffer, true)
|
||||
break
|
||||
case .inputDialogPeerFolder(let folderId):
|
||||
if boxed {
|
||||
buffer.appendInt32(1684014375)
|
||||
}
|
||||
serializeInt32(folderId, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .inputDialogPeer(let peer):
|
||||
return ("inputDialogPeer", [("peer", peer as Any)])
|
||||
case .inputDialogPeerFolder(let folderId):
|
||||
return ("inputDialogPeerFolder", [("folderId", folderId as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_inputDialogPeer(_ reader: BufferReader) -> InputDialogPeer? {
|
||||
var _1: Api.InputPeer?
|
||||
if let signature = reader.readInt32() {
|
||||
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
if _c1 {
|
||||
return Api.InputDialogPeer.inputDialogPeer(peer: _1!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputDialogPeerFolder(_ reader: BufferReader) -> InputDialogPeer? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
if _c1 {
|
||||
return Api.InputDialogPeer.inputDialogPeerFolder(folderId: _1!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum InputDocument: TypeConstructorDescription {
|
||||
case inputDocument(id: Int64, accessHash: Int64, fileReference: Buffer)
|
||||
case inputDocumentEmpty
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .inputDocument(let id, let accessHash, let fileReference):
|
||||
if boxed {
|
||||
buffer.appendInt32(448771445)
|
||||
}
|
||||
serializeInt64(id, buffer: buffer, boxed: false)
|
||||
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
||||
serializeBytes(fileReference, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .inputDocumentEmpty:
|
||||
if boxed {
|
||||
buffer.appendInt32(1928391342)
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .inputDocument(let id, let accessHash, let fileReference):
|
||||
return ("inputDocument", [("id", id as Any), ("accessHash", accessHash as Any), ("fileReference", fileReference as Any)])
|
||||
case .inputDocumentEmpty:
|
||||
return ("inputDocumentEmpty", [])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_inputDocument(_ reader: BufferReader) -> InputDocument? {
|
||||
var _1: Int64?
|
||||
_1 = reader.readInt64()
|
||||
var _2: Int64?
|
||||
_2 = reader.readInt64()
|
||||
var _3: Buffer?
|
||||
_3 = parseBytes(reader)
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
if _c1 && _c2 && _c3 {
|
||||
return Api.InputDocument.inputDocument(id: _1!, accessHash: _2!, fileReference: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputDocumentEmpty(_ reader: BufferReader) -> InputDocument? {
|
||||
return Api.InputDocument.inputDocumentEmpty
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum InputEncryptedChat: TypeConstructorDescription {
|
||||
case inputEncryptedChat(chatId: Int32, accessHash: Int64)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .inputEncryptedChat(let chatId, let accessHash):
|
||||
if boxed {
|
||||
buffer.appendInt32(-247351839)
|
||||
}
|
||||
serializeInt32(chatId, buffer: buffer, boxed: false)
|
||||
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .inputEncryptedChat(let chatId, let accessHash):
|
||||
return ("inputEncryptedChat", [("chatId", chatId as Any), ("accessHash", accessHash as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_inputEncryptedChat(_ reader: BufferReader) -> InputEncryptedChat? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Int64?
|
||||
_2 = reader.readInt64()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.InputEncryptedChat.inputEncryptedChat(chatId: _1!, accessHash: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum InputEncryptedFile: TypeConstructorDescription {
|
||||
case inputEncryptedFile(id: Int64, accessHash: Int64)
|
||||
case inputEncryptedFileBigUploaded(id: Int64, parts: Int32, keyFingerprint: Int32)
|
||||
case inputEncryptedFileEmpty
|
||||
case inputEncryptedFileUploaded(id: Int64, parts: Int32, md5Checksum: String, keyFingerprint: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .inputEncryptedFile(let id, let accessHash):
|
||||
if boxed {
|
||||
buffer.appendInt32(1511503333)
|
||||
}
|
||||
serializeInt64(id, buffer: buffer, boxed: false)
|
||||
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .inputEncryptedFileBigUploaded(let id, let parts, let keyFingerprint):
|
||||
if boxed {
|
||||
buffer.appendInt32(767652808)
|
||||
}
|
||||
serializeInt64(id, buffer: buffer, boxed: false)
|
||||
serializeInt32(parts, buffer: buffer, boxed: false)
|
||||
serializeInt32(keyFingerprint, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .inputEncryptedFileEmpty:
|
||||
if boxed {
|
||||
buffer.appendInt32(406307684)
|
||||
}
|
||||
|
||||
break
|
||||
case .inputEncryptedFileUploaded(let id, let parts, let md5Checksum, let keyFingerprint):
|
||||
if boxed {
|
||||
buffer.appendInt32(1690108678)
|
||||
}
|
||||
serializeInt64(id, buffer: buffer, boxed: false)
|
||||
serializeInt32(parts, buffer: buffer, boxed: false)
|
||||
serializeString(md5Checksum, buffer: buffer, boxed: false)
|
||||
serializeInt32(keyFingerprint, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .inputEncryptedFile(let id, let accessHash):
|
||||
return ("inputEncryptedFile", [("id", id as Any), ("accessHash", accessHash as Any)])
|
||||
case .inputEncryptedFileBigUploaded(let id, let parts, let keyFingerprint):
|
||||
return ("inputEncryptedFileBigUploaded", [("id", id as Any), ("parts", parts as Any), ("keyFingerprint", keyFingerprint as Any)])
|
||||
case .inputEncryptedFileEmpty:
|
||||
return ("inputEncryptedFileEmpty", [])
|
||||
case .inputEncryptedFileUploaded(let id, let parts, let md5Checksum, let keyFingerprint):
|
||||
return ("inputEncryptedFileUploaded", [("id", id as Any), ("parts", parts as Any), ("md5Checksum", md5Checksum as Any), ("keyFingerprint", keyFingerprint as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_inputEncryptedFile(_ reader: BufferReader) -> InputEncryptedFile? {
|
||||
var _1: Int64?
|
||||
_1 = reader.readInt64()
|
||||
var _2: Int64?
|
||||
_2 = reader.readInt64()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.InputEncryptedFile.inputEncryptedFile(id: _1!, accessHash: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputEncryptedFileBigUploaded(_ reader: BufferReader) -> InputEncryptedFile? {
|
||||
var _1: Int64?
|
||||
_1 = reader.readInt64()
|
||||
var _2: Int32?
|
||||
_2 = reader.readInt32()
|
||||
var _3: Int32?
|
||||
_3 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
if _c1 && _c2 && _c3 {
|
||||
return Api.InputEncryptedFile.inputEncryptedFileBigUploaded(id: _1!, parts: _2!, keyFingerprint: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputEncryptedFileEmpty(_ reader: BufferReader) -> InputEncryptedFile? {
|
||||
return Api.InputEncryptedFile.inputEncryptedFileEmpty
|
||||
}
|
||||
public static func parse_inputEncryptedFileUploaded(_ reader: BufferReader) -> InputEncryptedFile? {
|
||||
var _1: Int64?
|
||||
_1 = reader.readInt64()
|
||||
var _2: Int32?
|
||||
_2 = reader.readInt32()
|
||||
var _3: String?
|
||||
_3 = parseString(reader)
|
||||
var _4: Int32?
|
||||
_4 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 {
|
||||
return Api.InputEncryptedFile.inputEncryptedFileUploaded(id: _1!, parts: _2!, md5Checksum: _3!, keyFingerprint: _4!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,317 @@
|
||||
public extension Api {
|
||||
enum InputContact: TypeConstructorDescription {
|
||||
case inputPhoneContact(clientId: Int64, phone: String, firstName: String, lastName: String)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .inputPhoneContact(let clientId, let phone, let firstName, let lastName):
|
||||
if boxed {
|
||||
buffer.appendInt32(-208488460)
|
||||
}
|
||||
serializeInt64(clientId, buffer: buffer, boxed: false)
|
||||
serializeString(phone, buffer: buffer, boxed: false)
|
||||
serializeString(firstName, buffer: buffer, boxed: false)
|
||||
serializeString(lastName, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .inputPhoneContact(let clientId, let phone, let firstName, let lastName):
|
||||
return ("inputPhoneContact", [("clientId", clientId as Any), ("phone", phone as Any), ("firstName", firstName as Any), ("lastName", lastName as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_inputPhoneContact(_ reader: BufferReader) -> InputContact? {
|
||||
var _1: Int64?
|
||||
_1 = reader.readInt64()
|
||||
var _2: String?
|
||||
_2 = parseString(reader)
|
||||
var _3: String?
|
||||
_3 = parseString(reader)
|
||||
var _4: String?
|
||||
_4 = parseString(reader)
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 {
|
||||
return Api.InputContact.inputPhoneContact(clientId: _1!, phone: _2!, firstName: _3!, lastName: _4!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
indirect enum InputDialogPeer: TypeConstructorDescription {
|
||||
case inputDialogPeer(peer: Api.InputPeer)
|
||||
case inputDialogPeerFolder(folderId: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .inputDialogPeer(let peer):
|
||||
if boxed {
|
||||
buffer.appendInt32(-55902537)
|
||||
}
|
||||
peer.serialize(buffer, true)
|
||||
break
|
||||
case .inputDialogPeerFolder(let folderId):
|
||||
if boxed {
|
||||
buffer.appendInt32(1684014375)
|
||||
}
|
||||
serializeInt32(folderId, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .inputDialogPeer(let peer):
|
||||
return ("inputDialogPeer", [("peer", peer as Any)])
|
||||
case .inputDialogPeerFolder(let folderId):
|
||||
return ("inputDialogPeerFolder", [("folderId", folderId as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_inputDialogPeer(_ reader: BufferReader) -> InputDialogPeer? {
|
||||
var _1: Api.InputPeer?
|
||||
if let signature = reader.readInt32() {
|
||||
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
if _c1 {
|
||||
return Api.InputDialogPeer.inputDialogPeer(peer: _1!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputDialogPeerFolder(_ reader: BufferReader) -> InputDialogPeer? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
if _c1 {
|
||||
return Api.InputDialogPeer.inputDialogPeerFolder(folderId: _1!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum InputDocument: TypeConstructorDescription {
|
||||
case inputDocument(id: Int64, accessHash: Int64, fileReference: Buffer)
|
||||
case inputDocumentEmpty
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .inputDocument(let id, let accessHash, let fileReference):
|
||||
if boxed {
|
||||
buffer.appendInt32(448771445)
|
||||
}
|
||||
serializeInt64(id, buffer: buffer, boxed: false)
|
||||
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
||||
serializeBytes(fileReference, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .inputDocumentEmpty:
|
||||
if boxed {
|
||||
buffer.appendInt32(1928391342)
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .inputDocument(let id, let accessHash, let fileReference):
|
||||
return ("inputDocument", [("id", id as Any), ("accessHash", accessHash as Any), ("fileReference", fileReference as Any)])
|
||||
case .inputDocumentEmpty:
|
||||
return ("inputDocumentEmpty", [])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_inputDocument(_ reader: BufferReader) -> InputDocument? {
|
||||
var _1: Int64?
|
||||
_1 = reader.readInt64()
|
||||
var _2: Int64?
|
||||
_2 = reader.readInt64()
|
||||
var _3: Buffer?
|
||||
_3 = parseBytes(reader)
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
if _c1 && _c2 && _c3 {
|
||||
return Api.InputDocument.inputDocument(id: _1!, accessHash: _2!, fileReference: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputDocumentEmpty(_ reader: BufferReader) -> InputDocument? {
|
||||
return Api.InputDocument.inputDocumentEmpty
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum InputEncryptedChat: TypeConstructorDescription {
|
||||
case inputEncryptedChat(chatId: Int32, accessHash: Int64)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .inputEncryptedChat(let chatId, let accessHash):
|
||||
if boxed {
|
||||
buffer.appendInt32(-247351839)
|
||||
}
|
||||
serializeInt32(chatId, buffer: buffer, boxed: false)
|
||||
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .inputEncryptedChat(let chatId, let accessHash):
|
||||
return ("inputEncryptedChat", [("chatId", chatId as Any), ("accessHash", accessHash as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_inputEncryptedChat(_ reader: BufferReader) -> InputEncryptedChat? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Int64?
|
||||
_2 = reader.readInt64()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.InputEncryptedChat.inputEncryptedChat(chatId: _1!, accessHash: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum InputEncryptedFile: TypeConstructorDescription {
|
||||
case inputEncryptedFile(id: Int64, accessHash: Int64)
|
||||
case inputEncryptedFileBigUploaded(id: Int64, parts: Int32, keyFingerprint: Int32)
|
||||
case inputEncryptedFileEmpty
|
||||
case inputEncryptedFileUploaded(id: Int64, parts: Int32, md5Checksum: String, keyFingerprint: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .inputEncryptedFile(let id, let accessHash):
|
||||
if boxed {
|
||||
buffer.appendInt32(1511503333)
|
||||
}
|
||||
serializeInt64(id, buffer: buffer, boxed: false)
|
||||
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .inputEncryptedFileBigUploaded(let id, let parts, let keyFingerprint):
|
||||
if boxed {
|
||||
buffer.appendInt32(767652808)
|
||||
}
|
||||
serializeInt64(id, buffer: buffer, boxed: false)
|
||||
serializeInt32(parts, buffer: buffer, boxed: false)
|
||||
serializeInt32(keyFingerprint, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .inputEncryptedFileEmpty:
|
||||
if boxed {
|
||||
buffer.appendInt32(406307684)
|
||||
}
|
||||
|
||||
break
|
||||
case .inputEncryptedFileUploaded(let id, let parts, let md5Checksum, let keyFingerprint):
|
||||
if boxed {
|
||||
buffer.appendInt32(1690108678)
|
||||
}
|
||||
serializeInt64(id, buffer: buffer, boxed: false)
|
||||
serializeInt32(parts, buffer: buffer, boxed: false)
|
||||
serializeString(md5Checksum, buffer: buffer, boxed: false)
|
||||
serializeInt32(keyFingerprint, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .inputEncryptedFile(let id, let accessHash):
|
||||
return ("inputEncryptedFile", [("id", id as Any), ("accessHash", accessHash as Any)])
|
||||
case .inputEncryptedFileBigUploaded(let id, let parts, let keyFingerprint):
|
||||
return ("inputEncryptedFileBigUploaded", [("id", id as Any), ("parts", parts as Any), ("keyFingerprint", keyFingerprint as Any)])
|
||||
case .inputEncryptedFileEmpty:
|
||||
return ("inputEncryptedFileEmpty", [])
|
||||
case .inputEncryptedFileUploaded(let id, let parts, let md5Checksum, let keyFingerprint):
|
||||
return ("inputEncryptedFileUploaded", [("id", id as Any), ("parts", parts as Any), ("md5Checksum", md5Checksum as Any), ("keyFingerprint", keyFingerprint as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_inputEncryptedFile(_ reader: BufferReader) -> InputEncryptedFile? {
|
||||
var _1: Int64?
|
||||
_1 = reader.readInt64()
|
||||
var _2: Int64?
|
||||
_2 = reader.readInt64()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.InputEncryptedFile.inputEncryptedFile(id: _1!, accessHash: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputEncryptedFileBigUploaded(_ reader: BufferReader) -> InputEncryptedFile? {
|
||||
var _1: Int64?
|
||||
_1 = reader.readInt64()
|
||||
var _2: Int32?
|
||||
_2 = reader.readInt32()
|
||||
var _3: Int32?
|
||||
_3 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
if _c1 && _c2 && _c3 {
|
||||
return Api.InputEncryptedFile.inputEncryptedFileBigUploaded(id: _1!, parts: _2!, keyFingerprint: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_inputEncryptedFileEmpty(_ reader: BufferReader) -> InputEncryptedFile? {
|
||||
return Api.InputEncryptedFile.inputEncryptedFileEmpty
|
||||
}
|
||||
public static func parse_inputEncryptedFileUploaded(_ reader: BufferReader) -> InputEncryptedFile? {
|
||||
var _1: Int64?
|
||||
_1 = reader.readInt64()
|
||||
var _2: Int32?
|
||||
_2 = reader.readInt32()
|
||||
var _3: String?
|
||||
_3 = parseString(reader)
|
||||
var _4: Int32?
|
||||
_4 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 {
|
||||
return Api.InputEncryptedFile.inputEncryptedFileUploaded(id: _1!, parts: _2!, md5Checksum: _3!, keyFingerprint: _4!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum InputFile: TypeConstructorDescription {
|
||||
case inputFile(id: Int64, parts: Int32, name: String, md5Checksum: String)
|
||||
|
@ -93,8 +93,7 @@ final class AccountTaskManager {
|
||||
tasks.add(managedSynchronizeEmojiSearchCategories(postbox: self.stateManager.postbox, network: self.stateManager.network, kind: .emoji).start())
|
||||
tasks.add(managedSynchronizeEmojiSearchCategories(postbox: self.stateManager.postbox, network: self.stateManager.network, kind: .status).start())
|
||||
tasks.add(managedSynchronizeEmojiSearchCategories(postbox: self.stateManager.postbox, network: self.stateManager.network, kind: .avatar).start())
|
||||
tasks.add(managedSynchronizeEmojiSearchCategories(postbox: self.stateManager.postbox, network: self.stateManager.network, kind: .chatStickers).start())
|
||||
tasks.add(managedSynchronizeEmojiSearchCategories(postbox: self.stateManager.postbox, network: self.stateManager.network, kind: .greetingStickers).start())
|
||||
tasks.add(managedSynchronizeEmojiSearchCategories(postbox: self.stateManager.postbox, network: self.stateManager.network, kind: .combinedChatStickers).start())
|
||||
tasks.add(managedSynchronizeAttachMenuBots(accountPeerId: self.accountPeerId, postbox: self.stateManager.postbox, network: self.stateManager.network, force: true).start())
|
||||
tasks.add(managedSynchronizeNotificationSoundList(postbox: self.stateManager.postbox, network: self.stateManager.network).start())
|
||||
tasks.add(managedChatListFilters(postbox: self.stateManager.postbox, network: self.stateManager.network, accountPeerId: self.stateManager.accountPeerId).start())
|
||||
|
@ -8,8 +8,7 @@ public final class EmojiSearchCategories: Equatable, Codable {
|
||||
case emoji = 0
|
||||
case status = 1
|
||||
case avatar = 2
|
||||
case chatStickers = 3
|
||||
case greetingStickers = 4
|
||||
case combinedChatStickers = 3
|
||||
}
|
||||
|
||||
public struct Group: Codable, Equatable {
|
||||
@ -17,16 +16,25 @@ public final class EmojiSearchCategories: Equatable, Codable {
|
||||
case id
|
||||
case title
|
||||
case identifiers
|
||||
case kind
|
||||
}
|
||||
|
||||
public enum Kind: Int32, Codable {
|
||||
case generic
|
||||
case greeting
|
||||
case premium
|
||||
}
|
||||
|
||||
public var id: Int64
|
||||
public var title: String
|
||||
public var identifiers: [String]
|
||||
public var kind: Kind
|
||||
|
||||
public init(id: Int64, title: String, identifiers: [String]) {
|
||||
public init(id: Int64, title: String, identifiers: [String], kind: Kind) {
|
||||
self.id = id
|
||||
self.title = title
|
||||
self.identifiers = identifiers
|
||||
self.kind = kind
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
@ -35,6 +43,16 @@ public final class EmojiSearchCategories: Equatable, Codable {
|
||||
self.id = try container.decode(Int64.self, forKey: .id)
|
||||
self.title = try container.decode(String.self, forKey: .title)
|
||||
self.identifiers = try container.decode([String].self, forKey: .identifiers)
|
||||
self.kind = ((try container.decodeIfPresent(Int32.self, forKey: .kind)).flatMap(Kind.init(rawValue:))) ?? .generic
|
||||
}
|
||||
|
||||
public func encode(to encoder: any Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
|
||||
try container.encode(self.id, forKey: .id)
|
||||
try container.encode(self.title, forKey: .title)
|
||||
try container.encode(self.identifiers, forKey: .identifiers)
|
||||
try container.encode(self.kind.rawValue, forKey: .kind)
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,9 +148,8 @@ func managedSynchronizeEmojiSearchCategories(postbox: Postbox, network: Network,
|
||||
|> `catch` { _ -> Signal<Api.messages.EmojiGroups, NoError> in
|
||||
return .single(.emojiGroupsNotModified)
|
||||
}
|
||||
//TODO:localize
|
||||
case .chatStickers, .greetingStickers:
|
||||
signal = network.request(Api.functions.messages.getEmojiGroups(hash: current?.hash ?? 0))
|
||||
case .combinedChatStickers:
|
||||
signal = network.request(Api.functions.messages.getEmojiStickerGroups(hash: current?.hash ?? 0))
|
||||
|> `catch` { _ -> Signal<Api.messages.EmojiGroups, NoError> in
|
||||
return .single(.emojiGroupsNotModified)
|
||||
}
|
||||
@ -150,7 +167,23 @@ func managedSynchronizeEmojiSearchCategories(postbox: Postbox, network: Network,
|
||||
case let .emojiGroup(title, iconEmojiId, emoticons):
|
||||
return EmojiSearchCategories.Group(
|
||||
id: iconEmojiId,
|
||||
title: title, identifiers: emoticons
|
||||
title: title,
|
||||
identifiers: emoticons,
|
||||
kind: .generic
|
||||
)
|
||||
case let .emojiGroupGreeting(title, iconEmojiId, emoticons):
|
||||
return EmojiSearchCategories.Group(
|
||||
id: iconEmojiId,
|
||||
title: title,
|
||||
identifiers: emoticons,
|
||||
kind: .greeting
|
||||
)
|
||||
case let .emojiGroupPremium(title, iconEmojiId):
|
||||
return EmojiSearchCategories.Group(
|
||||
id: iconEmojiId,
|
||||
title: title,
|
||||
identifiers: [],
|
||||
kind: .premium
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -47,8 +47,11 @@ public struct RevenueStats: Equatable {
|
||||
extension RevenueStats {
|
||||
init(apiRevenueStats: Api.stats.BroadcastRevenueStats, peerId: PeerId) {
|
||||
switch apiRevenueStats {
|
||||
case let .broadcastRevenueStats(topHoursGraph, revenueGraph, currentBalance, availableBalance, overallRevenue, usdRate):
|
||||
self.init(topHoursGraph: StatsGraph(apiStatsGraph: topHoursGraph), revenueGraph: StatsGraph(apiStatsGraph: revenueGraph), currentBalance: currentBalance, availableBalance: availableBalance, overallRevenue: overallRevenue, usdRate: usdRate)
|
||||
case let .broadcastRevenueStats(topHoursGraph, revenueGraph, balances, usdRate):
|
||||
switch balances {
|
||||
case let .broadcastRevenueBalances(currentBalance, availableBalance, overallRevenue):
|
||||
self.init(topHoursGraph: StatsGraph(apiStatsGraph: topHoursGraph), revenueGraph: StatsGraph(apiStatsGraph: revenueGraph), currentBalance: currentBalance, availableBalance: availableBalance, overallRevenue: overallRevenue, usdRate: usdRate)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1191,21 +1191,23 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
|
||||
}
|
||||
recognizer.highlight = { [weak self] point in
|
||||
if let strongSelf = self {
|
||||
if let replyInfoNode = strongSelf.replyInfoNode {
|
||||
var translatedPoint: CGPoint?
|
||||
let convertedNodeFrame = replyInfoNode.view.convert(replyInfoNode.bounds, to: strongSelf.view)
|
||||
if let point = point, convertedNodeFrame.insetBy(dx: -4.0, dy: -4.0).contains(point) {
|
||||
translatedPoint = strongSelf.view.convert(point, to: replyInfoNode.view)
|
||||
if strongSelf.selectionNode == nil {
|
||||
if let replyInfoNode = strongSelf.replyInfoNode {
|
||||
var translatedPoint: CGPoint?
|
||||
let convertedNodeFrame = replyInfoNode.view.convert(replyInfoNode.bounds, to: strongSelf.view)
|
||||
if let point = point, convertedNodeFrame.insetBy(dx: -4.0, dy: -4.0).contains(point) {
|
||||
translatedPoint = strongSelf.view.convert(point, to: replyInfoNode.view)
|
||||
}
|
||||
replyInfoNode.updateTouchesAtPoint(translatedPoint)
|
||||
}
|
||||
replyInfoNode.updateTouchesAtPoint(translatedPoint)
|
||||
}
|
||||
if let forwardInfoNode = strongSelf.forwardInfoNode {
|
||||
var translatedPoint: CGPoint?
|
||||
let convertedNodeFrame = forwardInfoNode.view.convert(forwardInfoNode.bounds, to: strongSelf.view)
|
||||
if let point = point, convertedNodeFrame.insetBy(dx: -4.0, dy: -4.0).contains(point) {
|
||||
translatedPoint = strongSelf.view.convert(point, to: forwardInfoNode.view)
|
||||
if let forwardInfoNode = strongSelf.forwardInfoNode {
|
||||
var translatedPoint: CGPoint?
|
||||
let convertedNodeFrame = forwardInfoNode.view.convert(forwardInfoNode.bounds, to: strongSelf.view)
|
||||
if let point = point, convertedNodeFrame.insetBy(dx: -4.0, dy: -4.0).contains(point) {
|
||||
translatedPoint = strongSelf.view.convert(point, to: forwardInfoNode.view)
|
||||
}
|
||||
forwardInfoNode.updateTouchesAtPoint(translatedPoint)
|
||||
}
|
||||
forwardInfoNode.updateTouchesAtPoint(translatedPoint)
|
||||
}
|
||||
for contentNode in strongSelf.contentNodes {
|
||||
var translatedPoint: CGPoint?
|
||||
|
@ -85,6 +85,8 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
|
||||
private var highlightColor: UIColor?
|
||||
private var linkHighlightingNode: LinkHighlightingNode?
|
||||
|
||||
private var previousPeer: Peer?
|
||||
|
||||
public var openPsa: ((String, ASDisplayNode) -> Void)?
|
||||
|
||||
override public init() {
|
||||
@ -114,6 +116,32 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
public func getBoundingRects() -> [CGRect] {
|
||||
var initialRects: [CGRect] = []
|
||||
let addRects: (TextNode, CGPoint, CGFloat) -> Void = { textNode, offset, additionalWidth in
|
||||
guard let cachedLayout = textNode.cachedLayout else {
|
||||
return
|
||||
}
|
||||
for rect in cachedLayout.linesRects() {
|
||||
var rect = rect
|
||||
rect.size.width += rect.origin.x + additionalWidth
|
||||
rect.origin.x = 0.0
|
||||
initialRects.append(rect.offsetBy(dx: offset.x, dy: offset.y))
|
||||
}
|
||||
}
|
||||
|
||||
let offsetY: CGFloat = -12.0
|
||||
if let titleNode = self.titleNode {
|
||||
addRects(titleNode, CGPoint(x: titleNode.frame.minX, y: offsetY + titleNode.frame.minY), 0.0)
|
||||
|
||||
if let nameNode = self.nameNode {
|
||||
addRects(nameNode, CGPoint(x: titleNode.frame.minX, y: offsetY + nameNode.frame.minY), nameNode.frame.minX - titleNode.frame.minX)
|
||||
}
|
||||
}
|
||||
|
||||
return initialRects
|
||||
}
|
||||
|
||||
public func updateTouchesAtPoint(_ point: CGPoint?) {
|
||||
var isHighlighted = false
|
||||
if point != nil {
|
||||
@ -167,14 +195,19 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
|
||||
let titleNodeLayout = TextNode.asyncLayout(maybeNode?.titleNode)
|
||||
let nameNodeLayout = TextNode.asyncLayout(maybeNode?.nameNode)
|
||||
|
||||
let previousPeer = maybeNode?.previousPeer
|
||||
|
||||
return { context, presentationData, strings, type, peer, authorName, psaType, storyData, constrainedSize in
|
||||
let originalPeer = peer
|
||||
let peer = peer ?? previousPeer
|
||||
|
||||
let fontSize = floor(presentationData.fontSize.baseDisplaySize * 14.0 / 17.0)
|
||||
let prefixFont = Font.regular(fontSize)
|
||||
let peerFont = Font.medium(fontSize)
|
||||
|
||||
let peerString: String
|
||||
if let peer = peer {
|
||||
if let authorName = authorName {
|
||||
if let authorName = authorName, originalPeer === peer {
|
||||
peerString = "\(EnginePeer(peer).displayTitle(strings: strings, displayOrder: presentationData.nameDisplayOrder)) (\(authorName))"
|
||||
} else {
|
||||
peerString = EnginePeer(peer).displayTitle(strings: strings, displayOrder: presentationData.nameDisplayOrder)
|
||||
@ -343,18 +376,16 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
|
||||
|
||||
let (titleLayout, titleApply) = titleNodeLayout(TextNodeLayoutArguments(attributedString: string, backgroundColor: nil, maximumNumberOfLines: 2, truncationType: .end, constrainedSize: CGSize(width: constrainedSize.width - credibilityIconWidth - infoWidth, height: constrainedSize.height), alignment: .natural, cutout: cutout, insets: UIEdgeInsets()))
|
||||
|
||||
var authorAvatarInset: CGFloat = 0.0
|
||||
authorAvatarInset = 20.0
|
||||
|
||||
var nameLayoutAndApply: (TextNodeLayout, () -> TextNode)?
|
||||
if let authorString {
|
||||
nameLayoutAndApply = nameNodeLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: authorString, font: peerFont, textColor: titleColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: constrainedSize.width - credibilityIconWidth - infoWidth, height: constrainedSize.height), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
nameLayoutAndApply = nameNodeLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: authorString, font: peer != nil ? peerFont : prefixFont, textColor: titleColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: constrainedSize.width - credibilityIconWidth - infoWidth - authorAvatarInset, height: constrainedSize.height), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
}
|
||||
|
||||
let titleAuthorSpacing: CGFloat = 0.0
|
||||
|
||||
var authorAvatarInset: CGFloat = 0.0
|
||||
if peer != nil {
|
||||
authorAvatarInset = 20.0
|
||||
}
|
||||
|
||||
let resultSize: CGSize
|
||||
if let nameLayoutAndApply {
|
||||
resultSize = CGSize(
|
||||
@ -379,6 +410,8 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
|
||||
node.theme = presentationData.theme.theme
|
||||
node.highlightColor = titleColor.withMultipliedAlpha(0.1)
|
||||
|
||||
node.previousPeer = peer
|
||||
|
||||
let titleNode = titleApply()
|
||||
titleNode.displaysAsynchronously = !presentationData.isPreview
|
||||
|
||||
@ -398,7 +431,7 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
|
||||
}
|
||||
nameNode.frame = CGRect(origin: CGPoint(x: leftOffset + authorAvatarInset, y: titleLayout.size.height + titleAuthorSpacing), size: nameLayout.size)
|
||||
|
||||
if let peer, authorAvatarInset != 0.0 {
|
||||
if authorAvatarInset != 0.0 {
|
||||
let avatarNode: AvatarNode
|
||||
if let current = node.avatarNode {
|
||||
avatarNode = current
|
||||
@ -410,7 +443,13 @@ public class ChatMessageForwardInfoNode: ASDisplayNode {
|
||||
let avatarSize = CGSize(width: 16.0, height: 16.0)
|
||||
avatarNode.frame = CGRect(origin: CGPoint(x: leftOffset, y: titleLayout.size.height + titleAuthorSpacing), size: avatarSize)
|
||||
avatarNode.updateSize(size: avatarSize)
|
||||
avatarNode.setPeer(context: context, theme: presentationData.theme.theme, peer: EnginePeer(peer), displayDimensions: avatarSize)
|
||||
if let peer {
|
||||
avatarNode.setPeer(context: context, theme: presentationData.theme.theme, peer: EnginePeer(peer), displayDimensions: avatarSize)
|
||||
} else if let authorName, !authorName.isEmpty {
|
||||
avatarNode.setCustomLetters([String(authorName[authorName.startIndex])])
|
||||
} else {
|
||||
avatarNode.setCustomLetters([" "])
|
||||
}
|
||||
} else {
|
||||
if let avatarNode = node.avatarNode {
|
||||
node.avatarNode = nil
|
||||
|
@ -58,6 +58,7 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
private var replyBackgroundContent: WallpaperBubbleBackgroundNode?
|
||||
private var forwardInfoNode: ChatMessageForwardInfoNode?
|
||||
private var forwardBackgroundContent: WallpaperBubbleBackgroundNode?
|
||||
private var forwardBackgroundMaskNode: LinkHighlightingNode?
|
||||
|
||||
private var actionButtonsNode: ChatMessageActionButtonsNode?
|
||||
private var reactionButtonsNode: ChatMessageReactionButtonsNode?
|
||||
@ -1110,7 +1111,9 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
|
||||
var forwardBackgroundFrame: CGRect?
|
||||
if let forwardAreaFrame {
|
||||
forwardBackgroundFrame = forwardAreaFrame.insetBy(dx: -6.0, dy: -3.0)
|
||||
var forwardBackgroundFrameValue = forwardAreaFrame.insetBy(dx: -6.0, dy: -3.0)
|
||||
forwardBackgroundFrameValue.size.height += 2.0
|
||||
forwardBackgroundFrame = forwardBackgroundFrameValue
|
||||
}
|
||||
|
||||
var replyBackgroundFrame: CGRect?
|
||||
@ -1147,7 +1150,17 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
}
|
||||
|
||||
if let backgroundContent = strongSelf.forwardBackgroundContent, let forwardBackgroundFrame {
|
||||
backgroundContent.cornerRadius = 4.0
|
||||
let forwardBackgroundMaskNode: LinkHighlightingNode
|
||||
if let current = strongSelf.forwardBackgroundMaskNode {
|
||||
forwardBackgroundMaskNode = current
|
||||
} else {
|
||||
forwardBackgroundMaskNode = LinkHighlightingNode(color: .black)
|
||||
forwardBackgroundMaskNode.inset = 4.0
|
||||
forwardBackgroundMaskNode.outerRadius = 12.0
|
||||
strongSelf.forwardBackgroundMaskNode = forwardBackgroundMaskNode
|
||||
backgroundContent.view.mask = forwardBackgroundMaskNode.view
|
||||
}
|
||||
|
||||
backgroundContent.frame = forwardBackgroundFrame
|
||||
if let (rect, containerSize) = strongSelf.absoluteRect {
|
||||
var backgroundFrame = backgroundContent.frame
|
||||
@ -1155,6 +1168,28 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
||||
backgroundFrame.origin.y += rect.minY
|
||||
backgroundContent.update(rect: backgroundFrame, within: containerSize, transition: .immediate)
|
||||
}
|
||||
|
||||
if let forwardInfoNode = strongSelf.forwardInfoNode {
|
||||
forwardBackgroundMaskNode.frame = backgroundContent.bounds.offsetBy(dx: forwardInfoNode.frame.minX - backgroundContent.frame.minX, dy: forwardInfoNode.frame.minY - backgroundContent.frame.minY)
|
||||
var backgroundRects = forwardInfoNode.getBoundingRects()
|
||||
for i in 0 ..< backgroundRects.count {
|
||||
backgroundRects[i].origin.x -= 2.0
|
||||
backgroundRects[i].size.width += 4.0
|
||||
}
|
||||
for i in 0 ..< backgroundRects.count {
|
||||
if i != 0 {
|
||||
if abs(backgroundRects[i - 1].maxX - backgroundRects[i].maxX) < 16.0 {
|
||||
let maxMaxX = max(backgroundRects[i - 1].maxX, backgroundRects[i].maxX)
|
||||
backgroundRects[i - 1].size.width = max(0.0, maxMaxX - backgroundRects[i - 1].origin.x)
|
||||
backgroundRects[i].size.width = max(0.0, maxMaxX - backgroundRects[i].origin.x)
|
||||
}
|
||||
}
|
||||
}
|
||||
forwardBackgroundMaskNode.updateRects(backgroundRects)
|
||||
}
|
||||
} else if let forwardBackgroundMaskNode = strongSelf.forwardBackgroundMaskNode {
|
||||
strongSelf.forwardBackgroundMaskNode = nil
|
||||
forwardBackgroundMaskNode.view.removeFromSuperview()
|
||||
}
|
||||
|
||||
let panelsAlpha: CGFloat = item.controllerInteraction.selectionState == nil ? 1.0 : 0.0
|
||||
|
@ -315,7 +315,7 @@ public final class ChatMessageWebpageBubbleContentNode: ChatMessageBubbleContent
|
||||
var colors: [UInt32] = []
|
||||
var rotation: Int32?
|
||||
var intensity: Int32?
|
||||
if let wallpaper = parseWallpaperUrl(webpage.url), case let .slug(_, _, colorsValue, intensityValue, rotationValue) = wallpaper {
|
||||
if let wallpaper = parseWallpaperUrl(sharedContext: item.context.sharedContext, url: webpage.url), case let .slug(_, _, colorsValue, intensityValue, rotationValue) = wallpaper {
|
||||
colors = colorsValue
|
||||
rotation = rotationValue
|
||||
intensity = intensityValue
|
||||
@ -353,7 +353,7 @@ public final class ChatMessageWebpageBubbleContentNode: ChatMessageBubbleContent
|
||||
if type == "telegram_background" {
|
||||
var colors: [UInt32] = []
|
||||
var rotation: Int32?
|
||||
if let wallpaper = parseWallpaperUrl(webpage.url) {
|
||||
if let wallpaper = parseWallpaperUrl(sharedContext: item.context.sharedContext, url: webpage.url) {
|
||||
if case let .color(color) = wallpaper {
|
||||
colors = [color.rgb]
|
||||
} else if case let .gradient(colorsValue, rotationValue) = wallpaper {
|
||||
|
@ -1663,10 +1663,36 @@ public extension EmojiPagerContentComponent {
|
||||
switch subject {
|
||||
case .groupPhotoEmojiSelection, .profilePhotoEmojiSelection:
|
||||
searchCategories = context.engine.stickers.emojiSearchCategories(kind: .avatar)
|
||||
case .chatStickers:
|
||||
searchCategories = context.engine.stickers.emojiSearchCategories(kind: .chatStickers)
|
||||
case .greetingStickers:
|
||||
searchCategories = context.engine.stickers.emojiSearchCategories(kind: .greetingStickers)
|
||||
case .chatStickers, .greetingStickers:
|
||||
searchCategories = context.engine.stickers.emojiSearchCategories(kind: .combinedChatStickers)
|
||||
|> map { result -> EmojiSearchCategories? in
|
||||
guard let result else {
|
||||
return nil
|
||||
}
|
||||
|
||||
var groups: [EmojiSearchCategories.Group] = []
|
||||
groups = result.groups
|
||||
if case .greetingStickers = subject {
|
||||
if let index = groups.firstIndex(where: { group in
|
||||
return group.kind == .greeting
|
||||
}) {
|
||||
let group = groups.remove(at: index)
|
||||
groups.insert(group, at: 0)
|
||||
}
|
||||
} else if case .chatStickers = subject {
|
||||
if let index = groups.firstIndex(where: { group in
|
||||
return group.kind == .premium
|
||||
}) {
|
||||
let group = groups.remove(at: index)
|
||||
groups.append(group)
|
||||
}
|
||||
}
|
||||
|
||||
return EmojiSearchCategories(
|
||||
hash: result.hash,
|
||||
groups: groups
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return combineLatest(
|
||||
|
@ -2165,13 +2165,13 @@ private func extractAccountManagerState(records: AccountRecordsView<TelegramAcco
|
||||
return (sharedApplicationContext.sharedContext, context, authContext)
|
||||
}
|
||||
}
|
||||
|> deliverOnMainQueue).start(next: { _, context, authContext in
|
||||
if let authContext = authContext, let confirmationCode = parseConfirmationCodeUrl(url) {
|
||||
|> deliverOnMainQueue).start(next: { sharedContext, context, authContext in
|
||||
if let authContext = authContext, let confirmationCode = parseConfirmationCodeUrl(sharedContext: sharedContext, url: url) {
|
||||
authContext.rootController.applyConfirmationCode(confirmationCode)
|
||||
} else if let context = context {
|
||||
context.openUrl(url)
|
||||
} else if let authContext = authContext {
|
||||
if let proxyData = parseProxyUrl(url) {
|
||||
if let proxyData = parseProxyUrl(sharedContext: sharedContext, url: url) {
|
||||
authContext.rootController.view.endEditing(true)
|
||||
let presentationData = authContext.sharedContext.currentPresentationData.with { $0 }
|
||||
let controller = ProxyServerActionSheetController(presentationData: presentationData, accountManager: authContext.sharedContext.accountManager, postbox: authContext.account.postbox, network: authContext.account.network, server: proxyData, updatedPresentationData: nil)
|
||||
|
@ -856,7 +856,7 @@ extension ChatControllerImpl {
|
||||
}
|
||||
}, recognizedQRCode: { [weak self] code in
|
||||
if let strongSelf = self {
|
||||
if let (host, port, username, password, secret) = parseProxyUrl(code) {
|
||||
if let (host, port, username, password, secret) = parseProxyUrl(sharedContext: strongSelf.context.sharedContext, url: code) {
|
||||
strongSelf.openResolved(result: ResolvedUrl.proxy(host: host, port: port, username: username, password: password, secret: secret), sourceMessageId: nil)
|
||||
}
|
||||
}
|
||||
@ -1697,7 +1697,7 @@ extension ChatControllerImpl {
|
||||
}
|
||||
}, recognizedQRCode: { [weak self] code in
|
||||
if let strongSelf = self {
|
||||
if let (host, port, username, password, secret) = parseProxyUrl(code) {
|
||||
if let (host, port, username, password, secret) = parseProxyUrl(sharedContext: strongSelf.context.sharedContext, url: code) {
|
||||
strongSelf.openResolved(result: ResolvedUrl.proxy(host: host, port: port, username: username, password: password, secret: secret), sourceMessageId: nil)
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ public struct ParsedSecureIdUrl {
|
||||
public let opaqueNonce: Data
|
||||
}
|
||||
|
||||
public func parseProxyUrl(_ url: URL) -> ProxyServerSettings? {
|
||||
guard let proxy = parseProxyUrl(url.absoluteString) else {
|
||||
public func parseProxyUrl(sharedContext: SharedAccountContext, url: URL) -> ProxyServerSettings? {
|
||||
guard let proxy = parseProxyUrl(sharedContext: sharedContext, url: url.absoluteString) else {
|
||||
return nil
|
||||
}
|
||||
if let secret = proxy.secret, let _ = MTProxySecret.parseData(secret) {
|
||||
@ -107,14 +107,14 @@ public func parseSecureIdUrl(_ url: URL) -> ParsedSecureIdUrl? {
|
||||
return nil
|
||||
}
|
||||
|
||||
public func parseConfirmationCodeUrl(_ url: URL) -> Int? {
|
||||
public func parseConfirmationCodeUrl(sharedContext: SharedAccountContext, url: URL) -> Int? {
|
||||
if url.pathComponents.count == 3 && url.pathComponents[1].lowercased() == "login" {
|
||||
if let code = Int(url.pathComponents[2]) {
|
||||
return code
|
||||
}
|
||||
}
|
||||
if url.scheme == "tg" {
|
||||
if let host = url.host, let query = url.query, let parsedUrl = parseInternalUrl(query: host + "?" + query) {
|
||||
if let host = url.host, let query = url.query, let parsedUrl = parseInternalUrl(sharedContext: sharedContext, query: host + "?" + query) {
|
||||
switch parsedUrl {
|
||||
case let .confirmationCode(code):
|
||||
return code
|
||||
@ -168,7 +168,7 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur
|
||||
return
|
||||
}
|
||||
|
||||
guard let parsedUrl = parsedUrlValue else {
|
||||
guard var parsedUrl = parsedUrlValue else {
|
||||
return
|
||||
}
|
||||
|
||||
@ -249,6 +249,20 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur
|
||||
|> deliverOnMainQueue).startStandalone(next: handleResolvedUrl)
|
||||
}
|
||||
|
||||
if context.sharedContext.immediateExperimentalUISettings.browserExperiment {
|
||||
if let scheme = parsedUrl.scheme, (scheme == "tg" || scheme == context.sharedContext.applicationBindings.appSpecificScheme) {
|
||||
if parsedUrl.host == "ipfs" {
|
||||
if let value = URL(string: "ipfs:/" + parsedUrl.path) {
|
||||
parsedUrl = value
|
||||
}
|
||||
}
|
||||
} else if let scheme = parsedUrl.scheme, scheme == "https", parsedUrl.host == "t.me", parsedUrl.path.hasPrefix("/ipfs/") {
|
||||
if let value = URL(string: "ipfs://" + String(parsedUrl.path[parsedUrl.path.index(parsedUrl.path.startIndex, offsetBy: "/ipfs/".count)...])) {
|
||||
parsedUrl = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if let scheme = parsedUrl.scheme, (scheme == "tg" || scheme == context.sharedContext.applicationBindings.appSpecificScheme) {
|
||||
var convertedUrl: String?
|
||||
if let query = parsedUrl.query {
|
||||
|
@ -2504,7 +2504,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
||||
}
|
||||
|
||||
public func makeProxySettingsController(sharedContext: SharedAccountContext, account: UnauthorizedAccount) -> ViewController {
|
||||
return proxySettingsController(accountManager: sharedContext.accountManager, postbox: account.postbox, network: account.network, mode: .modal, presentationData: sharedContext.currentPresentationData.with { $0 }, updatedPresentationData: sharedContext.presentationData)
|
||||
return proxySettingsController(accountManager: sharedContext.accountManager, sharedContext: sharedContext, postbox: account.postbox, network: account.network, mode: .modal, presentationData: sharedContext.currentPresentationData.with { $0 }, updatedPresentationData: sharedContext.presentationData)
|
||||
}
|
||||
|
||||
public func makeInstalledStickerPacksController(context: AccountContext, mode: InstalledStickerPacksControllerMode, forceTheme: PresentationTheme?) -> ViewController {
|
||||
|
@ -103,6 +103,7 @@ public enum ParsedInternalUrl {
|
||||
case chatFolder(slug: String)
|
||||
case premiumGiftCode(slug: String)
|
||||
case messageLink(slug: String)
|
||||
case externalUrl(url: String)
|
||||
}
|
||||
|
||||
private enum ParsedUrl {
|
||||
@ -110,7 +111,7 @@ private enum ParsedUrl {
|
||||
case internalUrl(ParsedInternalUrl)
|
||||
}
|
||||
|
||||
public func parseInternalUrl(query: String) -> ParsedInternalUrl? {
|
||||
public func parseInternalUrl(sharedContext: SharedAccountContext, query: String) -> ParsedInternalUrl? {
|
||||
var query = query
|
||||
if query.hasPrefix("s/") {
|
||||
query = String(query[query.index(query.startIndex, offsetBy: 2)...])
|
||||
@ -129,6 +130,12 @@ public func parseInternalUrl(query: String) -> ParsedInternalUrl? {
|
||||
if !pathComponents.isEmpty && !pathComponents[0].isEmpty {
|
||||
let peerName: String = pathComponents[0]
|
||||
|
||||
if sharedContext.immediateExperimentalUISettings.browserExperiment {
|
||||
if query.hasPrefix("ipfs/") {
|
||||
return .externalUrl(url: "ipfs://" + String(query[query.index(query.startIndex, offsetBy: "ipfs/".count)...]))
|
||||
}
|
||||
}
|
||||
|
||||
if pathComponents[0].hasPrefix("+") || pathComponents[0].hasPrefix("%20") {
|
||||
let component = pathComponents[0].replacingOccurrences(of: "%20", with: "+")
|
||||
if component.rangeOfCharacter(from: CharacterSet(charactersIn: "0123456789+").inverted) == nil {
|
||||
@ -1016,7 +1023,8 @@ private func resolveInternalUrl(context: AccountContext, url: ParsedInternalUrl)
|
||||
return .single(.result(.messageLink(link: result)))
|
||||
}
|
||||
})
|
||||
|
||||
case let .externalUrl(url):
|
||||
return .single(.result(.externalUrl(url)))
|
||||
}
|
||||
}
|
||||
|
||||
@ -1046,20 +1054,20 @@ public func isTelegraPhLink(_ url: String) -> Bool {
|
||||
return false
|
||||
}
|
||||
|
||||
public func parseProxyUrl(_ url: String) -> (host: String, port: Int32, username: String?, password: String?, secret: Data?)? {
|
||||
public func parseProxyUrl(sharedContext: SharedAccountContext, url: String) -> (host: String, port: Int32, username: String?, password: String?, secret: Data?)? {
|
||||
let schemes = ["http://", "https://", ""]
|
||||
for basePath in baseTelegramMePaths {
|
||||
for scheme in schemes {
|
||||
let basePrefix = scheme + basePath + "/"
|
||||
if url.lowercased().hasPrefix(basePrefix) {
|
||||
if let internalUrl = parseInternalUrl(query: String(url[basePrefix.endIndex...])), case let .proxy(host, port, username, password, secret) = internalUrl {
|
||||
if let internalUrl = parseInternalUrl(sharedContext: sharedContext, query: String(url[basePrefix.endIndex...])), case let .proxy(host, port, username, password, secret) = internalUrl {
|
||||
return (host, port, username, password, secret)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if let parsedUrl = URL(string: url), parsedUrl.scheme == "tg", let host = parsedUrl.host, let query = parsedUrl.query {
|
||||
if let internalUrl = parseInternalUrl(query: host + "?" + query), case let .proxy(host, port, username, password, secret) = internalUrl {
|
||||
if let internalUrl = parseInternalUrl(sharedContext: sharedContext, query: host + "?" + query), case let .proxy(host, port, username, password, secret) = internalUrl {
|
||||
return (host, port, username, password, secret)
|
||||
}
|
||||
}
|
||||
@ -1067,20 +1075,20 @@ public func parseProxyUrl(_ url: String) -> (host: String, port: Int32, username
|
||||
return nil
|
||||
}
|
||||
|
||||
public func parseStickerPackUrl(_ url: String) -> String? {
|
||||
public func parseStickerPackUrl(sharedContext: SharedAccountContext, url: String) -> String? {
|
||||
let schemes = ["http://", "https://", ""]
|
||||
for basePath in baseTelegramMePaths {
|
||||
for scheme in schemes {
|
||||
let basePrefix = scheme + basePath + "/"
|
||||
if url.lowercased().hasPrefix(basePrefix) {
|
||||
if let internalUrl = parseInternalUrl(query: String(url[basePrefix.endIndex...])), case let .stickerPack(name, _) = internalUrl {
|
||||
if let internalUrl = parseInternalUrl(sharedContext: sharedContext, query: String(url[basePrefix.endIndex...])), case let .stickerPack(name, _) = internalUrl {
|
||||
return name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if let parsedUrl = URL(string: url), parsedUrl.scheme == "tg", let host = parsedUrl.host, let query = parsedUrl.query {
|
||||
if let internalUrl = parseInternalUrl(query: host + "?" + query), case let .stickerPack(name, _) = internalUrl {
|
||||
if let internalUrl = parseInternalUrl(sharedContext: sharedContext, query: host + "?" + query), case let .stickerPack(name, _) = internalUrl {
|
||||
return name
|
||||
}
|
||||
}
|
||||
@ -1088,20 +1096,20 @@ public func parseStickerPackUrl(_ url: String) -> String? {
|
||||
return nil
|
||||
}
|
||||
|
||||
public func parseWallpaperUrl(_ url: String) -> WallpaperUrlParameter? {
|
||||
public func parseWallpaperUrl(sharedContext: SharedAccountContext, url: String) -> WallpaperUrlParameter? {
|
||||
let schemes = ["http://", "https://", ""]
|
||||
for basePath in baseTelegramMePaths {
|
||||
for scheme in schemes {
|
||||
let basePrefix = scheme + basePath + "/"
|
||||
if url.lowercased().hasPrefix(basePrefix) {
|
||||
if let internalUrl = parseInternalUrl(query: String(url[basePrefix.endIndex...])), case let .wallpaper(wallpaper) = internalUrl {
|
||||
if let internalUrl = parseInternalUrl(sharedContext: sharedContext, query: String(url[basePrefix.endIndex...])), case let .wallpaper(wallpaper) = internalUrl {
|
||||
return wallpaper
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if let parsedUrl = URL(string: url), parsedUrl.scheme == "tg", let host = parsedUrl.host, let query = parsedUrl.query {
|
||||
if let internalUrl = parseInternalUrl(query: host + "?" + query), case let .wallpaper(wallpaper) = internalUrl {
|
||||
if let internalUrl = parseInternalUrl(sharedContext: sharedContext, query: host + "?" + query), case let .wallpaper(wallpaper) = internalUrl {
|
||||
return wallpaper
|
||||
}
|
||||
}
|
||||
@ -1178,7 +1186,7 @@ public func resolveUrlImpl(context: AccountContext, peerId: PeerId?, url: String
|
||||
url = basePrefix + String(url[scheme.endIndex...]).replacingOccurrences(of: ".\(basePath)/", with: "").replacingOccurrences(of: ".\(basePath)", with: "")
|
||||
}
|
||||
if url.lowercased().hasPrefix(basePrefix) {
|
||||
if let internalUrl = parseInternalUrl(query: String(url[basePrefix.endIndex...])) {
|
||||
if let internalUrl = parseInternalUrl(sharedContext: context.sharedContext, query: String(url[basePrefix.endIndex...])) {
|
||||
return resolveInternalUrl(context: context, url: internalUrl)
|
||||
|> map { result -> ResolveUrlResult in
|
||||
switch result {
|
||||
|
Loading…
x
Reference in New Issue
Block a user