mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 11:20:18 +00:00
API update: profile photo and forwards privacy settings
This commit is contained in:
parent
621f52fcf4
commit
d554ad5a85
@ -2442,7 +2442,7 @@ func replayFinalState(accountManager: AccountManager, postbox: Postbox, accountP
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch set {
|
switch set {
|
||||||
case let .stickerSet(flags, _, _, _, _, _, _, _):
|
case let .stickerSet(flags, _, _, _, _, _, _, _, _):
|
||||||
if (flags & (1 << 3)) != 0 {
|
if (flags & (1 << 3)) != 0 {
|
||||||
namespace = Namespaces.ItemCollection.CloudMaskPacks
|
namespace = Namespaces.ItemCollection.CloudMaskPacks
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -105,6 +105,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-1000708810] = { return Api.help.AppUpdate.parse_noAppUpdate($0) }
|
dict[-1000708810] = { return Api.help.AppUpdate.parse_noAppUpdate($0) }
|
||||||
dict[-209337866] = { return Api.LangPackDifference.parse_langPackDifference($0) }
|
dict[-209337866] = { return Api.LangPackDifference.parse_langPackDifference($0) }
|
||||||
dict[-1590738760] = { return Api.WallPaperSettings.parse_wallPaperSettings($0) }
|
dict[-1590738760] = { return Api.WallPaperSettings.parse_wallPaperSettings($0) }
|
||||||
|
dict[1152191385] = { return Api.EmojiURL.parse_EmojiURL($0) }
|
||||||
dict[-791039645] = { return Api.channels.ChannelParticipant.parse_channelParticipant($0) }
|
dict[-791039645] = { return Api.channels.ChannelParticipant.parse_channelParticipant($0) }
|
||||||
dict[-1736378792] = { return Api.InputCheckPasswordSRP.parse_inputCheckPasswordEmpty($0) }
|
dict[-1736378792] = { return Api.InputCheckPasswordSRP.parse_inputCheckPasswordEmpty($0) }
|
||||||
dict[-763367294] = { return Api.InputCheckPasswordSRP.parse_inputCheckPasswordSRP($0) }
|
dict[-763367294] = { return Api.InputCheckPasswordSRP.parse_inputCheckPasswordSRP($0) }
|
||||||
@ -157,6 +158,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[1343122938] = { return Api.PrivacyKey.parse_privacyKeyChatInvite($0) }
|
dict[1343122938] = { return Api.PrivacyKey.parse_privacyKeyChatInvite($0) }
|
||||||
dict[1030105979] = { return Api.PrivacyKey.parse_privacyKeyPhoneCall($0) }
|
dict[1030105979] = { return Api.PrivacyKey.parse_privacyKeyPhoneCall($0) }
|
||||||
dict[961092808] = { return Api.PrivacyKey.parse_privacyKeyPhoneP2P($0) }
|
dict[961092808] = { return Api.PrivacyKey.parse_privacyKeyPhoneP2P($0) }
|
||||||
|
dict[1777096355] = { return Api.PrivacyKey.parse_privacyKeyForwards($0) }
|
||||||
|
dict[-1777000467] = { return Api.PrivacyKey.parse_privacyKeyProfilePhoto($0) }
|
||||||
dict[522914557] = { return Api.Update.parse_updateNewMessage($0) }
|
dict[522914557] = { return Api.Update.parse_updateNewMessage($0) }
|
||||||
dict[1318109142] = { return Api.Update.parse_updateMessageID($0) }
|
dict[1318109142] = { return Api.Update.parse_updateMessageID($0) }
|
||||||
dict[-1576161051] = { return Api.Update.parse_updateDeleteMessages($0) }
|
dict[-1576161051] = { return Api.Update.parse_updateDeleteMessages($0) }
|
||||||
@ -286,7 +289,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[1098628881] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaVenue($0) }
|
dict[1098628881] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaVenue($0) }
|
||||||
dict[-1494368259] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaContact($0) }
|
dict[-1494368259] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaContact($0) }
|
||||||
dict[2002815875] = { return Api.KeyboardButtonRow.parse_keyboardButtonRow($0) }
|
dict[2002815875] = { return Api.KeyboardButtonRow.parse_keyboardButtonRow($0) }
|
||||||
dict[1434820921] = { return Api.StickerSet.parse_stickerSet($0) }
|
dict[1787870391] = { return Api.StickerSet.parse_stickerSet($0) }
|
||||||
dict[354925740] = { return Api.SecureSecretSettings.parse_secureSecretSettings($0) }
|
dict[354925740] = { return Api.SecureSecretSettings.parse_secureSecretSettings($0) }
|
||||||
dict[539045032] = { return Api.photos.Photo.parse_photo($0) }
|
dict[539045032] = { return Api.photos.Photo.parse_photo($0) }
|
||||||
dict[-208488460] = { return Api.InputContact.parse_inputPhoneContact($0) }
|
dict[-208488460] = { return Api.InputContact.parse_inputPhoneContact($0) }
|
||||||
@ -413,11 +416,14 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-1107622874] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyChatInvite($0) }
|
dict[-1107622874] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyChatInvite($0) }
|
||||||
dict[-88417185] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyPhoneCall($0) }
|
dict[-88417185] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyPhoneCall($0) }
|
||||||
dict[-610373422] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyPhoneP2P($0) }
|
dict[-610373422] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyPhoneP2P($0) }
|
||||||
|
dict[-1529000952] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyForwards($0) }
|
||||||
|
dict[1461304012] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyProfilePhoto($0) }
|
||||||
dict[235081943] = { return Api.help.RecentMeUrls.parse_recentMeUrls($0) }
|
dict[235081943] = { return Api.help.RecentMeUrls.parse_recentMeUrls($0) }
|
||||||
dict[-1606526075] = { return Api.ReplyMarkup.parse_replyKeyboardHide($0) }
|
dict[-1606526075] = { return Api.ReplyMarkup.parse_replyKeyboardHide($0) }
|
||||||
dict[-200242528] = { return Api.ReplyMarkup.parse_replyKeyboardForceReply($0) }
|
dict[-200242528] = { return Api.ReplyMarkup.parse_replyKeyboardForceReply($0) }
|
||||||
dict[889353612] = { return Api.ReplyMarkup.parse_replyKeyboardMarkup($0) }
|
dict[889353612] = { return Api.ReplyMarkup.parse_replyKeyboardMarkup($0) }
|
||||||
dict[1218642516] = { return Api.ReplyMarkup.parse_replyInlineMarkup($0) }
|
dict[1218642516] = { return Api.ReplyMarkup.parse_replyInlineMarkup($0) }
|
||||||
|
dict[1556570557] = { return Api.EmojiKeywordsDifference.parse_emojiKeywordsDifference($0) }
|
||||||
dict[1493171408] = { return Api.HighScore.parse_highScore($0) }
|
dict[1493171408] = { return Api.HighScore.parse_highScore($0) }
|
||||||
dict[-305282981] = { return Api.TopPeer.parse_topPeer($0) }
|
dict[-305282981] = { return Api.TopPeer.parse_topPeer($0) }
|
||||||
dict[986597452] = { return Api.contacts.Link.parse_link($0) }
|
dict[986597452] = { return Api.contacts.Link.parse_link($0) }
|
||||||
@ -587,6 +593,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[364538944] = { return Api.messages.Dialogs.parse_dialogs($0) }
|
dict[364538944] = { return Api.messages.Dialogs.parse_dialogs($0) }
|
||||||
dict[1910543603] = { return Api.messages.Dialogs.parse_dialogsSlice($0) }
|
dict[1910543603] = { return Api.messages.Dialogs.parse_dialogsSlice($0) }
|
||||||
dict[-253500010] = { return Api.messages.Dialogs.parse_dialogsNotModified($0) }
|
dict[-253500010] = { return Api.messages.Dialogs.parse_dialogsNotModified($0) }
|
||||||
|
dict[-709641735] = { return Api.EmojiKeyword.parse_emojiKeyword($0) }
|
||||||
|
dict[594408994] = { return Api.EmojiKeyword.parse_emojiKeywordDeleted($0) }
|
||||||
dict[-290921362] = { return Api.upload.CdnFile.parse_cdnFileReuploadNeeded($0) }
|
dict[-290921362] = { return Api.upload.CdnFile.parse_cdnFileReuploadNeeded($0) }
|
||||||
dict[-1449145777] = { return Api.upload.CdnFile.parse_cdnFile($0) }
|
dict[-1449145777] = { return Api.upload.CdnFile.parse_cdnFile($0) }
|
||||||
dict[415997816] = { return Api.help.InviteText.parse_inviteText($0) }
|
dict[415997816] = { return Api.help.InviteText.parse_inviteText($0) }
|
||||||
@ -844,6 +852,8 @@ struct Api {
|
|||||||
_1.serialize(buffer, boxed)
|
_1.serialize(buffer, boxed)
|
||||||
case let _1 as Api.WallPaperSettings:
|
case let _1 as Api.WallPaperSettings:
|
||||||
_1.serialize(buffer, boxed)
|
_1.serialize(buffer, boxed)
|
||||||
|
case let _1 as Api.EmojiURL:
|
||||||
|
_1.serialize(buffer, boxed)
|
||||||
case let _1 as Api.channels.ChannelParticipant:
|
case let _1 as Api.channels.ChannelParticipant:
|
||||||
_1.serialize(buffer, boxed)
|
_1.serialize(buffer, boxed)
|
||||||
case let _1 as Api.InputCheckPasswordSRP:
|
case let _1 as Api.InputCheckPasswordSRP:
|
||||||
@ -1024,6 +1034,8 @@ struct Api {
|
|||||||
_1.serialize(buffer, boxed)
|
_1.serialize(buffer, boxed)
|
||||||
case let _1 as Api.ReplyMarkup:
|
case let _1 as Api.ReplyMarkup:
|
||||||
_1.serialize(buffer, boxed)
|
_1.serialize(buffer, boxed)
|
||||||
|
case let _1 as Api.EmojiKeywordsDifference:
|
||||||
|
_1.serialize(buffer, boxed)
|
||||||
case let _1 as Api.HighScore:
|
case let _1 as Api.HighScore:
|
||||||
_1.serialize(buffer, boxed)
|
_1.serialize(buffer, boxed)
|
||||||
case let _1 as Api.TopPeer:
|
case let _1 as Api.TopPeer:
|
||||||
@ -1184,6 +1196,8 @@ struct Api {
|
|||||||
_1.serialize(buffer, boxed)
|
_1.serialize(buffer, boxed)
|
||||||
case let _1 as Api.messages.Dialogs:
|
case let _1 as Api.messages.Dialogs:
|
||||||
_1.serialize(buffer, boxed)
|
_1.serialize(buffer, boxed)
|
||||||
|
case let _1 as Api.EmojiKeyword:
|
||||||
|
_1.serialize(buffer, boxed)
|
||||||
case let _1 as Api.upload.CdnFile:
|
case let _1 as Api.upload.CdnFile:
|
||||||
_1.serialize(buffer, boxed)
|
_1.serialize(buffer, boxed)
|
||||||
case let _1 as Api.help.InviteText:
|
case let _1 as Api.help.InviteText:
|
||||||
|
|||||||
@ -2882,6 +2882,40 @@ extension Api {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
enum EmojiURL: TypeConstructorDescription {
|
||||||
|
case EmojiURL(url: String)
|
||||||
|
|
||||||
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .EmojiURL(let url):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(1152191385)
|
||||||
|
}
|
||||||
|
serializeString(url, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .EmojiURL(let url):
|
||||||
|
return ("EmojiURL", [("url", url)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static func parse_EmojiURL(_ reader: BufferReader) -> EmojiURL? {
|
||||||
|
var _1: String?
|
||||||
|
_1 = parseString(reader)
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.EmojiURL.EmojiURL(url: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
enum InputCheckPasswordSRP: TypeConstructorDescription {
|
enum InputCheckPasswordSRP: TypeConstructorDescription {
|
||||||
case inputCheckPasswordEmpty
|
case inputCheckPasswordEmpty
|
||||||
@ -3678,6 +3712,8 @@ extension Api {
|
|||||||
case privacyKeyChatInvite
|
case privacyKeyChatInvite
|
||||||
case privacyKeyPhoneCall
|
case privacyKeyPhoneCall
|
||||||
case privacyKeyPhoneP2P
|
case privacyKeyPhoneP2P
|
||||||
|
case privacyKeyForwards
|
||||||
|
case privacyKeyProfilePhoto
|
||||||
|
|
||||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -3704,6 +3740,18 @@ extension Api {
|
|||||||
buffer.appendInt32(961092808)
|
buffer.appendInt32(961092808)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
case .privacyKeyForwards:
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(1777096355)
|
||||||
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
case .privacyKeyProfilePhoto:
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1777000467)
|
||||||
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3718,6 +3766,10 @@ extension Api {
|
|||||||
return ("privacyKeyPhoneCall", [])
|
return ("privacyKeyPhoneCall", [])
|
||||||
case .privacyKeyPhoneP2P:
|
case .privacyKeyPhoneP2P:
|
||||||
return ("privacyKeyPhoneP2P", [])
|
return ("privacyKeyPhoneP2P", [])
|
||||||
|
case .privacyKeyForwards:
|
||||||
|
return ("privacyKeyForwards", [])
|
||||||
|
case .privacyKeyProfilePhoto:
|
||||||
|
return ("privacyKeyProfilePhoto", [])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3733,6 +3785,12 @@ extension Api {
|
|||||||
static func parse_privacyKeyPhoneP2P(_ reader: BufferReader) -> PrivacyKey? {
|
static func parse_privacyKeyPhoneP2P(_ reader: BufferReader) -> PrivacyKey? {
|
||||||
return Api.PrivacyKey.privacyKeyPhoneP2P
|
return Api.PrivacyKey.privacyKeyPhoneP2P
|
||||||
}
|
}
|
||||||
|
static func parse_privacyKeyForwards(_ reader: BufferReader) -> PrivacyKey? {
|
||||||
|
return Api.PrivacyKey.privacyKeyForwards
|
||||||
|
}
|
||||||
|
static func parse_privacyKeyProfilePhoto(_ reader: BufferReader) -> PrivacyKey? {
|
||||||
|
return Api.PrivacyKey.privacyKeyProfilePhoto
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
enum Update: TypeConstructorDescription {
|
enum Update: TypeConstructorDescription {
|
||||||
@ -7296,13 +7354,13 @@ extension Api {
|
|||||||
|
|
||||||
}
|
}
|
||||||
enum StickerSet: TypeConstructorDescription {
|
enum StickerSet: TypeConstructorDescription {
|
||||||
case stickerSet(flags: Int32, installedDate: Int32?, id: Int64, accessHash: Int64, title: String, shortName: String, count: Int32, hash: Int32)
|
case stickerSet(flags: Int32, installedDate: Int32?, id: Int64, accessHash: Int64, title: String, shortName: String, thumb: Api.PhotoSize?, count: Int32, hash: Int32)
|
||||||
|
|
||||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .stickerSet(let flags, let installedDate, let id, let accessHash, let title, let shortName, let count, let hash):
|
case .stickerSet(let flags, let installedDate, let id, let accessHash, let title, let shortName, let thumb, let count, let hash):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(1434820921)
|
buffer.appendInt32(1787870391)
|
||||||
}
|
}
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(installedDate!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(installedDate!, buffer: buffer, boxed: false)}
|
||||||
@ -7310,6 +7368,7 @@ extension Api {
|
|||||||
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
serializeInt64(accessHash, buffer: buffer, boxed: false)
|
||||||
serializeString(title, buffer: buffer, boxed: false)
|
serializeString(title, buffer: buffer, boxed: false)
|
||||||
serializeString(shortName, buffer: buffer, boxed: false)
|
serializeString(shortName, buffer: buffer, boxed: false)
|
||||||
|
if Int(flags) & Int(1 << 4) != 0 {thumb!.serialize(buffer, true)}
|
||||||
serializeInt32(count, buffer: buffer, boxed: false)
|
serializeInt32(count, buffer: buffer, boxed: false)
|
||||||
serializeInt32(hash, buffer: buffer, boxed: false)
|
serializeInt32(hash, buffer: buffer, boxed: false)
|
||||||
break
|
break
|
||||||
@ -7318,8 +7377,8 @@ extension Api {
|
|||||||
|
|
||||||
func descriptionFields() -> (String, [(String, Any)]) {
|
func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
switch self {
|
switch self {
|
||||||
case .stickerSet(let flags, let installedDate, let id, let accessHash, let title, let shortName, let count, let hash):
|
case .stickerSet(let flags, let installedDate, let id, let accessHash, let title, let shortName, let thumb, let count, let hash):
|
||||||
return ("stickerSet", [("flags", flags), ("installedDate", installedDate), ("id", id), ("accessHash", accessHash), ("title", title), ("shortName", shortName), ("count", count), ("hash", hash)])
|
return ("stickerSet", [("flags", flags), ("installedDate", installedDate), ("id", id), ("accessHash", accessHash), ("title", title), ("shortName", shortName), ("thumb", thumb), ("count", count), ("hash", hash)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7336,20 +7395,25 @@ extension Api {
|
|||||||
_5 = parseString(reader)
|
_5 = parseString(reader)
|
||||||
var _6: String?
|
var _6: String?
|
||||||
_6 = parseString(reader)
|
_6 = parseString(reader)
|
||||||
var _7: Int32?
|
var _7: Api.PhotoSize?
|
||||||
_7 = reader.readInt32()
|
if Int(_1!) & Int(1 << 4) != 0 {if let signature = reader.readInt32() {
|
||||||
|
_7 = Api.parse(reader, signature: signature) as? Api.PhotoSize
|
||||||
|
} }
|
||||||
var _8: Int32?
|
var _8: Int32?
|
||||||
_8 = reader.readInt32()
|
_8 = reader.readInt32()
|
||||||
|
var _9: Int32?
|
||||||
|
_9 = reader.readInt32()
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
|
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
|
||||||
let _c3 = _3 != nil
|
let _c3 = _3 != nil
|
||||||
let _c4 = _4 != nil
|
let _c4 = _4 != nil
|
||||||
let _c5 = _5 != nil
|
let _c5 = _5 != nil
|
||||||
let _c6 = _6 != nil
|
let _c6 = _6 != nil
|
||||||
let _c7 = _7 != nil
|
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
|
||||||
let _c8 = _8 != nil
|
let _c8 = _8 != nil
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
|
let _c9 = _9 != nil
|
||||||
return Api.StickerSet.stickerSet(flags: _1!, installedDate: _2, id: _3!, accessHash: _4!, title: _5!, shortName: _6!, count: _7!, hash: _8!)
|
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
|
||||||
|
return Api.StickerSet.stickerSet(flags: _1!, installedDate: _2, id: _3!, accessHash: _4!, title: _5!, shortName: _6!, thumb: _7, count: _8!, hash: _9!)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
@ -10094,6 +10158,8 @@ extension Api {
|
|||||||
case inputPrivacyKeyChatInvite
|
case inputPrivacyKeyChatInvite
|
||||||
case inputPrivacyKeyPhoneCall
|
case inputPrivacyKeyPhoneCall
|
||||||
case inputPrivacyKeyPhoneP2P
|
case inputPrivacyKeyPhoneP2P
|
||||||
|
case inputPrivacyKeyForwards
|
||||||
|
case inputPrivacyKeyProfilePhoto
|
||||||
|
|
||||||
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -10120,6 +10186,18 @@ extension Api {
|
|||||||
buffer.appendInt32(-610373422)
|
buffer.appendInt32(-610373422)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
case .inputPrivacyKeyForwards:
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1529000952)
|
||||||
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
case .inputPrivacyKeyProfilePhoto:
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(1461304012)
|
||||||
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10134,6 +10212,10 @@ extension Api {
|
|||||||
return ("inputPrivacyKeyPhoneCall", [])
|
return ("inputPrivacyKeyPhoneCall", [])
|
||||||
case .inputPrivacyKeyPhoneP2P:
|
case .inputPrivacyKeyPhoneP2P:
|
||||||
return ("inputPrivacyKeyPhoneP2P", [])
|
return ("inputPrivacyKeyPhoneP2P", [])
|
||||||
|
case .inputPrivacyKeyForwards:
|
||||||
|
return ("inputPrivacyKeyForwards", [])
|
||||||
|
case .inputPrivacyKeyProfilePhoto:
|
||||||
|
return ("inputPrivacyKeyProfilePhoto", [])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10149,6 +10231,12 @@ extension Api {
|
|||||||
static func parse_inputPrivacyKeyPhoneP2P(_ reader: BufferReader) -> InputPrivacyKey? {
|
static func parse_inputPrivacyKeyPhoneP2P(_ reader: BufferReader) -> InputPrivacyKey? {
|
||||||
return Api.InputPrivacyKey.inputPrivacyKeyPhoneP2P
|
return Api.InputPrivacyKey.inputPrivacyKeyPhoneP2P
|
||||||
}
|
}
|
||||||
|
static func parse_inputPrivacyKeyForwards(_ reader: BufferReader) -> InputPrivacyKey? {
|
||||||
|
return Api.InputPrivacyKey.inputPrivacyKeyForwards
|
||||||
|
}
|
||||||
|
static func parse_inputPrivacyKeyProfilePhoto(_ reader: BufferReader) -> InputPrivacyKey? {
|
||||||
|
return Api.InputPrivacyKey.inputPrivacyKeyProfilePhoto
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
enum ReplyMarkup: TypeConstructorDescription {
|
enum ReplyMarkup: TypeConstructorDescription {
|
||||||
@ -10260,6 +10348,58 @@ extension Api {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
enum EmojiKeywordsDifference: TypeConstructorDescription {
|
||||||
|
case emojiKeywordsDifference(langCode: String, fromVersion: Int32, version: Int32, keywords: [Api.EmojiKeyword])
|
||||||
|
|
||||||
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .emojiKeywordsDifference(let langCode, let fromVersion, let version, let keywords):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(1556570557)
|
||||||
|
}
|
||||||
|
serializeString(langCode, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(fromVersion, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(version, buffer: buffer, boxed: false)
|
||||||
|
buffer.appendInt32(481674261)
|
||||||
|
buffer.appendInt32(Int32(keywords.count))
|
||||||
|
for item in keywords {
|
||||||
|
item.serialize(buffer, true)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .emojiKeywordsDifference(let langCode, let fromVersion, let version, let keywords):
|
||||||
|
return ("emojiKeywordsDifference", [("langCode", langCode), ("fromVersion", fromVersion), ("version", version), ("keywords", keywords)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static func parse_emojiKeywordsDifference(_ reader: BufferReader) -> EmojiKeywordsDifference? {
|
||||||
|
var _1: String?
|
||||||
|
_1 = parseString(reader)
|
||||||
|
var _2: Int32?
|
||||||
|
_2 = reader.readInt32()
|
||||||
|
var _3: Int32?
|
||||||
|
_3 = reader.readInt32()
|
||||||
|
var _4: [Api.EmojiKeyword]?
|
||||||
|
if let _ = reader.readInt32() {
|
||||||
|
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.EmojiKeyword.self)
|
||||||
|
}
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
let _c3 = _3 != nil
|
||||||
|
let _c4 = _4 != nil
|
||||||
|
if _c1 && _c2 && _c3 && _c4 {
|
||||||
|
return Api.EmojiKeywordsDifference.emojiKeywordsDifference(langCode: _1!, fromVersion: _2!, version: _3!, keywords: _4!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
enum HighScore: TypeConstructorDescription {
|
enum HighScore: TypeConstructorDescription {
|
||||||
case highScore(pos: Int32, userId: Int32, score: Int32)
|
case highScore(pos: Int32, userId: Int32, score: Int32)
|
||||||
@ -14826,6 +14966,80 @@ extension Api {
|
|||||||
return Api.MessagesFilter.inputMessagesFilterContacts
|
return Api.MessagesFilter.inputMessagesFilterContacts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
enum EmojiKeyword: TypeConstructorDescription {
|
||||||
|
case emojiKeyword(keyword: String, emoticons: [String])
|
||||||
|
case emojiKeywordDeleted(keyword: String, emoticons: [String])
|
||||||
|
|
||||||
|
func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .emojiKeyword(let keyword, let emoticons):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-709641735)
|
||||||
|
}
|
||||||
|
serializeString(keyword, buffer: buffer, boxed: false)
|
||||||
|
buffer.appendInt32(481674261)
|
||||||
|
buffer.appendInt32(Int32(emoticons.count))
|
||||||
|
for item in emoticons {
|
||||||
|
serializeString(item, buffer: buffer, boxed: false)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case .emojiKeywordDeleted(let keyword, let emoticons):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(594408994)
|
||||||
|
}
|
||||||
|
serializeString(keyword, buffer: buffer, boxed: false)
|
||||||
|
buffer.appendInt32(481674261)
|
||||||
|
buffer.appendInt32(Int32(emoticons.count))
|
||||||
|
for item in emoticons {
|
||||||
|
serializeString(item, buffer: buffer, boxed: false)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .emojiKeyword(let keyword, let emoticons):
|
||||||
|
return ("emojiKeyword", [("keyword", keyword), ("emoticons", emoticons)])
|
||||||
|
case .emojiKeywordDeleted(let keyword, let emoticons):
|
||||||
|
return ("emojiKeywordDeleted", [("keyword", keyword), ("emoticons", emoticons)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static func parse_emojiKeyword(_ reader: BufferReader) -> EmojiKeyword? {
|
||||||
|
var _1: String?
|
||||||
|
_1 = parseString(reader)
|
||||||
|
var _2: [String]?
|
||||||
|
if let _ = reader.readInt32() {
|
||||||
|
_2 = Api.parseVector(reader, elementSignature: -1255641564, elementType: String.self)
|
||||||
|
}
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
if _c1 && _c2 {
|
||||||
|
return Api.EmojiKeyword.emojiKeyword(keyword: _1!, emoticons: _2!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static func parse_emojiKeywordDeleted(_ reader: BufferReader) -> EmojiKeyword? {
|
||||||
|
var _1: String?
|
||||||
|
_1 = parseString(reader)
|
||||||
|
var _2: [String]?
|
||||||
|
if let _ = reader.readInt32() {
|
||||||
|
_2 = Api.parseVector(reader, elementSignature: -1255641564, elementType: String.self)
|
||||||
|
}
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
if _c1 && _c2 {
|
||||||
|
return Api.EmojiKeyword.emojiKeywordDeleted(keyword: _1!, emoticons: _2!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
enum BotInlineMessage: TypeConstructorDescription {
|
enum BotInlineMessage: TypeConstructorDescription {
|
||||||
case botInlineMessageText(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?)
|
case botInlineMessageText(flags: Int32, message: String, entities: [Api.MessageEntity]?, replyMarkup: Api.ReplyMarkup?)
|
||||||
|
|||||||
@ -2846,6 +2846,49 @@ extension Api {
|
|||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static func getEmojiKeywords(langCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.EmojiKeywordsDifference>) {
|
||||||
|
let buffer = Buffer()
|
||||||
|
buffer.appendInt32(899735650)
|
||||||
|
serializeString(langCode, buffer: buffer, boxed: false)
|
||||||
|
return (FunctionDescription(name: "messages.getEmojiKeywords", parameters: [("langCode", langCode)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.EmojiKeywordsDifference? in
|
||||||
|
let reader = BufferReader(buffer)
|
||||||
|
var result: Api.EmojiKeywordsDifference?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
result = Api.parse(reader, signature: signature) as? Api.EmojiKeywordsDifference
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
static func getEmojiKeywordsDifference(langCode: String, fromVersion: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.EmojiKeywordsDifference>) {
|
||||||
|
let buffer = Buffer()
|
||||||
|
buffer.appendInt32(352892591)
|
||||||
|
serializeString(langCode, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(fromVersion, buffer: buffer, boxed: false)
|
||||||
|
return (FunctionDescription(name: "messages.getEmojiKeywordsDifference", parameters: [("langCode", langCode), ("fromVersion", fromVersion)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.EmojiKeywordsDifference? in
|
||||||
|
let reader = BufferReader(buffer)
|
||||||
|
var result: Api.EmojiKeywordsDifference?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
result = Api.parse(reader, signature: signature) as? Api.EmojiKeywordsDifference
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
static func getEmojiURL(langCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.EmojiURL>) {
|
||||||
|
let buffer = Buffer()
|
||||||
|
buffer.appendInt32(-709817306)
|
||||||
|
serializeString(langCode, buffer: buffer, boxed: false)
|
||||||
|
return (FunctionDescription(name: "messages.getEmojiURL", parameters: [("langCode", langCode)]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.EmojiURL? in
|
||||||
|
let reader = BufferReader(buffer)
|
||||||
|
var result: Api.EmojiURL?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
result = Api.parse(reader, signature: signature) as? Api.EmojiURL
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
struct channels {
|
struct channels {
|
||||||
static func readHistory(channel: Api.InputChannel, maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
static func readHistory(channel: Api.InputChannel, maxId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||||
|
|||||||
@ -45,7 +45,7 @@ func updatedRemoteStickerPack(postbox: Postbox, network: Network, reference: Sti
|
|||||||
case let .stickerSet(set, packs, documents):
|
case let .stickerSet(set, packs, documents):
|
||||||
let namespace: ItemCollectionId.Namespace
|
let namespace: ItemCollectionId.Namespace
|
||||||
switch set {
|
switch set {
|
||||||
case let .stickerSet(flags, _, _, _, _, _, _, _):
|
case let .stickerSet(flags, _, _, _, _, _, _, _, _):
|
||||||
if (flags & (1 << 3)) != 0 {
|
if (flags & (1 << 3)) != 0 {
|
||||||
namespace = Namespaces.ItemCollection.CloudMaskPacks
|
namespace = Namespaces.ItemCollection.CloudMaskPacks
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -7,11 +7,11 @@ import SwiftSignalKit
|
|||||||
import Postbox
|
import Postbox
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public final class NotificationExceptionsList : Equatable {
|
public final class NotificationExceptionsList: Equatable {
|
||||||
public let peers:[PeerId: Peer]
|
public let peers: [PeerId: Peer]
|
||||||
public let settings: [PeerId: TelegramPeerNotificationSettings]
|
public let settings: [PeerId: TelegramPeerNotificationSettings]
|
||||||
|
|
||||||
init(_ peers:[PeerId: Peer], _ settings: [PeerId : TelegramPeerNotificationSettings]) {
|
init(peers: [PeerId: Peer], settings: [PeerId: TelegramPeerNotificationSettings]) {
|
||||||
self.peers = peers
|
self.peers = peers
|
||||||
self.settings = settings
|
self.settings = settings
|
||||||
}
|
}
|
||||||
@ -21,50 +21,49 @@ public final class NotificationExceptionsList : Equatable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public func notificationExceptionsList(network: Network) -> Signal<NotificationExceptionsList, NoError> {
|
public func notificationExceptionsList(network: Network) -> Signal<NotificationExceptionsList, NoError> {
|
||||||
return network.request(Api.functions.account.getNotifyExceptions(flags: 1 << 1, peer: nil)) |> retryRequest |> map { result in
|
return network.request(Api.functions.account.getNotifyExceptions(flags: 1 << 1, peer: nil)) |> retryRequest |> map { result in
|
||||||
switch result {
|
switch result {
|
||||||
case let .updates(updates, users, chats, _, _):
|
case let .updates(updates, users, chats, _, _):
|
||||||
var peers:[PeerId: Peer] = [:]
|
var peers:[PeerId: Peer] = [:]
|
||||||
var settings:[PeerId : TelegramPeerNotificationSettings] = [:]
|
var settings:[PeerId : TelegramPeerNotificationSettings] = [:]
|
||||||
|
|
||||||
for user in users {
|
for user in users {
|
||||||
let peer = TelegramUser(user: user)
|
let peer = TelegramUser(user: user)
|
||||||
peers[peer.id] = peer
|
|
||||||
}
|
|
||||||
for chat in chats {
|
|
||||||
if let peer = parseTelegramGroupOrChannel(chat: chat) {
|
|
||||||
peers[peer.id] = peer
|
peers[peer.id] = peer
|
||||||
}
|
}
|
||||||
}
|
for chat in chats {
|
||||||
|
if let peer = parseTelegramGroupOrChannel(chat: chat) {
|
||||||
for update in updates {
|
peers[peer.id] = peer
|
||||||
switch update {
|
|
||||||
case let .updateNotifySettings(apiPeer, notifySettings):
|
|
||||||
switch apiPeer {
|
|
||||||
case let .notifyPeer(notifyPeer):
|
|
||||||
let peerId: PeerId
|
|
||||||
switch notifyPeer {
|
|
||||||
case let .peerUser(userId):
|
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: userId)
|
|
||||||
case let .peerChat(chatId):
|
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
|
||||||
case let .peerChannel(channelId):
|
|
||||||
peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId)
|
|
||||||
}
|
|
||||||
settings[peerId] = TelegramPeerNotificationSettings(apiSettings: notifySettings)
|
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
for update in updates {
|
||||||
return NotificationExceptionsList(peers, settings)
|
switch update {
|
||||||
default:
|
case let .updateNotifySettings(apiPeer, notifySettings):
|
||||||
return NotificationExceptionsList([:], [:])
|
switch apiPeer {
|
||||||
|
case let .notifyPeer(notifyPeer):
|
||||||
|
let peerId: PeerId
|
||||||
|
switch notifyPeer {
|
||||||
|
case let .peerUser(userId):
|
||||||
|
peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: userId)
|
||||||
|
case let .peerChat(chatId):
|
||||||
|
peerId = PeerId(namespace: Namespaces.Peer.CloudGroup, id: chatId)
|
||||||
|
case let .peerChannel(channelId):
|
||||||
|
peerId = PeerId(namespace: Namespaces.Peer.CloudChannel, id: channelId)
|
||||||
|
}
|
||||||
|
settings[peerId] = TelegramPeerNotificationSettings(apiSettings: notifySettings)
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NotificationExceptionsList(peers: peers, settings: settings)
|
||||||
|
default:
|
||||||
|
return NotificationExceptionsList(peers: [:], settings: [:])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,14 +61,18 @@ public struct AccountPrivacySettings: Equatable {
|
|||||||
public let groupInvitations: SelectivePrivacySettings
|
public let groupInvitations: SelectivePrivacySettings
|
||||||
public let voiceCalls: SelectivePrivacySettings
|
public let voiceCalls: SelectivePrivacySettings
|
||||||
public let voiceCallsP2P: SelectivePrivacySettings
|
public let voiceCallsP2P: SelectivePrivacySettings
|
||||||
|
public let profilePhoto: SelectivePrivacySettings
|
||||||
|
public let forwards: SelectivePrivacySettings
|
||||||
|
|
||||||
public let accountRemovalTimeout: Int32
|
public let accountRemovalTimeout: Int32
|
||||||
|
|
||||||
public init(presence: SelectivePrivacySettings, groupInvitations: SelectivePrivacySettings, voiceCalls: SelectivePrivacySettings, voiceCallsP2P: SelectivePrivacySettings, accountRemovalTimeout: Int32) {
|
public init(presence: SelectivePrivacySettings, groupInvitations: SelectivePrivacySettings, voiceCalls: SelectivePrivacySettings, voiceCallsP2P: SelectivePrivacySettings, profilePhoto: SelectivePrivacySettings, forwards: SelectivePrivacySettings, accountRemovalTimeout: Int32) {
|
||||||
self.presence = presence
|
self.presence = presence
|
||||||
self.groupInvitations = groupInvitations
|
self.groupInvitations = groupInvitations
|
||||||
self.voiceCalls = voiceCalls
|
self.voiceCalls = voiceCalls
|
||||||
self.voiceCallsP2P = voiceCallsP2P
|
self.voiceCallsP2P = voiceCallsP2P
|
||||||
|
self.profilePhoto = profilePhoto
|
||||||
|
self.forwards = forwards
|
||||||
self.accountRemovalTimeout = accountRemovalTimeout
|
self.accountRemovalTimeout = accountRemovalTimeout
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +89,12 @@ public struct AccountPrivacySettings: Equatable {
|
|||||||
if lhs.voiceCallsP2P != rhs.voiceCallsP2P {
|
if lhs.voiceCallsP2P != rhs.voiceCallsP2P {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if lhs.profilePhoto != rhs.profilePhoto {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if lhs.forwards != rhs.forwards {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if lhs.accountRemovalTimeout != rhs.accountRemovalTimeout {
|
if lhs.accountRemovalTimeout != rhs.accountRemovalTimeout {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -202,7 +202,7 @@ public class BoxedMessage: NSObject {
|
|||||||
|
|
||||||
public class Serialization: NSObject, MTSerialization {
|
public class Serialization: NSObject, MTSerialization {
|
||||||
public func currentLayer() -> UInt {
|
public func currentLayer() -> UInt {
|
||||||
return 96
|
return 97
|
||||||
}
|
}
|
||||||
|
|
||||||
public func parseMessage(_ data: Data!) -> Any! {
|
public func parseMessage(_ data: Data!) -> Any! {
|
||||||
|
|||||||
@ -148,7 +148,7 @@ public final class StickerPackItem: ItemCollectionItem, Equatable {
|
|||||||
extension StickerPackCollectionInfo {
|
extension StickerPackCollectionInfo {
|
||||||
convenience init(apiSet: Api.StickerSet, namespace: ItemCollectionId.Namespace) {
|
convenience init(apiSet: Api.StickerSet, namespace: ItemCollectionId.Namespace) {
|
||||||
switch apiSet {
|
switch apiSet {
|
||||||
case let .stickerSet(flags, _, id, accessHash, title, shortName, count, nHash):
|
case let .stickerSet(flags, _, id, accessHash, title, shortName, thumb, count, nHash):
|
||||||
var setFlags: StickerPackCollectionInfoFlags = StickerPackCollectionInfoFlags()
|
var setFlags: StickerPackCollectionInfoFlags = StickerPackCollectionInfoFlags()
|
||||||
if (flags & (1 << 2)) != 0 {
|
if (flags & (1 << 2)) != 0 {
|
||||||
setFlags.insert(.official)
|
setFlags.insert(.official)
|
||||||
|
|||||||
@ -324,7 +324,7 @@ func fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId: PeerId, network
|
|||||||
let stickerPack: StickerPackCollectionInfo? = stickerSet.flatMap { apiSet -> StickerPackCollectionInfo in
|
let stickerPack: StickerPackCollectionInfo? = stickerSet.flatMap { apiSet -> StickerPackCollectionInfo in
|
||||||
let namespace: ItemCollectionId.Namespace
|
let namespace: ItemCollectionId.Namespace
|
||||||
switch apiSet {
|
switch apiSet {
|
||||||
case let .stickerSet(flags, _, _, _, _, _, _, _):
|
case let .stickerSet(flags, _, _, _, _, _, _, _, _):
|
||||||
if (flags & (1 << 3)) != 0 {
|
if (flags & (1 << 3)) != 0 {
|
||||||
namespace = Namespaces.ItemCollection.CloudMaskPacks
|
namespace = Namespaces.ItemCollection.CloudMaskPacks
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -12,10 +12,12 @@ public func requestAccountPrivacySettings(account: Account) -> Signal<AccountPri
|
|||||||
let groupPrivacy = account.network.request(Api.functions.account.getPrivacy(key: .inputPrivacyKeyChatInvite))
|
let groupPrivacy = account.network.request(Api.functions.account.getPrivacy(key: .inputPrivacyKeyChatInvite))
|
||||||
let voiceCallPrivacy = account.network.request(Api.functions.account.getPrivacy(key: .inputPrivacyKeyPhoneCall))
|
let voiceCallPrivacy = account.network.request(Api.functions.account.getPrivacy(key: .inputPrivacyKeyPhoneCall))
|
||||||
let voiceCallP2P = account.network.request(Api.functions.account.getPrivacy(key: .inputPrivacyKeyPhoneP2P))
|
let voiceCallP2P = account.network.request(Api.functions.account.getPrivacy(key: .inputPrivacyKeyPhoneP2P))
|
||||||
|
let profilePhotoPrivacy = account.network.request(Api.functions.account.getPrivacy(key: .inputPrivacyKeyProfilePhoto))
|
||||||
|
let forwardPrivacy = account.network.request(Api.functions.account.getPrivacy(key: .inputPrivacyKeyForwards))
|
||||||
let autoremoveTimeout = account.network.request(Api.functions.account.getAccountTTL())
|
let autoremoveTimeout = account.network.request(Api.functions.account.getAccountTTL())
|
||||||
return combineLatest(lastSeenPrivacy, groupPrivacy, voiceCallPrivacy, voiceCallP2P, autoremoveTimeout)
|
return combineLatest(lastSeenPrivacy, groupPrivacy, voiceCallPrivacy, voiceCallP2P, profilePhotoPrivacy, forwardPrivacy, autoremoveTimeout)
|
||||||
|> retryRequest
|
|> retryRequest
|
||||||
|> mapToSignal { lastSeenPrivacy, groupPrivacy, voiceCallPrivacy, voiceCallP2P, autoremoveTimeout -> Signal<AccountPrivacySettings, NoError> in
|
|> mapToSignal { lastSeenPrivacy, groupPrivacy, voiceCallPrivacy, voiceCallP2P, profilePhotoPrivacy, forwardPrivacy, autoremoveTimeout -> Signal<AccountPrivacySettings, NoError> in
|
||||||
let accountTimeoutSeconds: Int32
|
let accountTimeoutSeconds: Int32
|
||||||
switch autoremoveTimeout {
|
switch autoremoveTimeout {
|
||||||
case let .accountDaysTTL(days):
|
case let .accountDaysTTL(days):
|
||||||
@ -27,6 +29,8 @@ public func requestAccountPrivacySettings(account: Account) -> Signal<AccountPri
|
|||||||
let groupRules: [Api.PrivacyRule]
|
let groupRules: [Api.PrivacyRule]
|
||||||
let voiceRules: [Api.PrivacyRule]
|
let voiceRules: [Api.PrivacyRule]
|
||||||
let voiceP2PRules: [Api.PrivacyRule]
|
let voiceP2PRules: [Api.PrivacyRule]
|
||||||
|
let profilePhotoRules: [Api.PrivacyRule]
|
||||||
|
let forwardRules: [Api.PrivacyRule]
|
||||||
var apiUsers: [Api.User] = []
|
var apiUsers: [Api.User] = []
|
||||||
|
|
||||||
switch lastSeenPrivacy {
|
switch lastSeenPrivacy {
|
||||||
@ -53,6 +57,18 @@ public func requestAccountPrivacySettings(account: Account) -> Signal<AccountPri
|
|||||||
voiceP2PRules = rules
|
voiceP2PRules = rules
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch profilePhotoPrivacy {
|
||||||
|
case let .privacyRules(rules, users):
|
||||||
|
apiUsers.append(contentsOf: users)
|
||||||
|
profilePhotoRules = rules
|
||||||
|
}
|
||||||
|
|
||||||
|
switch forwardPrivacy {
|
||||||
|
case let .privacyRules(rules, users):
|
||||||
|
apiUsers.append(contentsOf: users)
|
||||||
|
forwardRules = rules
|
||||||
|
}
|
||||||
|
|
||||||
let peers = apiUsers.map { TelegramUser(user: $0) }
|
let peers = apiUsers.map { TelegramUser(user: $0) }
|
||||||
|
|
||||||
return account.postbox.transaction { transaction -> AccountPrivacySettings in
|
return account.postbox.transaction { transaction -> AccountPrivacySettings in
|
||||||
@ -60,7 +76,7 @@ public func requestAccountPrivacySettings(account: Account) -> Signal<AccountPri
|
|||||||
return updated
|
return updated
|
||||||
})
|
})
|
||||||
|
|
||||||
return AccountPrivacySettings(presence: SelectivePrivacySettings(apiRules: lastSeenRules), groupInvitations: SelectivePrivacySettings(apiRules: groupRules), voiceCalls: SelectivePrivacySettings(apiRules: voiceRules), voiceCallsP2P: SelectivePrivacySettings(apiRules: voiceP2PRules), accountRemovalTimeout: accountTimeoutSeconds)
|
return AccountPrivacySettings(presence: SelectivePrivacySettings(apiRules: lastSeenRules), groupInvitations: SelectivePrivacySettings(apiRules: groupRules), voiceCalls: SelectivePrivacySettings(apiRules: voiceRules), voiceCallsP2P: SelectivePrivacySettings(apiRules: voiceP2PRules), profilePhoto: SelectivePrivacySettings(apiRules: profilePhotoRules), forwards: SelectivePrivacySettings(apiRules: forwardRules), accountRemovalTimeout: accountTimeoutSeconds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,6 +94,8 @@ public enum UpdateSelectiveAccountPrivacySettingsType {
|
|||||||
case groupInvitations
|
case groupInvitations
|
||||||
case voiceCalls
|
case voiceCalls
|
||||||
case voiceCallsP2P
|
case voiceCallsP2P
|
||||||
|
case profilePhoto
|
||||||
|
case forwards
|
||||||
|
|
||||||
var apiKey: Api.InputPrivacyKey {
|
var apiKey: Api.InputPrivacyKey {
|
||||||
switch self {
|
switch self {
|
||||||
@ -89,6 +107,10 @@ public enum UpdateSelectiveAccountPrivacySettingsType {
|
|||||||
return .inputPrivacyKeyPhoneCall
|
return .inputPrivacyKeyPhoneCall
|
||||||
case .voiceCallsP2P:
|
case .voiceCallsP2P:
|
||||||
return .inputPrivacyKeyPhoneP2P
|
return .inputPrivacyKeyPhoneP2P
|
||||||
|
case .profilePhoto:
|
||||||
|
return .inputPrivacyKeyProfilePhoto
|
||||||
|
case .forwards:
|
||||||
|
return .inputPrivacyKeyForwards
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user