Skip to content

Commit 85b6a8f

Browse files
committed
Update API [skip ci]
1 parent 83a7019 commit 85b6a8f

40 files changed

+1678
-833
lines changed

submodules/AccountContext/Sources/AccountContext.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,12 @@ public enum StickerPackUrlType {
278278
case emoji
279279
}
280280

281+
public enum ResolvedStartAppMode {
282+
case generic
283+
case compact
284+
case fullscreen
285+
}
286+
281287
public enum ResolvedUrl {
282288
case externalUrl(String)
283289
case urlAuth(String)
@@ -1044,7 +1050,7 @@ public protocol SharedAccountContext: AnyObject {
10441050
func makeMiniAppListScreenInitialData(context: AccountContext) -> Signal<MiniAppListScreenInitialData, NoError>
10451051
func makeMiniAppListScreen(context: AccountContext, initialData: MiniAppListScreenInitialData) -> ViewController
10461052

1047-
func openWebApp(context: AccountContext, parentController: ViewController, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?, peer: EnginePeer, threadId: Int64?, buttonText: String, url: String, simple: Bool, source: ChatOpenWebViewSource, skipTermsOfService: Bool, payload: String?)
1053+
func openWebApp(context: AccountContext, parentController: ViewController, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?, botPeer: EnginePeer, chatPeer: EnginePeer?, threadId: Int64?, buttonText: String, url: String, simple: Bool, source: ChatOpenWebViewSource, skipTermsOfService: Bool, payload: String?)
10481054

10491055
func makeDebugSettingsController(context: AccountContext?) -> ViewController?
10501056

submodules/AccountContext/Sources/ChatController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,13 @@ public struct ChatControllerInitialBotAppStart {
301301
public let botApp: BotApp?
302302
public let payload: String?
303303
public let justInstalled: Bool
304-
public let compact: Bool
304+
public let mode: ResolvedStartAppMode
305305

306-
public init(botApp: BotApp?, payload: String?, justInstalled: Bool, compact: Bool) {
306+
public init(botApp: BotApp?, payload: String?, justInstalled: Bool, mode: ResolvedStartAppMode) {
307307
self.botApp = botApp
308308
self.payload = payload
309309
self.justInstalled = justInstalled
310-
self.compact = compact
310+
self.mode = mode
311311
}
312312
}
313313

submodules/BrowserUI/Sources/BrowserWebContent.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,8 +1460,7 @@ final class BrowserWebContent: UIView, BrowserContent, WKNavigationDelegate, WKU
14601460
}
14611461
}
14621462

1463-
if result.isEmpty, let webViewUrl = self.webView.url {
1464-
let schemeAndHostUrl = webViewUrl.deletingPathExtension()
1463+
if result.isEmpty, let webViewUrl = self.webView.url, let schemeAndHostUrl = URL(string: "/", relativeTo: webViewUrl) {
14651464
let url = schemeAndHostUrl.appendingPathComponent("favicon.ico")
14661465
result.insert(Favicon(url: url.absoluteString, dimensions: nil))
14671466
}

submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3816,7 +3816,8 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
38163816
context: self.context,
38173817
parentController: parentController,
38183818
updatedPresentationData: nil,
3819-
peer: peer,
3819+
botPeer: peer,
3820+
chatPeer: nil,
38203821
threadId: nil,
38213822
buttonText: "",
38223823
url: "",
@@ -3840,7 +3841,8 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
38403841
context: self.context,
38413842
parentController: parentController,
38423843
updatedPresentationData: nil,
3843-
peer: peer,
3844+
botPeer: peer,
3845+
chatPeer: nil,
38443846
threadId: nil,
38453847
buttonText: "",
38463848
url: "",

submodules/TelegramApi/Sources/Api0.swift

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
8383
dict[1262359766] = { return Api.Boost.parse_boost($0) }
8484
dict[-1778593322] = { return Api.BotApp.parse_botApp($0) }
8585
dict[1571189943] = { return Api.BotApp.parse_botAppNotModified($0) }
86+
dict[-2103898979] = { return Api.BotAppSettings.parse_botAppSettings($0) }
8687
dict[-1989921868] = { return Api.BotBusinessConnection.parse_botBusinessConnection($0) }
8788
dict[-1032140601] = { return Api.BotCommand.parse_botCommand($0) }
8889
dict[-1180016534] = { return Api.BotCommandScope.parse_botCommandScopeChatAdmins($0) }
@@ -92,7 +93,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
9293
dict[1071145937] = { return Api.BotCommandScope.parse_botCommandScopePeerAdmins($0) }
9394
dict[169026035] = { return Api.BotCommandScope.parse_botCommandScopePeerUser($0) }
9495
dict[1011811544] = { return Api.BotCommandScope.parse_botCommandScopeUsers($0) }
95-
dict[-2109505932] = { return Api.BotInfo.parse_botInfo($0) }
96+
dict[912290611] = { return Api.BotInfo.parse_botInfo($0) }
9697
dict[1984755728] = { return Api.BotInlineMessage.parse_botInlineMessageMediaAuto($0) }
9798
dict[416402882] = { return Api.BotInlineMessage.parse_botInlineMessageMediaContact($0) }
9899
dict[85477117] = { return Api.BotInlineMessage.parse_botInlineMessageMediaGeo($0) }
@@ -974,7 +975,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
974975
dict[675009298] = { return Api.Update.parse_updateBotPurchasedPaidMedia($0) }
975976
dict[-1246823043] = { return Api.Update.parse_updateBotShippingQuery($0) }
976977
dict[-997782967] = { return Api.Update.parse_updateBotStopped($0) }
977-
dict[-1464975695] = { return Api.Update.parse_updateBotSubscriptionExpire($0) }
978+
dict[756270830] = { return Api.Update.parse_updateBotSubscriptionExpire($0) }
978979
dict[-2095595325] = { return Api.Update.parse_updateBotWebhookJSON($0) }
979980
dict[-1684914010] = { return Api.Update.parse_updateBotWebhookJSONQuery($0) }
980981
dict[-539401739] = { return Api.Update.parse_updateBroadcastRevenueTransactions($0) }
@@ -1266,6 +1267,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
12661267
dict[-1626924713] = { return Api.messages.AvailableReactions.parse_availableReactionsNotModified($0) }
12671268
dict[-347034123] = { return Api.messages.BotApp.parse_botApp($0) }
12681269
dict[911761060] = { return Api.messages.BotCallbackAnswer.parse_botCallbackAnswer($0) }
1270+
dict[-1899035375] = { return Api.messages.BotPreparedInlineMessage.parse_botPreparedInlineMessage($0) }
12691271
dict[-534646026] = { return Api.messages.BotResults.parse_botResults($0) }
12701272
dict[-1231326505] = { return Api.messages.ChatAdminsWithInvites.parse_chatAdminsWithInvites($0) }
12711273
dict[-438840932] = { return Api.messages.ChatFull.parse_chatFull($0) }
@@ -1307,6 +1309,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
13071309
dict[-83926371] = { return Api.messages.MyStickers.parse_myStickers($0) }
13081310
dict[863093588] = { return Api.messages.PeerDialogs.parse_peerDialogs($0) }
13091311
dict[1753266509] = { return Api.messages.PeerSettings.parse_peerSettings($0) }
1312+
dict[1636301421] = { return Api.messages.PreparedInlineMessage.parse_preparedInlineMessage($0) }
13101313
dict[-963811691] = { return Api.messages.QuickReplies.parse_quickReplies($0) }
13111314
dict[1603398491] = { return Api.messages.QuickReplies.parse_quickRepliesNotModified($0) }
13121315
dict[-352454890] = { return Api.messages.Reactions.parse_reactions($0) }
@@ -1511,6 +1514,8 @@ public extension Api {
15111514
_1.serialize(buffer, boxed)
15121515
case let _1 as Api.BotApp:
15131516
_1.serialize(buffer, boxed)
1517+
case let _1 as Api.BotAppSettings:
1518+
_1.serialize(buffer, boxed)
15141519
case let _1 as Api.BotBusinessConnection:
15151520
_1.serialize(buffer, boxed)
15161521
case let _1 as Api.BotCommand:
@@ -2297,6 +2302,8 @@ public extension Api {
22972302
_1.serialize(buffer, boxed)
22982303
case let _1 as Api.messages.BotCallbackAnswer:
22992304
_1.serialize(buffer, boxed)
2305+
case let _1 as Api.messages.BotPreparedInlineMessage:
2306+
_1.serialize(buffer, boxed)
23002307
case let _1 as Api.messages.BotResults:
23012308
_1.serialize(buffer, boxed)
23022309
case let _1 as Api.messages.ChatAdminsWithInvites:
@@ -2355,6 +2362,8 @@ public extension Api {
23552362
_1.serialize(buffer, boxed)
23562363
case let _1 as Api.messages.PeerSettings:
23572364
_1.serialize(buffer, boxed)
2365+
case let _1 as Api.messages.PreparedInlineMessage:
2366+
_1.serialize(buffer, boxed)
23582367
case let _1 as Api.messages.QuickReplies:
23592368
_1.serialize(buffer, boxed)
23602369
case let _1 as Api.messages.Reactions:

submodules/TelegramApi/Sources/Api1.swift

Lines changed: 54 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,49 +1113,55 @@ public extension Api {
11131113
}
11141114
}
11151115
public extension Api {
1116-
enum BotBusinessConnection: TypeConstructorDescription {
1117-
case botBusinessConnection(flags: Int32, connectionId: String, userId: Int64, dcId: Int32, date: Int32)
1116+
enum BotAppSettings: TypeConstructorDescription {
1117+
case botAppSettings(flags: Int32, placeholderDocument: Api.Document?, backgroundColor: Int32?, backgroundDarkColor: Int32?, headerColor: Int32?, headerDarkColor: Int32?)
11181118

11191119
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
11201120
switch self {
1121-
case .botBusinessConnection(let flags, let connectionId, let userId, let dcId, let date):
1121+
case .botAppSettings(let flags, let placeholderDocument, let backgroundColor, let backgroundDarkColor, let headerColor, let headerDarkColor):
11221122
if boxed {
1123-
buffer.appendInt32(-1989921868)
1123+
buffer.appendInt32(-2103898979)
11241124
}
11251125
serializeInt32(flags, buffer: buffer, boxed: false)
1126-
serializeString(connectionId, buffer: buffer, boxed: false)
1127-
serializeInt64(userId, buffer: buffer, boxed: false)
1128-
serializeInt32(dcId, buffer: buffer, boxed: false)
1129-
serializeInt32(date, buffer: buffer, boxed: false)
1126+
if Int(flags) & Int(1 << 0) != 0 {placeholderDocument!.serialize(buffer, true)}
1127+
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(backgroundColor!, buffer: buffer, boxed: false)}
1128+
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(backgroundDarkColor!, buffer: buffer, boxed: false)}
1129+
if Int(flags) & Int(1 << 3) != 0 {serializeInt32(headerColor!, buffer: buffer, boxed: false)}
1130+
if Int(flags) & Int(1 << 4) != 0 {serializeInt32(headerDarkColor!, buffer: buffer, boxed: false)}
11301131
break
11311132
}
11321133
}
11331134

11341135
public func descriptionFields() -> (String, [(String, Any)]) {
11351136
switch self {
1136-
case .botBusinessConnection(let flags, let connectionId, let userId, let dcId, let date):
1137-
return ("botBusinessConnection", [("flags", flags as Any), ("connectionId", connectionId as Any), ("userId", userId as Any), ("dcId", dcId as Any), ("date", date as Any)])
1137+
case .botAppSettings(let flags, let placeholderDocument, let backgroundColor, let backgroundDarkColor, let headerColor, let headerDarkColor):
1138+
return ("botAppSettings", [("flags", flags as Any), ("placeholderDocument", placeholderDocument as Any), ("backgroundColor", backgroundColor as Any), ("backgroundDarkColor", backgroundDarkColor as Any), ("headerColor", headerColor as Any), ("headerDarkColor", headerDarkColor as Any)])
11381139
}
11391140
}
11401141

1141-
public static func parse_botBusinessConnection(_ reader: BufferReader) -> BotBusinessConnection? {
1142+
public static func parse_botAppSettings(_ reader: BufferReader) -> BotAppSettings? {
11421143
var _1: Int32?
11431144
_1 = reader.readInt32()
1144-
var _2: String?
1145-
_2 = parseString(reader)
1146-
var _3: Int64?
1147-
_3 = reader.readInt64()
1145+
var _2: Api.Document?
1146+
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
1147+
_2 = Api.parse(reader, signature: signature) as? Api.Document
1148+
} }
1149+
var _3: Int32?
1150+
if Int(_1!) & Int(1 << 1) != 0 {_3 = reader.readInt32() }
11481151
var _4: Int32?
1149-
_4 = reader.readInt32()
1152+
if Int(_1!) & Int(1 << 2) != 0 {_4 = reader.readInt32() }
11501153
var _5: Int32?
1151-
_5 = reader.readInt32()
1154+
if Int(_1!) & Int(1 << 3) != 0 {_5 = reader.readInt32() }
1155+
var _6: Int32?
1156+
if Int(_1!) & Int(1 << 4) != 0 {_6 = reader.readInt32() }
11521157
let _c1 = _1 != nil
1153-
let _c2 = _2 != nil
1154-
let _c3 = _3 != nil
1155-
let _c4 = _4 != nil
1156-
let _c5 = _5 != nil
1157-
if _c1 && _c2 && _c3 && _c4 && _c5 {
1158-
return Api.BotBusinessConnection.botBusinessConnection(flags: _1!, connectionId: _2!, userId: _3!, dcId: _4!, date: _5!)
1158+
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
1159+
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
1160+
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
1161+
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
1162+
let _c6 = (Int(_1!) & Int(1 << 4) == 0) || _6 != nil
1163+
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
1164+
return Api.BotAppSettings.botAppSettings(flags: _1!, placeholderDocument: _2, backgroundColor: _3, backgroundDarkColor: _4, headerColor: _5, headerDarkColor: _6)
11591165
}
11601166
else {
11611167
return nil
@@ -1165,37 +1171,49 @@ public extension Api {
11651171
}
11661172
}
11671173
public extension Api {
1168-
enum BotCommand: TypeConstructorDescription {
1169-
case botCommand(command: String, description: String)
1174+
enum BotBusinessConnection: TypeConstructorDescription {
1175+
case botBusinessConnection(flags: Int32, connectionId: String, userId: Int64, dcId: Int32, date: Int32)
11701176

11711177
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
11721178
switch self {
1173-
case .botCommand(let command, let description):
1179+
case .botBusinessConnection(let flags, let connectionId, let userId, let dcId, let date):
11741180
if boxed {
1175-
buffer.appendInt32(-1032140601)
1181+
buffer.appendInt32(-1989921868)
11761182
}
1177-
serializeString(command, buffer: buffer, boxed: false)
1178-
serializeString(description, buffer: buffer, boxed: false)
1183+
serializeInt32(flags, buffer: buffer, boxed: false)
1184+
serializeString(connectionId, buffer: buffer, boxed: false)
1185+
serializeInt64(userId, buffer: buffer, boxed: false)
1186+
serializeInt32(dcId, buffer: buffer, boxed: false)
1187+
serializeInt32(date, buffer: buffer, boxed: false)
11791188
break
11801189
}
11811190
}
11821191

11831192
public func descriptionFields() -> (String, [(String, Any)]) {
11841193
switch self {
1185-
case .botCommand(let command, let description):
1186-
return ("botCommand", [("command", command as Any), ("description", description as Any)])
1194+
case .botBusinessConnection(let flags, let connectionId, let userId, let dcId, let date):
1195+
return ("botBusinessConnection", [("flags", flags as Any), ("connectionId", connectionId as Any), ("userId", userId as Any), ("dcId", dcId as Any), ("date", date as Any)])
11871196
}
11881197
}
11891198

1190-
public static func parse_botCommand(_ reader: BufferReader) -> BotCommand? {
1191-
var _1: String?
1192-
_1 = parseString(reader)
1199+
public static func parse_botBusinessConnection(_ reader: BufferReader) -> BotBusinessConnection? {
1200+
var _1: Int32?
1201+
_1 = reader.readInt32()
11931202
var _2: String?
11941203
_2 = parseString(reader)
1204+
var _3: Int64?
1205+
_3 = reader.readInt64()
1206+
var _4: Int32?
1207+
_4 = reader.readInt32()
1208+
var _5: Int32?
1209+
_5 = reader.readInt32()
11951210
let _c1 = _1 != nil
11961211
let _c2 = _2 != nil
1197-
if _c1 && _c2 {
1198-
return Api.BotCommand.botCommand(command: _1!, description: _2!)
1212+
let _c3 = _3 != nil
1213+
let _c4 = _4 != nil
1214+
let _c5 = _5 != nil
1215+
if _c1 && _c2 && _c3 && _c4 && _c5 {
1216+
return Api.BotBusinessConnection.botBusinessConnection(flags: _1!, connectionId: _2!, userId: _3!, dcId: _4!, date: _5!)
11991217
}
12001218
else {
12011219
return nil

0 commit comments

Comments
 (0)