mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Color updates
This commit is contained in:
parent
5cd1fd89b1
commit
b1fba62426
@ -286,6 +286,35 @@ public extension UIColor {
|
||||
return self
|
||||
}
|
||||
|
||||
func blendOver(background: UIColor) -> UIColor {
|
||||
let base = background
|
||||
let blend = self
|
||||
|
||||
func overlayChannel(baseChannel: CGFloat, blendChannel: CGFloat) -> CGFloat {
|
||||
if baseChannel < 0.5 {
|
||||
return 2 * baseChannel * blendChannel
|
||||
} else {
|
||||
return 1 - 2 * (1 - baseChannel) * (1 - blendChannel)
|
||||
}
|
||||
}
|
||||
|
||||
var baseRed: CGFloat = 0, baseGreen: CGFloat = 0, baseBlue: CGFloat = 0, baseAlpha: CGFloat = 0
|
||||
base.getRed(&baseRed, green: &baseGreen, blue: &baseBlue, alpha: &baseAlpha)
|
||||
|
||||
var blendRed: CGFloat = 0, blendGreen: CGFloat = 0, blendBlue: CGFloat = 0, blendAlpha: CGFloat = 0
|
||||
blend.getRed(&blendRed, green: &blendGreen, blue: &blendBlue, alpha: &blendAlpha)
|
||||
|
||||
var red = overlayChannel(baseChannel: baseRed, blendChannel: blendRed)
|
||||
var green = overlayChannel(baseChannel: baseGreen, blendChannel: blendGreen)
|
||||
var blue = overlayChannel(baseChannel: baseBlue, blendChannel: blendBlue)
|
||||
|
||||
red = max(0.0, min(1.0, red))
|
||||
green = max(0.0, min(1.0, green))
|
||||
blue = max(0.0, min(1.0, blue))
|
||||
|
||||
return UIColor(red: red, green: green, blue: blue, alpha: blendAlpha).blitOver(background, alpha: 1.0)
|
||||
}
|
||||
|
||||
func withMultipliedAlpha(_ alpha: CGFloat) -> UIColor {
|
||||
var r1: CGFloat = 0.0
|
||||
var g1: CGFloat = 0.0
|
||||
|
@ -1083,7 +1083,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[415997816] = { return Api.help.InviteText.parse_inviteText($0) }
|
||||
dict[-1600596305] = { return Api.help.PassportConfig.parse_passportConfig($0) }
|
||||
dict[-1078332329] = { return Api.help.PassportConfig.parse_passportConfigNotModified($0) }
|
||||
dict[1780171841] = { return Api.help.PeerColorOption.parse_peerColorOption($0) }
|
||||
dict[324785199] = { return Api.help.PeerColorOption.parse_peerColorOption($0) }
|
||||
dict[864391742] = { return Api.help.PeerColorSet.parse_peerColorProfileSet($0) }
|
||||
dict[639736408] = { return Api.help.PeerColorSet.parse_peerColorSet($0) }
|
||||
dict[16313608] = { return Api.help.PeerColors.parse_peerColors($0) }
|
||||
dict[732034510] = { return Api.help.PeerColors.parse_peerColorsNotModified($0) }
|
||||
dict[1395946908] = { return Api.help.PremiumPromo.parse_premiumPromo($0) }
|
||||
@ -1946,6 +1948,8 @@ public extension Api {
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.help.PeerColorOption:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.help.PeerColorSet:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.help.PeerColors:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.help.PremiumPromo:
|
||||
|
@ -1104,26 +1104,18 @@ public extension Api.help {
|
||||
}
|
||||
public extension Api.help {
|
||||
enum PeerColorOption: TypeConstructorDescription {
|
||||
case peerColorOption(flags: Int32, colorId: Int32, colors: [Int32]?, darkColors: [Int32]?)
|
||||
case peerColorOption(flags: Int32, colorId: Int32, colors: Api.help.PeerColorSet?, darkColors: Api.help.PeerColorSet?)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .peerColorOption(let flags, let colorId, let colors, let darkColors):
|
||||
if boxed {
|
||||
buffer.appendInt32(1780171841)
|
||||
buffer.appendInt32(324785199)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeInt32(colorId, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(colors!.count))
|
||||
for item in colors! {
|
||||
serializeInt32(item, buffer: buffer, boxed: false)
|
||||
}}
|
||||
if Int(flags) & Int(1 << 2) != 0 {buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(darkColors!.count))
|
||||
for item in darkColors! {
|
||||
serializeInt32(item, buffer: buffer, boxed: false)
|
||||
}}
|
||||
if Int(flags) & Int(1 << 1) != 0 {colors!.serialize(buffer, true)}
|
||||
if Int(flags) & Int(1 << 2) != 0 {darkColors!.serialize(buffer, true)}
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -1140,13 +1132,13 @@ public extension Api.help {
|
||||
_1 = reader.readInt32()
|
||||
var _2: Int32?
|
||||
_2 = reader.readInt32()
|
||||
var _3: [Int32]?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
|
||||
_3 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
|
||||
var _3: Api.help.PeerColorSet?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
|
||||
_3 = Api.parse(reader, signature: signature) as? Api.help.PeerColorSet
|
||||
} }
|
||||
var _4: [Int32]?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let _ = reader.readInt32() {
|
||||
_4 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
|
||||
var _4: Api.help.PeerColorSet?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
|
||||
_4 = Api.parse(reader, signature: signature) as? Api.help.PeerColorSet
|
||||
} }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
@ -1162,6 +1154,94 @@ public extension Api.help {
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.help {
|
||||
enum PeerColorSet: TypeConstructorDescription {
|
||||
case peerColorProfileSet(palleteColors: [Int32], bgColors: [Int32], storyColors: [Int32])
|
||||
case peerColorSet(colors: [Int32])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .peerColorProfileSet(let palleteColors, let bgColors, let storyColors):
|
||||
if boxed {
|
||||
buffer.appendInt32(864391742)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(palleteColors.count))
|
||||
for item in palleteColors {
|
||||
serializeInt32(item, buffer: buffer, boxed: false)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(bgColors.count))
|
||||
for item in bgColors {
|
||||
serializeInt32(item, buffer: buffer, boxed: false)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(storyColors.count))
|
||||
for item in storyColors {
|
||||
serializeInt32(item, buffer: buffer, boxed: false)
|
||||
}
|
||||
break
|
||||
case .peerColorSet(let colors):
|
||||
if boxed {
|
||||
buffer.appendInt32(639736408)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(colors.count))
|
||||
for item in colors {
|
||||
serializeInt32(item, buffer: buffer, boxed: false)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .peerColorProfileSet(let palleteColors, let bgColors, let storyColors):
|
||||
return ("peerColorProfileSet", [("palleteColors", palleteColors as Any), ("bgColors", bgColors as Any), ("storyColors", storyColors as Any)])
|
||||
case .peerColorSet(let colors):
|
||||
return ("peerColorSet", [("colors", colors as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_peerColorProfileSet(_ reader: BufferReader) -> PeerColorSet? {
|
||||
var _1: [Int32]?
|
||||
if let _ = reader.readInt32() {
|
||||
_1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
|
||||
}
|
||||
var _2: [Int32]?
|
||||
if let _ = reader.readInt32() {
|
||||
_2 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
|
||||
}
|
||||
var _3: [Int32]?
|
||||
if let _ = reader.readInt32() {
|
||||
_3 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
if _c1 && _c2 && _c3 {
|
||||
return Api.help.PeerColorSet.peerColorProfileSet(palleteColors: _1!, bgColors: _2!, storyColors: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_peerColorSet(_ reader: BufferReader) -> PeerColorSet? {
|
||||
var _1: [Int32]?
|
||||
if let _ = reader.readInt32() {
|
||||
_1 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
if _c1 {
|
||||
return Api.help.PeerColorSet.peerColorSet(colors: _1!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.help {
|
||||
enum PeerColors: TypeConstructorDescription {
|
||||
case peerColors(hash: Int32, colors: [Api.help.PeerColorOption])
|
||||
@ -1306,97 +1386,3 @@ public extension Api.help {
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.help {
|
||||
enum PromoData: TypeConstructorDescription {
|
||||
case promoData(flags: Int32, expires: Int32, peer: Api.Peer, chats: [Api.Chat], users: [Api.User], psaType: String?, psaMessage: String?)
|
||||
case promoDataEmpty(expires: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .promoData(let flags, let expires, let peer, let chats, let users, let psaType, let psaMessage):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1942390465)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeInt32(expires, buffer: buffer, boxed: false)
|
||||
peer.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)
|
||||
}
|
||||
if Int(flags) & Int(1 << 1) != 0 {serializeString(psaType!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 2) != 0 {serializeString(psaMessage!, buffer: buffer, boxed: false)}
|
||||
break
|
||||
case .promoDataEmpty(let expires):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1728664459)
|
||||
}
|
||||
serializeInt32(expires, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .promoData(let flags, let expires, let peer, let chats, let users, let psaType, let psaMessage):
|
||||
return ("promoData", [("flags", flags as Any), ("expires", expires as Any), ("peer", peer as Any), ("chats", chats as Any), ("users", users as Any), ("psaType", psaType as Any), ("psaMessage", psaMessage as Any)])
|
||||
case .promoDataEmpty(let expires):
|
||||
return ("promoDataEmpty", [("expires", expires as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_promoData(_ reader: BufferReader) -> PromoData? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Int32?
|
||||
_2 = reader.readInt32()
|
||||
var _3: Api.Peer?
|
||||
if let signature = reader.readInt32() {
|
||||
_3 = Api.parse(reader, signature: signature) as? Api.Peer
|
||||
}
|
||||
var _4: [Api.Chat]?
|
||||
if let _ = reader.readInt32() {
|
||||
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
|
||||
}
|
||||
var _5: [Api.User]?
|
||||
if let _ = reader.readInt32() {
|
||||
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
}
|
||||
var _6: String?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {_6 = parseString(reader) }
|
||||
var _7: String?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {_7 = parseString(reader) }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
|
||||
let _c7 = (Int(_1!) & Int(1 << 2) == 0) || _7 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
|
||||
return Api.help.PromoData.promoData(flags: _1!, expires: _2!, peer: _3!, chats: _4!, users: _5!, psaType: _6, psaMessage: _7)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_promoDataEmpty(_ reader: BufferReader) -> PromoData? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
if _c1 {
|
||||
return Api.help.PromoData.promoDataEmpty(expires: _1!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,97 @@
|
||||
public extension Api.help {
|
||||
enum PromoData: TypeConstructorDescription {
|
||||
case promoData(flags: Int32, expires: Int32, peer: Api.Peer, chats: [Api.Chat], users: [Api.User], psaType: String?, psaMessage: String?)
|
||||
case promoDataEmpty(expires: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .promoData(let flags, let expires, let peer, let chats, let users, let psaType, let psaMessage):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1942390465)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeInt32(expires, buffer: buffer, boxed: false)
|
||||
peer.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)
|
||||
}
|
||||
if Int(flags) & Int(1 << 1) != 0 {serializeString(psaType!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 2) != 0 {serializeString(psaMessage!, buffer: buffer, boxed: false)}
|
||||
break
|
||||
case .promoDataEmpty(let expires):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1728664459)
|
||||
}
|
||||
serializeInt32(expires, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .promoData(let flags, let expires, let peer, let chats, let users, let psaType, let psaMessage):
|
||||
return ("promoData", [("flags", flags as Any), ("expires", expires as Any), ("peer", peer as Any), ("chats", chats as Any), ("users", users as Any), ("psaType", psaType as Any), ("psaMessage", psaMessage as Any)])
|
||||
case .promoDataEmpty(let expires):
|
||||
return ("promoDataEmpty", [("expires", expires as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_promoData(_ reader: BufferReader) -> PromoData? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Int32?
|
||||
_2 = reader.readInt32()
|
||||
var _3: Api.Peer?
|
||||
if let signature = reader.readInt32() {
|
||||
_3 = Api.parse(reader, signature: signature) as? Api.Peer
|
||||
}
|
||||
var _4: [Api.Chat]?
|
||||
if let _ = reader.readInt32() {
|
||||
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
|
||||
}
|
||||
var _5: [Api.User]?
|
||||
if let _ = reader.readInt32() {
|
||||
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
}
|
||||
var _6: String?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {_6 = parseString(reader) }
|
||||
var _7: String?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {_7 = parseString(reader) }
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
|
||||
let _c7 = (Int(_1!) & Int(1 << 2) == 0) || _7 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
|
||||
return Api.help.PromoData.promoData(flags: _1!, expires: _2!, peer: _3!, chats: _4!, users: _5!, psaType: _6, psaMessage: _7)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_promoDataEmpty(_ reader: BufferReader) -> PromoData? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
if _c1 {
|
||||
return Api.help.PromoData.promoDataEmpty(expires: _1!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.help {
|
||||
enum RecentMeUrls: TypeConstructorDescription {
|
||||
case recentMeUrls(urls: [Api.RecentMeUrl], chats: [Api.Chat], users: [Api.User])
|
||||
@ -1290,143 +1384,3 @@ public extension Api.messages {
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.messages {
|
||||
enum DiscussionMessage: TypeConstructorDescription {
|
||||
case discussionMessage(flags: Int32, messages: [Api.Message], maxId: Int32?, readInboxMaxId: Int32?, readOutboxMaxId: Int32?, unreadCount: Int32, chats: [Api.Chat], users: [Api.User])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .discussionMessage(let flags, let messages, let maxId, let readInboxMaxId, let readOutboxMaxId, let unreadCount, let chats, let users):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1506535550)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(messages.count))
|
||||
for item in messages {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(maxId!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(readInboxMaxId!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(readOutboxMaxId!, buffer: buffer, boxed: false)}
|
||||
serializeInt32(unreadCount, buffer: buffer, boxed: false)
|
||||
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 .discussionMessage(let flags, let messages, let maxId, let readInboxMaxId, let readOutboxMaxId, let unreadCount, let chats, let users):
|
||||
return ("discussionMessage", [("flags", flags as Any), ("messages", messages as Any), ("maxId", maxId as Any), ("readInboxMaxId", readInboxMaxId as Any), ("readOutboxMaxId", readOutboxMaxId as Any), ("unreadCount", unreadCount as Any), ("chats", chats as Any), ("users", users as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_discussionMessage(_ reader: BufferReader) -> DiscussionMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: [Api.Message]?
|
||||
if let _ = reader.readInt32() {
|
||||
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
|
||||
}
|
||||
var _3: Int32?
|
||||
if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() }
|
||||
var _4: Int32?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {_4 = reader.readInt32() }
|
||||
var _5: Int32?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {_5 = reader.readInt32() }
|
||||
var _6: Int32?
|
||||
_6 = reader.readInt32()
|
||||
var _7: [Api.Chat]?
|
||||
if let _ = reader.readInt32() {
|
||||
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
|
||||
}
|
||||
var _8: [Api.User]?
|
||||
if let _ = reader.readInt32() {
|
||||
_8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
|
||||
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
|
||||
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
let _c7 = _7 != nil
|
||||
let _c8 = _8 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
|
||||
return Api.messages.DiscussionMessage.discussionMessage(flags: _1!, messages: _2!, maxId: _3, readInboxMaxId: _4, readOutboxMaxId: _5, unreadCount: _6!, chats: _7!, users: _8!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.messages {
|
||||
enum EmojiGroups: TypeConstructorDescription {
|
||||
case emojiGroups(hash: Int32, groups: [Api.EmojiGroup])
|
||||
case emojiGroupsNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .emojiGroups(let hash, let groups):
|
||||
if boxed {
|
||||
buffer.appendInt32(-2011186869)
|
||||
}
|
||||
serializeInt32(hash, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(groups.count))
|
||||
for item in groups {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
break
|
||||
case .emojiGroupsNotModified:
|
||||
if boxed {
|
||||
buffer.appendInt32(1874111879)
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .emojiGroups(let hash, let groups):
|
||||
return ("emojiGroups", [("hash", hash as Any), ("groups", groups as Any)])
|
||||
case .emojiGroupsNotModified:
|
||||
return ("emojiGroupsNotModified", [])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_emojiGroups(_ reader: BufferReader) -> EmojiGroups? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: [Api.EmojiGroup]?
|
||||
if let _ = reader.readInt32() {
|
||||
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.EmojiGroup.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.messages.EmojiGroups.emojiGroups(hash: _1!, groups: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_emojiGroupsNotModified(_ reader: BufferReader) -> EmojiGroups? {
|
||||
return Api.messages.EmojiGroups.emojiGroupsNotModified
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,143 @@
|
||||
public extension Api.messages {
|
||||
enum DiscussionMessage: TypeConstructorDescription {
|
||||
case discussionMessage(flags: Int32, messages: [Api.Message], maxId: Int32?, readInboxMaxId: Int32?, readOutboxMaxId: Int32?, unreadCount: Int32, chats: [Api.Chat], users: [Api.User])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .discussionMessage(let flags, let messages, let maxId, let readInboxMaxId, let readOutboxMaxId, let unreadCount, let chats, let users):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1506535550)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(messages.count))
|
||||
for item in messages {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(maxId!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(readInboxMaxId!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(readOutboxMaxId!, buffer: buffer, boxed: false)}
|
||||
serializeInt32(unreadCount, buffer: buffer, boxed: false)
|
||||
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 .discussionMessage(let flags, let messages, let maxId, let readInboxMaxId, let readOutboxMaxId, let unreadCount, let chats, let users):
|
||||
return ("discussionMessage", [("flags", flags as Any), ("messages", messages as Any), ("maxId", maxId as Any), ("readInboxMaxId", readInboxMaxId as Any), ("readOutboxMaxId", readOutboxMaxId as Any), ("unreadCount", unreadCount as Any), ("chats", chats as Any), ("users", users as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_discussionMessage(_ reader: BufferReader) -> DiscussionMessage? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: [Api.Message]?
|
||||
if let _ = reader.readInt32() {
|
||||
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
|
||||
}
|
||||
var _3: Int32?
|
||||
if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() }
|
||||
var _4: Int32?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {_4 = reader.readInt32() }
|
||||
var _5: Int32?
|
||||
if Int(_1!) & Int(1 << 2) != 0 {_5 = reader.readInt32() }
|
||||
var _6: Int32?
|
||||
_6 = reader.readInt32()
|
||||
var _7: [Api.Chat]?
|
||||
if let _ = reader.readInt32() {
|
||||
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
|
||||
}
|
||||
var _8: [Api.User]?
|
||||
if let _ = reader.readInt32() {
|
||||
_8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
|
||||
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
|
||||
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
let _c7 = _7 != nil
|
||||
let _c8 = _8 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
|
||||
return Api.messages.DiscussionMessage.discussionMessage(flags: _1!, messages: _2!, maxId: _3, readInboxMaxId: _4, readOutboxMaxId: _5, unreadCount: _6!, chats: _7!, users: _8!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.messages {
|
||||
enum EmojiGroups: TypeConstructorDescription {
|
||||
case emojiGroups(hash: Int32, groups: [Api.EmojiGroup])
|
||||
case emojiGroupsNotModified
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .emojiGroups(let hash, let groups):
|
||||
if boxed {
|
||||
buffer.appendInt32(-2011186869)
|
||||
}
|
||||
serializeInt32(hash, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(groups.count))
|
||||
for item in groups {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
break
|
||||
case .emojiGroupsNotModified:
|
||||
if boxed {
|
||||
buffer.appendInt32(1874111879)
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .emojiGroups(let hash, let groups):
|
||||
return ("emojiGroups", [("hash", hash as Any), ("groups", groups as Any)])
|
||||
case .emojiGroupsNotModified:
|
||||
return ("emojiGroupsNotModified", [])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_emojiGroups(_ reader: BufferReader) -> EmojiGroups? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: [Api.EmojiGroup]?
|
||||
if let _ = reader.readInt32() {
|
||||
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.EmojiGroup.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.messages.EmojiGroups.emojiGroups(hash: _1!, groups: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_emojiGroupsNotModified(_ reader: BufferReader) -> EmojiGroups? {
|
||||
return Api.messages.EmojiGroups.emojiGroupsNotModified
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.messages {
|
||||
enum ExportedChatInvite: TypeConstructorDescription {
|
||||
case exportedChatInvite(invite: Api.ExportedChatInvite, users: [Api.User])
|
||||
@ -1342,187 +1482,3 @@ public extension Api.messages {
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.messages {
|
||||
enum SearchCounter: TypeConstructorDescription {
|
||||
case searchCounter(flags: Int32, filter: Api.MessagesFilter, count: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .searchCounter(let flags, let filter, let count):
|
||||
if boxed {
|
||||
buffer.appendInt32(-398136321)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
filter.serialize(buffer, true)
|
||||
serializeInt32(count, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .searchCounter(let flags, let filter, let count):
|
||||
return ("searchCounter", [("flags", flags as Any), ("filter", filter as Any), ("count", count as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_searchCounter(_ reader: BufferReader) -> SearchCounter? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Api.MessagesFilter?
|
||||
if let signature = reader.readInt32() {
|
||||
_2 = Api.parse(reader, signature: signature) as? Api.MessagesFilter
|
||||
}
|
||||
var _3: Int32?
|
||||
_3 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
if _c1 && _c2 && _c3 {
|
||||
return Api.messages.SearchCounter.searchCounter(flags: _1!, filter: _2!, count: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.messages {
|
||||
enum SearchResultsCalendar: TypeConstructorDescription {
|
||||
case searchResultsCalendar(flags: Int32, count: Int32, minDate: Int32, minMsgId: Int32, offsetIdOffset: Int32?, periods: [Api.SearchResultsCalendarPeriod], messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .searchResultsCalendar(let flags, let count, let minDate, let minMsgId, let offsetIdOffset, let periods, let messages, let chats, let users):
|
||||
if boxed {
|
||||
buffer.appendInt32(343859772)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeInt32(count, buffer: buffer, boxed: false)
|
||||
serializeInt32(minDate, buffer: buffer, boxed: false)
|
||||
serializeInt32(minMsgId, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(offsetIdOffset!, buffer: buffer, boxed: false)}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(periods.count))
|
||||
for item in periods {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(messages.count))
|
||||
for item in messages {
|
||||
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 .searchResultsCalendar(let flags, let count, let minDate, let minMsgId, let offsetIdOffset, let periods, let messages, let chats, let users):
|
||||
return ("searchResultsCalendar", [("flags", flags as Any), ("count", count as Any), ("minDate", minDate as Any), ("minMsgId", minMsgId as Any), ("offsetIdOffset", offsetIdOffset as Any), ("periods", periods as Any), ("messages", messages as Any), ("chats", chats as Any), ("users", users as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_searchResultsCalendar(_ reader: BufferReader) -> SearchResultsCalendar? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Int32?
|
||||
_2 = reader.readInt32()
|
||||
var _3: Int32?
|
||||
_3 = reader.readInt32()
|
||||
var _4: Int32?
|
||||
_4 = reader.readInt32()
|
||||
var _5: Int32?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {_5 = reader.readInt32() }
|
||||
var _6: [Api.SearchResultsCalendarPeriod]?
|
||||
if let _ = reader.readInt32() {
|
||||
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SearchResultsCalendarPeriod.self)
|
||||
}
|
||||
var _7: [Api.Message]?
|
||||
if let _ = reader.readInt32() {
|
||||
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
|
||||
}
|
||||
var _8: [Api.Chat]?
|
||||
if let _ = reader.readInt32() {
|
||||
_8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
|
||||
}
|
||||
var _9: [Api.User]?
|
||||
if let _ = reader.readInt32() {
|
||||
_9 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
let _c7 = _7 != nil
|
||||
let _c8 = _8 != nil
|
||||
let _c9 = _9 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
|
||||
return Api.messages.SearchResultsCalendar.searchResultsCalendar(flags: _1!, count: _2!, minDate: _3!, minMsgId: _4!, offsetIdOffset: _5, periods: _6!, messages: _7!, chats: _8!, users: _9!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.messages {
|
||||
enum SearchResultsPositions: TypeConstructorDescription {
|
||||
case searchResultsPositions(count: Int32, positions: [Api.SearchResultsPosition])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .searchResultsPositions(let count, let positions):
|
||||
if boxed {
|
||||
buffer.appendInt32(1404185519)
|
||||
}
|
||||
serializeInt32(count, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(positions.count))
|
||||
for item in positions {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .searchResultsPositions(let count, let positions):
|
||||
return ("searchResultsPositions", [("count", count as Any), ("positions", positions as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_searchResultsPositions(_ reader: BufferReader) -> SearchResultsPositions? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: [Api.SearchResultsPosition]?
|
||||
if let _ = reader.readInt32() {
|
||||
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SearchResultsPosition.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.messages.SearchResultsPositions.searchResultsPositions(count: _1!, positions: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,187 @@
|
||||
public extension Api.messages {
|
||||
enum SearchCounter: TypeConstructorDescription {
|
||||
case searchCounter(flags: Int32, filter: Api.MessagesFilter, count: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .searchCounter(let flags, let filter, let count):
|
||||
if boxed {
|
||||
buffer.appendInt32(-398136321)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
filter.serialize(buffer, true)
|
||||
serializeInt32(count, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .searchCounter(let flags, let filter, let count):
|
||||
return ("searchCounter", [("flags", flags as Any), ("filter", filter as Any), ("count", count as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_searchCounter(_ reader: BufferReader) -> SearchCounter? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Api.MessagesFilter?
|
||||
if let signature = reader.readInt32() {
|
||||
_2 = Api.parse(reader, signature: signature) as? Api.MessagesFilter
|
||||
}
|
||||
var _3: Int32?
|
||||
_3 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
if _c1 && _c2 && _c3 {
|
||||
return Api.messages.SearchCounter.searchCounter(flags: _1!, filter: _2!, count: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.messages {
|
||||
enum SearchResultsCalendar: TypeConstructorDescription {
|
||||
case searchResultsCalendar(flags: Int32, count: Int32, minDate: Int32, minMsgId: Int32, offsetIdOffset: Int32?, periods: [Api.SearchResultsCalendarPeriod], messages: [Api.Message], chats: [Api.Chat], users: [Api.User])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .searchResultsCalendar(let flags, let count, let minDate, let minMsgId, let offsetIdOffset, let periods, let messages, let chats, let users):
|
||||
if boxed {
|
||||
buffer.appendInt32(343859772)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeInt32(count, buffer: buffer, boxed: false)
|
||||
serializeInt32(minDate, buffer: buffer, boxed: false)
|
||||
serializeInt32(minMsgId, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(offsetIdOffset!, buffer: buffer, boxed: false)}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(periods.count))
|
||||
for item in periods {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(messages.count))
|
||||
for item in messages {
|
||||
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 .searchResultsCalendar(let flags, let count, let minDate, let minMsgId, let offsetIdOffset, let periods, let messages, let chats, let users):
|
||||
return ("searchResultsCalendar", [("flags", flags as Any), ("count", count as Any), ("minDate", minDate as Any), ("minMsgId", minMsgId as Any), ("offsetIdOffset", offsetIdOffset as Any), ("periods", periods as Any), ("messages", messages as Any), ("chats", chats as Any), ("users", users as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_searchResultsCalendar(_ reader: BufferReader) -> SearchResultsCalendar? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Int32?
|
||||
_2 = reader.readInt32()
|
||||
var _3: Int32?
|
||||
_3 = reader.readInt32()
|
||||
var _4: Int32?
|
||||
_4 = reader.readInt32()
|
||||
var _5: Int32?
|
||||
if Int(_1!) & Int(1 << 1) != 0 {_5 = reader.readInt32() }
|
||||
var _6: [Api.SearchResultsCalendarPeriod]?
|
||||
if let _ = reader.readInt32() {
|
||||
_6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SearchResultsCalendarPeriod.self)
|
||||
}
|
||||
var _7: [Api.Message]?
|
||||
if let _ = reader.readInt32() {
|
||||
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
|
||||
}
|
||||
var _8: [Api.Chat]?
|
||||
if let _ = reader.readInt32() {
|
||||
_8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
|
||||
}
|
||||
var _9: [Api.User]?
|
||||
if let _ = reader.readInt32() {
|
||||
_9 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
let _c7 = _7 != nil
|
||||
let _c8 = _8 != nil
|
||||
let _c9 = _9 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
|
||||
return Api.messages.SearchResultsCalendar.searchResultsCalendar(flags: _1!, count: _2!, minDate: _3!, minMsgId: _4!, offsetIdOffset: _5, periods: _6!, messages: _7!, chats: _8!, users: _9!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.messages {
|
||||
enum SearchResultsPositions: TypeConstructorDescription {
|
||||
case searchResultsPositions(count: Int32, positions: [Api.SearchResultsPosition])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .searchResultsPositions(let count, let positions):
|
||||
if boxed {
|
||||
buffer.appendInt32(1404185519)
|
||||
}
|
||||
serializeInt32(count, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(positions.count))
|
||||
for item in positions {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .searchResultsPositions(let count, let positions):
|
||||
return ("searchResultsPositions", [("count", count as Any), ("positions", positions as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_searchResultsPositions(_ reader: BufferReader) -> SearchResultsPositions? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: [Api.SearchResultsPosition]?
|
||||
if let _ = reader.readInt32() {
|
||||
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SearchResultsPosition.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.messages.SearchResultsPositions.searchResultsPositions(count: _1!, positions: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.messages {
|
||||
enum SentEncryptedMessage: TypeConstructorDescription {
|
||||
case sentEncryptedFile(date: Int32, file: Api.EncryptedFile)
|
||||
@ -1380,187 +1564,3 @@ public extension Api.phone {
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.phone {
|
||||
enum GroupParticipants: TypeConstructorDescription {
|
||||
case groupParticipants(count: Int32, participants: [Api.GroupCallParticipant], nextOffset: String, chats: [Api.Chat], users: [Api.User], version: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .groupParticipants(let count, let participants, let nextOffset, let chats, let users, let version):
|
||||
if boxed {
|
||||
buffer.appendInt32(-193506890)
|
||||
}
|
||||
serializeInt32(count, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(participants.count))
|
||||
for item in participants {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
serializeString(nextOffset, buffer: buffer, boxed: false)
|
||||
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)
|
||||
}
|
||||
serializeInt32(version, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .groupParticipants(let count, let participants, let nextOffset, let chats, let users, let version):
|
||||
return ("groupParticipants", [("count", count as Any), ("participants", participants as Any), ("nextOffset", nextOffset as Any), ("chats", chats as Any), ("users", users as Any), ("version", version as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_groupParticipants(_ reader: BufferReader) -> GroupParticipants? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: [Api.GroupCallParticipant]?
|
||||
if let _ = reader.readInt32() {
|
||||
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.GroupCallParticipant.self)
|
||||
}
|
||||
var _3: String?
|
||||
_3 = parseString(reader)
|
||||
var _4: [Api.Chat]?
|
||||
if let _ = reader.readInt32() {
|
||||
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
|
||||
}
|
||||
var _5: [Api.User]?
|
||||
if let _ = reader.readInt32() {
|
||||
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
}
|
||||
var _6: Int32?
|
||||
_6 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||
return Api.phone.GroupParticipants.groupParticipants(count: _1!, participants: _2!, nextOffset: _3!, chats: _4!, users: _5!, version: _6!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.phone {
|
||||
enum JoinAsPeers: TypeConstructorDescription {
|
||||
case joinAsPeers(peers: [Api.Peer], chats: [Api.Chat], users: [Api.User])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .joinAsPeers(let peers, let chats, let users):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1343921601)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(peers.count))
|
||||
for item in peers {
|
||||
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 .joinAsPeers(let peers, let chats, let users):
|
||||
return ("joinAsPeers", [("peers", peers as Any), ("chats", chats as Any), ("users", users as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_joinAsPeers(_ reader: BufferReader) -> JoinAsPeers? {
|
||||
var _1: [Api.Peer]?
|
||||
if let _ = reader.readInt32() {
|
||||
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.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.phone.JoinAsPeers.joinAsPeers(peers: _1!, chats: _2!, users: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.phone {
|
||||
enum PhoneCall: TypeConstructorDescription {
|
||||
case phoneCall(phoneCall: Api.PhoneCall, users: [Api.User])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .phoneCall(let phoneCall, let users):
|
||||
if boxed {
|
||||
buffer.appendInt32(-326966976)
|
||||
}
|
||||
phoneCall.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 .phoneCall(let phoneCall, let users):
|
||||
return ("phoneCall", [("phoneCall", phoneCall as Any), ("users", users as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_phoneCall(_ reader: BufferReader) -> PhoneCall? {
|
||||
var _1: Api.PhoneCall?
|
||||
if let signature = reader.readInt32() {
|
||||
_1 = Api.parse(reader, signature: signature) as? Api.PhoneCall
|
||||
}
|
||||
var _2: [Api.User]?
|
||||
if let _ = reader.readInt32() {
|
||||
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.phone.PhoneCall.phoneCall(phoneCall: _1!, users: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,187 @@
|
||||
public extension Api.phone {
|
||||
enum GroupParticipants: TypeConstructorDescription {
|
||||
case groupParticipants(count: Int32, participants: [Api.GroupCallParticipant], nextOffset: String, chats: [Api.Chat], users: [Api.User], version: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .groupParticipants(let count, let participants, let nextOffset, let chats, let users, let version):
|
||||
if boxed {
|
||||
buffer.appendInt32(-193506890)
|
||||
}
|
||||
serializeInt32(count, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(participants.count))
|
||||
for item in participants {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
serializeString(nextOffset, buffer: buffer, boxed: false)
|
||||
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)
|
||||
}
|
||||
serializeInt32(version, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .groupParticipants(let count, let participants, let nextOffset, let chats, let users, let version):
|
||||
return ("groupParticipants", [("count", count as Any), ("participants", participants as Any), ("nextOffset", nextOffset as Any), ("chats", chats as Any), ("users", users as Any), ("version", version as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_groupParticipants(_ reader: BufferReader) -> GroupParticipants? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: [Api.GroupCallParticipant]?
|
||||
if let _ = reader.readInt32() {
|
||||
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.GroupCallParticipant.self)
|
||||
}
|
||||
var _3: String?
|
||||
_3 = parseString(reader)
|
||||
var _4: [Api.Chat]?
|
||||
if let _ = reader.readInt32() {
|
||||
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
|
||||
}
|
||||
var _5: [Api.User]?
|
||||
if let _ = reader.readInt32() {
|
||||
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
}
|
||||
var _6: Int32?
|
||||
_6 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||
return Api.phone.GroupParticipants.groupParticipants(count: _1!, participants: _2!, nextOffset: _3!, chats: _4!, users: _5!, version: _6!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.phone {
|
||||
enum JoinAsPeers: TypeConstructorDescription {
|
||||
case joinAsPeers(peers: [Api.Peer], chats: [Api.Chat], users: [Api.User])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .joinAsPeers(let peers, let chats, let users):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1343921601)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(peers.count))
|
||||
for item in peers {
|
||||
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 .joinAsPeers(let peers, let chats, let users):
|
||||
return ("joinAsPeers", [("peers", peers as Any), ("chats", chats as Any), ("users", users as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_joinAsPeers(_ reader: BufferReader) -> JoinAsPeers? {
|
||||
var _1: [Api.Peer]?
|
||||
if let _ = reader.readInt32() {
|
||||
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.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.phone.JoinAsPeers.joinAsPeers(peers: _1!, chats: _2!, users: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.phone {
|
||||
enum PhoneCall: TypeConstructorDescription {
|
||||
case phoneCall(phoneCall: Api.PhoneCall, users: [Api.User])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .phoneCall(let phoneCall, let users):
|
||||
if boxed {
|
||||
buffer.appendInt32(-326966976)
|
||||
}
|
||||
phoneCall.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 .phoneCall(let phoneCall, let users):
|
||||
return ("phoneCall", [("phoneCall", phoneCall as Any), ("users", users as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_phoneCall(_ reader: BufferReader) -> PhoneCall? {
|
||||
var _1: Api.PhoneCall?
|
||||
if let signature = reader.readInt32() {
|
||||
_1 = Api.parse(reader, signature: signature) as? Api.PhoneCall
|
||||
}
|
||||
var _2: [Api.User]?
|
||||
if let _ = reader.readInt32() {
|
||||
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.phone.PhoneCall.phoneCall(phoneCall: _1!, users: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.photos {
|
||||
enum Photo: TypeConstructorDescription {
|
||||
case photo(photo: Api.Photo, users: [Api.User])
|
||||
@ -1454,207 +1638,3 @@ public extension Api.updates {
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.updates {
|
||||
enum Difference: TypeConstructorDescription {
|
||||
case difference(newMessages: [Api.Message], newEncryptedMessages: [Api.EncryptedMessage], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User], state: Api.updates.State)
|
||||
case differenceEmpty(date: Int32, seq: Int32)
|
||||
case differenceSlice(newMessages: [Api.Message], newEncryptedMessages: [Api.EncryptedMessage], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User], intermediateState: Api.updates.State)
|
||||
case differenceTooLong(pts: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .difference(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let state):
|
||||
if boxed {
|
||||
buffer.appendInt32(16030880)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(newMessages.count))
|
||||
for item in newMessages {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(newEncryptedMessages.count))
|
||||
for item in newEncryptedMessages {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(otherUpdates.count))
|
||||
for item in otherUpdates {
|
||||
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)
|
||||
}
|
||||
state.serialize(buffer, true)
|
||||
break
|
||||
case .differenceEmpty(let date, let seq):
|
||||
if boxed {
|
||||
buffer.appendInt32(1567990072)
|
||||
}
|
||||
serializeInt32(date, buffer: buffer, boxed: false)
|
||||
serializeInt32(seq, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .differenceSlice(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let intermediateState):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1459938943)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(newMessages.count))
|
||||
for item in newMessages {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(newEncryptedMessages.count))
|
||||
for item in newEncryptedMessages {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(otherUpdates.count))
|
||||
for item in otherUpdates {
|
||||
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)
|
||||
}
|
||||
intermediateState.serialize(buffer, true)
|
||||
break
|
||||
case .differenceTooLong(let pts):
|
||||
if boxed {
|
||||
buffer.appendInt32(1258196845)
|
||||
}
|
||||
serializeInt32(pts, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .difference(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let state):
|
||||
return ("difference", [("newMessages", newMessages as Any), ("newEncryptedMessages", newEncryptedMessages as Any), ("otherUpdates", otherUpdates as Any), ("chats", chats as Any), ("users", users as Any), ("state", state as Any)])
|
||||
case .differenceEmpty(let date, let seq):
|
||||
return ("differenceEmpty", [("date", date as Any), ("seq", seq as Any)])
|
||||
case .differenceSlice(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let intermediateState):
|
||||
return ("differenceSlice", [("newMessages", newMessages as Any), ("newEncryptedMessages", newEncryptedMessages as Any), ("otherUpdates", otherUpdates as Any), ("chats", chats as Any), ("users", users as Any), ("intermediateState", intermediateState as Any)])
|
||||
case .differenceTooLong(let pts):
|
||||
return ("differenceTooLong", [("pts", pts as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_difference(_ reader: BufferReader) -> Difference? {
|
||||
var _1: [Api.Message]?
|
||||
if let _ = reader.readInt32() {
|
||||
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
|
||||
}
|
||||
var _2: [Api.EncryptedMessage]?
|
||||
if let _ = reader.readInt32() {
|
||||
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.EncryptedMessage.self)
|
||||
}
|
||||
var _3: [Api.Update]?
|
||||
if let _ = reader.readInt32() {
|
||||
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Update.self)
|
||||
}
|
||||
var _4: [Api.Chat]?
|
||||
if let _ = reader.readInt32() {
|
||||
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
|
||||
}
|
||||
var _5: [Api.User]?
|
||||
if let _ = reader.readInt32() {
|
||||
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
}
|
||||
var _6: Api.updates.State?
|
||||
if let signature = reader.readInt32() {
|
||||
_6 = Api.parse(reader, signature: signature) as? Api.updates.State
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||
return Api.updates.Difference.difference(newMessages: _1!, newEncryptedMessages: _2!, otherUpdates: _3!, chats: _4!, users: _5!, state: _6!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_differenceEmpty(_ reader: BufferReader) -> Difference? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Int32?
|
||||
_2 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.updates.Difference.differenceEmpty(date: _1!, seq: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_differenceSlice(_ reader: BufferReader) -> Difference? {
|
||||
var _1: [Api.Message]?
|
||||
if let _ = reader.readInt32() {
|
||||
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
|
||||
}
|
||||
var _2: [Api.EncryptedMessage]?
|
||||
if let _ = reader.readInt32() {
|
||||
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.EncryptedMessage.self)
|
||||
}
|
||||
var _3: [Api.Update]?
|
||||
if let _ = reader.readInt32() {
|
||||
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Update.self)
|
||||
}
|
||||
var _4: [Api.Chat]?
|
||||
if let _ = reader.readInt32() {
|
||||
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
|
||||
}
|
||||
var _5: [Api.User]?
|
||||
if let _ = reader.readInt32() {
|
||||
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
}
|
||||
var _6: Api.updates.State?
|
||||
if let signature = reader.readInt32() {
|
||||
_6 = Api.parse(reader, signature: signature) as? Api.updates.State
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||
return Api.updates.Difference.differenceSlice(newMessages: _1!, newEncryptedMessages: _2!, otherUpdates: _3!, chats: _4!, users: _5!, intermediateState: _6!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_differenceTooLong(_ reader: BufferReader) -> Difference? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
if _c1 {
|
||||
return Api.updates.Difference.differenceTooLong(pts: _1!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,207 @@
|
||||
public extension Api.updates {
|
||||
enum Difference: TypeConstructorDescription {
|
||||
case difference(newMessages: [Api.Message], newEncryptedMessages: [Api.EncryptedMessage], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User], state: Api.updates.State)
|
||||
case differenceEmpty(date: Int32, seq: Int32)
|
||||
case differenceSlice(newMessages: [Api.Message], newEncryptedMessages: [Api.EncryptedMessage], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User], intermediateState: Api.updates.State)
|
||||
case differenceTooLong(pts: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .difference(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let state):
|
||||
if boxed {
|
||||
buffer.appendInt32(16030880)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(newMessages.count))
|
||||
for item in newMessages {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(newEncryptedMessages.count))
|
||||
for item in newEncryptedMessages {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(otherUpdates.count))
|
||||
for item in otherUpdates {
|
||||
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)
|
||||
}
|
||||
state.serialize(buffer, true)
|
||||
break
|
||||
case .differenceEmpty(let date, let seq):
|
||||
if boxed {
|
||||
buffer.appendInt32(1567990072)
|
||||
}
|
||||
serializeInt32(date, buffer: buffer, boxed: false)
|
||||
serializeInt32(seq, buffer: buffer, boxed: false)
|
||||
break
|
||||
case .differenceSlice(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let intermediateState):
|
||||
if boxed {
|
||||
buffer.appendInt32(-1459938943)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(newMessages.count))
|
||||
for item in newMessages {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(newEncryptedMessages.count))
|
||||
for item in newEncryptedMessages {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(otherUpdates.count))
|
||||
for item in otherUpdates {
|
||||
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)
|
||||
}
|
||||
intermediateState.serialize(buffer, true)
|
||||
break
|
||||
case .differenceTooLong(let pts):
|
||||
if boxed {
|
||||
buffer.appendInt32(1258196845)
|
||||
}
|
||||
serializeInt32(pts, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .difference(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let state):
|
||||
return ("difference", [("newMessages", newMessages as Any), ("newEncryptedMessages", newEncryptedMessages as Any), ("otherUpdates", otherUpdates as Any), ("chats", chats as Any), ("users", users as Any), ("state", state as Any)])
|
||||
case .differenceEmpty(let date, let seq):
|
||||
return ("differenceEmpty", [("date", date as Any), ("seq", seq as Any)])
|
||||
case .differenceSlice(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let intermediateState):
|
||||
return ("differenceSlice", [("newMessages", newMessages as Any), ("newEncryptedMessages", newEncryptedMessages as Any), ("otherUpdates", otherUpdates as Any), ("chats", chats as Any), ("users", users as Any), ("intermediateState", intermediateState as Any)])
|
||||
case .differenceTooLong(let pts):
|
||||
return ("differenceTooLong", [("pts", pts as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_difference(_ reader: BufferReader) -> Difference? {
|
||||
var _1: [Api.Message]?
|
||||
if let _ = reader.readInt32() {
|
||||
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
|
||||
}
|
||||
var _2: [Api.EncryptedMessage]?
|
||||
if let _ = reader.readInt32() {
|
||||
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.EncryptedMessage.self)
|
||||
}
|
||||
var _3: [Api.Update]?
|
||||
if let _ = reader.readInt32() {
|
||||
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Update.self)
|
||||
}
|
||||
var _4: [Api.Chat]?
|
||||
if let _ = reader.readInt32() {
|
||||
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
|
||||
}
|
||||
var _5: [Api.User]?
|
||||
if let _ = reader.readInt32() {
|
||||
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
}
|
||||
var _6: Api.updates.State?
|
||||
if let signature = reader.readInt32() {
|
||||
_6 = Api.parse(reader, signature: signature) as? Api.updates.State
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||
return Api.updates.Difference.difference(newMessages: _1!, newEncryptedMessages: _2!, otherUpdates: _3!, chats: _4!, users: _5!, state: _6!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_differenceEmpty(_ reader: BufferReader) -> Difference? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Int32?
|
||||
_2 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.updates.Difference.differenceEmpty(date: _1!, seq: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_differenceSlice(_ reader: BufferReader) -> Difference? {
|
||||
var _1: [Api.Message]?
|
||||
if let _ = reader.readInt32() {
|
||||
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
|
||||
}
|
||||
var _2: [Api.EncryptedMessage]?
|
||||
if let _ = reader.readInt32() {
|
||||
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.EncryptedMessage.self)
|
||||
}
|
||||
var _3: [Api.Update]?
|
||||
if let _ = reader.readInt32() {
|
||||
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Update.self)
|
||||
}
|
||||
var _4: [Api.Chat]?
|
||||
if let _ = reader.readInt32() {
|
||||
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
|
||||
}
|
||||
var _5: [Api.User]?
|
||||
if let _ = reader.readInt32() {
|
||||
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||
}
|
||||
var _6: Api.updates.State?
|
||||
if let signature = reader.readInt32() {
|
||||
_6 = Api.parse(reader, signature: signature) as? Api.updates.State
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||
return Api.updates.Difference.differenceSlice(newMessages: _1!, newEncryptedMessages: _2!, otherUpdates: _3!, chats: _4!, users: _5!, intermediateState: _6!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_differenceTooLong(_ reader: BufferReader) -> Difference? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
if _c1 {
|
||||
return Api.updates.Difference.differenceTooLong(pts: _1!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.updates {
|
||||
enum State: TypeConstructorDescription {
|
||||
case state(pts: Int32, qts: Int32, date: Int32, seq: Int32, unreadCount: Int32)
|
||||
|
@ -1232,11 +1232,11 @@ public extension Api.functions.account {
|
||||
}
|
||||
}
|
||||
public extension Api.functions.account {
|
||||
static func updateColor(flags: Int32, color: Int32, backgroundEmojiId: Int64?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||
static func updateColor(flags: Int32, color: Int32?, backgroundEmojiId: Int64?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-1610494909)
|
||||
buffer.appendInt32(2096079197)
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeInt32(color, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(color!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 0) != 0 {serializeInt64(backgroundEmojiId!, buffer: buffer, boxed: false)}
|
||||
return (FunctionDescription(name: "account.updateColor", parameters: [("flags", String(describing: flags)), ("color", String(describing: color)), ("backgroundEmojiId", String(describing: backgroundEmojiId))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
|
||||
let reader = BufferReader(buffer)
|
||||
|
@ -222,58 +222,35 @@ public final class EngineAvailableColorOptions: Codable, Equatable {
|
||||
}
|
||||
|
||||
private extension EngineAvailableColorOptions.ColorOption {
|
||||
convenience init?(apiColors: [Int32]) {
|
||||
convenience init?(apiColors: Api.help.PeerColorSet) {
|
||||
let palette: EngineAvailableColorOptions.MultiColorPack
|
||||
let background: EngineAvailableColorOptions.MultiColorPack
|
||||
let stories: EngineAvailableColorOptions.MultiColorPack?
|
||||
|
||||
if apiColors.count == 1 {
|
||||
palette = EngineAvailableColorOptions.MultiColorPack(colors: [
|
||||
UInt32(bitPattern: apiColors[0])
|
||||
])
|
||||
switch apiColors {
|
||||
case let .peerColorSet(colors):
|
||||
if colors.isEmpty {
|
||||
return nil
|
||||
}
|
||||
palette = EngineAvailableColorOptions.MultiColorPack(colors: colors.map(UInt32.init(bitPattern:)))
|
||||
background = palette
|
||||
stories = nil
|
||||
} else if apiColors.count == 2 {
|
||||
palette = EngineAvailableColorOptions.MultiColorPack(colors: [
|
||||
UInt32(bitPattern: apiColors[0]),
|
||||
UInt32(bitPattern: apiColors[1])
|
||||
])
|
||||
background = palette
|
||||
stories = nil
|
||||
} else if apiColors.count == 3 {
|
||||
palette = EngineAvailableColorOptions.MultiColorPack(colors: [
|
||||
UInt32(bitPattern: apiColors[0]),
|
||||
UInt32(bitPattern: apiColors[1]),
|
||||
UInt32(bitPattern: apiColors[2])
|
||||
])
|
||||
background = palette
|
||||
stories = nil
|
||||
} else if apiColors.count == 4 {
|
||||
palette = EngineAvailableColorOptions.MultiColorPack(colors: [
|
||||
UInt32(bitPattern: apiColors[0])
|
||||
])
|
||||
background = EngineAvailableColorOptions.MultiColorPack(colors: [
|
||||
UInt32(bitPattern: apiColors[1])
|
||||
])
|
||||
stories = EngineAvailableColorOptions.MultiColorPack(colors: [
|
||||
UInt32(bitPattern: apiColors[2]),
|
||||
UInt32(bitPattern: apiColors[3])
|
||||
])
|
||||
} else if apiColors.count == 6 {
|
||||
palette = EngineAvailableColorOptions.MultiColorPack(colors: [
|
||||
UInt32(bitPattern: apiColors[0]),
|
||||
UInt32(bitPattern: apiColors[1])
|
||||
])
|
||||
background = EngineAvailableColorOptions.MultiColorPack(colors: [
|
||||
UInt32(bitPattern: apiColors[2]),
|
||||
UInt32(bitPattern: apiColors[3])
|
||||
])
|
||||
stories = EngineAvailableColorOptions.MultiColorPack(colors: [
|
||||
UInt32(bitPattern: apiColors[4]),
|
||||
UInt32(bitPattern: apiColors[5])
|
||||
])
|
||||
} else {
|
||||
return nil
|
||||
case let .peerColorProfileSet(palleteColors, bgColors, storyColors):
|
||||
if palleteColors.isEmpty {
|
||||
return nil
|
||||
}
|
||||
palette = EngineAvailableColorOptions.MultiColorPack(colors: palleteColors.map(UInt32.init(bitPattern:)))
|
||||
|
||||
if bgColors.isEmpty {
|
||||
return nil
|
||||
}
|
||||
background = EngineAvailableColorOptions.MultiColorPack(colors: bgColors.map(UInt32.init(bitPattern:)))
|
||||
|
||||
if !storyColors.isEmpty {
|
||||
stories = EngineAvailableColorOptions.MultiColorPack(colors: storyColors.map(UInt32.init(bitPattern:)))
|
||||
} else {
|
||||
stories = nil
|
||||
}
|
||||
}
|
||||
|
||||
self.init(palette: palette, background: background, stories: stories)
|
||||
@ -287,6 +264,7 @@ private extension EngineAvailableColorOptions {
|
||||
switch apiColor {
|
||||
case let .peerColorOption(flags, colorId, colors, darkColors):
|
||||
let isHidden = (flags & (1 << 0)) != 0
|
||||
|
||||
let mappedColors = colors.flatMap(EngineAvailableColorOptions.ColorOption.init(apiColors:))
|
||||
let mappedDarkColors = darkColors.flatMap(EngineAvailableColorOptions.ColorOption.init(apiColors:))
|
||||
|
||||
|
@ -238,9 +238,11 @@ public final class PeerInfoCoverComponent: Component {
|
||||
var secondaryBackgroundColor: UIColor
|
||||
let patternColor: UIColor
|
||||
if let peer = component.peer, let colors = peer._asPeer().profileColor.flatMap({ component.context.peerNameColors.getProfile($0, dark: component.isDark) }) {
|
||||
|
||||
backgroundColor = colors.main
|
||||
secondaryBackgroundColor = colors.secondary ?? colors.main
|
||||
patternColor = colors.main.withMultiplied(hue: 1.0, saturation: 1.0, brightness: 0.8).withMultipliedAlpha(0.8)
|
||||
|
||||
patternColor = UIColor(white: 0.0, alpha: component.isDark ? 0.2 : 0.15).blendOver(background: backgroundColor)
|
||||
} else {
|
||||
backgroundColor = .clear
|
||||
secondaryBackgroundColor = .clear
|
||||
|
@ -526,15 +526,15 @@ final class PeerInfoHeaderNode: ASDisplayNode {
|
||||
|
||||
let regularNavigationContentsSecondaryColor: UIColor
|
||||
if let profileColor = peer?.profileColor {
|
||||
let backgroundColor = self.context.peerNameColors.getProfile(profileColor).main
|
||||
let backgroundColor = self.context.peerNameColors.getProfile(profileColor, dark: presentationData.theme.overallDarkAppearance).main
|
||||
regularNavigationContentsSecondaryColor = UIColor(white: 1.0, alpha: 0.6).blitOver(backgroundColor.withMultiplied(hue: 1.0, saturation: 2.2, brightness: 1.5), alpha: 1.0)
|
||||
|
||||
if presentationData.theme.overallDarkAppearance {
|
||||
let baseButtonBackgroundColor: UIColor = UIColor(white: 0.0, alpha: 0.4)
|
||||
regularContentButtonBackgroundColor = baseButtonBackgroundColor.blitOver(backgroundColor.withMultiplied(hue: 1.0, saturation: 2.2, brightness: 0.7), alpha: 1.0)
|
||||
let baseButtonBackgroundColor: UIColor = UIColor(white: 0.0, alpha: 0.25)
|
||||
regularContentButtonBackgroundColor = baseButtonBackgroundColor.blendOver(background: backgroundColor)
|
||||
} else {
|
||||
let baseButtonBackgroundColor: UIColor = UIColor(white: 1.0, alpha: 0.3)
|
||||
regularContentButtonBackgroundColor = baseButtonBackgroundColor.blitOver(backgroundColor.withMultiplied(hue: 1.0, saturation: 0.8, brightness: 1.0), alpha: 1.0)
|
||||
let baseButtonBackgroundColor: UIColor = UIColor(white: 1.0, alpha: 0.25)
|
||||
regularContentButtonBackgroundColor = baseButtonBackgroundColor.blendOver(background: backgroundColor)
|
||||
}
|
||||
regularHeaderButtonBackgroundColor = regularContentButtonBackgroundColor
|
||||
} else {
|
||||
|
@ -37,6 +37,7 @@ swift_library(
|
||||
"//submodules/MediaPickerUI",
|
||||
"//submodules/TelegramUI/Components/Stories/StoryContainerScreen",
|
||||
"//submodules/TelegramUI/Components/EmptyStateIndicatorComponent",
|
||||
"//submodules/UIKitRuntimeUtils",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
@ -27,6 +27,7 @@ import InvisibleInkDustNode
|
||||
import MediaPickerUI
|
||||
import StoryContainerScreen
|
||||
import EmptyStateIndicatorComponent
|
||||
import UIKitRuntimeUtils
|
||||
|
||||
private let mediaBadgeBackgroundColor = UIColor(white: 0.0, alpha: 0.6)
|
||||
private let mediaBadgeTextColor = UIColor.white
|
||||
@ -483,213 +484,6 @@ private final class GenericItemLayer: CALayer, ItemLayer {
|
||||
}
|
||||
}
|
||||
|
||||
private final class CaptureProtectedItemLayer: AVSampleBufferDisplayLayer, ItemLayer {
|
||||
var item: VisualMediaItem?
|
||||
var viewCountLayer: DurationLayer?
|
||||
var durationLayer: DurationLayer?
|
||||
var leftShadowLayer: SimpleLayer?
|
||||
var rightShadowLayer: SimpleLayer?
|
||||
var minFactor: CGFloat = 1.0
|
||||
var selectionLayer: GridMessageSelectionLayer?
|
||||
var dustLayer: MediaDustLayer?
|
||||
var disposable: Disposable?
|
||||
|
||||
var hasContents: Bool = false
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
|
||||
self.contentsGravity = .resize
|
||||
if #available(iOS 13.0, *) {
|
||||
self.preventsCapture = true
|
||||
self.preventsDisplaySleepDuringVideoPlayback = false
|
||||
}
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
deinit {
|
||||
self.disposable?.dispose()
|
||||
}
|
||||
|
||||
override func action(forKey event: String) -> CAAction? {
|
||||
return nullAction
|
||||
}
|
||||
|
||||
private var layerContents: Any?
|
||||
func getContents() -> Any? {
|
||||
return self.layerContents
|
||||
}
|
||||
|
||||
func setContents(_ contents: Any?) {
|
||||
self.layerContents = contents
|
||||
|
||||
if let image = contents as? UIImage {
|
||||
self.layerContents = image.cgImage
|
||||
if let cmSampleBuffer = image.cmSampleBuffer {
|
||||
self.enqueue(cmSampleBuffer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func setSpoilerContents(_ contents: Any?) {
|
||||
if let image = contents as? UIImage {
|
||||
self.dustLayer?.contents = image.cgImage
|
||||
}
|
||||
}
|
||||
|
||||
func bind(item: VisualMediaItem) {
|
||||
self.item = item
|
||||
}
|
||||
|
||||
func updateDuration(viewCount: Int32?, duration: Int32?, isMin: Bool, minFactor: CGFloat) {
|
||||
self.minFactor = minFactor
|
||||
|
||||
if let viewCount {
|
||||
if let viewCountLayer = self.viewCountLayer {
|
||||
viewCountLayer.update(viewCount: viewCount, isMin: isMin)
|
||||
} else {
|
||||
let viewCountLayer = DurationLayer()
|
||||
viewCountLayer.contentsGravity = .topLeft
|
||||
viewCountLayer.update(viewCount: viewCount, isMin: isMin)
|
||||
self.addSublayer(viewCountLayer)
|
||||
viewCountLayer.frame = CGRect(origin: CGPoint(x: 7.0, y: self.bounds.height - 4.0), size: CGSize())
|
||||
viewCountLayer.transform = CATransform3DMakeScale(minFactor, minFactor, 1.0)
|
||||
self.viewCountLayer = viewCountLayer
|
||||
}
|
||||
} else if let viewCountLayer = self.viewCountLayer {
|
||||
self.viewCountLayer = nil
|
||||
viewCountLayer.removeFromSuperlayer()
|
||||
}
|
||||
|
||||
if let duration {
|
||||
if let durationLayer = self.durationLayer {
|
||||
durationLayer.update(duration: duration, isMin: isMin)
|
||||
} else {
|
||||
let durationLayer = DurationLayer()
|
||||
durationLayer.update(duration: duration, isMin: isMin)
|
||||
self.addSublayer(durationLayer)
|
||||
durationLayer.frame = CGRect(origin: CGPoint(x: self.bounds.width - 3.0, y: self.bounds.height - 4.0), size: CGSize())
|
||||
durationLayer.transform = CATransform3DMakeScale(minFactor, minFactor, 1.0)
|
||||
self.durationLayer = durationLayer
|
||||
}
|
||||
} else if let durationLayer = self.durationLayer {
|
||||
self.durationLayer = nil
|
||||
durationLayer.removeFromSuperlayer()
|
||||
}
|
||||
|
||||
let size = self.bounds.size
|
||||
|
||||
if self.viewCountLayer != nil {
|
||||
if self.leftShadowLayer == nil {
|
||||
let leftShadowLayer = SimpleLayer()
|
||||
self.leftShadowLayer = leftShadowLayer
|
||||
self.insertSublayer(leftShadowLayer, at: 0)
|
||||
leftShadowLayer.contents = leftShadowImage.cgImage
|
||||
let shadowSize = CGSize(width: min(size.width, leftShadowImage.size.width), height: min(size.height, leftShadowImage.size.height))
|
||||
leftShadowLayer.frame = CGRect(origin: CGPoint(x: 0.0, y: size.height - shadowSize.height), size: shadowSize)
|
||||
}
|
||||
} else {
|
||||
if let leftShadowLayer = self.leftShadowLayer {
|
||||
self.leftShadowLayer = nil
|
||||
leftShadowLayer.removeFromSuperlayer()
|
||||
}
|
||||
}
|
||||
|
||||
if self.durationLayer != nil {
|
||||
if self.rightShadowLayer == nil {
|
||||
let rightShadowLayer = SimpleLayer()
|
||||
self.rightShadowLayer = rightShadowLayer
|
||||
self.insertSublayer(rightShadowLayer, at: 0)
|
||||
rightShadowLayer.contents = rightShadowImage.cgImage
|
||||
let shadowSize = CGSize(width: min(size.width, rightShadowImage.size.width), height: min(size.height, rightShadowImage.size.height))
|
||||
rightShadowLayer.frame = CGRect(origin: CGPoint(x: size.width - shadowSize.width, y: size.height - shadowSize.height), size: shadowSize)
|
||||
}
|
||||
} else {
|
||||
if let rightShadowLayer = self.rightShadowLayer {
|
||||
self.rightShadowLayer = nil
|
||||
rightShadowLayer.removeFromSuperlayer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func updateSelection(theme: CheckNodeTheme, isSelected: Bool?, animated: Bool) {
|
||||
if let isSelected = isSelected {
|
||||
if let selectionLayer = self.selectionLayer {
|
||||
selectionLayer.updateSelected(isSelected, animated: animated)
|
||||
} else {
|
||||
let selectionLayer = GridMessageSelectionLayer(theme: theme)
|
||||
selectionLayer.updateSelected(isSelected, animated: false)
|
||||
self.selectionLayer = selectionLayer
|
||||
self.addSublayer(selectionLayer)
|
||||
if !self.bounds.isEmpty {
|
||||
selectionLayer.frame = CGRect(origin: CGPoint(), size: self.bounds.size)
|
||||
selectionLayer.updateLayout(size: self.bounds.size)
|
||||
if animated {
|
||||
selectionLayer.animateIn()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if let selectionLayer = self.selectionLayer {
|
||||
self.selectionLayer = nil
|
||||
if animated {
|
||||
selectionLayer.animateOut { [weak selectionLayer] in
|
||||
selectionLayer?.removeFromSuperlayer()
|
||||
}
|
||||
} else {
|
||||
selectionLayer.removeFromSuperlayer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func updateHasSpoiler(hasSpoiler: Bool) {
|
||||
if hasSpoiler {
|
||||
if let _ = self.dustLayer {
|
||||
} else {
|
||||
let dustLayer = MediaDustLayer()
|
||||
self.dustLayer = dustLayer
|
||||
self.addSublayer(dustLayer)
|
||||
if !self.bounds.isEmpty {
|
||||
dustLayer.frame = CGRect(origin: CGPoint(), size: self.bounds.size)
|
||||
dustLayer.updateLayout(size: self.bounds.size)
|
||||
}
|
||||
}
|
||||
} else if let dustLayer = self.dustLayer {
|
||||
self.dustLayer = nil
|
||||
dustLayer.removeFromSuperlayer()
|
||||
}
|
||||
}
|
||||
|
||||
func unbind() {
|
||||
self.item = nil
|
||||
}
|
||||
|
||||
func needsShimmer() -> Bool {
|
||||
return !self.hasContents
|
||||
}
|
||||
|
||||
func update(size: CGSize, insets: UIEdgeInsets, displayItem: SparseItemGridDisplayItem, binding: SparseItemGridBinding, item: SparseItemGrid.Item?) {
|
||||
if let viewCountLayer = self.viewCountLayer {
|
||||
viewCountLayer.frame = CGRect(origin: CGPoint(x: 7.0, y: size.height - 4.0), size: CGSize())
|
||||
}
|
||||
if let durationLayer = self.durationLayer {
|
||||
durationLayer.frame = CGRect(origin: CGPoint(x: size.width - 3.0, y: size.height - 4.0), size: CGSize())
|
||||
}
|
||||
|
||||
if let leftShadowLayer = self.leftShadowLayer {
|
||||
let shadowSize = CGSize(width: min(size.width, leftShadowImage.size.width), height: min(size.height, leftShadowImage.size.height))
|
||||
leftShadowLayer.frame = CGRect(origin: CGPoint(x: 0.0, y: size.height - shadowSize.height), size: shadowSize)
|
||||
}
|
||||
|
||||
if let rightShadowLayer = self.rightShadowLayer {
|
||||
let shadowSize = CGSize(width: min(size.width, rightShadowImage.size.width), height: min(size.height, rightShadowImage.size.height))
|
||||
rightShadowLayer.frame = CGRect(origin: CGPoint(x: size.width - shadowSize.width, y: size.height - shadowSize.height), size: shadowSize)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final class ItemTransitionView: UIView {
|
||||
private weak var itemLayer: CALayer?
|
||||
private var copyDurationLayer: SimpleLayer?
|
||||
@ -712,11 +506,7 @@ private final class ItemTransitionView: UIView {
|
||||
var durationLayer: CALayer?
|
||||
var leftShadowLayer: CALayer?
|
||||
var rightShadowLayer: CALayer?
|
||||
if let itemLayer = itemLayer as? CaptureProtectedItemLayer {
|
||||
viewCountLayer = itemLayer.viewCountLayer
|
||||
durationLayer = itemLayer.durationLayer
|
||||
self.layer.contents = itemLayer.getContents()
|
||||
} else if let itemLayer = itemLayer as? GenericItemLayer {
|
||||
if let itemLayer = itemLayer as? GenericItemLayer {
|
||||
viewCountLayer = itemLayer.viewCountLayer
|
||||
durationLayer = itemLayer.durationLayer
|
||||
leftShadowLayer = itemLayer.leftShadowLayer
|
||||
@ -852,7 +642,9 @@ private final class SparseItemGridBindingImpl: SparseItemGridBinding {
|
||||
|
||||
func createLayer(item: SparseItemGrid.Item) -> SparseItemGridLayer? {
|
||||
if let item = item as? VisualMediaItem, item.story.isForwardingDisabled {
|
||||
return CaptureProtectedItemLayer()
|
||||
let layer = GenericItemLayer()
|
||||
setLayerDisableScreenshots(layer, true)
|
||||
return layer
|
||||
} else {
|
||||
return GenericItemLayer()
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import ChatControllerInteraction
|
||||
import InvisibleInkDustNode
|
||||
import MediaPickerUI
|
||||
import ChatControllerInteraction
|
||||
import UIKitRuntimeUtils
|
||||
|
||||
public enum PeerInfoPaneKey: Int32 {
|
||||
case members
|
||||
@ -517,170 +518,6 @@ private final class GenericItemLayer: CALayer, ItemLayer {
|
||||
}
|
||||
}
|
||||
|
||||
private final class CaptureProtectedItemLayer: AVSampleBufferDisplayLayer, ItemLayer {
|
||||
var item: VisualMediaItem?
|
||||
var durationLayer: DurationLayer?
|
||||
var rightShadowLayer: SimpleLayer?
|
||||
var minFactor: CGFloat = 1.0
|
||||
var selectionLayer: GridMessageSelectionLayer?
|
||||
var dustLayer: MediaDustLayer?
|
||||
var disposable: Disposable?
|
||||
|
||||
var hasContents: Bool = false
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
|
||||
self.contentsGravity = .resize
|
||||
if #available(iOS 13.0, *) {
|
||||
self.preventsCapture = true
|
||||
self.preventsDisplaySleepDuringVideoPlayback = false
|
||||
}
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
deinit {
|
||||
self.disposable?.dispose()
|
||||
}
|
||||
|
||||
override func action(forKey event: String) -> CAAction? {
|
||||
return nullAction
|
||||
}
|
||||
|
||||
private var layerContents: Any?
|
||||
func getContents() -> Any? {
|
||||
return self.layerContents
|
||||
}
|
||||
|
||||
func setContents(_ contents: Any?) {
|
||||
self.layerContents = contents
|
||||
|
||||
if let image = contents as? UIImage {
|
||||
self.layerContents = image.cgImage
|
||||
if let cmSampleBuffer = image.cmSampleBuffer {
|
||||
self.enqueue(cmSampleBuffer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func setSpoilerContents(_ contents: Any?) {
|
||||
if let image = contents as? UIImage {
|
||||
self.dustLayer?.contents = image.cgImage
|
||||
}
|
||||
}
|
||||
|
||||
func bind(item: VisualMediaItem) {
|
||||
self.item = item
|
||||
}
|
||||
|
||||
func updateDuration(duration: Int32?, isMin: Bool, minFactor: CGFloat) {
|
||||
self.minFactor = minFactor
|
||||
|
||||
if let duration {
|
||||
if let durationLayer = self.durationLayer {
|
||||
durationLayer.update(duration: duration, isMin: isMin)
|
||||
} else {
|
||||
let durationLayer = DurationLayer()
|
||||
durationLayer.update(duration: duration, isMin: isMin)
|
||||
self.addSublayer(durationLayer)
|
||||
durationLayer.frame = CGRect(origin: CGPoint(x: self.bounds.width - 3.0, y: self.bounds.height - 3.0), size: CGSize())
|
||||
durationLayer.transform = CATransform3DMakeScale(minFactor, minFactor, 1.0)
|
||||
self.durationLayer = durationLayer
|
||||
}
|
||||
} else if let durationLayer = self.durationLayer {
|
||||
self.durationLayer = nil
|
||||
durationLayer.removeFromSuperlayer()
|
||||
}
|
||||
|
||||
let size = self.bounds.size
|
||||
|
||||
if self.durationLayer != nil {
|
||||
if self.rightShadowLayer == nil {
|
||||
let rightShadowLayer = SimpleLayer()
|
||||
self.rightShadowLayer = rightShadowLayer
|
||||
self.insertSublayer(rightShadowLayer, at: 0)
|
||||
rightShadowLayer.contents = rightShadowImage.cgImage
|
||||
let shadowSize = CGSize(width: min(size.width, rightShadowImage.size.width), height: min(size.height, rightShadowImage.size.height))
|
||||
rightShadowLayer.frame = CGRect(origin: CGPoint(x: size.width - shadowSize.width, y: size.height - shadowSize.height), size: shadowSize)
|
||||
}
|
||||
} else {
|
||||
if let rightShadowLayer = self.rightShadowLayer {
|
||||
self.rightShadowLayer = nil
|
||||
rightShadowLayer.removeFromSuperlayer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func updateSelection(theme: CheckNodeTheme, isSelected: Bool?, animated: Bool) {
|
||||
if let isSelected = isSelected {
|
||||
if let selectionLayer = self.selectionLayer {
|
||||
selectionLayer.updateSelected(isSelected, animated: animated)
|
||||
} else {
|
||||
let selectionLayer = GridMessageSelectionLayer(theme: theme)
|
||||
selectionLayer.updateSelected(isSelected, animated: false)
|
||||
self.selectionLayer = selectionLayer
|
||||
self.addSublayer(selectionLayer)
|
||||
if !self.bounds.isEmpty {
|
||||
selectionLayer.frame = CGRect(origin: CGPoint(), size: self.bounds.size)
|
||||
selectionLayer.updateLayout(size: self.bounds.size)
|
||||
if animated {
|
||||
selectionLayer.animateIn()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if let selectionLayer = self.selectionLayer {
|
||||
self.selectionLayer = nil
|
||||
if animated {
|
||||
selectionLayer.animateOut { [weak selectionLayer] in
|
||||
selectionLayer?.removeFromSuperlayer()
|
||||
}
|
||||
} else {
|
||||
selectionLayer.removeFromSuperlayer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func updateHasSpoiler(hasSpoiler: Bool) {
|
||||
if hasSpoiler {
|
||||
if let _ = self.dustLayer {
|
||||
} else {
|
||||
let dustLayer = MediaDustLayer()
|
||||
self.dustLayer = dustLayer
|
||||
self.addSublayer(dustLayer)
|
||||
if !self.bounds.isEmpty {
|
||||
dustLayer.frame = CGRect(origin: CGPoint(), size: self.bounds.size)
|
||||
dustLayer.updateLayout(size: self.bounds.size)
|
||||
}
|
||||
}
|
||||
} else if let dustLayer = self.dustLayer {
|
||||
self.dustLayer = nil
|
||||
dustLayer.removeFromSuperlayer()
|
||||
}
|
||||
}
|
||||
|
||||
func unbind() {
|
||||
self.item = nil
|
||||
}
|
||||
|
||||
func needsShimmer() -> Bool {
|
||||
return !self.hasContents
|
||||
}
|
||||
|
||||
func update(size: CGSize, insets: UIEdgeInsets, displayItem: SparseItemGridDisplayItem, binding: SparseItemGridBinding, item: SparseItemGrid.Item?) {
|
||||
if let durationLayer = self.durationLayer {
|
||||
durationLayer.frame = CGRect(origin: CGPoint(x: size.width - 3.0, y: size.height - 3.0), size: CGSize())
|
||||
}
|
||||
|
||||
if let rightShadowLayer = self.rightShadowLayer {
|
||||
let shadowSize = CGSize(width: min(size.width, rightShadowImage.size.width), height: min(size.height, rightShadowImage.size.height))
|
||||
rightShadowLayer.frame = CGRect(origin: CGPoint(x: size.width - shadowSize.width, y: size.height - shadowSize.height), size: shadowSize)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final class ItemView: UIView, SparseItemGridView {
|
||||
var item: VisualMediaItem?
|
||||
var disposable: Disposable?
|
||||
@ -1005,7 +842,9 @@ private final class SparseItemGridBindingImpl: SparseItemGridBinding, ListShimme
|
||||
return nil
|
||||
}
|
||||
if self.captureProtected {
|
||||
return CaptureProtectedItemLayer()
|
||||
let layer = GenericItemLayer()
|
||||
setLayerDisableScreenshots(layer, true)
|
||||
return layer
|
||||
} else {
|
||||
return GenericItemLayer()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user