Update scheme

This commit is contained in:
Ilya Laktyushin 2023-10-17 13:52:47 +04:00
parent 1b50b16bee
commit fc8b77d946
20 changed files with 917 additions and 533 deletions

View File

@ -10127,15 +10127,18 @@ Sorry for the inconvenience.";
"Appearance.NameColor" = "Your Name Color";
"NameColor.Title.Account" = "Your Name Color";
"NameColor.Title.Channel" = "Channel Title Color";
"NameColor.Title.Channel" = "Your Channel Color";
"NameColor.ChatPreview.Title" = "COLOR PREVIEW";
"NameColor.ChatPreview.ReplyText" = "Reply to your message";
"NameColor.ChatPreview.MessageText" = "Your name and replies to your messages will be shown in the selected color.";
"NameColor.ChatPreview.ReplyText.Account" = "Reply to your message";
"NameColor.ChatPreview.ReplyText.Channel" = "Reply to your channel message";
"NameColor.ChatPreview.MessageText.Account" = "Your name and replies to your messages will be shown in the selected color.";
"NameColor.ChatPreview.MessageText.Channel" = "The name of your channek and replies to its messages will be shown in the selected color.";
"NameColor.ChatPreview.LinkSite" = "Telegram";
"NameColor.ChatPreview.LinkTitle" = "Link Preview";
"NameColor.ChatPreview.LinkText" = "Your selected color will also tint the link preview.";
"NameColor.ChatPreview.Description.Account" = "You can choose an individual color to tint your name, the links you send, and replies to your messages.";
"NameColor.ChatPreview.Description.Channel" = "You can choose an individual color to tint your channel's name, the links it sends, and replies to its messages.";
"NameColor.ApplyColor" = "Apply Color";

View File

@ -11,6 +11,7 @@ public enum Api {
public enum payments {}
public enum phone {}
public enum photos {}
public enum premium {}
public enum stats {}
public enum stickers {}
public enum storage {}
@ -32,6 +33,7 @@ public enum Api {
public enum payments {}
public enum phone {}
public enum photos {}
public enum premium {}
public enum stats {}
public enum stickers {}
public enum stories {}
@ -73,7 +75,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1834973166] = { return Api.BaseTheme.parse_baseThemeTinted($0) }
dict[-1132882121] = { return Api.Bool.parse_boolFalse($0) }
dict[-1720552011] = { return Api.Bool.parse_boolTrue($0) }
dict[245261184] = { return Api.Booster.parse_booster($0) }
dict[1405288648] = { return Api.Boost.parse_boost($0) }
dict[-1778593322] = { return Api.BotApp.parse_botApp($0) }
dict[1571189943] = { return Api.BotApp.parse_botAppNotModified($0) }
dict[-1032140601] = { return Api.BotCommand.parse_botCommand($0) }
@ -90,6 +92,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[85477117] = { return Api.BotInlineMessage.parse_botInlineMessageMediaGeo($0) }
dict[894081801] = { return Api.BotInlineMessage.parse_botInlineMessageMediaInvoice($0) }
dict[-1970903652] = { return Api.BotInlineMessage.parse_botInlineMessageMediaVenue($0) }
dict[-2137335386] = { return Api.BotInlineMessage.parse_botInlineMessageMediaWebPage($0) }
dict[-1937807902] = { return Api.BotInlineMessage.parse_botInlineMessageText($0) }
dict[400266251] = { return Api.BotInlineResult.parse_botInlineMediaResult($0) }
dict[295067450] = { return Api.BotInlineResult.parse_botInlineResult($0) }
@ -281,6 +284,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1768777083] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaGeo($0) }
dict[-672693723] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaInvoice($0) }
dict[1098628881] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaVenue($0) }
dict[-1109605104] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaWebPage($0) }
dict[1036876423] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageText($0) }
dict[-1995686519] = { return Api.InputBotInlineMessageID.parse_inputBotInlineMessageID($0) }
dict[-1227287081] = { return Api.InputBotInlineMessageID.parse_inputBotInlineMessageID64($0) }
@ -574,6 +578,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[2129714567] = { return Api.MessagesFilter.parse_inputMessagesFilterUrl($0) }
dict[-1614803355] = { return Api.MessagesFilter.parse_inputMessagesFilterVideo($0) }
dict[1358283666] = { return Api.MessagesFilter.parse_inputMessagesFilterVoice($0) }
dict[1267991078] = { return Api.MyBoost.parse_myBoost($0) }
dict[-1910892683] = { return Api.NearestDc.parse_nearestDc($0) }
dict[-1746354498] = { return Api.NotificationSound.parse_notificationSoundDefault($0) }
dict[-2096391452] = { return Api.NotificationSound.parse_notificationSoundLocal($0) }
@ -1175,6 +1180,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[539045032] = { return Api.photos.Photo.parse_photo($0) }
dict[-1916114267] = { return Api.photos.Photos.parse_photos($0) }
dict[352657236] = { return Api.photos.Photos.parse_photosSlice($0) }
dict[-2030542532] = { return Api.premium.BoostsList.parse_boostsList($0) }
dict[-1696454430] = { return Api.premium.MyBoosts.parse_myBoosts($0) }
dict[-1107852396] = { return Api.stats.BroadcastStats.parse_broadcastStats($0) }
dict[-276825834] = { return Api.stats.MegagroupStats.parse_megagroupStats($0) }
dict[-1986399595] = { return Api.stats.MessageStats.parse_messageStats($0) }
@ -1191,10 +1198,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[276907596] = { return Api.storage.FileType.parse_fileWebp($0) }
dict[1862033025] = { return Api.stories.AllStories.parse_allStories($0) }
dict[291044926] = { return Api.stories.AllStories.parse_allStoriesNotModified($0) }
dict[-203604707] = { return Api.stories.BoostersList.parse_boostersList($0) }
dict[1911715597] = { return Api.stories.BoostsStatus.parse_boostsStatus($0) }
dict[-1021889145] = { return Api.stories.CanApplyBoostResult.parse_canApplyBoostOk($0) }
dict[1898726997] = { return Api.stories.CanApplyBoostResult.parse_canApplyBoostReplace($0) }
dict[-869070685] = { return Api.stories.BoostsStatus.parse_boostsStatus($0) }
dict[-890861720] = { return Api.stories.PeerStories.parse_peerStories($0) }
dict[1574486984] = { return Api.stories.Stories.parse_stories($0) }
dict[-560009955] = { return Api.stories.StoryViews.parse_storyViews($0) }
@ -1304,7 +1308,7 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.Bool:
_1.serialize(buffer, boxed)
case let _1 as Api.Booster:
case let _1 as Api.Boost:
_1.serialize(buffer, boxed)
case let _1 as Api.BotApp:
_1.serialize(buffer, boxed)
@ -1604,6 +1608,8 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.MessagesFilter:
_1.serialize(buffer, boxed)
case let _1 as Api.MyBoost:
_1.serialize(buffer, boxed)
case let _1 as Api.NearestDc:
_1.serialize(buffer, boxed)
case let _1 as Api.NotificationSound:
@ -2074,6 +2080,10 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.photos.Photos:
_1.serialize(buffer, boxed)
case let _1 as Api.premium.BoostsList:
_1.serialize(buffer, boxed)
case let _1 as Api.premium.MyBoosts:
_1.serialize(buffer, boxed)
case let _1 as Api.stats.BroadcastStats:
_1.serialize(buffer, boxed)
case let _1 as Api.stats.MegagroupStats:
@ -2086,12 +2096,8 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.stories.AllStories:
_1.serialize(buffer, boxed)
case let _1 as Api.stories.BoostersList:
_1.serialize(buffer, boxed)
case let _1 as Api.stories.BoostsStatus:
_1.serialize(buffer, boxed)
case let _1 as Api.stories.CanApplyBoostResult:
_1.serialize(buffer, boxed)
case let _1 as Api.stories.PeerStories:
_1.serialize(buffer, boxed)
case let _1 as Api.stories.Stories:

View File

@ -893,37 +893,57 @@ public extension Api {
}
}
public extension Api {
enum Booster: TypeConstructorDescription {
case booster(userId: Int64, expires: Int32)
enum Boost: TypeConstructorDescription {
case boost(flags: Int32, id: String, userId: Int64?, giveawayMsgId: Int32?, date: Int32, expires: Int32, usedGiftSlug: String?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .booster(let userId, let expires):
case .boost(let flags, let id, let userId, let giveawayMsgId, let date, let expires, let usedGiftSlug):
if boxed {
buffer.appendInt32(245261184)
buffer.appendInt32(1405288648)
}
serializeInt64(userId, buffer: buffer, boxed: false)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(id, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt64(userId!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(giveawayMsgId!, buffer: buffer, boxed: false)}
serializeInt32(date, buffer: buffer, boxed: false)
serializeInt32(expires, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 4) != 0 {serializeString(usedGiftSlug!, buffer: buffer, boxed: false)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .booster(let userId, let expires):
return ("booster", [("userId", userId as Any), ("expires", expires as Any)])
case .boost(let flags, let id, let userId, let giveawayMsgId, let date, let expires, let usedGiftSlug):
return ("boost", [("flags", flags as Any), ("id", id as Any), ("userId", userId as Any), ("giveawayMsgId", giveawayMsgId as Any), ("date", date as Any), ("expires", expires as Any), ("usedGiftSlug", usedGiftSlug as Any)])
}
}
public static func parse_booster(_ reader: BufferReader) -> Booster? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int32?
_2 = reader.readInt32()
public static func parse_boost(_ reader: BufferReader) -> Boost? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: Int64?
if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt64() }
var _4: Int32?
if Int(_1!) & Int(1 << 2) != 0 {_4 = reader.readInt32() }
var _5: Int32?
_5 = reader.readInt32()
var _6: Int32?
_6 = reader.readInt32()
var _7: String?
if Int(_1!) & Int(1 << 4) != 0 {_7 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.Booster.booster(userId: _1!, expires: _2!)
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
return Api.Boost.boost(flags: _1!, id: _2!, userId: _3, giveawayMsgId: _4, date: _5!, expires: _6!, usedGiftSlug: _7)
}
else {
return nil

View File

@ -698,6 +698,60 @@ public extension Api {
}
}
public extension Api {
enum MyBoost: TypeConstructorDescription {
case myBoost(flags: Int32, slot: Int32, peer: Api.Peer?, expires: Int32, cooldownUntilDate: Int32?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .myBoost(let flags, let slot, let peer, let expires, let cooldownUntilDate):
if boxed {
buffer.appendInt32(1267991078)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(slot, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {peer!.serialize(buffer, true)}
serializeInt32(expires, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(cooldownUntilDate!, buffer: buffer, boxed: false)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .myBoost(let flags, let slot, let peer, let expires, let cooldownUntilDate):
return ("myBoost", [("flags", flags as Any), ("slot", slot as Any), ("peer", peer as Any), ("expires", expires as Any), ("cooldownUntilDate", cooldownUntilDate as Any)])
}
}
public static func parse_myBoost(_ reader: BufferReader) -> MyBoost? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Api.Peer?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.Peer
} }
var _4: Int32?
_4 = reader.readInt32()
var _5: Int32?
if Int(_1!) & Int(1 << 1) != 0 {_5 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.MyBoost.myBoost(flags: _1!, slot: _2!, peer: _3, expires: _4!, cooldownUntilDate: _5)
}
else {
return nil
}
}
}
}
public extension Api {
enum NearestDc: TypeConstructorDescription {
case nearestDc(country: String, thisDc: Int32, nearestDc: Int32)

View File

@ -77,6 +77,7 @@ public extension Api {
case botInlineMessageMediaGeo(flags: Int32, geo: Api.GeoPoint, heading: Int32?, period: Int32?, proximityNotificationRadius: Int32?, replyMarkup: Api.ReplyMarkup?)
case botInlineMessageMediaInvoice(flags: Int32, title: String, description: String, photo: Api.WebDocument?, currency: String, totalAmount: Int64, replyMarkup: Api.ReplyMarkup?)
case botInlineMessageMediaVenue(flags: Int32, geo: Api.GeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String, replyMarkup: Api.ReplyMarkup?)
case botInlineMessageMediaWebPage(flags: Int32, message: String, entities: [Api.MessageEntity]?, url: String, replyMarkup: Api.ReplyMarkup?)
case botInlineMessageText(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
@ -141,6 +142,20 @@ public extension Api {
serializeString(venueType, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
break
case .botInlineMessageMediaWebPage(let flags, let message, let entities, let url, let replyMarkup):
if boxed {
buffer.appendInt32(-2137335386)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(message, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(entities!.count))
for item in entities! {
item.serialize(buffer, true)
}}
serializeString(url, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
break
case .botInlineMessageText(let flags, let message, let entities, let replyMarkup):
if boxed {
buffer.appendInt32(-1937807902)
@ -169,6 +184,8 @@ public extension Api {
return ("botInlineMessageMediaInvoice", [("flags", flags as Any), ("title", title as Any), ("description", description as Any), ("photo", photo as Any), ("currency", currency as Any), ("totalAmount", totalAmount as Any), ("replyMarkup", replyMarkup as Any)])
case .botInlineMessageMediaVenue(let flags, let geo, let title, let address, let provider, let venueId, let venueType, let replyMarkup):
return ("botInlineMessageMediaVenue", [("flags", flags as Any), ("geo", geo as Any), ("title", title as Any), ("address", address as Any), ("provider", provider as Any), ("venueId", venueId as Any), ("venueType", venueType as Any), ("replyMarkup", replyMarkup as Any)])
case .botInlineMessageMediaWebPage(let flags, let message, let entities, let url, let replyMarkup):
return ("botInlineMessageMediaWebPage", [("flags", flags as Any), ("message", message as Any), ("entities", entities as Any), ("url", url as Any), ("replyMarkup", replyMarkup as Any)])
case .botInlineMessageText(let flags, let message, let entities, let replyMarkup):
return ("botInlineMessageText", [("flags", flags as Any), ("message", message as Any), ("entities", entities as Any), ("replyMarkup", replyMarkup as Any)])
}
@ -325,6 +342,33 @@ public extension Api {
return nil
}
}
public static func parse_botInlineMessageMediaWebPage(_ reader: BufferReader) -> BotInlineMessage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: [Api.MessageEntity]?
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
} }
var _4: String?
_4 = parseString(reader)
var _5: Api.ReplyMarkup?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.BotInlineMessage.botInlineMessageMediaWebPage(flags: _1!, message: _2!, entities: _3, url: _4!, replyMarkup: _5)
}
else {
return nil
}
}
public static func parse_botInlineMessageText(_ reader: BufferReader) -> BotInlineMessage? {
var _1: Int32?
_1 = reader.readInt32()

View File

@ -1,3 +1,129 @@
public extension Api.premium {
enum BoostsList: TypeConstructorDescription {
case boostsList(flags: Int32, count: Int32, boosts: [Api.Boost], nextOffset: String?, users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .boostsList(let flags, let count, let boosts, let nextOffset, let users):
if boxed {
buffer.appendInt32(-2030542532)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(boosts.count))
for item in boosts {
item.serialize(buffer, true)
}
if Int(flags) & Int(1 << 0) != 0 {serializeString(nextOffset!, buffer: buffer, boxed: false)}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .boostsList(let flags, let count, let boosts, let nextOffset, let users):
return ("boostsList", [("flags", flags as Any), ("count", count as Any), ("boosts", boosts as Any), ("nextOffset", nextOffset as Any), ("users", users as Any)])
}
}
public static func parse_boostsList(_ reader: BufferReader) -> BoostsList? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: [Api.Boost]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Boost.self)
}
var _4: String?
if Int(_1!) & Int(1 << 0) != 0 {_4 = parseString(reader) }
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.premium.BoostsList.boostsList(flags: _1!, count: _2!, boosts: _3!, nextOffset: _4, users: _5!)
}
else {
return nil
}
}
}
}
public extension Api.premium {
enum MyBoosts: TypeConstructorDescription {
case myBoosts(myBoosts: [Api.MyBoost], chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .myBoosts(let myBoosts, let chats, let users):
if boxed {
buffer.appendInt32(-1696454430)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(myBoosts.count))
for item in myBoosts {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .myBoosts(let myBoosts, let chats, let users):
return ("myBoosts", [("myBoosts", myBoosts as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_myBoosts(_ reader: BufferReader) -> MyBoosts? {
var _1: [Api.MyBoost]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MyBoost.self)
}
var _2: [Api.Chat]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.premium.MyBoosts.myBoosts(myBoosts: _1!, chats: _2!, users: _3!)
}
else {
return nil
}
}
}
}
public extension Api.stats {
enum BroadcastStats: TypeConstructorDescription {
case broadcastStats(period: Api.StatsDateRangeDays, followers: Api.StatsAbsValueAndPrev, viewsPerPost: Api.StatsAbsValueAndPrev, sharesPerPost: Api.StatsAbsValueAndPrev, enabledNotifications: Api.StatsPercentValue, growthGraph: Api.StatsGraph, followersGraph: Api.StatsGraph, muteGraph: Api.StatsGraph, topHoursGraph: Api.StatsGraph, interactionsGraph: Api.StatsGraph, ivInteractionsGraph: Api.StatsGraph, viewsBySourceGraph: Api.StatsGraph, newFollowersBySourceGraph: Api.StatsGraph, languagesGraph: Api.StatsGraph, recentMessageInteractions: [Api.MessageInteractionCounters])
@ -594,91 +720,28 @@ public extension Api.stories {
}
}
public extension Api.stories {
enum BoostersList: TypeConstructorDescription {
case boostersList(flags: Int32, count: Int32, boosters: [Api.Booster], nextOffset: String?, users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .boostersList(let flags, let count, let boosters, let nextOffset, let users):
if boxed {
buffer.appendInt32(-203604707)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(boosters.count))
for item in boosters {
item.serialize(buffer, true)
}
if Int(flags) & Int(1 << 0) != 0 {serializeString(nextOffset!, buffer: buffer, boxed: false)}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .boostersList(let flags, let count, let boosters, let nextOffset, let users):
return ("boostersList", [("flags", flags as Any), ("count", count as Any), ("boosters", boosters as Any), ("nextOffset", nextOffset as Any), ("users", users as Any)])
}
}
public static func parse_boostersList(_ reader: BufferReader) -> BoostersList? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: [Api.Booster]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Booster.self)
}
var _4: String?
if Int(_1!) & Int(1 << 0) != 0 {_4 = parseString(reader) }
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.stories.BoostersList.boostersList(flags: _1!, count: _2!, boosters: _3!, nextOffset: _4, users: _5!)
}
else {
return nil
}
}
}
}
public extension Api.stories {
enum BoostsStatus: TypeConstructorDescription {
case boostsStatus(flags: Int32, level: Int32, currentLevelBoosts: Int32, boosts: Int32, nextLevelBoosts: Int32?, premiumAudience: Api.StatsPercentValue?, boostUrl: String, prepaidGiveaways: [Api.PrepaidGiveaway]?)
case boostsStatus(flags: Int32, level: Int32, currentLevelBoosts: Int32, boosts: Int32, giftBoosts: Int32?, nextLevelBoosts: Int32?, premiumAudience: Api.StatsPercentValue?, boostUrl: String, myBoostSlots: [Int32]?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .boostsStatus(let flags, let level, let currentLevelBoosts, let boosts, let nextLevelBoosts, let premiumAudience, let boostUrl, let prepaidGiveaways):
case .boostsStatus(let flags, let level, let currentLevelBoosts, let boosts, let giftBoosts, let nextLevelBoosts, let premiumAudience, let boostUrl, let myBoostSlots):
if boxed {
buffer.appendInt32(1911715597)
buffer.appendInt32(-869070685)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(level, buffer: buffer, boxed: false)
serializeInt32(currentLevelBoosts, buffer: buffer, boxed: false)
serializeInt32(boosts, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 3) != 0 {serializeInt32(giftBoosts!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(nextLevelBoosts!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {premiumAudience!.serialize(buffer, true)}
serializeString(boostUrl, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(prepaidGiveaways!.count))
for item in prepaidGiveaways! {
item.serialize(buffer, true)
if Int(flags) & Int(1 << 2) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(myBoostSlots!.count))
for item in myBoostSlots! {
serializeInt32(item, buffer: buffer, boxed: false)
}}
break
}
@ -686,8 +749,8 @@ public extension Api.stories {
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .boostsStatus(let flags, let level, let currentLevelBoosts, let boosts, let nextLevelBoosts, let premiumAudience, let boostUrl, let prepaidGiveaways):
return ("boostsStatus", [("flags", flags as Any), ("level", level as Any), ("currentLevelBoosts", currentLevelBoosts as Any), ("boosts", boosts as Any), ("nextLevelBoosts", nextLevelBoosts as Any), ("premiumAudience", premiumAudience as Any), ("boostUrl", boostUrl as Any), ("prepaidGiveaways", prepaidGiveaways as Any)])
case .boostsStatus(let flags, let level, let currentLevelBoosts, let boosts, let giftBoosts, let nextLevelBoosts, let premiumAudience, let boostUrl, let myBoostSlots):
return ("boostsStatus", [("flags", flags as Any), ("level", level as Any), ("currentLevelBoosts", currentLevelBoosts as Any), ("boosts", boosts as Any), ("giftBoosts", giftBoosts as Any), ("nextLevelBoosts", nextLevelBoosts as Any), ("premiumAudience", premiumAudience as Any), ("boostUrl", boostUrl as Any), ("myBoostSlots", myBoostSlots as Any)])
}
}
@ -701,87 +764,30 @@ public extension Api.stories {
var _4: Int32?
_4 = reader.readInt32()
var _5: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_5 = reader.readInt32() }
var _6: Api.StatsPercentValue?
if Int(_1!) & Int(1 << 3) != 0 {_5 = reader.readInt32() }
var _6: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_6 = reader.readInt32() }
var _7: Api.StatsPercentValue?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.StatsPercentValue
_7 = Api.parse(reader, signature: signature) as? Api.StatsPercentValue
} }
var _7: String?
_7 = parseString(reader)
var _8: [Api.PrepaidGiveaway]?
if Int(_1!) & Int(1 << 3) != 0 {if let _ = reader.readInt32() {
_8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PrepaidGiveaway.self)
var _8: String?
_8 = parseString(reader)
var _9: [Int32]?
if Int(_1!) & Int(1 << 2) != 0 {if let _ = reader.readInt32() {
_9 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
let _c7 = _7 != nil
let _c8 = (Int(_1!) & Int(1 << 3) == 0) || _8 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
return Api.stories.BoostsStatus.boostsStatus(flags: _1!, level: _2!, currentLevelBoosts: _3!, boosts: _4!, nextLevelBoosts: _5, premiumAudience: _6, boostUrl: _7!, prepaidGiveaways: _8)
}
else {
return nil
}
}
}
}
public extension Api.stories {
enum CanApplyBoostResult: TypeConstructorDescription {
case canApplyBoostOk
case canApplyBoostReplace(currentBoost: Api.Peer, chats: [Api.Chat])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .canApplyBoostOk:
if boxed {
buffer.appendInt32(-1021889145)
}
break
case .canApplyBoostReplace(let currentBoost, let chats):
if boxed {
buffer.appendInt32(1898726997)
}
currentBoost.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .canApplyBoostOk:
return ("canApplyBoostOk", [])
case .canApplyBoostReplace(let currentBoost, let chats):
return ("canApplyBoostReplace", [("currentBoost", currentBoost as Any), ("chats", chats as Any)])
}
}
public static func parse_canApplyBoostOk(_ reader: BufferReader) -> CanApplyBoostResult? {
return Api.stories.CanApplyBoostResult.canApplyBoostOk
}
public static func parse_canApplyBoostReplace(_ reader: BufferReader) -> CanApplyBoostResult? {
var _1: Api.Peer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.Peer
}
var _2: [Api.Chat]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.stories.CanApplyBoostResult.canApplyBoostReplace(currentBoost: _1!, chats: _2!)
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
let _c8 = _8 != nil
let _c9 = (Int(_1!) & Int(1 << 2) == 0) || _9 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
return Api.stories.BoostsStatus.boostsStatus(flags: _1!, level: _2!, currentLevelBoosts: _3!, boosts: _4!, giftBoosts: _5, nextLevelBoosts: _6, premiumAudience: _7, boostUrl: _8!, myBoostSlots: _9)
}
else {
return nil
@ -1462,3 +1468,59 @@ public extension Api.updates {
}
}
public extension Api.upload {
enum CdnFile: TypeConstructorDescription {
case cdnFile(bytes: Buffer)
case cdnFileReuploadNeeded(requestToken: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .cdnFile(let bytes):
if boxed {
buffer.appendInt32(-1449145777)
}
serializeBytes(bytes, buffer: buffer, boxed: false)
break
case .cdnFileReuploadNeeded(let requestToken):
if boxed {
buffer.appendInt32(-290921362)
}
serializeBytes(requestToken, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .cdnFile(let bytes):
return ("cdnFile", [("bytes", bytes as Any)])
case .cdnFileReuploadNeeded(let requestToken):
return ("cdnFileReuploadNeeded", [("requestToken", requestToken as Any)])
}
}
public static func parse_cdnFile(_ reader: BufferReader) -> CdnFile? {
var _1: Buffer?
_1 = parseBytes(reader)
let _c1 = _1 != nil
if _c1 {
return Api.upload.CdnFile.cdnFile(bytes: _1!)
}
else {
return nil
}
}
public static func parse_cdnFileReuploadNeeded(_ reader: BufferReader) -> CdnFile? {
var _1: Buffer?
_1 = parseBytes(reader)
let _c1 = _1 != nil
if _c1 {
return Api.upload.CdnFile.cdnFileReuploadNeeded(requestToken: _1!)
}
else {
return nil
}
}
}
}

View File

@ -1,59 +1,3 @@
public extension Api.upload {
enum CdnFile: TypeConstructorDescription {
case cdnFile(bytes: Buffer)
case cdnFileReuploadNeeded(requestToken: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .cdnFile(let bytes):
if boxed {
buffer.appendInt32(-1449145777)
}
serializeBytes(bytes, buffer: buffer, boxed: false)
break
case .cdnFileReuploadNeeded(let requestToken):
if boxed {
buffer.appendInt32(-290921362)
}
serializeBytes(requestToken, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .cdnFile(let bytes):
return ("cdnFile", [("bytes", bytes as Any)])
case .cdnFileReuploadNeeded(let requestToken):
return ("cdnFileReuploadNeeded", [("requestToken", requestToken as Any)])
}
}
public static func parse_cdnFile(_ reader: BufferReader) -> CdnFile? {
var _1: Buffer?
_1 = parseBytes(reader)
let _c1 = _1 != nil
if _c1 {
return Api.upload.CdnFile.cdnFile(bytes: _1!)
}
else {
return nil
}
}
public static func parse_cdnFileReuploadNeeded(_ reader: BufferReader) -> CdnFile? {
var _1: Buffer?
_1 = parseBytes(reader)
let _c1 = _1 != nil
if _c1 {
return Api.upload.CdnFile.cdnFileReuploadNeeded(requestToken: _1!)
}
else {
return nil
}
}
}
}
public extension Api.upload {
enum File: TypeConstructorDescription {
case file(type: Api.storage.FileType, mtime: Int32, bytes: Buffer)

View File

@ -8361,6 +8361,56 @@ public extension Api.functions.photos {
})
}
}
public extension Api.functions.premium {
static func applyBoost(flags: Int32, slot: Int32?, peer: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(1186373995)
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(slot!, buffer: buffer, boxed: false)}
peer.serialize(buffer, true)
return (FunctionDescription(name: "premium.applyBoost", parameters: [("flags", String(describing: flags)), ("slot", String(describing: slot)), ("peer", String(describing: peer))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
}
public extension Api.functions.premium {
static func getBoostsList(flags: Int32, peer: Api.InputPeer, offset: String, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.premium.BoostsList>) {
let buffer = Buffer()
buffer.appendInt32(1626764896)
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeString(offset, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "premium.getBoostsList", parameters: [("flags", String(describing: flags)), ("peer", String(describing: peer)), ("offset", String(describing: offset)), ("limit", String(describing: limit))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.premium.BoostsList? in
let reader = BufferReader(buffer)
var result: Api.premium.BoostsList?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.premium.BoostsList
}
return result
})
}
}
public extension Api.functions.premium {
static func getMyBoosts() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.premium.MyBoosts>) {
let buffer = Buffer()
buffer.appendInt32(199719754)
return (FunctionDescription(name: "premium.getMyBoosts", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.premium.MyBoosts? in
let reader = BufferReader(buffer)
var result: Api.premium.MyBoosts?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.premium.MyBoosts
}
return result
})
}
}
public extension Api.functions.stats {
static func getBroadcastStats(flags: Int32, channel: Api.InputChannel) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.stats.BroadcastStats>) {
let buffer = Buffer()
@ -8632,36 +8682,6 @@ public extension Api.functions.stories {
})
}
}
public extension Api.functions.stories {
static func applyBoost(peer: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-224560085)
peer.serialize(buffer, true)
return (FunctionDescription(name: "stories.applyBoost", parameters: [("peer", String(describing: peer))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
let reader = BufferReader(buffer)
var result: Api.Bool?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.Bool
}
return result
})
}
}
public extension Api.functions.stories {
static func canApplyBoost(peer: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.stories.CanApplyBoostResult>) {
let buffer = Buffer()
buffer.appendInt32(-620379715)
peer.serialize(buffer, true)
return (FunctionDescription(name: "stories.canApplyBoost", parameters: [("peer", String(describing: peer))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.stories.CanApplyBoostResult? in
let reader = BufferReader(buffer)
var result: Api.stories.CanApplyBoostResult?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.stories.CanApplyBoostResult
}
return result
})
}
}
public extension Api.functions.stories {
static func canSendStory(peer: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
@ -8778,38 +8798,6 @@ public extension Api.functions.stories {
})
}
}
public extension Api.functions.stories {
static func getBoostersList(peer: Api.InputPeer, offset: String, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.stories.BoostersList>) {
let buffer = Buffer()
buffer.appendInt32(863959424)
peer.serialize(buffer, true)
serializeString(offset, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "stories.getBoostersList", parameters: [("peer", String(describing: peer)), ("offset", String(describing: offset)), ("limit", String(describing: limit))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.stories.BoostersList? in
let reader = BufferReader(buffer)
var result: Api.stories.BoostersList?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.stories.BoostersList
}
return result
})
}
}
public extension Api.functions.stories {
static func getBoostsStatus(peer: Api.InputPeer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.stories.BoostsStatus>) {
let buffer = Buffer()
buffer.appendInt32(1279562866)
peer.serialize(buffer, true)
return (FunctionDescription(name: "stories.getBoostsStatus", parameters: [("peer", String(describing: peer))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.stories.BoostsStatus? in
let reader = BufferReader(buffer)
var result: Api.stories.BoostsStatus?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.stories.BoostsStatus
}
return result
})
}
}
public extension Api.functions.stories {
static func getChatsToSend() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.Chats>) {
let buffer = Buffer()

View File

@ -1198,6 +1198,7 @@ public extension Api {
case inputBotInlineMessageMediaGeo(flags: Int32, geoPoint: Api.InputGeoPoint, heading: Int32?, period: Int32?, proximityNotificationRadius: Int32?, replyMarkup: Api.ReplyMarkup?)
case inputBotInlineMessageMediaInvoice(flags: Int32, title: String, description: String, photo: Api.InputWebDocument?, invoice: Api.Invoice, payload: Buffer, provider: String, providerData: Api.DataJSON, replyMarkup: Api.ReplyMarkup?)
case inputBotInlineMessageMediaVenue(flags: Int32, geoPoint: Api.InputGeoPoint, title: String, address: String, provider: String, venueId: String, venueType: String, replyMarkup: Api.ReplyMarkup?)
case inputBotInlineMessageMediaWebPage(flags: Int32, message: String, entities: [Api.MessageEntity]?, url: String, replyMarkup: Api.ReplyMarkup?)
case inputBotInlineMessageText(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
@ -1271,6 +1272,20 @@ public extension Api {
serializeString(venueType, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
break
case .inputBotInlineMessageMediaWebPage(let flags, let message, let entities, let url, let replyMarkup):
if boxed {
buffer.appendInt32(-1109605104)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(message, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(entities!.count))
for item in entities! {
item.serialize(buffer, true)
}}
serializeString(url, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)}
break
case .inputBotInlineMessageText(let flags, let message, let entities, let replyMarkup):
if boxed {
buffer.appendInt32(1036876423)
@ -1301,6 +1316,8 @@ public extension Api {
return ("inputBotInlineMessageMediaInvoice", [("flags", flags as Any), ("title", title as Any), ("description", description as Any), ("photo", photo as Any), ("invoice", invoice as Any), ("payload", payload as Any), ("provider", provider as Any), ("providerData", providerData as Any), ("replyMarkup", replyMarkup as Any)])
case .inputBotInlineMessageMediaVenue(let flags, let geoPoint, let title, let address, let provider, let venueId, let venueType, let replyMarkup):
return ("inputBotInlineMessageMediaVenue", [("flags", flags as Any), ("geoPoint", geoPoint as Any), ("title", title as Any), ("address", address as Any), ("provider", provider as Any), ("venueId", venueId as Any), ("venueType", venueType as Any), ("replyMarkup", replyMarkup as Any)])
case .inputBotInlineMessageMediaWebPage(let flags, let message, let entities, let url, let replyMarkup):
return ("inputBotInlineMessageMediaWebPage", [("flags", flags as Any), ("message", message as Any), ("entities", entities as Any), ("url", url as Any), ("replyMarkup", replyMarkup as Any)])
case .inputBotInlineMessageText(let flags, let message, let entities, let replyMarkup):
return ("inputBotInlineMessageText", [("flags", flags as Any), ("message", message as Any), ("entities", entities as Any), ("replyMarkup", replyMarkup as Any)])
}
@ -1483,6 +1500,33 @@ public extension Api {
return nil
}
}
public static func parse_inputBotInlineMessageMediaWebPage(_ reader: BufferReader) -> InputBotInlineMessage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: [Api.MessageEntity]?
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
} }
var _4: String?
_4 = parseString(reader)
var _5: Api.ReplyMarkup?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.InputBotInlineMessage.inputBotInlineMessageMediaWebPage(flags: _1!, message: _2!, entities: _3, url: _4!, replyMarkup: _5)
}
else {
return nil
}
}
public static func parse_inputBotInlineMessageText(_ reader: BufferReader) -> InputBotInlineMessage? {
var _1: Int32?
_1 = reader.readInt32()

View File

@ -493,6 +493,13 @@ extension ChatContextResultMessage {
parsedReplyMarkup = ReplyMarkupMessageAttribute(apiMarkup: replyMarkup)
}
self = .invoice(media: TelegramMediaInvoice(title: title, description: description, photo: photo.flatMap(TelegramMediaWebFile.init), receiptMessageId: nil, currency: currency, totalAmount: totalAmount, startParam: "", extendedMedia: nil, flags: parsedFlags, version: TelegramMediaInvoice.lastVersion), replyMarkup: parsedReplyMarkup)
case let .botInlineMessageMediaWebPage(flags, message, entities, url, replyMarkup):
let _ = flags
let _ = message
let _ = entities
let _ = url
let _ = replyMarkup
fatalError()
}
}
}

View File

@ -49,29 +49,30 @@ public final class ChannelBoostStatus: Equatable {
}
func _internal_getChannelBoostStatus(account: Account, peerId: PeerId) -> Signal<ChannelBoostStatus?, NoError> {
return account.postbox.transaction { transaction -> Api.InputPeer? in
return transaction.getPeer(peerId).flatMap(apiInputPeer)
}
|> mapToSignal { inputPeer -> Signal<ChannelBoostStatus?, NoError> in
guard let inputPeer = inputPeer else {
return .single(nil)
}
return account.network.request(Api.functions.stories.getBoostsStatus(peer: inputPeer))
|> map(Optional.init)
|> `catch` { _ -> Signal<Api.stories.BoostsStatus?, NoError> in
return .single(nil)
}
|> map { result -> ChannelBoostStatus? in
guard let result = result else {
return nil
}
switch result {
case let .boostsStatus(_, level, currentLevelBoosts, boosts, nextLevelBoosts, premiumAudience, url, prepaidGiveaways):
return ChannelBoostStatus(level: Int(level), boosts: Int(boosts), currentLevelBoosts: Int(currentLevelBoosts), nextLevelBoosts: nextLevelBoosts.flatMap(Int.init), premiumAudience: premiumAudience.flatMap({ StatsPercentValue(apiPercentValue: $0) }), url: url, prepaidGiveaways: prepaidGiveaways?.map({ PrepaidGiveaway(apiPrepaidGiveaway: $0) }) ?? [])
}
}
}
return .single(nil)
// return account.postbox.transaction { transaction -> Api.InputPeer? in
// return transaction.getPeer(peerId).flatMap(apiInputPeer)
// }
// |> mapToSignal { inputPeer -> Signal<ChannelBoostStatus?, NoError> in
// guard let inputPeer = inputPeer else {
// return .single(nil)
// }
// return account.network.request(Api.functions.stories.getBoostsStatus(peer: inputPeer))
// |> map(Optional.init)
// |> `catch` { _ -> Signal<Api.stories.BoostsStatus?, NoError> in
// return .single(nil)
// }
// |> map { result -> ChannelBoostStatus? in
// guard let result = result else {
// return nil
// }
//
// switch result {
// case let .boostsStatus(_, level, currentLevelBoosts, boosts, nextLevelBoosts, premiumAudience, url, prepaidGiveaways):
// return ChannelBoostStatus(level: Int(level), boosts: Int(boosts), currentLevelBoosts: Int(currentLevelBoosts), nextLevelBoosts: nextLevelBoosts.flatMap(Int.init), premiumAudience: premiumAudience.flatMap({ StatsPercentValue(apiPercentValue: $0) }), url: url, prepaidGiveaways: prepaidGiveaways?.map({ PrepaidGiveaway(apiPrepaidGiveaway: $0) }) ?? [])
// }
// }
// }
}
public enum CanApplyBoostStatus {
@ -89,85 +90,87 @@ public enum CanApplyBoostStatus {
}
func _internal_canApplyChannelBoost(account: Account, peerId: PeerId) -> Signal<CanApplyBoostStatus, NoError> {
return account.postbox.transaction { transaction -> Api.InputPeer? in
return transaction.getPeer(peerId).flatMap(apiInputPeer)
}
|> mapToSignal { inputPeer -> Signal<CanApplyBoostStatus, NoError> in
guard let inputPeer = inputPeer else {
return .single(.error(.generic))
}
return account.network.request(Api.functions.stories.canApplyBoost(peer: inputPeer), automaticFloodWait: false)
|> map { result -> (Api.stories.CanApplyBoostResult?, CanApplyBoostStatus.ErrorReason?) in
return (result, nil)
}
|> `catch` { error -> Signal<(Api.stories.CanApplyBoostResult?, CanApplyBoostStatus.ErrorReason?), NoError> in
let reason: CanApplyBoostStatus.ErrorReason
if error.errorDescription == "PREMIUM_ACCOUNT_REQUIRED" {
reason = .premiumRequired
} else if error.errorDescription.hasPrefix("FLOOD_WAIT_") {
let errorText = error.errorDescription ?? ""
if let underscoreIndex = errorText.lastIndex(of: "_") {
let timeoutText = errorText[errorText.index(after: underscoreIndex)...]
if let timeoutValue = Int32(String(timeoutText)) {
reason = .floodWait(timeoutValue)
} else {
reason = .generic
}
} else {
reason = .generic
}
} else if error.errorDescription == "SAME_BOOST_ALREADY_ACTIVE" || error.errorDescription == "BOOST_NOT_MODIFIED" {
reason = .peerBoostAlreadyActive
} else if error.errorDescription == "PREMIUM_GIFTED_NOT_ALLOWED" {
reason = .giftedPremiumNotAllowed
} else {
reason = .generic
}
return .single((nil, reason))
}
|> mapToSignal { result, errorReason -> Signal<CanApplyBoostStatus, NoError> in
guard let result = result else {
return .single(.error(errorReason ?? .generic))
}
return account.postbox.transaction { transaction -> CanApplyBoostStatus in
switch result {
case .canApplyBoostOk:
return .ok
case let .canApplyBoostReplace(currentBoost, chats):
updatePeers(transaction: transaction, accountPeerId: account.peerId, peers: AccumulatedPeers(transaction: transaction, chats: chats, users: []))
if let peer = transaction.getPeer(currentBoost.peerId) {
return .replace(currentBoost: EnginePeer(peer))
} else {
return .error(.generic)
}
}
}
}
}
return .single(.error(.generic))
// return account.postbox.transaction { transaction -> Api.InputPeer? in
// return transaction.getPeer(peerId).flatMap(apiInputPeer)
// }
// |> mapToSignal { inputPeer -> Signal<CanApplyBoostStatus, NoError> in
// guard let inputPeer = inputPeer else {
// return .single(.error(.generic))
// }
// return account.network.request(Api.functions.stories.canApplyBoost(peer: inputPeer), automaticFloodWait: false)
// |> map { result -> (Api.stories.CanApplyBoostResult?, CanApplyBoostStatus.ErrorReason?) in
// return (result, nil)
// }
// |> `catch` { error -> Signal<(Api.stories.CanApplyBoostResult?, CanApplyBoostStatus.ErrorReason?), NoError> in
// let reason: CanApplyBoostStatus.ErrorReason
// if error.errorDescription == "PREMIUM_ACCOUNT_REQUIRED" {
// reason = .premiumRequired
// } else if error.errorDescription.hasPrefix("FLOOD_WAIT_") {
// let errorText = error.errorDescription ?? ""
// if let underscoreIndex = errorText.lastIndex(of: "_") {
// let timeoutText = errorText[errorText.index(after: underscoreIndex)...]
// if let timeoutValue = Int32(String(timeoutText)) {
// reason = .floodWait(timeoutValue)
// } else {
// reason = .generic
// }
// } else {
// reason = .generic
// }
// } else if error.errorDescription == "SAME_BOOST_ALREADY_ACTIVE" || error.errorDescription == "BOOST_NOT_MODIFIED" {
// reason = .peerBoostAlreadyActive
// } else if error.errorDescription == "PREMIUM_GIFTED_NOT_ALLOWED" {
// reason = .giftedPremiumNotAllowed
// } else {
// reason = .generic
// }
//
// return .single((nil, reason))
// }
// |> mapToSignal { result, errorReason -> Signal<CanApplyBoostStatus, NoError> in
// guard let result = result else {
// return .single(.error(errorReason ?? .generic))
// }
//
// return account.postbox.transaction { transaction -> CanApplyBoostStatus in
// switch result {
// case .canApplyBoostOk:
// return .ok
// case let .canApplyBoostReplace(currentBoost, chats):
// updatePeers(transaction: transaction, accountPeerId: account.peerId, peers: AccumulatedPeers(transaction: transaction, chats: chats, users: []))
//
// if let peer = transaction.getPeer(currentBoost.peerId) {
// return .replace(currentBoost: EnginePeer(peer))
// } else {
// return .error(.generic)
// }
// }
// }
// }
// }
}
func _internal_applyChannelBoost(account: Account, peerId: PeerId) -> Signal<Bool, NoError> {
return account.postbox.transaction { transaction -> Api.InputPeer? in
return transaction.getPeer(peerId).flatMap(apiInputPeer)
}
|> mapToSignal { inputPeer -> Signal<Bool, NoError> in
guard let inputPeer = inputPeer else {
return .single(false)
}
return account.network.request(Api.functions.stories.applyBoost(peer: inputPeer))
|> `catch` { error -> Signal<Api.Bool, NoError> in
return .single(.boolFalse)
}
|> map { result -> Bool in
if case .boolTrue = result {
return true
}
return false
}
}
return .single(false)
// return account.postbox.transaction { transaction -> Api.InputPeer? in
// return transaction.getPeer(peerId).flatMap(apiInputPeer)
// }
// |> mapToSignal { inputPeer -> Signal<Bool, NoError> in
// guard let inputPeer = inputPeer else {
// return .single(false)
// }
// return account.network.request(Api.functions.stories.applyBoost(peer: inputPeer))
// |> `catch` { error -> Signal<Api.Bool, NoError> in
// return .single(.boolFalse)
// }
// |> map { result -> Bool in
// if case .boolTrue = result {
// return true
// }
// return false
// }
// }
}
private final class ChannelBoostersContextImpl {
@ -240,95 +243,95 @@ private final class ChannelBoostersContextImpl {
}
func loadMore() {
if self.isLoadingMore {
return
}
self.isLoadingMore = true
let account = self.account
let accountPeerId = account.peerId
let peerId = self.peerId
let populateCache = self.populateCache
if self.loadedFromCache {
self.loadedFromCache = false
}
let lastOffset = self.lastOffset
self.disposable.set((self.account.postbox.transaction { transaction -> Api.InputPeer? in
return transaction.getPeer(peerId).flatMap(apiInputPeer)
}
|> mapToSignal { inputPeer -> Signal<([ChannelBoostersContext.State.Booster], Int32, String?), NoError> in
if let inputPeer = inputPeer {
let offset = lastOffset ?? ""
let limit: Int32 = lastOffset == nil ? 25 : 50
let signal = account.network.request(Api.functions.stories.getBoostersList(peer: inputPeer, offset: offset, limit: limit))
|> map(Optional.init)
|> `catch` { _ -> Signal<Api.stories.BoostersList?, NoError> in
return .single(nil)
}
|> mapToSignal { result -> Signal<([ChannelBoostersContext.State.Booster], Int32, String?), NoError> in
return account.postbox.transaction { transaction -> ([ChannelBoostersContext.State.Booster], Int32, String?) in
guard let result = result else {
return ([], 0, nil)
}
switch result {
case let .boostersList(_, count, boosters, nextOffset, users):
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: AccumulatedPeers(users: users))
var resultBoosters: [ChannelBoostersContext.State.Booster] = []
for booster in boosters {
let peerId: EnginePeer.Id
let expires: Int32
switch booster {
case let .booster(userId, expiresValue):
peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))
expires = expiresValue
}
if let peer = transaction.getPeer(peerId) {
resultBoosters.append(ChannelBoostersContext.State.Booster(peer: EnginePeer(peer), expires: expires))
}
}
if populateCache {
if let entry = CodableEntry(CachedChannelBoosters(boosters: resultBoosters, count: count)) {
transaction.putItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedChannelBoosters, key: CachedChannelBoosters.key(peerId: peerId)), entry: entry)
}
}
return (resultBoosters, count, nextOffset)
}
}
}
return signal
} else {
return .single(([], 0, nil))
}
}
|> deliverOn(self.queue)).start(next: { [weak self] boosters, updatedCount, nextOffset in
guard let strongSelf = self else {
return
}
strongSelf.lastOffset = nextOffset
if strongSelf.populateCache {
strongSelf.populateCache = false
strongSelf.results.removeAll()
}
var existingIds = Set(strongSelf.results.map { $0.peer.id })
for booster in boosters {
if !existingIds.contains(booster.peer.id) {
strongSelf.results.append(booster)
existingIds.insert(booster.peer.id)
}
}
strongSelf.isLoadingMore = false
strongSelf.hasLoadedOnce = true
strongSelf.canLoadMore = !boosters.isEmpty
if strongSelf.canLoadMore {
strongSelf.count = max(updatedCount, Int32(strongSelf.results.count))
} else {
strongSelf.count = Int32(strongSelf.results.count)
}
strongSelf.updateState()
}))
self.updateState()
// if self.isLoadingMore {
// return
// }
// self.isLoadingMore = true
// let account = self.account
// let accountPeerId = account.peerId
// let peerId = self.peerId
// let populateCache = self.populateCache
//
// if self.loadedFromCache {
// self.loadedFromCache = false
// }
// let lastOffset = self.lastOffset
//
// self.disposable.set((self.account.postbox.transaction { transaction -> Api.InputPeer? in
// return transaction.getPeer(peerId).flatMap(apiInputPeer)
// }
// |> mapToSignal { inputPeer -> Signal<([ChannelBoostersContext.State.Booster], Int32, String?), NoError> in
// if let inputPeer = inputPeer {
// let offset = lastOffset ?? ""
// let limit: Int32 = lastOffset == nil ? 25 : 50
//
// let signal = account.network.request(Api.functions.stories.getBoostersList(peer: inputPeer, offset: offset, limit: limit))
// |> map(Optional.init)
// |> `catch` { _ -> Signal<Api.stories.BoostersList?, NoError> in
// return .single(nil)
// }
// |> mapToSignal { result -> Signal<([ChannelBoostersContext.State.Booster], Int32, String?), NoError> in
// return account.postbox.transaction { transaction -> ([ChannelBoostersContext.State.Booster], Int32, String?) in
// guard let result = result else {
// return ([], 0, nil)
// }
// switch result {
// case let .boostersList(_, count, boosters, nextOffset, users):
// updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: AccumulatedPeers(users: users))
// var resultBoosters: [ChannelBoostersContext.State.Booster] = []
// for booster in boosters {
// let peerId: EnginePeer.Id
// let expires: Int32
// switch booster {
// case let .booster(userId, expiresValue):
// peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(userId))
// expires = expiresValue
// }
// if let peer = transaction.getPeer(peerId) {
// resultBoosters.append(ChannelBoostersContext.State.Booster(peer: EnginePeer(peer), expires: expires))
// }
// }
// if populateCache {
// if let entry = CodableEntry(CachedChannelBoosters(boosters: resultBoosters, count: count)) {
// transaction.putItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedChannelBoosters, key: CachedChannelBoosters.key(peerId: peerId)), entry: entry)
// }
// }
// return (resultBoosters, count, nextOffset)
// }
// }
// }
// return signal
// } else {
// return .single(([], 0, nil))
// }
// }
// |> deliverOn(self.queue)).start(next: { [weak self] boosters, updatedCount, nextOffset in
// guard let strongSelf = self else {
// return
// }
// strongSelf.lastOffset = nextOffset
// if strongSelf.populateCache {
// strongSelf.populateCache = false
// strongSelf.results.removeAll()
// }
// var existingIds = Set(strongSelf.results.map { $0.peer.id })
// for booster in boosters {
// if !existingIds.contains(booster.peer.id) {
// strongSelf.results.append(booster)
// existingIds.insert(booster.peer.id)
// }
// }
// strongSelf.isLoadingMore = false
// strongSelf.hasLoadedOnce = true
// strongSelf.canLoadMore = !boosters.isEmpty
// if strongSelf.canLoadMore {
// strongSelf.count = max(updatedCount, Int32(strongSelf.results.count))
// } else {
// strongSelf.count = Int32(strongSelf.results.count)
// }
// strongSelf.updateState()
// }))
// self.updateState()
}
private func updateCache() {

View File

@ -522,7 +522,7 @@ func _internal_sendBotPaymentForm(account: Account, formId: Int64, source: BotPa
}
}
}
case let .premiumGiftCode(peerIds, boostPeer, quantity, option):
case .premiumGiftCode:
receiptMessageId = nil
}
}

View File

@ -235,6 +235,14 @@ public extension Peer {
return nil
}
}
var hasCustomNameColor: Bool {
let defaultNameColor = PeerNameColor(rawValue: Int32(self.id.id._internalGetInt64Value() % 7)) ?? .blue
if self.nameColor != defaultNameColor {
return true
}
return false
}
}
public extension TelegramPeerUsername {

View File

@ -407,6 +407,7 @@ swift_library(
"//submodules/TelegramUI/Components/Chat/ChatRecentActionsController",
"//submodules/TelegramUI/Components/Chat/ChatNavigationButton",
"//submodules/TelegramUI/Components/Chat/ChatLoadingNode",
"//submodules/TelegramUI/Components/Settings/PeerNameColorScreen",
] + select({
"@build_bazel_rules_apple//apple:ios_arm64": appcenter_targets,
"//build-system:ios_sim_arm64": [],

View File

@ -58,36 +58,41 @@ struct CameraState: Equatable {
let flashMode: Camera.FlashMode
let flashModeDidChange: Bool
let flashTint: FlashTint
let flashTintSize: CGFloat
let recording: Recording
let duration: Double
let isDualCameraEnabled: Bool
func updatedMode(_ mode: CameraMode) -> CameraState {
return CameraState(mode: mode, position: self.position, flashMode: self.flashMode, flashModeDidChange: self.flashModeDidChange, flashTint: self.flashTint, recording: self.recording, duration: self.duration, isDualCameraEnabled: self.isDualCameraEnabled)
return CameraState(mode: mode, position: self.position, flashMode: self.flashMode, flashModeDidChange: self.flashModeDidChange, flashTint: self.flashTint, flashTintSize: self.flashTintSize, recording: self.recording, duration: self.duration, isDualCameraEnabled: self.isDualCameraEnabled)
}
func updatedPosition(_ position: Camera.Position) -> CameraState {
return CameraState(mode: self.mode, position: position, flashMode: self.flashMode, flashModeDidChange: self.flashModeDidChange, flashTint: self.flashTint, recording: self.recording, duration: self.duration, isDualCameraEnabled: self.isDualCameraEnabled)
return CameraState(mode: self.mode, position: position, flashMode: self.flashMode, flashModeDidChange: self.flashModeDidChange, flashTint: self.flashTint, flashTintSize: self.flashTintSize, recording: self.recording, duration: self.duration, isDualCameraEnabled: self.isDualCameraEnabled)
}
func updatedFlashMode(_ flashMode: Camera.FlashMode) -> CameraState {
return CameraState(mode: self.mode, position: self.position, flashMode: flashMode, flashModeDidChange: self.flashMode != flashMode, flashTint: self.flashTint, recording: self.recording, duration: self.duration, isDualCameraEnabled: self.isDualCameraEnabled)
return CameraState(mode: self.mode, position: self.position, flashMode: flashMode, flashModeDidChange: self.flashMode != flashMode, flashTint: self.flashTint, flashTintSize: self.flashTintSize, recording: self.recording, duration: self.duration, isDualCameraEnabled: self.isDualCameraEnabled)
}
func updatedFlashTint(_ flashTint: FlashTint) -> CameraState {
return CameraState(mode: self.mode, position: self.position, flashMode: self.flashMode, flashModeDidChange: self.flashModeDidChange, flashTint: flashTint, recording: self.recording, duration: self.duration, isDualCameraEnabled: self.isDualCameraEnabled)
return CameraState(mode: self.mode, position: self.position, flashMode: self.flashMode, flashModeDidChange: self.flashModeDidChange, flashTint: flashTint, flashTintSize: self.flashTintSize, recording: self.recording, duration: self.duration, isDualCameraEnabled: self.isDualCameraEnabled)
}
func updatedFlashTintSize(_ size: CGFloat) -> CameraState {
return CameraState(mode: self.mode, position: self.position, flashMode: self.flashMode, flashModeDidChange: self.flashModeDidChange, flashTint: self.flashTint, flashTintSize: size, recording: self.recording, duration: self.duration, isDualCameraEnabled: self.isDualCameraEnabled)
}
func updatedRecording(_ recording: Recording) -> CameraState {
return CameraState(mode: self.mode, position: self.position, flashMode: self.flashMode, flashModeDidChange: self.flashModeDidChange, flashTint: self.flashTint, recording: recording, duration: self.duration, isDualCameraEnabled: self.isDualCameraEnabled)
return CameraState(mode: self.mode, position: self.position, flashMode: self.flashMode, flashModeDidChange: self.flashModeDidChange, flashTint: self.flashTint, flashTintSize: self.flashTintSize, recording: recording, duration: self.duration, isDualCameraEnabled: self.isDualCameraEnabled)
}
func updatedDuration(_ duration: Double) -> CameraState {
return CameraState(mode: self.mode, position: self.position, flashMode: self.flashMode, flashModeDidChange: self.flashModeDidChange, flashTint: self.flashTint, recording: self.recording, duration: duration, isDualCameraEnabled: self.isDualCameraEnabled)
return CameraState(mode: self.mode, position: self.position, flashMode: self.flashMode, flashModeDidChange: self.flashModeDidChange, flashTint: self.flashTint, flashTintSize: self.flashTintSize, recording: self.recording, duration: duration, isDualCameraEnabled: self.isDualCameraEnabled)
}
func updatedIsDualCameraEnabled(_ isDualCameraEnabled: Bool) -> CameraState {
return CameraState(mode: self.mode, position: self.position, flashMode: self.flashMode, flashModeDidChange: self.flashModeDidChange, flashTint: self.flashTint, recording: self.recording, duration: self.duration, isDualCameraEnabled: isDualCameraEnabled)
return CameraState(mode: self.mode, position: self.position, flashMode: self.flashMode, flashModeDidChange: self.flashModeDidChange, flashTint: self.flashTint, flashTintSize: self.flashTintSize, recording: self.recording, duration: self.duration, isDualCameraEnabled: isDualCameraEnabled)
}
}
@ -439,6 +444,14 @@ private final class CameraScreenComponent: CombinedComponent {
}
}
func updateFlashTintSize(_ size: CGFloat) {
guard let controller = self.getController() else {
return
}
controller.updateCameraState({ $0.updatedFlashTintSize(size) }, transition: .immediate)
}
func presentFlashTint() {
guard let controller = self.getController(), let camera = controller.camera else {
return
@ -1156,9 +1169,13 @@ private final class CameraScreenComponent: CombinedComponent {
component: FlashTintControlComponent(
position: flashButtonPosition.offsetBy(dx: 0.0, dy: 27.0),
tint: component.cameraState.flashTint,
size: component.cameraState.flashTintSize,
update: { [weak state] tint in
state?.updateFlashTint(tint)
},
updateSize: { [weak state] size in
state?.updateFlashTintSize(size)
},
dismiss: { [weak state] in
state?.displayingFlashTint = false
state?.updated(transition: .easeInOut(duration: 0.2))
@ -1461,6 +1478,7 @@ public class CameraScreen: ViewController {
flashMode: .off,
flashModeDidChange: false,
flashTint: .white,
flashTintSize: 1.0,
recording: .none,
duration: 0.0,
isDualCameraEnabled: isDualCameraEnabled

View File

@ -121,7 +121,7 @@ private final class FlashColorComponent: Component {
self.circleLayer.fillColor = UIColor(rgb: 0xffffff, alpha: 0.1).cgColor
self.ringLayer?.borderColor = UIColor.clear.cgColor
}
return contentSize
}
}
@ -138,23 +138,29 @@ private final class FlashColorComponent: Component {
final class FlashTintControlComponent: Component {
let position: CGPoint
let tint: CameraState.FlashTint
let size: CGFloat
let update: (CameraState.FlashTint?) -> Void
let updateSize: (CGFloat) -> Void
let dismiss: () -> Void
init(
position: CGPoint,
tint: CameraState.FlashTint,
size: CGFloat,
update: @escaping (CameraState.FlashTint?) -> Void,
updateSize: @escaping (CGFloat) -> Void,
dismiss: @escaping () -> Void
) {
self.position = position
self.tint = tint
self.size = size
self.update = update
self.updateSize = updateSize
self.dismiss = dismiss
}
static func == (lhs: FlashTintControlComponent, rhs: FlashTintControlComponent) -> Bool {
return lhs.position == rhs.position && lhs.tint == rhs.tint
return lhs.position == rhs.position && lhs.tint == rhs.tint && lhs.size == rhs.size
}
final class View: UIButton {
@ -165,10 +171,16 @@ final class FlashTintControlComponent: Component {
private let effectView: UIVisualEffectView
private let maskLayer = CAShapeLayer()
private let swatches = ComponentView<Empty>()
private let sliderView: SliderView
override init(frame: CGRect) {
self.effectView = UIVisualEffectView(effect: UIBlurEffect(style: .dark))
var sizeUpdateImpl: ((CGFloat) -> Void)?
self.sliderView = SliderView(minValue: 0.0, maxValue: 1.0, value: 1.0, valueChanged: { value , _ in
sizeUpdateImpl?(value)
})
super.init(frame: frame)
self.containerView.layer.anchorPoint = CGPoint(x: 0.8, y: 0.0)
@ -176,8 +188,15 @@ final class FlashTintControlComponent: Component {
self.addSubview(self.dismissView)
self.addSubview(self.containerView)
self.containerView.addSubview(self.effectView)
self.containerView.addSubview(self.sliderView)
self.dismissView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.dismissTapped)))
sizeUpdateImpl = { [weak self] size in
if let self, let component {
component.updateSize(size)
}
}
}
required init?(coder: NSCoder) {
@ -193,7 +212,12 @@ final class FlashTintControlComponent: Component {
self.component = component
let size = CGSize(width: 184.0, height: 92.0)
self.sliderView.frame = CGRect(origin: CGPoint(x: 8.0, y: size.height - 38.0), size: CGSize(width: size.width - 16.0, height: 30.0))
if isFirstTime {
self.sliderView.value = component.size
self.maskLayer.path = generateRoundedRectWithTailPath(rectSize: size, cornerRadius: 10.0, tailSize: CGSize(width: 18, height: 7.0), tailRadius: 1.0, tailPosition: 0.8, transformTail: false).cgPath
self.maskLayer.frame = CGRect(origin: .zero, size: CGSize(width: size.width, height: size.height + 7.0))
self.effectView.layer.mask = self.maskLayer
@ -298,3 +322,112 @@ final class FlashTintControlComponent: Component {
return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
}
}
private final class SliderView: UIView {
private let foregroundView: UIView
private let knobView: UIImageView
let minValue: CGFloat
let maxValue: CGFloat
var value: CGFloat = 1.0 {
didSet {
self.updateValue()
}
}
private let valueChanged: (CGFloat, Bool) -> Void
private let hapticFeedback = HapticFeedback()
init(minValue: CGFloat, maxValue: CGFloat, value: CGFloat, valueChanged: @escaping (CGFloat, Bool) -> Void) {
self.minValue = minValue
self.maxValue = maxValue
self.value = value
self.valueChanged = valueChanged
self.foregroundView = UIView()
self.foregroundView.backgroundColor = UIColor(rgb: 0x8b8b8a)
self.knobView = UIImageView(image: generateFilledCircleImage(diameter: 30.0, color: .white))
super.init(frame: .zero)
self.backgroundColor = UIColor(rgb: 0x3e3e3e)
self.clipsToBounds = true
self.layer.cornerRadius = 15.0
self.foregroundView.isUserInteractionEnabled = false
self.knobView.isUserInteractionEnabled = false
self.addSubview(self.foregroundView)
self.addSubview(self.knobView)
let panGestureRecognizer = UIPanGestureRecognizer(target: self, action: #selector(self.panGesture(_:)))
self.addGestureRecognizer(panGestureRecognizer)
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.tapGesture(_:)))
self.addGestureRecognizer(tapGestureRecognizer)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func updateValue(transition: Transition = .immediate) {
let width = self.frame.width
let range = self.maxValue - self.minValue
let value = (self.value - self.minValue) / range
transition.setFrame(view: self.foregroundView, frame: CGRect(origin: CGPoint(), size: CGSize(width: 15.0 + value * (width - 30.0), height: 30.0)))
transition.setFrame(view: self.knobView, frame: CGRect(origin: CGPoint(x: (width - 30.0) * value, y: 0.0), size: CGSize(width: 30.0, height: 30.0)))
}
@objc private func panGesture(_ gestureRecognizer: UIPanGestureRecognizer) {
let range = self.maxValue - self.minValue
switch gestureRecognizer.state {
case .began:
break
case .changed:
let previousValue = self.value
let translation: CGFloat = gestureRecognizer.translation(in: gestureRecognizer.view).x
let delta = translation / self.bounds.width * range
self.value = max(self.minValue, min(self.maxValue, self.value + delta))
gestureRecognizer.setTranslation(CGPoint(), in: gestureRecognizer.view)
if self.value == 1.0 && previousValue != 1.0 {
self.hapticFeedback.impact(.soft)
} else if self.value == 0.0 && previousValue != 0.0 {
self.hapticFeedback.impact(.soft)
}
if abs(previousValue - self.value) >= 0.001 {
self.valueChanged(self.value, false)
}
case .ended:
let translation: CGFloat = gestureRecognizer.translation(in: gestureRecognizer.view).x
let delta = translation / self.bounds.width * range
self.value = max(self.minValue, min(self.maxValue, self.value + delta))
self.valueChanged(self.value, true)
default:
break
}
}
@objc private func tapGesture(_ gestureRecognizer: UITapGestureRecognizer) {
let range = self.maxValue - self.minValue
let location = gestureRecognizer.location(in: gestureRecognizer.view)
self.value = max(self.minValue, min(self.maxValue, self.minValue + location.x / self.bounds.width * range))
self.valueChanged(self.value, true)
}
func canBeHighlighted() -> Bool {
return false
}
func updateIsHighlighted(isHighlighted: Bool) {
}
func performAction() {
}
}

View File

@ -221,25 +221,25 @@ public class ChatMessageReplyInfoNode: ASDisplayNode {
let author = arguments.message?.effectiveAuthor
if [Namespaces.Peer.CloudGroup, Namespaces.Peer.CloudChannel].contains(arguments.parentMessage.id.peerId.namespace) && author?.id.namespace == Namespaces.Peer.CloudUser {
if author?.hasCustomNameColor == true || ([Namespaces.Peer.CloudGroup, Namespaces.Peer.CloudChannel].contains(arguments.parentMessage.id.peerId.namespace) && author?.id.namespace == Namespaces.Peer.CloudUser) {
authorNameColor = author?.nameColor?.color
dashSecondaryColor = author?.nameColor?.dashColors.1
if let rawAuthorNameColor = authorNameColor {
var dimColors = false
switch arguments.presentationData.theme.theme.name {
case .builtin(.nightAccent), .builtin(.night):
dimColors = true
default:
break
}
if dimColors {
var hue: CGFloat = 0.0
var saturation: CGFloat = 0.0
var brightness: CGFloat = 0.0
rawAuthorNameColor.getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: nil)
authorNameColor = UIColor(hue: hue, saturation: saturation * 0.7, brightness: min(1.0, brightness * 1.2), alpha: 1.0)
}
}
// if let rawAuthorNameColor = authorNameColor {
// var dimColors = false
// switch arguments.presentationData.theme.theme.name {
// case .builtin(.nightAccent), .builtin(.night):
// dimColors = true
// default:
// break
// }
// if dimColors {
// var hue: CGFloat = 0.0
// var saturation: CGFloat = 0.0
// var brightness: CGFloat = 0.0
// rawAuthorNameColor.getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: nil)
// authorNameColor = UIColor(hue: hue, saturation: saturation * 0.7, brightness: min(1.0, brightness * 1.2), alpha: 1.0)
// }
// }
}
let mainColor: UIColor

View File

@ -213,6 +213,16 @@ private func peerNameColorScreenEntries(
} else {
nameColor = .blue
}
let replyText: String
let messageText: String
if case .channel = peer {
replyText = presentationData.strings.NameColor_ChatPreview_ReplyText_Channel
messageText = presentationData.strings.NameColor_ChatPreview_MessageText_Channel
} else {
replyText = presentationData.strings.NameColor_ChatPreview_ReplyText_Account
messageText = presentationData.strings.NameColor_ChatPreview_MessageText_Account
}
let messageItem = PeerNameColorChatPreviewItem.MessageItem(
outgoing: false,
peerId: peer.id,
@ -220,9 +230,9 @@ private func peerNameColorScreenEntries(
photo: peer.profileImageRepresentations,
nameColor: nameColor,
backgroundEmojiId: nil,
reply: (peer.compactDisplayTitle, presentationData.strings.NameColor_ChatPreview_ReplyText),
reply: (peer.compactDisplayTitle, replyText),
linkPreview: (presentationData.strings.NameColor_ChatPreview_LinkSite, presentationData.strings.NameColor_ChatPreview_LinkTitle, presentationData.strings.NameColor_ChatPreview_LinkText),
text: presentationData.strings.NameColor_ChatPreview_MessageText
text: messageText
)
entries.append(.colorHeader(presentationData.strings.NameColor_ChatPreview_Title))
@ -304,17 +314,20 @@ public func PeerNameColorScreen(
|> map { presentationData, state, availableReactions, peer -> (ItemListControllerState, (ItemListNodeState, Any)) in
let isPremium = peer?.isPremium ?? false
let title: String
let isLocked: Bool
switch subject {
case .account:
title = presentationData.strings.NameColor_Title_Account
isLocked = !isPremium
case .channel:
title = presentationData.strings.NameColor_Title_Channel
isLocked = false
}
let footerItem = ApplyColorFooterItem(
theme: presentationData.theme,
title: presentationData.strings.NameColor_ApplyColor,
locked: !isPremium,
locked: isLocked,
action: {
if isPremium {
let state = stateValue.with { $0 }

View File

@ -8,12 +8,13 @@ final class PeerInfoScreenDisclosureItem: PeerInfoScreenItem {
case none
case text(String)
case badge(String, UIColor)
case semitransparentBadge(String, UIColor)
var text: String {
switch self {
case .none:
return ""
case let .text(text), let .badge(text, _):
case let .text(text), let .badge(text, _), let .semitransparentBadge(text, _):
return text
}
}
@ -22,7 +23,7 @@ final class PeerInfoScreenDisclosureItem: PeerInfoScreenItem {
switch self {
case .none, .text:
return nil
case let .badge(_, color):
case let .badge(_, color), let .semitransparentBadge(_, color):
return color
}
}
@ -135,11 +136,14 @@ private final class PeerInfoScreenDisclosureItemNode: PeerInfoScreenItemNode {
let titleFont = Font.regular(presentationData.listsFontSize.itemListBaseFontSize)
self.bottomSeparatorNode.backgroundColor = presentationData.theme.list.itemBlocksSeparatorColor
let textColorValue: UIColor = presentationData.theme.list.itemPrimaryTextColor
let labelColorValue: UIColor
let labelFont: UIFont
if case .badge = item.label {
if case let .semitransparentBadge(_, color) = item.label {
labelColorValue = color
labelFont = Font.semibold(14.0)
} else if case .badge = item.label {
labelColorValue = presentationData.theme.list.itemCheckColors.foregroundColor
labelFont = Font.regular(15.0)
} else {
@ -170,7 +174,7 @@ private final class PeerInfoScreenDisclosureItemNode: PeerInfoScreenItemNode {
if previousItem?.text != item.text {
self.iconNode.image = nil
self.iconDisposable.set((iconSignal
|> deliverOnMainQueue).startStrict(next: { [weak self] icon in
|> deliverOnMainQueue).startStrict(next: { [weak self] icon in
if let self {
self.iconNode.image = icon
}
@ -193,8 +197,16 @@ private final class PeerInfoScreenDisclosureItemNode: PeerInfoScreenItemNode {
transition.updateFrame(node: self.arrowNode, frame: arrowFrame)
}
let badgeDiameter: CGFloat = 20.0
if case let .badge(text, badgeColor) = item.label, !text.isEmpty {
var badgeDiameter: CGFloat = 20.0
if case let .semitransparentBadge(text, badgeColor) = item.label, !text.isEmpty {
badgeDiameter = 24.0
if previousItem?.label.badgeColor != badgeColor {
self.labelBadgeNode.image = generateStretchableFilledCircleImage(diameter: badgeDiameter, color: badgeColor.withAlphaComponent(0.1))
}
if self.labelBadgeNode.supernode == nil {
self.insertSubnode(self.labelBadgeNode, belowSubnode: self.labelNode)
}
} else if case let .badge(text, badgeColor) = item.label, !text.isEmpty {
if previousItem?.label.badgeColor != badgeColor {
self.labelBadgeNode.image = generateStretchableFilledCircleImage(diameter: badgeDiameter, color: badgeColor)
}
@ -205,15 +217,20 @@ private final class PeerInfoScreenDisclosureItemNode: PeerInfoScreenItemNode {
self.labelBadgeNode.removeFromSupernode()
}
let badgeWidth = max(badgeDiameter, labelSize.width + 10.0)
var badgeWidth = max(badgeDiameter, labelSize.width + 10.0)
if case .semitransparentBadge = item.label {
badgeWidth += 2.0
}
let labelFrame: CGRect
if case .badge = item.label {
if case .semitransparentBadge = item.label {
labelFrame = CGRect(origin: CGPoint(x: width - rightInset - badgeWidth + (badgeWidth - labelSize.width) / 2.0, y: floor((height - labelSize.height) / 2.0)), size: labelSize)
} else if case .badge = item.label {
labelFrame = CGRect(origin: CGPoint(x: width - rightInset - badgeWidth + (badgeWidth - labelSize.width) / 2.0, y: floor((height - labelSize.height) / 2.0)), size: labelSize)
} else {
labelFrame = CGRect(origin: CGPoint(x: width - rightInset - labelSize.width, y: 12.0), size: labelSize)
}
let labelBadgeNodeFrame = CGRect(origin: CGPoint(x: width - rightInset - badgeWidth, y: labelFrame.minY - 1.0), size: CGSize(width: badgeWidth, height: badgeDiameter))
let labelBadgeNodeFrame = CGRect(origin: CGPoint(x: width - rightInset - badgeWidth, y: floorToScreenPixels(labelFrame.midY - badgeDiameter / 2.0)), size: CGSize(width: badgeWidth, height: badgeDiameter))
self.activateArea.accessibilityLabel = item.text
self.activateArea.accessibilityValue = item.label.text

View File

@ -94,6 +94,7 @@ import PeerReportScreen
import WebUI
import ShareWithPeersScreen
import ItemListPeerItem
import PeerNameColorScreen
enum PeerInfoAvatarEditingMode {
case generic
@ -522,6 +523,7 @@ private final class PeerInfoInteraction {
let openAddBotToGroup: () -> Void
let performBotCommand: (PeerInfoBotCommand) -> Void
let editingOpenPublicLinkSetup: () -> Void
let editingOpenNameColorSetup: () -> Void
let editingOpenInviteLinksSetup: () -> Void
let editingOpenDiscussionGroupSetup: () -> Void
let editingToggleMessageSignatures: (Bool) -> Void
@ -574,6 +576,7 @@ private final class PeerInfoInteraction {
openAddBotToGroup: @escaping () -> Void,
performBotCommand: @escaping (PeerInfoBotCommand) -> Void,
editingOpenPublicLinkSetup: @escaping () -> Void,
editingOpenNameColorSetup: @escaping () -> Void,
editingOpenInviteLinksSetup: @escaping () -> Void,
editingOpenDiscussionGroupSetup: @escaping () -> Void,
editingToggleMessageSignatures: @escaping (Bool) -> Void,
@ -625,6 +628,7 @@ private final class PeerInfoInteraction {
self.openAddBotToGroup = openAddBotToGroup
self.performBotCommand = performBotCommand
self.editingOpenPublicLinkSetup = editingOpenPublicLinkSetup
self.editingOpenNameColorSetup = editingOpenNameColorSetup
self.editingOpenInviteLinksSetup = editingOpenInviteLinksSetup
self.editingOpenDiscussionGroupSetup = editingOpenDiscussionGroupSetup
self.editingToggleMessageSignatures = editingToggleMessageSignatures
@ -1537,18 +1541,18 @@ private func editingItems(data: PeerInfoScreenData?, state: PeerInfoState, chatL
switch channel.info {
case .broadcast:
let ItemUsername = 1
let ItemInviteLinks = 2
let ItemDiscussionGroup = 3
let ItemSignMessages = 4
let ItemSignMessagesHelp = 5
let ItemDeleteChannel = 6
let ItemReactions = 7
let ItemAdmins = 8
let ItemMembers = 9
let ItemMemberRequests = 10
let ItemBanned = 11
let ItemRecentActions = 12
let ItemNameColor = 2
let ItemInviteLinks = 3
let ItemDiscussionGroup = 4
let ItemSignMessages = 5
let ItemSignMessagesHelp = 6
let ItemDeleteChannel = 7
let ItemReactions = 8
let ItemAdmins = 9
let ItemMembers = 10
let ItemMemberRequests = 11
let ItemBanned = 12
let ItemRecentActions = 13
let isCreator = channel.flags.contains(.isCreator)
@ -1563,7 +1567,14 @@ private func editingItems(data: PeerInfoScreenData?, state: PeerInfoState, chatL
interaction.editingOpenPublicLinkSetup()
}))
}
if isCreator || (channel.adminRights?.rights.contains(.canChangeInfo) == true) {
items[.peerSettings]!.append(PeerInfoScreenDisclosureItem(id: ItemNameColor, label: .semitransparentBadge(EnginePeer(channel).compactDisplayTitle, (data.peer?.nameColor ?? .blue).color), text: "Channel Color", icon: UIImage(bundleImageName: "Settings/Menu/Appearance"), action: {
interaction.editingOpenNameColorSetup()
}))
}
if (isCreator && (channel.addressName?.isEmpty ?? true)) || (!channel.flags.contains(.isCreator) && channel.adminRights?.rights.contains(.canInviteUsers) == true) {
let invitesText: String
if let count = data.invitations?.count, count > 0 {
@ -2276,6 +2287,9 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
editingOpenPublicLinkSetup: { [weak self] in
self?.editingOpenPublicLinkSetup()
},
editingOpenNameColorSetup: { [weak self] in
self?.editingOpenNameColorSetup()
},
editingOpenInviteLinksSetup: { [weak self] in
self?.editingOpenInviteLinksSetup()
},
@ -7072,6 +7086,11 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
}
}
private func editingOpenNameColorSetup() {
let controller = PeerNameColorScreen(context: self.context, updatedPresentationData: self.controller?.updatedPresentationData, subject: .channel(self.peerId))
self.controller?.push(controller)
}
private func editingOpenInviteLinksSetup() {
self.controller?.push(inviteLinkListController(context: self.context, updatedPresentationData: self.controller?.updatedPresentationData, peerId: self.peerId, admin: nil))
}