Various improvements

This commit is contained in:
Ilya Laktyushin 2024-07-26 20:59:48 +02:00
parent 8e219193d0
commit 40d40dd8e7
24 changed files with 1117 additions and 970 deletions

View File

@ -12571,7 +12571,7 @@ Sorry for the inconvenience.";
"WebBrowser.AutoLogin.Info" = "Use your Telegram account to automatically log in to websites opened in the in-app browser.";
"WebBrowser.ClearCookies" = "Clear Cookies";
"WebBrowser.ClearCookies.Info" = "Delete all cookies in the Telegram in-app browser. This action will sign you out of most websites.";
"WebBrowser.ClearCookies.Info" = "Delete all cookies and cache in the Telegram in-app browser. This action will sign you out of most websites.";
"WebBrowser.ClearCookies.Succeed" = "Cookies cleared.";
"WebBrowser.Exceptions.Title" = "NEVER OPEN IN THE IN-APP BROWSER";
@ -12589,6 +12589,12 @@ Sorry for the inconvenience.";
"WebBrowser.ClearCookies.ClearConfirmation.Text" = "Are you sure you want to clear cookies?";
"WebBrowser.ClearCookies.ClearConfirmation.Clear" = "Clear";
"WebBrowser.ClearCache" = "Clear Cache";
"WebBrowser.ClearCache.ClearConfirmation.Text" = "Are you sure you want to clear cookies?";
"WebBrowser.ClearCache.ClearConfirmation.Clear" = "Clear";
"WebBrowser.ClearCache.Succeed" = "Cookies cleared.";
"WebBrowser.Done" = "Done";
"AccessDenied.LocationWeather" = "Telegram needs access to your location so that you can add the weather widget to your stories.\n\nPlease go to Settings > Privacy > Location Services and set Telegram to ON.";
@ -12658,3 +12664,7 @@ Sorry for the inconvenience.";
"Stars.Intro.Transaction.Gift.Title" = "Received Gift";
"Stars.Intro.Transaction.Gift.UnknownUser" = "Unknown User";
"WebApp.PrivacyPolicy" = "Privacy Policy";
"Conversation.OpenProfile" = "OPEN PROFILE";

View File

@ -249,8 +249,7 @@ final class AddressBarContentComponent: Component {
public func textFieldShouldReturn(_ textField: UITextField) -> Bool {
if let component = self.component {
let finalUrl = explicitUrl(textField.text ?? "")
// finalUrl = finalUrl.addingPercentEncoding(withAllowedCharacters: .urlFragmentAllowed) ?? finalUrl
component.performAction.invoke(.navigateTo(finalUrl))
component.performAction.invoke(.navigateTo(finalUrl, true))
}
textField.endEditing(true)
return false

View File

@ -390,7 +390,7 @@ final class BrowserAddressListComponent: Component {
insets: component.insets,
action: {
if let url = webPage?.content.url {
performAction.invoke(.navigateTo(url))
performAction.invoke(.navigateTo(url, false))
}
},
contextAction: { [weak self] webPage, message, sourceView, gesture in

View File

@ -153,24 +153,26 @@ private final class BrowserScreenComponent: CombinedComponent {
]
if isTablet {
// navigationLeftItems.append(
// AnyComponentWithIdentity(
// id: "minimize",
// component: AnyComponent(
// Button(
// content: AnyComponent(
// BundleIconComponent(
// name: "Media Gallery/PictureInPictureButton",
// tintColor: environment.theme.rootController.navigationBar.accentTextColor
// )
// ),
// action: {
// performAction.invoke(.close)
// }
// )
// )
// )
// )
#if DEBUG
navigationLeftItems.append(
AnyComponentWithIdentity(
id: "minimize",
component: AnyComponent(
Button(
content: AnyComponent(
BundleIconComponent(
name: "Media Gallery/PictureInPictureButton",
tintColor: environment.theme.rootController.navigationBar.accentTextColor
)
),
action: {
performAction.invoke(.close)
}
)
)
)
)
#endif
let canGoBack = context.component.contentState?.canGoBack ?? false
let canGoForward = context.component.contentState?.canGoForward ?? false
@ -483,7 +485,7 @@ public class BrowserScreen: ViewController, MinimizableController {
case openBookmarks
case openAddressBar
case closeAddressBar
case navigateTo(String)
case navigateTo(String, Bool)
case expand
}
@ -730,9 +732,12 @@ public class BrowserScreen: ViewController, MinimizableController {
updatedState.addressFocused = false
return updatedState
})
case let .navigateTo(address):
case let .navigateTo(address, addToRecent):
if let content = self.content.last as? BrowserWebContent {
content.navigateTo(address: address)
if addToRecent {
content.addToRecentlyVisited()
}
}
self.updatePresentationState(transition: .spring(duration: 0.4), { state in
var updatedState = state
@ -988,7 +993,7 @@ public class BrowserScreen: ViewController, MinimizableController {
}
let controller = BrowserBookmarksScreen(context: self.context, url: url, openUrl: { [weak self] url in
if let self {
self.performAction.invoke(.navigateTo(url))
self.performAction.invoke(.navigateTo(url, true))
}
}, addBookmark: { [weak self] in
self?.addBookmark(url, showArrow: false)

View File

@ -752,7 +752,12 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
if navigationAction.targetFrame == nil {
if let url = navigationAction.request.url?.absoluteString {
self.open(url: url, new: true)
if isTelegramMeLink(url) || isTelegraPhLink(url) {
self.minimize()
self.openAppUrl(url)
} else {
self.open(url: url, new: true)
}
}
}
return nil

View File

@ -21,6 +21,7 @@ private final class WebBrowserSettingsControllerArguments {
let context: AccountContext
let updateDefaultBrowser: (String?) -> Void
let clearCookies: () -> Void
let clearCache: () -> Void
let addException: () -> Void
let removeException: (String) -> Void
let clearExceptions: () -> Void
@ -29,6 +30,7 @@ private final class WebBrowserSettingsControllerArguments {
context: AccountContext,
updateDefaultBrowser: @escaping (String?) -> Void,
clearCookies: @escaping () -> Void,
clearCache: @escaping () -> Void,
addException: @escaping () -> Void,
removeException: @escaping (String) -> Void,
clearExceptions: @escaping () -> Void
@ -36,6 +38,7 @@ private final class WebBrowserSettingsControllerArguments {
self.context = context
self.updateDefaultBrowser = updateDefaultBrowser
self.clearCookies = clearCookies
self.clearCache = clearCache
self.addException = addException
self.removeException = removeException
self.clearExceptions = clearExceptions
@ -53,6 +56,7 @@ private enum WebBrowserSettingsControllerEntry: ItemListNodeEntry {
case browser(PresentationTheme, String, OpenInApplication?, String?, Bool, Int32)
case clearCookies(PresentationTheme, String)
case clearCache(PresentationTheme, String)
case clearCookiesInfo(PresentationTheme, String)
case exceptionsHeader(PresentationTheme, String)
@ -65,7 +69,7 @@ private enum WebBrowserSettingsControllerEntry: ItemListNodeEntry {
switch self {
case .browserHeader, .browser:
return WebBrowserSettingsSection.browsers.rawValue
case .clearCookies, .clearCookiesInfo:
case .clearCookies, .clearCache, .clearCookiesInfo:
return WebBrowserSettingsSection.clearCookies.rawValue
case .exceptionsHeader, .exceptionsAdd, .exception, .exceptionsClear, .exceptionsInfo:
return WebBrowserSettingsSection.exceptions.rawValue
@ -80,12 +84,14 @@ private enum WebBrowserSettingsControllerEntry: ItemListNodeEntry {
return UInt64(1 + index)
case .clearCookies:
return 102
case .clearCookiesInfo:
case .clearCache:
return 103
case .exceptionsHeader:
case .clearCookiesInfo:
return 104
case .exceptionsAdd:
case .exceptionsHeader:
return 105
case .exceptionsAdd:
return 106
case let .exception(_, _, exception):
return 2000 + exception.domain.persistentHashValue
case .exceptionsClear:
@ -103,14 +109,16 @@ private enum WebBrowserSettingsControllerEntry: ItemListNodeEntry {
return 1 + index
case .clearCookies:
return 102
case .clearCookiesInfo:
case .clearCache:
return 103
case .exceptionsHeader:
case .clearCookiesInfo:
return 104
case .exceptionsAdd:
case .exceptionsHeader:
return 105
case .exceptionsAdd:
return 106
case let .exception(index, _, _):
return 106 + index
return 107 + index
case .exceptionsClear:
return 1000
case .exceptionsInfo:
@ -138,6 +146,12 @@ private enum WebBrowserSettingsControllerEntry: ItemListNodeEntry {
} else {
return false
}
case let .clearCache(lhsTheme, lhsText):
if case let .clearCache(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
return true
} else {
return false
}
case let .clearCookiesInfo(lhsTheme, lhsText):
if case let .clearCookiesInfo(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
return true
@ -194,6 +208,10 @@ private enum WebBrowserSettingsControllerEntry: ItemListNodeEntry {
return ItemListPeerActionItem(presentationData: presentationData, icon: PresentationResourcesItemList.accentDeleteIconImage(presentationData.theme), title: text, sectionId: self.section, height: .generic, color: .accent, editing: false, action: {
arguments.clearCookies()
})
case let .clearCache(_, text):
return ItemListPeerActionItem(presentationData: presentationData, icon: PresentationResourcesItemList.accentDeleteIconImage(presentationData.theme), title: text, sectionId: self.section, height: .generic, color: .accent, editing: false, action: {
arguments.clearCache()
})
case let .clearCookiesInfo(_, text):
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
case let .exceptionsHeader(_, text):
@ -232,6 +250,7 @@ private func webBrowserSettingsControllerEntries(context: AccountContext, presen
if settings.defaultWebBrowser == nil {
entries.append(.clearCookies(presentationData.theme, presentationData.strings.WebBrowser_ClearCookies))
entries.append(.clearCache(presentationData.theme, presentationData.strings.WebBrowser_ClearCache))
entries.append(.clearCookiesInfo(presentationData.theme, presentationData.strings.WebBrowser_ClearCookies_Info))
entries.append(.exceptionsHeader(presentationData.theme, presentationData.strings.WebBrowser_Exceptions_Title))
@ -255,6 +274,7 @@ private func webBrowserSettingsControllerEntries(context: AccountContext, presen
public func webBrowserSettingsController(context: AccountContext) -> ViewController {
var clearCookiesImpl: (() -> Void)?
var clearCacheImpl: (() -> Void)?
var addExceptionImpl: (() -> Void)?
var removeExceptionImpl: ((String) -> Void)?
var clearExceptionsImpl: (() -> Void)?
@ -269,6 +289,9 @@ public func webBrowserSettingsController(context: AccountContext) -> ViewControl
clearCookies: {
clearCookiesImpl?()
},
clearCache: {
clearCacheImpl?()
},
addException: {
addExceptionImpl?()
},
@ -320,7 +343,7 @@ public func webBrowserSettingsController(context: AccountContext) -> ViewControl
actions: [
TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}),
TextAlertAction(type: .defaultAction, title: presentationData.strings.WebBrowser_ClearCookies_ClearConfirmation_Clear, action: {
WKWebsiteDataStore.default().removeData(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes(), modifiedSince: Date(timeIntervalSince1970: 0), completionHandler:{})
WKWebsiteDataStore.default().removeData(ofTypes: [WKWebsiteDataTypeCookies, WKWebsiteDataTypeLocalStorage, WKWebsiteDataTypeSessionStorage], modifiedSince: Date(timeIntervalSince1970: 0), completionHandler:{})
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
controller?.present(UndoOverlayController(
@ -341,6 +364,38 @@ public func webBrowserSettingsController(context: AccountContext) -> ViewControl
controller?.present(alertController, in: .window(.root))
}
clearCacheImpl = { [weak controller] in
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let alertController = textAlertController(
context: context,
updatedPresentationData: nil,
title: nil,
text: presentationData.strings.WebBrowser_ClearCache_ClearConfirmation_Text,
actions: [
TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {}),
TextAlertAction(type: .defaultAction, title: presentationData.strings.WebBrowser_ClearCache_ClearConfirmation_Clear, action: {
WKWebsiteDataStore.default().removeData(ofTypes: [WKWebsiteDataTypeDiskCache, WKWebsiteDataTypeMemoryCache], modifiedSince: Date(timeIntervalSince1970: 0), completionHandler:{})
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
controller?.present(UndoOverlayController(
presentationData: presentationData,
content: .info(
title: nil,
text: presentationData.strings.WebBrowser_ClearCache_Succeed,
timeout: nil,
customUndoText: nil
),
elevatedLayout: false,
position: .bottom,
action: { _ in return false }), in: .current
)
})
]
)
controller?.present(alertController, in: .window(.root))
}
addExceptionImpl = { [weak controller] in
var dismissImpl: (() -> Void)?
let linkController = webBrowserDomainController(context: context, apply: { url in

View File

@ -355,6 +355,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1690108678] = { return Api.InputEncryptedFile.parse_inputEncryptedFileUploaded($0) }
dict[-181407105] = { return Api.InputFile.parse_inputFile($0) }
dict[-95482955] = { return Api.InputFile.parse_inputFileBig($0) }
dict[1658620744] = { return Api.InputFile.parse_inputFileStoryDocument($0) }
dict[-1160743548] = { return Api.InputFileLocation.parse_inputDocumentFileLocation($0) }
dict[-182231723] = { return Api.InputFileLocation.parse_inputEncryptedFileLocation($0) }
dict[-539317279] = { return Api.InputFileLocation.parse_inputFileLocation($0) }
@ -1401,7 +1402,7 @@ public extension Api {
return parser(reader)
}
else {
telegramApiLog("Type constructor \(String(UInt32(bitPattern: signature), radix: 16, uppercase: false)) not found")
telegramApiLog("Type constructor \(String(signature, radix: 16, uppercase: false)) not found")
return nil
}
}

View File

@ -1,3 +1,115 @@
public extension Api {
indirect enum InputInvoice: TypeConstructorDescription {
case inputInvoiceMessage(peer: Api.InputPeer, msgId: Int32)
case inputInvoicePremiumGiftCode(purpose: Api.InputStorePaymentPurpose, option: Api.PremiumGiftCodeOption)
case inputInvoiceSlug(slug: String)
case inputInvoiceStars(purpose: Api.InputStorePaymentPurpose)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputInvoiceMessage(let peer, let msgId):
if boxed {
buffer.appendInt32(-977967015)
}
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
break
case .inputInvoicePremiumGiftCode(let purpose, let option):
if boxed {
buffer.appendInt32(-1734841331)
}
purpose.serialize(buffer, true)
option.serialize(buffer, true)
break
case .inputInvoiceSlug(let slug):
if boxed {
buffer.appendInt32(-1020867857)
}
serializeString(slug, buffer: buffer, boxed: false)
break
case .inputInvoiceStars(let purpose):
if boxed {
buffer.appendInt32(1710230755)
}
purpose.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputInvoiceMessage(let peer, let msgId):
return ("inputInvoiceMessage", [("peer", peer as Any), ("msgId", msgId as Any)])
case .inputInvoicePremiumGiftCode(let purpose, let option):
return ("inputInvoicePremiumGiftCode", [("purpose", purpose as Any), ("option", option as Any)])
case .inputInvoiceSlug(let slug):
return ("inputInvoiceSlug", [("slug", slug as Any)])
case .inputInvoiceStars(let purpose):
return ("inputInvoiceStars", [("purpose", purpose as Any)])
}
}
public static func parse_inputInvoiceMessage(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputPeer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputInvoice.inputInvoiceMessage(peer: _1!, msgId: _2!)
}
else {
return nil
}
}
public static func parse_inputInvoicePremiumGiftCode(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputStorePaymentPurpose?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputStorePaymentPurpose
}
var _2: Api.PremiumGiftCodeOption?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.PremiumGiftCodeOption
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputInvoice.inputInvoicePremiumGiftCode(purpose: _1!, option: _2!)
}
else {
return nil
}
}
public static func parse_inputInvoiceSlug(_ reader: BufferReader) -> InputInvoice? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.InputInvoice.inputInvoiceSlug(slug: _1!)
}
else {
return nil
}
}
public static func parse_inputInvoiceStars(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputStorePaymentPurpose?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputStorePaymentPurpose
}
let _c1 = _1 != nil
if _c1 {
return Api.InputInvoice.inputInvoiceStars(purpose: _1!)
}
else {
return nil
}
}
}
}
public extension Api {
indirect enum InputMedia: TypeConstructorDescription {
case inputMediaContact(phoneNumber: String, firstName: String, lastName: String, vcard: String)
@ -918,171 +1030,3 @@ public extension Api {
}
}
public extension Api {
indirect enum InputPeer: TypeConstructorDescription {
case inputPeerChannel(channelId: Int64, accessHash: Int64)
case inputPeerChannelFromMessage(peer: Api.InputPeer, msgId: Int32, channelId: Int64)
case inputPeerChat(chatId: Int64)
case inputPeerEmpty
case inputPeerSelf
case inputPeerUser(userId: Int64, accessHash: Int64)
case inputPeerUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int64)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputPeerChannel(let channelId, let accessHash):
if boxed {
buffer.appendInt32(666680316)
}
serializeInt64(channelId, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputPeerChannelFromMessage(let peer, let msgId, let channelId):
if boxed {
buffer.appendInt32(-1121318848)
}
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
serializeInt64(channelId, buffer: buffer, boxed: false)
break
case .inputPeerChat(let chatId):
if boxed {
buffer.appendInt32(900291769)
}
serializeInt64(chatId, buffer: buffer, boxed: false)
break
case .inputPeerEmpty:
if boxed {
buffer.appendInt32(2134579434)
}
break
case .inputPeerSelf:
if boxed {
buffer.appendInt32(2107670217)
}
break
case .inputPeerUser(let userId, let accessHash):
if boxed {
buffer.appendInt32(-571955892)
}
serializeInt64(userId, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputPeerUserFromMessage(let peer, let msgId, let userId):
if boxed {
buffer.appendInt32(-1468331492)
}
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
serializeInt64(userId, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputPeerChannel(let channelId, let accessHash):
return ("inputPeerChannel", [("channelId", channelId as Any), ("accessHash", accessHash as Any)])
case .inputPeerChannelFromMessage(let peer, let msgId, let channelId):
return ("inputPeerChannelFromMessage", [("peer", peer as Any), ("msgId", msgId as Any), ("channelId", channelId as Any)])
case .inputPeerChat(let chatId):
return ("inputPeerChat", [("chatId", chatId as Any)])
case .inputPeerEmpty:
return ("inputPeerEmpty", [])
case .inputPeerSelf:
return ("inputPeerSelf", [])
case .inputPeerUser(let userId, let accessHash):
return ("inputPeerUser", [("userId", userId as Any), ("accessHash", accessHash as Any)])
case .inputPeerUserFromMessage(let peer, let msgId, let userId):
return ("inputPeerUserFromMessage", [("peer", peer as Any), ("msgId", msgId as Any), ("userId", userId as Any)])
}
}
public static func parse_inputPeerChannel(_ reader: BufferReader) -> InputPeer? {
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.InputPeer.inputPeerChannel(channelId: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputPeerChannelFromMessage(_ reader: BufferReader) -> InputPeer? {
var _1: Api.InputPeer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
var _2: Int32?
_2 = reader.readInt32()
var _3: Int64?
_3 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputPeer.inputPeerChannelFromMessage(peer: _1!, msgId: _2!, channelId: _3!)
}
else {
return nil
}
}
public static func parse_inputPeerChat(_ reader: BufferReader) -> InputPeer? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
if _c1 {
return Api.InputPeer.inputPeerChat(chatId: _1!)
}
else {
return nil
}
}
public static func parse_inputPeerEmpty(_ reader: BufferReader) -> InputPeer? {
return Api.InputPeer.inputPeerEmpty
}
public static func parse_inputPeerSelf(_ reader: BufferReader) -> InputPeer? {
return Api.InputPeer.inputPeerSelf
}
public static func parse_inputPeerUser(_ reader: BufferReader) -> InputPeer? {
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.InputPeer.inputPeerUser(userId: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputPeerUserFromMessage(_ reader: BufferReader) -> InputPeer? {
var _1: Api.InputPeer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
var _2: Int32?
_2 = reader.readInt32()
var _3: Int64?
_3 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputPeer.inputPeerUserFromMessage(peer: _1!, msgId: _2!, userId: _3!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,171 @@
public extension Api {
indirect enum InputPeer: TypeConstructorDescription {
case inputPeerChannel(channelId: Int64, accessHash: Int64)
case inputPeerChannelFromMessage(peer: Api.InputPeer, msgId: Int32, channelId: Int64)
case inputPeerChat(chatId: Int64)
case inputPeerEmpty
case inputPeerSelf
case inputPeerUser(userId: Int64, accessHash: Int64)
case inputPeerUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int64)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputPeerChannel(let channelId, let accessHash):
if boxed {
buffer.appendInt32(666680316)
}
serializeInt64(channelId, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputPeerChannelFromMessage(let peer, let msgId, let channelId):
if boxed {
buffer.appendInt32(-1121318848)
}
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
serializeInt64(channelId, buffer: buffer, boxed: false)
break
case .inputPeerChat(let chatId):
if boxed {
buffer.appendInt32(900291769)
}
serializeInt64(chatId, buffer: buffer, boxed: false)
break
case .inputPeerEmpty:
if boxed {
buffer.appendInt32(2134579434)
}
break
case .inputPeerSelf:
if boxed {
buffer.appendInt32(2107670217)
}
break
case .inputPeerUser(let userId, let accessHash):
if boxed {
buffer.appendInt32(-571955892)
}
serializeInt64(userId, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputPeerUserFromMessage(let peer, let msgId, let userId):
if boxed {
buffer.appendInt32(-1468331492)
}
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
serializeInt64(userId, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputPeerChannel(let channelId, let accessHash):
return ("inputPeerChannel", [("channelId", channelId as Any), ("accessHash", accessHash as Any)])
case .inputPeerChannelFromMessage(let peer, let msgId, let channelId):
return ("inputPeerChannelFromMessage", [("peer", peer as Any), ("msgId", msgId as Any), ("channelId", channelId as Any)])
case .inputPeerChat(let chatId):
return ("inputPeerChat", [("chatId", chatId as Any)])
case .inputPeerEmpty:
return ("inputPeerEmpty", [])
case .inputPeerSelf:
return ("inputPeerSelf", [])
case .inputPeerUser(let userId, let accessHash):
return ("inputPeerUser", [("userId", userId as Any), ("accessHash", accessHash as Any)])
case .inputPeerUserFromMessage(let peer, let msgId, let userId):
return ("inputPeerUserFromMessage", [("peer", peer as Any), ("msgId", msgId as Any), ("userId", userId as Any)])
}
}
public static func parse_inputPeerChannel(_ reader: BufferReader) -> InputPeer? {
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.InputPeer.inputPeerChannel(channelId: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputPeerChannelFromMessage(_ reader: BufferReader) -> InputPeer? {
var _1: Api.InputPeer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
var _2: Int32?
_2 = reader.readInt32()
var _3: Int64?
_3 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputPeer.inputPeerChannelFromMessage(peer: _1!, msgId: _2!, channelId: _3!)
}
else {
return nil
}
}
public static func parse_inputPeerChat(_ reader: BufferReader) -> InputPeer? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
if _c1 {
return Api.InputPeer.inputPeerChat(chatId: _1!)
}
else {
return nil
}
}
public static func parse_inputPeerEmpty(_ reader: BufferReader) -> InputPeer? {
return Api.InputPeer.inputPeerEmpty
}
public static func parse_inputPeerSelf(_ reader: BufferReader) -> InputPeer? {
return Api.InputPeer.inputPeerSelf
}
public static func parse_inputPeerUser(_ reader: BufferReader) -> InputPeer? {
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.InputPeer.inputPeerUser(userId: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputPeerUserFromMessage(_ reader: BufferReader) -> InputPeer? {
var _1: Api.InputPeer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
var _2: Int32?
_2 = reader.readInt32()
var _3: Int64?
_3 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputPeer.inputPeerUserFromMessage(peer: _1!, msgId: _2!, userId: _3!)
}
else {
return nil
}
}
}
}
public extension Api {
enum InputPeerNotifySettings: TypeConstructorDescription {
case inputPeerNotifySettings(flags: Int32, showPreviews: Api.Bool?, silent: Api.Bool?, muteUntil: Int32?, sound: Api.NotificationSound?, storiesMuted: Api.Bool?, storiesHideSender: Api.Bool?, storiesSound: Api.NotificationSound?)
@ -510,321 +678,3 @@ public extension Api {
}
}
public extension Api {
enum InputQuickReplyShortcut: TypeConstructorDescription {
case inputQuickReplyShortcut(shortcut: String)
case inputQuickReplyShortcutId(shortcutId: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputQuickReplyShortcut(let shortcut):
if boxed {
buffer.appendInt32(609840449)
}
serializeString(shortcut, buffer: buffer, boxed: false)
break
case .inputQuickReplyShortcutId(let shortcutId):
if boxed {
buffer.appendInt32(18418929)
}
serializeInt32(shortcutId, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputQuickReplyShortcut(let shortcut):
return ("inputQuickReplyShortcut", [("shortcut", shortcut as Any)])
case .inputQuickReplyShortcutId(let shortcutId):
return ("inputQuickReplyShortcutId", [("shortcutId", shortcutId as Any)])
}
}
public static func parse_inputQuickReplyShortcut(_ reader: BufferReader) -> InputQuickReplyShortcut? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.InputQuickReplyShortcut.inputQuickReplyShortcut(shortcut: _1!)
}
else {
return nil
}
}
public static func parse_inputQuickReplyShortcutId(_ reader: BufferReader) -> InputQuickReplyShortcut? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.InputQuickReplyShortcut.inputQuickReplyShortcutId(shortcutId: _1!)
}
else {
return nil
}
}
}
}
public extension Api {
indirect enum InputReplyTo: TypeConstructorDescription {
case inputReplyToMessage(flags: Int32, replyToMsgId: Int32, topMsgId: Int32?, replyToPeerId: Api.InputPeer?, quoteText: String?, quoteEntities: [Api.MessageEntity]?, quoteOffset: Int32?)
case inputReplyToStory(peer: Api.InputPeer, storyId: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputReplyToMessage(let flags, let replyToMsgId, let topMsgId, let replyToPeerId, let quoteText, let quoteEntities, let quoteOffset):
if boxed {
buffer.appendInt32(583071445)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(replyToMsgId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(topMsgId!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {replyToPeerId!.serialize(buffer, true)}
if Int(flags) & Int(1 << 2) != 0 {serializeString(quoteText!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(quoteEntities!.count))
for item in quoteEntities! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 4) != 0 {serializeInt32(quoteOffset!, buffer: buffer, boxed: false)}
break
case .inputReplyToStory(let peer, let storyId):
if boxed {
buffer.appendInt32(1484862010)
}
peer.serialize(buffer, true)
serializeInt32(storyId, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputReplyToMessage(let flags, let replyToMsgId, let topMsgId, let replyToPeerId, let quoteText, let quoteEntities, let quoteOffset):
return ("inputReplyToMessage", [("flags", flags as Any), ("replyToMsgId", replyToMsgId as Any), ("topMsgId", topMsgId as Any), ("replyToPeerId", replyToPeerId as Any), ("quoteText", quoteText as Any), ("quoteEntities", quoteEntities as Any), ("quoteOffset", quoteOffset as Any)])
case .inputReplyToStory(let peer, let storyId):
return ("inputReplyToStory", [("peer", peer as Any), ("storyId", storyId as Any)])
}
}
public static func parse_inputReplyToMessage(_ reader: BufferReader) -> InputReplyTo? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() }
var _4: Api.InputPeer?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.InputPeer
} }
var _5: String?
if Int(_1!) & Int(1 << 2) != 0 {_5 = parseString(reader) }
var _6: [Api.MessageEntity]?
if Int(_1!) & Int(1 << 3) != 0 {if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
} }
var _7: Int32?
if Int(_1!) & Int(1 << 4) != 0 {_7 = reader.readInt32() }
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 << 2) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
return Api.InputReplyTo.inputReplyToMessage(flags: _1!, replyToMsgId: _2!, topMsgId: _3, replyToPeerId: _4, quoteText: _5, quoteEntities: _6, quoteOffset: _7)
}
else {
return nil
}
}
public static func parse_inputReplyToStory(_ reader: BufferReader) -> InputReplyTo? {
var _1: Api.InputPeer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputReplyTo.inputReplyToStory(peer: _1!, storyId: _2!)
}
else {
return nil
}
}
}
}
public extension Api {
enum InputSecureFile: TypeConstructorDescription {
case inputSecureFile(id: Int64, accessHash: Int64)
case inputSecureFileUploaded(id: Int64, parts: Int32, md5Checksum: String, fileHash: Buffer, secret: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputSecureFile(let id, let accessHash):
if boxed {
buffer.appendInt32(1399317950)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputSecureFileUploaded(let id, let parts, let md5Checksum, let fileHash, let secret):
if boxed {
buffer.appendInt32(859091184)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt32(parts, buffer: buffer, boxed: false)
serializeString(md5Checksum, buffer: buffer, boxed: false)
serializeBytes(fileHash, buffer: buffer, boxed: false)
serializeBytes(secret, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputSecureFile(let id, let accessHash):
return ("inputSecureFile", [("id", id as Any), ("accessHash", accessHash as Any)])
case .inputSecureFileUploaded(let id, let parts, let md5Checksum, let fileHash, let secret):
return ("inputSecureFileUploaded", [("id", id as Any), ("parts", parts as Any), ("md5Checksum", md5Checksum as Any), ("fileHash", fileHash as Any), ("secret", secret as Any)])
}
}
public static func parse_inputSecureFile(_ reader: BufferReader) -> InputSecureFile? {
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.InputSecureFile.inputSecureFile(id: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputSecureFileUploaded(_ reader: BufferReader) -> InputSecureFile? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int32?
_2 = reader.readInt32()
var _3: String?
_3 = parseString(reader)
var _4: Buffer?
_4 = parseBytes(reader)
var _5: Buffer?
_5 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.InputSecureFile.inputSecureFileUploaded(id: _1!, parts: _2!, md5Checksum: _3!, fileHash: _4!, secret: _5!)
}
else {
return nil
}
}
}
}
public extension Api {
enum InputSecureValue: TypeConstructorDescription {
case inputSecureValue(flags: Int32, type: Api.SecureValueType, data: Api.SecureData?, frontSide: Api.InputSecureFile?, reverseSide: Api.InputSecureFile?, selfie: Api.InputSecureFile?, translation: [Api.InputSecureFile]?, files: [Api.InputSecureFile]?, plainData: Api.SecurePlainData?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputSecureValue(let flags, let type, let data, let frontSide, let reverseSide, let selfie, let translation, let files, let plainData):
if boxed {
buffer.appendInt32(-618540889)
}
serializeInt32(flags, buffer: buffer, boxed: false)
type.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {data!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {frontSide!.serialize(buffer, true)}
if Int(flags) & Int(1 << 2) != 0 {reverseSide!.serialize(buffer, true)}
if Int(flags) & Int(1 << 3) != 0 {selfie!.serialize(buffer, true)}
if Int(flags) & Int(1 << 6) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(translation!.count))
for item in translation! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 4) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(files!.count))
for item in files! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 5) != 0 {plainData!.serialize(buffer, true)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputSecureValue(let flags, let type, let data, let frontSide, let reverseSide, let selfie, let translation, let files, let plainData):
return ("inputSecureValue", [("flags", flags as Any), ("type", type as Any), ("data", data as Any), ("frontSide", frontSide as Any), ("reverseSide", reverseSide as Any), ("selfie", selfie as Any), ("translation", translation as Any), ("files", files as Any), ("plainData", plainData as Any)])
}
}
public static func parse_inputSecureValue(_ reader: BufferReader) -> InputSecureValue? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.SecureValueType?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.SecureValueType
}
var _3: Api.SecureData?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.SecureData
} }
var _4: Api.InputSecureFile?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
} }
var _5: Api.InputSecureFile?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
} }
var _6: Api.InputSecureFile?
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
} }
var _7: [Api.InputSecureFile]?
if Int(_1!) & Int(1 << 6) != 0 {if let _ = reader.readInt32() {
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputSecureFile.self)
} }
var _8: [Api.InputSecureFile]?
if Int(_1!) & Int(1 << 4) != 0 {if let _ = reader.readInt32() {
_8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputSecureFile.self)
} }
var _9: Api.SecurePlainData?
if Int(_1!) & Int(1 << 5) != 0 {if let signature = reader.readInt32() {
_9 = Api.parse(reader, signature: signature) as? Api.SecurePlainData
} }
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 << 2) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 6) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 5) == 0) || _9 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
return Api.InputSecureValue.inputSecureValue(flags: _1!, type: _2!, data: _3, frontSide: _4, reverseSide: _5, selfie: _6, translation: _7, files: _8, plainData: _9)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,321 @@
public extension Api {
enum InputQuickReplyShortcut: TypeConstructorDescription {
case inputQuickReplyShortcut(shortcut: String)
case inputQuickReplyShortcutId(shortcutId: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputQuickReplyShortcut(let shortcut):
if boxed {
buffer.appendInt32(609840449)
}
serializeString(shortcut, buffer: buffer, boxed: false)
break
case .inputQuickReplyShortcutId(let shortcutId):
if boxed {
buffer.appendInt32(18418929)
}
serializeInt32(shortcutId, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputQuickReplyShortcut(let shortcut):
return ("inputQuickReplyShortcut", [("shortcut", shortcut as Any)])
case .inputQuickReplyShortcutId(let shortcutId):
return ("inputQuickReplyShortcutId", [("shortcutId", shortcutId as Any)])
}
}
public static func parse_inputQuickReplyShortcut(_ reader: BufferReader) -> InputQuickReplyShortcut? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.InputQuickReplyShortcut.inputQuickReplyShortcut(shortcut: _1!)
}
else {
return nil
}
}
public static func parse_inputQuickReplyShortcutId(_ reader: BufferReader) -> InputQuickReplyShortcut? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.InputQuickReplyShortcut.inputQuickReplyShortcutId(shortcutId: _1!)
}
else {
return nil
}
}
}
}
public extension Api {
indirect enum InputReplyTo: TypeConstructorDescription {
case inputReplyToMessage(flags: Int32, replyToMsgId: Int32, topMsgId: Int32?, replyToPeerId: Api.InputPeer?, quoteText: String?, quoteEntities: [Api.MessageEntity]?, quoteOffset: Int32?)
case inputReplyToStory(peer: Api.InputPeer, storyId: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputReplyToMessage(let flags, let replyToMsgId, let topMsgId, let replyToPeerId, let quoteText, let quoteEntities, let quoteOffset):
if boxed {
buffer.appendInt32(583071445)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(replyToMsgId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(topMsgId!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {replyToPeerId!.serialize(buffer, true)}
if Int(flags) & Int(1 << 2) != 0 {serializeString(quoteText!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(quoteEntities!.count))
for item in quoteEntities! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 4) != 0 {serializeInt32(quoteOffset!, buffer: buffer, boxed: false)}
break
case .inputReplyToStory(let peer, let storyId):
if boxed {
buffer.appendInt32(1484862010)
}
peer.serialize(buffer, true)
serializeInt32(storyId, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputReplyToMessage(let flags, let replyToMsgId, let topMsgId, let replyToPeerId, let quoteText, let quoteEntities, let quoteOffset):
return ("inputReplyToMessage", [("flags", flags as Any), ("replyToMsgId", replyToMsgId as Any), ("topMsgId", topMsgId as Any), ("replyToPeerId", replyToPeerId as Any), ("quoteText", quoteText as Any), ("quoteEntities", quoteEntities as Any), ("quoteOffset", quoteOffset as Any)])
case .inputReplyToStory(let peer, let storyId):
return ("inputReplyToStory", [("peer", peer as Any), ("storyId", storyId as Any)])
}
}
public static func parse_inputReplyToMessage(_ reader: BufferReader) -> InputReplyTo? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() }
var _4: Api.InputPeer?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.InputPeer
} }
var _5: String?
if Int(_1!) & Int(1 << 2) != 0 {_5 = parseString(reader) }
var _6: [Api.MessageEntity]?
if Int(_1!) & Int(1 << 3) != 0 {if let _ = reader.readInt32() {
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
} }
var _7: Int32?
if Int(_1!) & Int(1 << 4) != 0 {_7 = reader.readInt32() }
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 << 2) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
return Api.InputReplyTo.inputReplyToMessage(flags: _1!, replyToMsgId: _2!, topMsgId: _3, replyToPeerId: _4, quoteText: _5, quoteEntities: _6, quoteOffset: _7)
}
else {
return nil
}
}
public static func parse_inputReplyToStory(_ reader: BufferReader) -> InputReplyTo? {
var _1: Api.InputPeer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputReplyTo.inputReplyToStory(peer: _1!, storyId: _2!)
}
else {
return nil
}
}
}
}
public extension Api {
enum InputSecureFile: TypeConstructorDescription {
case inputSecureFile(id: Int64, accessHash: Int64)
case inputSecureFileUploaded(id: Int64, parts: Int32, md5Checksum: String, fileHash: Buffer, secret: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputSecureFile(let id, let accessHash):
if boxed {
buffer.appendInt32(1399317950)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputSecureFileUploaded(let id, let parts, let md5Checksum, let fileHash, let secret):
if boxed {
buffer.appendInt32(859091184)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt32(parts, buffer: buffer, boxed: false)
serializeString(md5Checksum, buffer: buffer, boxed: false)
serializeBytes(fileHash, buffer: buffer, boxed: false)
serializeBytes(secret, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputSecureFile(let id, let accessHash):
return ("inputSecureFile", [("id", id as Any), ("accessHash", accessHash as Any)])
case .inputSecureFileUploaded(let id, let parts, let md5Checksum, let fileHash, let secret):
return ("inputSecureFileUploaded", [("id", id as Any), ("parts", parts as Any), ("md5Checksum", md5Checksum as Any), ("fileHash", fileHash as Any), ("secret", secret as Any)])
}
}
public static func parse_inputSecureFile(_ reader: BufferReader) -> InputSecureFile? {
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.InputSecureFile.inputSecureFile(id: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputSecureFileUploaded(_ reader: BufferReader) -> InputSecureFile? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int32?
_2 = reader.readInt32()
var _3: String?
_3 = parseString(reader)
var _4: Buffer?
_4 = parseBytes(reader)
var _5: Buffer?
_5 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.InputSecureFile.inputSecureFileUploaded(id: _1!, parts: _2!, md5Checksum: _3!, fileHash: _4!, secret: _5!)
}
else {
return nil
}
}
}
}
public extension Api {
enum InputSecureValue: TypeConstructorDescription {
case inputSecureValue(flags: Int32, type: Api.SecureValueType, data: Api.SecureData?, frontSide: Api.InputSecureFile?, reverseSide: Api.InputSecureFile?, selfie: Api.InputSecureFile?, translation: [Api.InputSecureFile]?, files: [Api.InputSecureFile]?, plainData: Api.SecurePlainData?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputSecureValue(let flags, let type, let data, let frontSide, let reverseSide, let selfie, let translation, let files, let plainData):
if boxed {
buffer.appendInt32(-618540889)
}
serializeInt32(flags, buffer: buffer, boxed: false)
type.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {data!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {frontSide!.serialize(buffer, true)}
if Int(flags) & Int(1 << 2) != 0 {reverseSide!.serialize(buffer, true)}
if Int(flags) & Int(1 << 3) != 0 {selfie!.serialize(buffer, true)}
if Int(flags) & Int(1 << 6) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(translation!.count))
for item in translation! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 4) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(files!.count))
for item in files! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 5) != 0 {plainData!.serialize(buffer, true)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputSecureValue(let flags, let type, let data, let frontSide, let reverseSide, let selfie, let translation, let files, let plainData):
return ("inputSecureValue", [("flags", flags as Any), ("type", type as Any), ("data", data as Any), ("frontSide", frontSide as Any), ("reverseSide", reverseSide as Any), ("selfie", selfie as Any), ("translation", translation as Any), ("files", files as Any), ("plainData", plainData as Any)])
}
}
public static func parse_inputSecureValue(_ reader: BufferReader) -> InputSecureValue? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.SecureValueType?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.SecureValueType
}
var _3: Api.SecureData?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.SecureData
} }
var _4: Api.InputSecureFile?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
} }
var _5: Api.InputSecureFile?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
} }
var _6: Api.InputSecureFile?
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
} }
var _7: [Api.InputSecureFile]?
if Int(_1!) & Int(1 << 6) != 0 {if let _ = reader.readInt32() {
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputSecureFile.self)
} }
var _8: [Api.InputSecureFile]?
if Int(_1!) & Int(1 << 4) != 0 {if let _ = reader.readInt32() {
_8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputSecureFile.self)
} }
var _9: Api.SecurePlainData?
if Int(_1!) & Int(1 << 5) != 0 {if let signature = reader.readInt32() {
_9 = Api.parse(reader, signature: signature) as? Api.SecurePlainData
} }
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 << 2) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 6) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 5) == 0) || _9 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
return Api.InputSecureValue.inputSecureValue(flags: _1!, type: _2!, data: _3, frontSide: _4, reverseSide: _5, selfie: _6, translation: _7, files: _8, plainData: _9)
}
else {
return nil
}
}
}
}
public extension Api {
indirect enum InputSingleMedia: TypeConstructorDescription {
case inputSingleMedia(flags: Int32, media: Api.InputMedia, randomId: Int64, message: String, entities: [Api.MessageEntity]?)
@ -760,177 +1078,3 @@ public extension Api {
}
}
public extension Api {
indirect enum InputUser: TypeConstructorDescription {
case inputUser(userId: Int64, accessHash: Int64)
case inputUserEmpty
case inputUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int64)
case inputUserSelf
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputUser(let userId, let accessHash):
if boxed {
buffer.appendInt32(-233744186)
}
serializeInt64(userId, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputUserEmpty:
if boxed {
buffer.appendInt32(-1182234929)
}
break
case .inputUserFromMessage(let peer, let msgId, let userId):
if boxed {
buffer.appendInt32(497305826)
}
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
serializeInt64(userId, buffer: buffer, boxed: false)
break
case .inputUserSelf:
if boxed {
buffer.appendInt32(-138301121)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputUser(let userId, let accessHash):
return ("inputUser", [("userId", userId as Any), ("accessHash", accessHash as Any)])
case .inputUserEmpty:
return ("inputUserEmpty", [])
case .inputUserFromMessage(let peer, let msgId, let userId):
return ("inputUserFromMessage", [("peer", peer as Any), ("msgId", msgId as Any), ("userId", userId as Any)])
case .inputUserSelf:
return ("inputUserSelf", [])
}
}
public static func parse_inputUser(_ reader: BufferReader) -> InputUser? {
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.InputUser.inputUser(userId: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputUserEmpty(_ reader: BufferReader) -> InputUser? {
return Api.InputUser.inputUserEmpty
}
public static func parse_inputUserFromMessage(_ reader: BufferReader) -> InputUser? {
var _1: Api.InputPeer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
var _2: Int32?
_2 = reader.readInt32()
var _3: Int64?
_3 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputUser.inputUserFromMessage(peer: _1!, msgId: _2!, userId: _3!)
}
else {
return nil
}
}
public static func parse_inputUserSelf(_ reader: BufferReader) -> InputUser? {
return Api.InputUser.inputUserSelf
}
}
}
public extension Api {
enum InputWallPaper: TypeConstructorDescription {
case inputWallPaper(id: Int64, accessHash: Int64)
case inputWallPaperNoFile(id: Int64)
case inputWallPaperSlug(slug: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputWallPaper(let id, let accessHash):
if boxed {
buffer.appendInt32(-433014407)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputWallPaperNoFile(let id):
if boxed {
buffer.appendInt32(-1770371538)
}
serializeInt64(id, buffer: buffer, boxed: false)
break
case .inputWallPaperSlug(let slug):
if boxed {
buffer.appendInt32(1913199744)
}
serializeString(slug, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputWallPaper(let id, let accessHash):
return ("inputWallPaper", [("id", id as Any), ("accessHash", accessHash as Any)])
case .inputWallPaperNoFile(let id):
return ("inputWallPaperNoFile", [("id", id as Any)])
case .inputWallPaperSlug(let slug):
return ("inputWallPaperSlug", [("slug", slug as Any)])
}
}
public static func parse_inputWallPaper(_ reader: BufferReader) -> InputWallPaper? {
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.InputWallPaper.inputWallPaper(id: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputWallPaperNoFile(_ reader: BufferReader) -> InputWallPaper? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
if _c1 {
return Api.InputWallPaper.inputWallPaperNoFile(id: _1!)
}
else {
return nil
}
}
public static func parse_inputWallPaperSlug(_ reader: BufferReader) -> InputWallPaper? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.InputWallPaper.inputWallPaperSlug(slug: _1!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,177 @@
public extension Api {
indirect enum InputUser: TypeConstructorDescription {
case inputUser(userId: Int64, accessHash: Int64)
case inputUserEmpty
case inputUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int64)
case inputUserSelf
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputUser(let userId, let accessHash):
if boxed {
buffer.appendInt32(-233744186)
}
serializeInt64(userId, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputUserEmpty:
if boxed {
buffer.appendInt32(-1182234929)
}
break
case .inputUserFromMessage(let peer, let msgId, let userId):
if boxed {
buffer.appendInt32(497305826)
}
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
serializeInt64(userId, buffer: buffer, boxed: false)
break
case .inputUserSelf:
if boxed {
buffer.appendInt32(-138301121)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputUser(let userId, let accessHash):
return ("inputUser", [("userId", userId as Any), ("accessHash", accessHash as Any)])
case .inputUserEmpty:
return ("inputUserEmpty", [])
case .inputUserFromMessage(let peer, let msgId, let userId):
return ("inputUserFromMessage", [("peer", peer as Any), ("msgId", msgId as Any), ("userId", userId as Any)])
case .inputUserSelf:
return ("inputUserSelf", [])
}
}
public static func parse_inputUser(_ reader: BufferReader) -> InputUser? {
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.InputUser.inputUser(userId: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputUserEmpty(_ reader: BufferReader) -> InputUser? {
return Api.InputUser.inputUserEmpty
}
public static func parse_inputUserFromMessage(_ reader: BufferReader) -> InputUser? {
var _1: Api.InputPeer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
var _2: Int32?
_2 = reader.readInt32()
var _3: Int64?
_3 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputUser.inputUserFromMessage(peer: _1!, msgId: _2!, userId: _3!)
}
else {
return nil
}
}
public static func parse_inputUserSelf(_ reader: BufferReader) -> InputUser? {
return Api.InputUser.inputUserSelf
}
}
}
public extension Api {
enum InputWallPaper: TypeConstructorDescription {
case inputWallPaper(id: Int64, accessHash: Int64)
case inputWallPaperNoFile(id: Int64)
case inputWallPaperSlug(slug: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputWallPaper(let id, let accessHash):
if boxed {
buffer.appendInt32(-433014407)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputWallPaperNoFile(let id):
if boxed {
buffer.appendInt32(-1770371538)
}
serializeInt64(id, buffer: buffer, boxed: false)
break
case .inputWallPaperSlug(let slug):
if boxed {
buffer.appendInt32(1913199744)
}
serializeString(slug, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputWallPaper(let id, let accessHash):
return ("inputWallPaper", [("id", id as Any), ("accessHash", accessHash as Any)])
case .inputWallPaperNoFile(let id):
return ("inputWallPaperNoFile", [("id", id as Any)])
case .inputWallPaperSlug(let slug):
return ("inputWallPaperSlug", [("slug", slug as Any)])
}
}
public static func parse_inputWallPaper(_ reader: BufferReader) -> InputWallPaper? {
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.InputWallPaper.inputWallPaper(id: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputWallPaperNoFile(_ reader: BufferReader) -> InputWallPaper? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
if _c1 {
return Api.InputWallPaper.inputWallPaperNoFile(id: _1!)
}
else {
return nil
}
}
public static func parse_inputWallPaperSlug(_ reader: BufferReader) -> InputWallPaper? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.InputWallPaper.inputWallPaperSlug(slug: _1!)
}
else {
return nil
}
}
}
}
public extension Api {
enum InputWebDocument: TypeConstructorDescription {
case inputWebDocument(url: String, size: Int32, mimeType: String, attributes: [Api.DocumentAttribute])
@ -900,139 +1074,3 @@ public extension Api {
}
}
public extension Api {
enum KeyboardButtonRow: TypeConstructorDescription {
case keyboardButtonRow(buttons: [Api.KeyboardButton])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .keyboardButtonRow(let buttons):
if boxed {
buffer.appendInt32(2002815875)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(buttons.count))
for item in buttons {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .keyboardButtonRow(let buttons):
return ("keyboardButtonRow", [("buttons", buttons as Any)])
}
}
public static func parse_keyboardButtonRow(_ reader: BufferReader) -> KeyboardButtonRow? {
var _1: [Api.KeyboardButton]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.KeyboardButton.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.KeyboardButtonRow.keyboardButtonRow(buttons: _1!)
}
else {
return nil
}
}
}
}
public extension Api {
enum LabeledPrice: TypeConstructorDescription {
case labeledPrice(label: String, amount: Int64)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .labeledPrice(let label, let amount):
if boxed {
buffer.appendInt32(-886477832)
}
serializeString(label, buffer: buffer, boxed: false)
serializeInt64(amount, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .labeledPrice(let label, let amount):
return ("labeledPrice", [("label", label as Any), ("amount", amount as Any)])
}
}
public static func parse_labeledPrice(_ reader: BufferReader) -> LabeledPrice? {
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.LabeledPrice.labeledPrice(label: _1!, amount: _2!)
}
else {
return nil
}
}
}
}
public extension Api {
enum LangPackDifference: TypeConstructorDescription {
case langPackDifference(langCode: String, fromVersion: Int32, version: Int32, strings: [Api.LangPackString])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .langPackDifference(let langCode, let fromVersion, let version, let strings):
if boxed {
buffer.appendInt32(-209337866)
}
serializeString(langCode, buffer: buffer, boxed: false)
serializeInt32(fromVersion, buffer: buffer, boxed: false)
serializeInt32(version, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(strings.count))
for item in strings {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .langPackDifference(let langCode, let fromVersion, let version, let strings):
return ("langPackDifference", [("langCode", langCode as Any), ("fromVersion", fromVersion as Any), ("version", version as Any), ("strings", strings as Any)])
}
}
public static func parse_langPackDifference(_ reader: BufferReader) -> LangPackDifference? {
var _1: String?
_1 = parseString(reader)
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
var _4: [Api.LangPackString]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.LangPackString.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.LangPackDifference.langPackDifference(langCode: _1!, fromVersion: _2!, version: _3!, strings: _4!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,139 @@
public extension Api {
enum KeyboardButtonRow: TypeConstructorDescription {
case keyboardButtonRow(buttons: [Api.KeyboardButton])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .keyboardButtonRow(let buttons):
if boxed {
buffer.appendInt32(2002815875)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(buttons.count))
for item in buttons {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .keyboardButtonRow(let buttons):
return ("keyboardButtonRow", [("buttons", buttons as Any)])
}
}
public static func parse_keyboardButtonRow(_ reader: BufferReader) -> KeyboardButtonRow? {
var _1: [Api.KeyboardButton]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.KeyboardButton.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.KeyboardButtonRow.keyboardButtonRow(buttons: _1!)
}
else {
return nil
}
}
}
}
public extension Api {
enum LabeledPrice: TypeConstructorDescription {
case labeledPrice(label: String, amount: Int64)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .labeledPrice(let label, let amount):
if boxed {
buffer.appendInt32(-886477832)
}
serializeString(label, buffer: buffer, boxed: false)
serializeInt64(amount, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .labeledPrice(let label, let amount):
return ("labeledPrice", [("label", label as Any), ("amount", amount as Any)])
}
}
public static func parse_labeledPrice(_ reader: BufferReader) -> LabeledPrice? {
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.LabeledPrice.labeledPrice(label: _1!, amount: _2!)
}
else {
return nil
}
}
}
}
public extension Api {
enum LangPackDifference: TypeConstructorDescription {
case langPackDifference(langCode: String, fromVersion: Int32, version: Int32, strings: [Api.LangPackString])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .langPackDifference(let langCode, let fromVersion, let version, let strings):
if boxed {
buffer.appendInt32(-209337866)
}
serializeString(langCode, buffer: buffer, boxed: false)
serializeInt32(fromVersion, buffer: buffer, boxed: false)
serializeInt32(version, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(strings.count))
for item in strings {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .langPackDifference(let langCode, let fromVersion, let version, let strings):
return ("langPackDifference", [("langCode", langCode as Any), ("fromVersion", fromVersion as Any), ("version", version as Any), ("strings", strings as Any)])
}
}
public static func parse_langPackDifference(_ reader: BufferReader) -> LangPackDifference? {
var _1: String?
_1 = parseString(reader)
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
var _4: [Api.LangPackString]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.LangPackString.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.LangPackDifference.langPackDifference(langCode: _1!, fromVersion: _2!, version: _3!, strings: _4!)
}
else {
return nil
}
}
}
}
public extension Api {
enum LangPackLanguage: TypeConstructorDescription {
case langPackLanguage(flags: Int32, name: String, nativeName: String, langCode: String, baseLangCode: String?, pluralCode: String, stringsCount: Int32, translatedCount: Int32, translationsUrl: String)

View File

@ -412,6 +412,7 @@ public extension Api {
enum InputFile: TypeConstructorDescription {
case inputFile(id: Int64, parts: Int32, name: String, md5Checksum: String)
case inputFileBig(id: Int64, parts: Int32, name: String)
case inputFileStoryDocument(id: Api.InputDocument)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
@ -432,6 +433,12 @@ public extension Api {
serializeInt32(parts, buffer: buffer, boxed: false)
serializeString(name, buffer: buffer, boxed: false)
break
case .inputFileStoryDocument(let id):
if boxed {
buffer.appendInt32(1658620744)
}
id.serialize(buffer, true)
break
}
}
@ -441,6 +448,8 @@ public extension Api {
return ("inputFile", [("id", id as Any), ("parts", parts as Any), ("name", name as Any), ("md5Checksum", md5Checksum as Any)])
case .inputFileBig(let id, let parts, let name):
return ("inputFileBig", [("id", id as Any), ("parts", parts as Any), ("name", name as Any)])
case .inputFileStoryDocument(let id):
return ("inputFileStoryDocument", [("id", id as Any)])
}
}
@ -481,6 +490,19 @@ public extension Api {
return nil
}
}
public static func parse_inputFileStoryDocument(_ reader: BufferReader) -> InputFile? {
var _1: Api.InputDocument?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputDocument
}
let _c1 = _1 != nil
if _c1 {
return Api.InputFile.inputFileStoryDocument(id: _1!)
}
else {
return nil
}
}
}
}
@ -1002,115 +1024,3 @@ public extension Api {
}
}
public extension Api {
indirect enum InputInvoice: TypeConstructorDescription {
case inputInvoiceMessage(peer: Api.InputPeer, msgId: Int32)
case inputInvoicePremiumGiftCode(purpose: Api.InputStorePaymentPurpose, option: Api.PremiumGiftCodeOption)
case inputInvoiceSlug(slug: String)
case inputInvoiceStars(purpose: Api.InputStorePaymentPurpose)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputInvoiceMessage(let peer, let msgId):
if boxed {
buffer.appendInt32(-977967015)
}
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
break
case .inputInvoicePremiumGiftCode(let purpose, let option):
if boxed {
buffer.appendInt32(-1734841331)
}
purpose.serialize(buffer, true)
option.serialize(buffer, true)
break
case .inputInvoiceSlug(let slug):
if boxed {
buffer.appendInt32(-1020867857)
}
serializeString(slug, buffer: buffer, boxed: false)
break
case .inputInvoiceStars(let purpose):
if boxed {
buffer.appendInt32(1710230755)
}
purpose.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputInvoiceMessage(let peer, let msgId):
return ("inputInvoiceMessage", [("peer", peer as Any), ("msgId", msgId as Any)])
case .inputInvoicePremiumGiftCode(let purpose, let option):
return ("inputInvoicePremiumGiftCode", [("purpose", purpose as Any), ("option", option as Any)])
case .inputInvoiceSlug(let slug):
return ("inputInvoiceSlug", [("slug", slug as Any)])
case .inputInvoiceStars(let purpose):
return ("inputInvoiceStars", [("purpose", purpose as Any)])
}
}
public static func parse_inputInvoiceMessage(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputPeer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputInvoice.inputInvoiceMessage(peer: _1!, msgId: _2!)
}
else {
return nil
}
}
public static func parse_inputInvoicePremiumGiftCode(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputStorePaymentPurpose?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputStorePaymentPurpose
}
var _2: Api.PremiumGiftCodeOption?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.PremiumGiftCodeOption
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputInvoice.inputInvoicePremiumGiftCode(purpose: _1!, option: _2!)
}
else {
return nil
}
}
public static func parse_inputInvoiceSlug(_ reader: BufferReader) -> InputInvoice? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.InputInvoice.inputInvoiceSlug(slug: _1!)
}
else {
return nil
}
}
public static func parse_inputInvoiceStars(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputStorePaymentPurpose?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputStorePaymentPurpose
}
let _c1 = _1 != nil
if _c1 {
return Api.InputInvoice.inputInvoiceStars(purpose: _1!)
}
else {
return nil
}
}
}
}

View File

@ -14,7 +14,7 @@ private func copyOrMoveResourceData(from fromResource: MediaResource, to toResou
}
}
func applyMediaResourceChanges(from: Media, to: Media, postbox: Postbox, force: Bool) {
func applyMediaResourceChanges(from: Media, to: Media, postbox: Postbox, force: Bool, skipPreviews: Bool = false) {
if let fromImage = from as? TelegramMediaImage, let toImage = to as? TelegramMediaImage {
let fromSmallestRepresentation = smallestImageRepresentation(fromImage.representations)
if let fromSmallestRepresentation = fromSmallestRepresentation, let toSmallestRepresentation = smallestImageRepresentation(toImage.representations) {
@ -32,11 +32,13 @@ func applyMediaResourceChanges(from: Media, to: Media, postbox: Postbox, force:
}
}
} else if let fromFile = from as? TelegramMediaFile, let toFile = to as? TelegramMediaFile {
if let fromPreview = smallestImageRepresentation(fromFile.previewRepresentations), let toPreview = smallestImageRepresentation(toFile.previewRepresentations) {
copyOrMoveResourceData(from: fromPreview.resource, to: toPreview.resource, mediaBox: postbox.mediaBox)
}
if let fromVideoThumbnail = fromFile.videoThumbnails.first, let toVideoThumbnail = toFile.videoThumbnails.first, fromVideoThumbnail.resource.id != toVideoThumbnail.resource.id {
copyOrMoveResourceData(from: fromVideoThumbnail.resource, to: toVideoThumbnail.resource, mediaBox: postbox.mediaBox)
if !skipPreviews {
if let fromPreview = smallestImageRepresentation(fromFile.previewRepresentations), let toPreview = smallestImageRepresentation(toFile.previewRepresentations) {
copyOrMoveResourceData(from: fromPreview.resource, to: toPreview.resource, mediaBox: postbox.mediaBox)
}
if let fromVideoThumbnail = fromFile.videoThumbnails.first, let toVideoThumbnail = toFile.videoThumbnails.first, fromVideoThumbnail.resource.id != toVideoThumbnail.resource.id {
copyOrMoveResourceData(from: fromVideoThumbnail.resource, to: toVideoThumbnail.resource, mediaBox: postbox.mediaBox)
}
}
let videoFirstFrameFromPath = postbox.mediaBox.cachedRepresentationCompletePath(fromFile.resource.id, keepDuration: .general, representationId: "first-frame")
let videoFirstFrameToPath = postbox.mediaBox.cachedRepresentationCompletePath(toFile.resource.id, keepDuration: .general, representationId: "first-frame")

View File

@ -1498,9 +1498,13 @@ func _internal_editStory(account: Account, peerId: PeerId, id: Int32, media: Eng
return .single(.progress(progress.progress))
}
var updatingCoverTime = false
let inputMedia: Api.InputMedia?
if let result = result, case let .content(uploadedContent) = result, case let .media(media, _) = uploadedContent.content {
inputMedia = media
} else if case let .existing(media) = media, let file = media as? TelegramMediaFile, let resource = file.resource as? CloudDocumentMediaResource {
inputMedia = .inputMediaUploadedDocument(flags: 0, file: .inputFileStoryDocument(id: .inputDocument(id: resource.fileId, accessHash: resource.accessHash, fileReference: Buffer(data: resource.fileReference))), thumb: nil, mimeType: file.mimeType, attributes: inputDocumentAttributesFromFileAttributes(file.attributes), stickers: nil, ttlSeconds: nil)
updatingCoverTime = true
} else {
inputMedia = nil
}
@ -1566,7 +1570,7 @@ func _internal_editStory(account: Account, peerId: PeerId, id: Int32, media: Eng
case let .storyItem(_, _, _, _, _, _, _, _, media, _, _, _, _):
let (parsedMedia, _, _, _, _) = textMediaAndExpirationTimerFromApiMedia(media, account.peerId)
if let parsedMedia = parsedMedia, let originalMedia = originalMedia {
applyMediaResourceChanges(from: originalMedia, to: parsedMedia, postbox: account.postbox, force: false)
applyMediaResourceChanges(from: originalMedia, to: parsedMedia, postbox: account.postbox, force: false, skipPreviews: updatingCoverTime)
}
default:
break

View File

@ -31,6 +31,7 @@ swift_library(
"//submodules/ReactionSelectionNode",
"//submodules/TelegramUI/Components/Chat/ChatMediaInputStickerGridItem",
"//submodules/PremiumUI",
"//submodules/TelegramUI/Components/LottieComponent",
],
visibility = [
"//visibility:public",

View File

@ -22,6 +22,7 @@ import ReactionSelectionNode
import ChatMediaInputStickerGridItem
import UndoUI
import PremiumUI
import LottieComponent
private protocol ChatEmptyNodeContent {
func updateLayout(interfaceState: ChatPresentationInterfaceState, subject: ChatEmptyNode.Subject, size: CGSize, transition: ContainedViewLayoutTransition) -> CGSize
@ -1203,7 +1204,7 @@ public final class ChatEmptyNodePremiumRequiredChatContent: ASDisplayNode, ChatE
private let interaction: ChatPanelInterfaceInteraction?
private let iconBackground: SimpleLayer
private let icon: UIImageView
private let icon = ComponentView<Empty>()
private let text = ComponentView<Empty>()
private let buttonTitle = ComponentView<Empty>()
private let button: HighlightTrackingButton
@ -1219,8 +1220,7 @@ public final class ChatEmptyNodePremiumRequiredChatContent: ASDisplayNode, ChatE
self.interaction = interaction
self.iconBackground = SimpleLayer()
self.icon = UIImageView(image: UIImage(bundleImageName: "Chat/Empty Chat/PremiumRequiredIcon")?.withRenderingMode(.alwaysTemplate))
self.button = HighlightTrackingButton()
self.button.clipsToBounds = true
@ -1230,7 +1230,6 @@ public final class ChatEmptyNodePremiumRequiredChatContent: ASDisplayNode, ChatE
super.init()
self.layer.addSublayer(self.iconBackground)
self.view.addSubview(self.icon)
if !self.isPremiumDisabled {
self.view.addSubview(self.button)
@ -1330,11 +1329,28 @@ public final class ChatEmptyNodePremiumRequiredChatContent: ASDisplayNode, ChatE
contentsHeight += iconBackgroundSize
contentsHeight += iconTextSpacing
self.icon.tintColor = serviceColor.primaryText
if let image = self.icon.image {
transition.updateFrame(view: self.icon, frame: CGRect(origin: CGPoint(x: iconBackgroundFrame.minX + floor((iconBackgroundFrame.width - image.size.width) * 0.5), y: iconBackgroundFrame.minY + floor((iconBackgroundFrame.height - image.size.height) * 0.5)), size: image.size))
let iconSize = self.icon.update(
transition: .immediate,
component: AnyComponent(
LottieComponent(
content: LottieComponent.AppBundleContent(name: "PremiumRequired"),
color: serviceColor.primaryText,
size: CGSize(width: 120.0, height: 120.0),
loop: true
)
),
environment: {},
containerSize: CGSize(width: maxWidth - sideInset * 2.0, height: 500.0)
)
let iconFrame = CGRect(origin: CGPoint(x: iconBackgroundFrame.minX + floor((iconBackgroundFrame.width - iconSize.width) * 0.5), y: iconBackgroundFrame.minY + floor((iconBackgroundFrame.height - iconSize.height) * 0.5)), size: iconSize)
if let iconView = self.icon.view {
if iconView.superview == nil {
iconView.isUserInteractionEnabled = false
self.view.addSubview(iconView)
}
iconView.frame = iconFrame
}
let textFrame = CGRect(origin: CGPoint(x: floor((contentsWidth - textSize.width) * 0.5), y: contentsHeight), size: textSize)
if let textView = self.text.view {
if textView.superview == nil {

View File

@ -395,7 +395,11 @@ public final class ChatMessageWebpageBubbleContentNode: ChatMessageBubbleContent
actionTitle = item.presentationData.strings.Conversation_ViewMessage
}
case "telegram_user":
actionTitle = item.presentationData.strings.Conversation_UserSendMessage
if webpage.displayUrl.contains("?profile") {
actionTitle = item.presentationData.strings.Conversation_OpenProfile
} else {
actionTitle = item.presentationData.strings.Conversation_UserSendMessage
}
case "telegram_channel_request":
actionTitle = item.presentationData.strings.Conversation_RequestToJoinChannel
case "telegram_chat_request", "telegram_megagroup_request":

View File

@ -83,6 +83,17 @@ public extension MediaEditorScreen {
transitionOut: nil
)
var videoPlaybackPosition = videoPlaybackPosition
if cover, case let .file(file) = storyItem.media {
videoPlaybackPosition = 0.0
for attribute in file.attributes {
if case let .Video(_, _, _, _, coverTime) = attribute {
videoPlaybackPosition = coverTime
break
}
}
}
var updateProgressImpl: ((Float) -> Void)?
let controller = MediaEditorScreen(
context: context,
@ -248,7 +259,7 @@ public extension MediaEditorScreen {
var updatedAttributes: [TelegramMediaFileAttribute] = []
for attribute in file.attributes {
if case let .Video(duration, size, flags, preloadSize, _) = attribute {
updatedAttributes.append(.Video(duration: duration, size: size, flags: flags, preloadSize: preloadSize, coverTime: updatedCoverTimestamp))
updatedAttributes.append(.Video(duration: duration, size: size, flags: flags, preloadSize: preloadSize, coverTime: min(duration, updatedCoverTimestamp)))
} else {
updatedAttributes.append(attribute)
}

View File

@ -2945,7 +2945,11 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
let mediaEditor = MediaEditor(context: self.context, mode: isStickerEditor ? .sticker : .default, subject: effectiveSubject.editorSubject, values: initialValues, hasHistogram: true)
if let initialVideoPosition = controller.initialVideoPosition {
mediaEditor.seek(initialVideoPosition, andPlay: true)
if controller.isEditingStoryCover {
mediaEditor.setCoverImageTimestamp(initialVideoPosition)
} else {
mediaEditor.seek(initialVideoPosition, andPlay: true)
}
}
if case .message = subject, self.context.sharedContext.currentPresentationData.with({$0}).autoNightModeTriggered {
mediaEditor.setNightTheme(true)
@ -6293,7 +6297,7 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
let content: UndoOverlayContent = .info(
title: nil,
text: presentationData.strings.Story_Editor_TooltipWeatherLimitText.string,
text: presentationData.strings.Story_Editor_TooltipWeatherLimitText,
timeout: nil,
customUndoText: nil
)

View File

@ -135,11 +135,11 @@ func openWebAppImpl(context: AccountContext, parentController: ViewController, u
}
}, didDismiss: { [weak parentController] in
if let parentController = parentController as? ChatControllerImpl {
let isFocused = parentController.chatDisplayNode.textInputPanelNode?.isFocused ?? false
parentController.chatDisplayNode.insertSubnode(parentController.chatDisplayNode.inputPanelContainerNode, aboveSubnode: parentController.chatDisplayNode.inputContextPanelContainer)
if isFocused {
parentController.chatDisplayNode.textInputPanelNode?.ensureFocused()
}
// let isFocused = parentController.chatDisplayNode.textInputPanelNode?.isFocused ?? false
// parentController.chatDisplayNode.insertSubnode(parentController.chatDisplayNode.inputPanelContainerNode, aboveSubnode: parentController.chatDisplayNode.inputContextPanelContainer)
// if isFocused {
// parentController.chatDisplayNode.textInputPanelNode?.ensureFocused()
// }
parentController.updateChatPresentationInterfaceState(interactive: false) { state in
return state.updatedForceInputCommandsHidden(false)

View File

@ -678,9 +678,9 @@ public final class TelegramRootController: NavigationController, TelegramRootCon
var coverTime: Double?
if let coverImageTimestamp = values.coverImageTimestamp {
if let trimRange = values.videoTrimRange {
coverTime = coverImageTimestamp - trimRange.lowerBound
coverTime = min(duration, coverImageTimestamp - trimRange.lowerBound)
} else {
coverTime = coverImageTimestamp
coverTime = min(duration, coverImageTimestamp)
}
}

View File

@ -2069,6 +2069,14 @@ public final class WebAppController: ViewController, AttachmentContainable {
self?.controllerNode.webView?.reload()
})))
// items.append(.action(ContextMenuActionItem(text: presentationData.strings.WebApp_PrivacyPolicy, icon: { theme in
// return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Reload"), color: theme.contextMenu.primaryColor)
// }, action: { [weak self] c, _ in
// c?.dismiss(completion: nil)
//
// self?.controllerNode.webView?.reload()
// })))
items.append(.action(ContextMenuActionItem(text: presentationData.strings.WebApp_TermsOfUse, icon: { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Info"), color: theme.contextMenu.primaryColor)
}, action: { [weak self] c, _ in