mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Update API
This commit is contained in:
parent
64b02c95ce
commit
9d5f08d53e
@ -2755,9 +2755,10 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
self.context.engine.data.get(
|
self.context.engine.data.get(
|
||||||
EngineDataList(data.includePeers.peers.map(TelegramEngine.EngineData.Item.Peer.Peer.init(id:)))
|
EngineDataList(data.includePeers.peers.map(TelegramEngine.EngineData.Item.Peer.Peer.init(id:)))
|
||||||
),
|
),
|
||||||
self.context.engine.peers.getExportedChatFolderLinks(id: id)
|
self.context.engine.peers.getExportedChatFolderLinks(id: id),
|
||||||
|
self.context.engine.peers.requestLeaveChatFolderSuggestions(folderId: id)
|
||||||
)
|
)
|
||||||
|> deliverOnMainQueue).start(next: { [weak self] peers, links in
|
|> deliverOnMainQueue).start(next: { [weak self] peers, links, defaultSelectedPeerIds in
|
||||||
guard let self else {
|
guard let self else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -2776,7 +2777,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
|
|
||||||
let previewScreen = ChatFolderLinkPreviewScreen(
|
let previewScreen = ChatFolderLinkPreviewScreen(
|
||||||
context: self.context,
|
context: self.context,
|
||||||
subject: .remove(folderId: id),
|
subject: .remove(folderId: id, defaultSelectedPeerIds: defaultSelectedPeerIds),
|
||||||
contents: ChatFolderLinkContents(
|
contents: ChatFolderLinkContents(
|
||||||
localFilterId: id,
|
localFilterId: id,
|
||||||
title: title,
|
title: title,
|
||||||
|
@ -395,9 +395,10 @@ public func chatListFilterPresetListController(context: AccountContext, mode: Ch
|
|||||||
context.engine.data.get(
|
context.engine.data.get(
|
||||||
EngineDataList(data.includePeers.peers.map(TelegramEngine.EngineData.Item.Peer.Peer.init(id:)))
|
EngineDataList(data.includePeers.peers.map(TelegramEngine.EngineData.Item.Peer.Peer.init(id:)))
|
||||||
),
|
),
|
||||||
context.engine.peers.getExportedChatFolderLinks(id: id)
|
context.engine.peers.getExportedChatFolderLinks(id: id),
|
||||||
|
context.engine.peers.requestLeaveChatFolderSuggestions(folderId: id)
|
||||||
)
|
)
|
||||||
|> deliverOnMainQueue).start(next: { peers, links in
|
|> deliverOnMainQueue).start(next: { peers, links, defaultSelectedPeerIds in
|
||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
|
|
||||||
var hasLinks = false
|
var hasLinks = false
|
||||||
@ -408,7 +409,7 @@ public func chatListFilterPresetListController(context: AccountContext, mode: Ch
|
|||||||
let confirmDeleteFolder: () -> Void = {
|
let confirmDeleteFolder: () -> Void = {
|
||||||
let previewScreen = ChatFolderLinkPreviewScreen(
|
let previewScreen = ChatFolderLinkPreviewScreen(
|
||||||
context: context,
|
context: context,
|
||||||
subject: .remove(folderId: id),
|
subject: .remove(folderId: id, defaultSelectedPeerIds: defaultSelectedPeerIds),
|
||||||
contents: ChatFolderLinkContents(
|
contents: ChatFolderLinkContents(
|
||||||
localFilterId: id,
|
localFilterId: id,
|
||||||
title: title,
|
title: title,
|
||||||
|
@ -476,6 +476,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-648257196] = { return Api.MessageAction.parse_messageActionSecureValuesSent($0) }
|
dict[-648257196] = { return Api.MessageAction.parse_messageActionSecureValuesSent($0) }
|
||||||
dict[455635795] = { return Api.MessageAction.parse_messageActionSecureValuesSentMe($0) }
|
dict[455635795] = { return Api.MessageAction.parse_messageActionSecureValuesSentMe($0) }
|
||||||
dict[-1434950843] = { return Api.MessageAction.parse_messageActionSetChatTheme($0) }
|
dict[-1434950843] = { return Api.MessageAction.parse_messageActionSetChatTheme($0) }
|
||||||
|
dict[-1136350937] = { return Api.MessageAction.parse_messageActionSetChatWallPaper($0) }
|
||||||
dict[1007897979] = { return Api.MessageAction.parse_messageActionSetMessagesTTL($0) }
|
dict[1007897979] = { return Api.MessageAction.parse_messageActionSetMessagesTTL($0) }
|
||||||
dict[1474192222] = { return Api.MessageAction.parse_messageActionSuggestProfilePhoto($0) }
|
dict[1474192222] = { return Api.MessageAction.parse_messageActionSuggestProfilePhoto($0) }
|
||||||
dict[228168278] = { return Api.MessageAction.parse_messageActionTopicCreate($0) }
|
dict[228168278] = { return Api.MessageAction.parse_messageActionTopicCreate($0) }
|
||||||
@ -913,7 +914,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-1831650802] = { return Api.UrlAuthResult.parse_urlAuthResultRequest($0) }
|
dict[-1831650802] = { return Api.UrlAuthResult.parse_urlAuthResultRequest($0) }
|
||||||
dict[-1885878744] = { return Api.User.parse_user($0) }
|
dict[-1885878744] = { return Api.User.parse_user($0) }
|
||||||
dict[-742634630] = { return Api.User.parse_userEmpty($0) }
|
dict[-742634630] = { return Api.User.parse_userEmpty($0) }
|
||||||
dict[-120378643] = { return Api.UserFull.parse_userFull($0) }
|
dict[-1813324973] = { return Api.UserFull.parse_userFull($0) }
|
||||||
dict[-2100168954] = { return Api.UserProfilePhoto.parse_userProfilePhoto($0) }
|
dict[-2100168954] = { return Api.UserProfilePhoto.parse_userProfilePhoto($0) }
|
||||||
dict[1326562017] = { return Api.UserProfilePhoto.parse_userProfilePhotoEmpty($0) }
|
dict[1326562017] = { return Api.UserProfilePhoto.parse_userProfilePhotoEmpty($0) }
|
||||||
dict[164646985] = { return Api.UserStatus.parse_userStatusEmpty($0) }
|
dict[164646985] = { return Api.UserStatus.parse_userStatusEmpty($0) }
|
||||||
|
@ -261,6 +261,7 @@ public extension Api {
|
|||||||
case messageActionSecureValuesSent(types: [Api.SecureValueType])
|
case messageActionSecureValuesSent(types: [Api.SecureValueType])
|
||||||
case messageActionSecureValuesSentMe(values: [Api.SecureValue], credentials: Api.SecureCredentialsEncrypted)
|
case messageActionSecureValuesSentMe(values: [Api.SecureValue], credentials: Api.SecureCredentialsEncrypted)
|
||||||
case messageActionSetChatTheme(emoticon: String)
|
case messageActionSetChatTheme(emoticon: String)
|
||||||
|
case messageActionSetChatWallPaper(wallpaper: Api.WallPaper)
|
||||||
case messageActionSetMessagesTTL(flags: Int32, period: Int32, autoSettingFrom: Int64?)
|
case messageActionSetMessagesTTL(flags: Int32, period: Int32, autoSettingFrom: Int64?)
|
||||||
case messageActionSuggestProfilePhoto(photo: Api.Photo)
|
case messageActionSuggestProfilePhoto(photo: Api.Photo)
|
||||||
case messageActionTopicCreate(flags: Int32, title: String, iconColor: Int32, iconEmojiId: Int64?)
|
case messageActionTopicCreate(flags: Int32, title: String, iconColor: Int32, iconEmojiId: Int64?)
|
||||||
@ -506,6 +507,12 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
serializeString(emoticon, buffer: buffer, boxed: false)
|
serializeString(emoticon, buffer: buffer, boxed: false)
|
||||||
break
|
break
|
||||||
|
case .messageActionSetChatWallPaper(let wallpaper):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1136350937)
|
||||||
|
}
|
||||||
|
wallpaper.serialize(buffer, true)
|
||||||
|
break
|
||||||
case .messageActionSetMessagesTTL(let flags, let period, let autoSettingFrom):
|
case .messageActionSetMessagesTTL(let flags, let period, let autoSettingFrom):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(1007897979)
|
buffer.appendInt32(1007897979)
|
||||||
@ -619,6 +626,8 @@ public extension Api {
|
|||||||
return ("messageActionSecureValuesSentMe", [("values", values as Any), ("credentials", credentials as Any)])
|
return ("messageActionSecureValuesSentMe", [("values", values as Any), ("credentials", credentials as Any)])
|
||||||
case .messageActionSetChatTheme(let emoticon):
|
case .messageActionSetChatTheme(let emoticon):
|
||||||
return ("messageActionSetChatTheme", [("emoticon", emoticon as Any)])
|
return ("messageActionSetChatTheme", [("emoticon", emoticon as Any)])
|
||||||
|
case .messageActionSetChatWallPaper(let wallpaper):
|
||||||
|
return ("messageActionSetChatWallPaper", [("wallpaper", wallpaper as Any)])
|
||||||
case .messageActionSetMessagesTTL(let flags, let period, let autoSettingFrom):
|
case .messageActionSetMessagesTTL(let flags, let period, let autoSettingFrom):
|
||||||
return ("messageActionSetMessagesTTL", [("flags", flags as Any), ("period", period as Any), ("autoSettingFrom", autoSettingFrom as Any)])
|
return ("messageActionSetMessagesTTL", [("flags", flags as Any), ("period", period as Any), ("autoSettingFrom", autoSettingFrom as Any)])
|
||||||
case .messageActionSuggestProfilePhoto(let photo):
|
case .messageActionSuggestProfilePhoto(let photo):
|
||||||
@ -1043,6 +1052,19 @@ public extension Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static func parse_messageActionSetChatWallPaper(_ reader: BufferReader) -> MessageAction? {
|
||||||
|
var _1: Api.WallPaper?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_1 = Api.parse(reader, signature: signature) as? Api.WallPaper
|
||||||
|
}
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.MessageAction.messageActionSetChatWallPaper(wallpaper: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
public static func parse_messageActionSetMessagesTTL(_ reader: BufferReader) -> MessageAction? {
|
public static func parse_messageActionSetMessagesTTL(_ reader: BufferReader) -> MessageAction? {
|
||||||
var _1: Int32?
|
var _1: Int32?
|
||||||
_1 = reader.readInt32()
|
_1 = reader.readInt32()
|
||||||
|
@ -586,13 +586,13 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
public extension Api {
|
public extension Api {
|
||||||
enum UserFull: TypeConstructorDescription {
|
enum UserFull: TypeConstructorDescription {
|
||||||
case userFull(flags: Int32, id: Int64, about: String?, settings: Api.PeerSettings, personalPhoto: Api.Photo?, profilePhoto: Api.Photo?, fallbackPhoto: Api.Photo?, notifySettings: Api.PeerNotifySettings, botInfo: Api.BotInfo?, pinnedMsgId: Int32?, commonChatsCount: Int32, folderId: Int32?, ttlPeriod: Int32?, themeEmoticon: String?, privateForwardName: String?, botGroupAdminRights: Api.ChatAdminRights?, botBroadcastAdminRights: Api.ChatAdminRights?, premiumGifts: [Api.PremiumGiftOption]?)
|
case userFull(flags: Int32, id: Int64, about: String?, settings: Api.PeerSettings, personalPhoto: Api.Photo?, profilePhoto: Api.Photo?, fallbackPhoto: Api.Photo?, notifySettings: Api.PeerNotifySettings, botInfo: Api.BotInfo?, pinnedMsgId: Int32?, commonChatsCount: Int32, folderId: Int32?, ttlPeriod: Int32?, themeEmoticon: String?, privateForwardName: String?, botGroupAdminRights: Api.ChatAdminRights?, botBroadcastAdminRights: Api.ChatAdminRights?, premiumGifts: [Api.PremiumGiftOption]?, wallpaper: Api.WallPaper?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .userFull(let flags, let id, let about, let settings, let personalPhoto, let profilePhoto, let fallbackPhoto, let notifySettings, let botInfo, let pinnedMsgId, let commonChatsCount, let folderId, let ttlPeriod, let themeEmoticon, let privateForwardName, let botGroupAdminRights, let botBroadcastAdminRights, let premiumGifts):
|
case .userFull(let flags, let id, let about, let settings, let personalPhoto, let profilePhoto, let fallbackPhoto, let notifySettings, let botInfo, let pinnedMsgId, let commonChatsCount, let folderId, let ttlPeriod, let themeEmoticon, let privateForwardName, let botGroupAdminRights, let botBroadcastAdminRights, let premiumGifts, let wallpaper):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(-120378643)
|
buffer.appendInt32(-1813324973)
|
||||||
}
|
}
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
serializeInt64(id, buffer: buffer, boxed: false)
|
serializeInt64(id, buffer: buffer, boxed: false)
|
||||||
@ -616,14 +616,15 @@ public extension Api {
|
|||||||
for item in premiumGifts! {
|
for item in premiumGifts! {
|
||||||
item.serialize(buffer, true)
|
item.serialize(buffer, true)
|
||||||
}}
|
}}
|
||||||
|
if Int(flags) & Int(1 << 24) != 0 {wallpaper!.serialize(buffer, true)}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
switch self {
|
switch self {
|
||||||
case .userFull(let flags, let id, let about, let settings, let personalPhoto, let profilePhoto, let fallbackPhoto, let notifySettings, let botInfo, let pinnedMsgId, let commonChatsCount, let folderId, let ttlPeriod, let themeEmoticon, let privateForwardName, let botGroupAdminRights, let botBroadcastAdminRights, let premiumGifts):
|
case .userFull(let flags, let id, let about, let settings, let personalPhoto, let profilePhoto, let fallbackPhoto, let notifySettings, let botInfo, let pinnedMsgId, let commonChatsCount, let folderId, let ttlPeriod, let themeEmoticon, let privateForwardName, let botGroupAdminRights, let botBroadcastAdminRights, let premiumGifts, let wallpaper):
|
||||||
return ("userFull", [("flags", flags as Any), ("id", id as Any), ("about", about as Any), ("settings", settings as Any), ("personalPhoto", personalPhoto as Any), ("profilePhoto", profilePhoto as Any), ("fallbackPhoto", fallbackPhoto as Any), ("notifySettings", notifySettings as Any), ("botInfo", botInfo as Any), ("pinnedMsgId", pinnedMsgId as Any), ("commonChatsCount", commonChatsCount as Any), ("folderId", folderId as Any), ("ttlPeriod", ttlPeriod as Any), ("themeEmoticon", themeEmoticon as Any), ("privateForwardName", privateForwardName as Any), ("botGroupAdminRights", botGroupAdminRights as Any), ("botBroadcastAdminRights", botBroadcastAdminRights as Any), ("premiumGifts", premiumGifts as Any)])
|
return ("userFull", [("flags", flags as Any), ("id", id as Any), ("about", about as Any), ("settings", settings as Any), ("personalPhoto", personalPhoto as Any), ("profilePhoto", profilePhoto as Any), ("fallbackPhoto", fallbackPhoto as Any), ("notifySettings", notifySettings as Any), ("botInfo", botInfo as Any), ("pinnedMsgId", pinnedMsgId as Any), ("commonChatsCount", commonChatsCount as Any), ("folderId", folderId as Any), ("ttlPeriod", ttlPeriod as Any), ("themeEmoticon", themeEmoticon as Any), ("privateForwardName", privateForwardName as Any), ("botGroupAdminRights", botGroupAdminRights as Any), ("botBroadcastAdminRights", botBroadcastAdminRights as Any), ("premiumGifts", premiumGifts as Any), ("wallpaper", wallpaper as Any)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -682,6 +683,10 @@ public extension Api {
|
|||||||
if Int(_1!) & Int(1 << 19) != 0 {if let _ = reader.readInt32() {
|
if Int(_1!) & Int(1 << 19) != 0 {if let _ = reader.readInt32() {
|
||||||
_18 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PremiumGiftOption.self)
|
_18 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PremiumGiftOption.self)
|
||||||
} }
|
} }
|
||||||
|
var _19: Api.WallPaper?
|
||||||
|
if Int(_1!) & Int(1 << 24) != 0 {if let signature = reader.readInt32() {
|
||||||
|
_19 = Api.parse(reader, signature: signature) as? Api.WallPaper
|
||||||
|
} }
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = _2 != nil
|
let _c2 = _2 != nil
|
||||||
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
|
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
|
||||||
@ -700,8 +705,9 @@ public extension Api {
|
|||||||
let _c16 = (Int(_1!) & Int(1 << 17) == 0) || _16 != nil
|
let _c16 = (Int(_1!) & Int(1 << 17) == 0) || _16 != nil
|
||||||
let _c17 = (Int(_1!) & Int(1 << 18) == 0) || _17 != nil
|
let _c17 = (Int(_1!) & Int(1 << 18) == 0) || _17 != nil
|
||||||
let _c18 = (Int(_1!) & Int(1 << 19) == 0) || _18 != nil
|
let _c18 = (Int(_1!) & Int(1 << 19) == 0) || _18 != nil
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 {
|
let _c19 = (Int(_1!) & Int(1 << 24) == 0) || _19 != nil
|
||||||
return Api.UserFull.userFull(flags: _1!, id: _2!, about: _3, settings: _4!, personalPhoto: _5, profilePhoto: _6, fallbackPhoto: _7, notifySettings: _8!, botInfo: _9, pinnedMsgId: _10, commonChatsCount: _11!, folderId: _12, ttlPeriod: _13, themeEmoticon: _14, privateForwardName: _15, botGroupAdminRights: _16, botBroadcastAdminRights: _17, premiumGifts: _18)
|
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 {
|
||||||
|
return Api.UserFull.userFull(flags: _1!, id: _2!, about: _3, settings: _4!, personalPhoto: _5, profilePhoto: _6, fallbackPhoto: _7, notifySettings: _8!, botInfo: _9, pinnedMsgId: _10, commonChatsCount: _11!, folderId: _12, ttlPeriod: _13, themeEmoticon: _14, privateForwardName: _15, botGroupAdminRights: _16, botBroadcastAdminRights: _17, premiumGifts: _18, wallpaper: _19)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
|
@ -3057,6 +3057,21 @@ public extension Api.functions.communities {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public extension Api.functions.communities {
|
||||||
|
static func getLeaveCommunitySuggestions(community: Api.InputCommunity) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.Peer]>) {
|
||||||
|
let buffer = Buffer()
|
||||||
|
buffer.appendInt32(-296838430)
|
||||||
|
community.serialize(buffer, true)
|
||||||
|
return (FunctionDescription(name: "communities.getLeaveCommunitySuggestions", parameters: [("community", String(describing: community))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.Peer]? in
|
||||||
|
let reader = BufferReader(buffer)
|
||||||
|
var result: [Api.Peer]?
|
||||||
|
if let _ = reader.readInt32() {
|
||||||
|
result = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self)
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
public extension Api.functions.communities {
|
public extension Api.functions.communities {
|
||||||
static func hideCommunityUpdates(community: Api.InputCommunity) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
static func hideCommunityUpdates(community: Api.InputCommunity) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||||
let buffer = Buffer()
|
let buffer = Buffer()
|
||||||
@ -6865,6 +6880,23 @@ public extension Api.functions.messages {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public extension Api.functions.messages {
|
||||||
|
static func setChatWallPaper(peer: Api.InputPeer, wallpaper: Api.InputWallPaper, settings: Api.WallPaperSettings) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||||
|
let buffer = Buffer()
|
||||||
|
buffer.appendInt32(-1109557590)
|
||||||
|
peer.serialize(buffer, true)
|
||||||
|
wallpaper.serialize(buffer, true)
|
||||||
|
settings.serialize(buffer, true)
|
||||||
|
return (FunctionDescription(name: "messages.setChatWallPaper", parameters: [("peer", String(describing: peer)), ("wallpaper", String(describing: wallpaper)), ("settings", String(describing: settings))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||||
|
let reader = BufferReader(buffer)
|
||||||
|
var result: Api.Updates?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
result = Api.parse(reader, signature: signature) as? Api.Updates
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
public extension Api.functions.messages {
|
public extension Api.functions.messages {
|
||||||
static func setDefaultHistoryTTL(period: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
static func setDefaultHistoryTTL(period: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||||
let buffer = Buffer()
|
let buffer = Buffer()
|
||||||
|
@ -205,7 +205,7 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch action {
|
switch action {
|
||||||
case .messageActionChannelCreate, .messageActionChatDeletePhoto, .messageActionChatEditPhoto, .messageActionChatEditTitle, .messageActionEmpty, .messageActionPinMessage, .messageActionHistoryClear, .messageActionGameScore, .messageActionPaymentSent, .messageActionPaymentSentMe, .messageActionPhoneCall, .messageActionScreenshotTaken, .messageActionCustomAction, .messageActionBotAllowed, .messageActionSecureValuesSent, .messageActionSecureValuesSentMe, .messageActionContactSignUp, .messageActionGroupCall, .messageActionSetMessagesTTL, .messageActionGroupCallScheduled, .messageActionSetChatTheme, .messageActionChatJoinedByRequest, .messageActionWebViewDataSent, .messageActionWebViewDataSentMe, .messageActionGiftPremium, .messageActionTopicCreate, .messageActionTopicEdit, .messageActionSuggestProfilePhoto:
|
case .messageActionChannelCreate, .messageActionChatDeletePhoto, .messageActionChatEditPhoto, .messageActionChatEditTitle, .messageActionEmpty, .messageActionPinMessage, .messageActionHistoryClear, .messageActionGameScore, .messageActionPaymentSent, .messageActionPaymentSentMe, .messageActionPhoneCall, .messageActionScreenshotTaken, .messageActionCustomAction, .messageActionBotAllowed, .messageActionSecureValuesSent, .messageActionSecureValuesSentMe, .messageActionContactSignUp, .messageActionGroupCall, .messageActionSetMessagesTTL, .messageActionGroupCallScheduled, .messageActionSetChatTheme, .messageActionChatJoinedByRequest, .messageActionWebViewDataSent, .messageActionWebViewDataSentMe, .messageActionGiftPremium, .messageActionTopicCreate, .messageActionTopicEdit, .messageActionSuggestProfilePhoto, .messageActionSetChatWallPaper:
|
||||||
break
|
break
|
||||||
case let .messageActionChannelMigrateFrom(_, chatId):
|
case let .messageActionChannelMigrateFrom(_, chatId):
|
||||||
result.append(PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)))
|
result.append(PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)))
|
||||||
|
@ -108,6 +108,8 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
|
|||||||
return TelegramMediaAction(action: .suggestedProfilePhoto(image: telegramMediaImageFromApiPhoto(photo)))
|
return TelegramMediaAction(action: .suggestedProfilePhoto(image: telegramMediaImageFromApiPhoto(photo)))
|
||||||
case let .messageActionRequestedPeer(buttonId, peer):
|
case let .messageActionRequestedPeer(buttonId, peer):
|
||||||
return TelegramMediaAction(action: .requestedPeer(buttonId: buttonId, peerId: peer.peerId))
|
return TelegramMediaAction(action: .requestedPeer(buttonId: buttonId, peerId: peer.peerId))
|
||||||
|
case .messageActionSetChatWallPaper:
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -686,3 +686,13 @@ func _internal_leaveChatFolder(account: Account, folderId: Int32, removePeerIds:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _internal_requestLeaveChatFolderSuggestions(account: Account, folderId: Int32) -> Signal<[EnginePeer.Id], NoError> {
|
||||||
|
return account.network.request(Api.functions.communities.getLeaveCommunitySuggestions(community: .inputCommunityDialogFilter(filterId: folderId)))
|
||||||
|
|> map { result -> [EnginePeer.Id] in
|
||||||
|
return result.map(\.peerId)
|
||||||
|
}
|
||||||
|
|> `catch` { _ -> Signal<[EnginePeer.Id], NoError> in
|
||||||
|
return .single([])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1085,6 +1085,10 @@ public extension TelegramEngine {
|
|||||||
public func leaveChatFolder(folderId: Int32, removePeerIds: [EnginePeer.Id]) -> Signal<Never, NoError> {
|
public func leaveChatFolder(folderId: Int32, removePeerIds: [EnginePeer.Id]) -> Signal<Never, NoError> {
|
||||||
return _internal_leaveChatFolder(account: self.account, folderId: folderId, removePeerIds: removePeerIds)
|
return _internal_leaveChatFolder(account: self.account, folderId: folderId, removePeerIds: removePeerIds)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func requestLeaveChatFolderSuggestions(folderId: Int32) -> Signal<[EnginePeer.Id], NoError> {
|
||||||
|
return _internal_requestLeaveChatFolderSuggestions(account: self.account, folderId: folderId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch fullUser {
|
switch fullUser {
|
||||||
case let .userFull(_, _, _, _, _, _, _, userFullNotifySettings, _, _, _, _, _, _, _, _, _, _):
|
case let .userFull(_, _, _, _, _, _, _, userFullNotifySettings, _, _, _, _, _, _, _, _, _, _, _):
|
||||||
updatePeers(transaction: transaction, peers: peers, update: { previous, updated -> Peer in
|
updatePeers(transaction: transaction, peers: peers, update: { previous, updated -> Peer in
|
||||||
if previous?.id == accountPeerId, let accountUser = accountUser, let user = TelegramUser.merge(previous as? TelegramUser, rhs: accountUser) {
|
if previous?.id == accountPeerId, let accountUser = accountUser, let user = TelegramUser.merge(previous as? TelegramUser, rhs: accountUser) {
|
||||||
return user
|
return user
|
||||||
@ -255,7 +255,7 @@ func _internal_fetchAndUpdateCachedPeerData(accountPeerId: PeerId, peerId rawPee
|
|||||||
previous = CachedUserData()
|
previous = CachedUserData()
|
||||||
}
|
}
|
||||||
switch fullUser {
|
switch fullUser {
|
||||||
case let .userFull(userFullFlags, _, userFullAbout, userFullSettings, personalPhoto, profilePhoto, fallbackPhoto, _, userFullBotInfo, userFullPinnedMsgId, userFullCommonChatsCount, _, userFullTtlPeriod, userFullThemeEmoticon, _, _, _, userPremiumGiftOptions):
|
case let .userFull(userFullFlags, _, userFullAbout, userFullSettings, personalPhoto, profilePhoto, fallbackPhoto, _, userFullBotInfo, userFullPinnedMsgId, userFullCommonChatsCount, _, userFullTtlPeriod, userFullThemeEmoticon, _, _, _, userPremiumGiftOptions, _):
|
||||||
let botInfo = userFullBotInfo.flatMap(BotInfo.init(apiBotInfo:))
|
let botInfo = userFullBotInfo.flatMap(BotInfo.init(apiBotInfo:))
|
||||||
let isBlocked = (userFullFlags & (1 << 0)) != 0
|
let isBlocked = (userFullFlags & (1 << 0)) != 0
|
||||||
let voiceCallsAvailable = (userFullFlags & (1 << 4)) != 0
|
let voiceCallsAvailable = (userFullFlags & (1 << 4)) != 0
|
||||||
|
@ -287,8 +287,16 @@ private final class ChatFolderLinkPreviewScreenComponent: Component {
|
|||||||
let sideInset: CGFloat = 16.0
|
let sideInset: CGFloat = 16.0
|
||||||
|
|
||||||
if self.component?.linkContents == nil, let linkContents = component.linkContents {
|
if self.component?.linkContents == nil, let linkContents = component.linkContents {
|
||||||
for peer in linkContents.peers {
|
if case let .remove(_, defaultSelectedPeerIds) = component.subject {
|
||||||
self.selectedItems.insert(peer.id)
|
for peer in linkContents.peers {
|
||||||
|
if defaultSelectedPeerIds.contains(peer.id) {
|
||||||
|
self.selectedItems.insert(peer.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for peer in linkContents.peers {
|
||||||
|
self.selectedItems.insert(peer.id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -712,7 +720,7 @@ private final class ChatFolderLinkPreviewScreenComponent: Component {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if case let .remove(folderId) = component.subject {
|
if case let .remove(folderId, _) = component.subject {
|
||||||
self.inProgress = true
|
self.inProgress = true
|
||||||
self.state?.updated(transition: .immediate)
|
self.state?.updated(transition: .immediate)
|
||||||
|
|
||||||
@ -851,7 +859,7 @@ public class ChatFolderLinkPreviewScreen: ViewControllerComponentContainer {
|
|||||||
public enum Subject: Equatable {
|
public enum Subject: Equatable {
|
||||||
case slug(String)
|
case slug(String)
|
||||||
case updates(ChatFolderUpdates)
|
case updates(ChatFolderUpdates)
|
||||||
case remove(folderId: Int32)
|
case remove(folderId: Int32, defaultSelectedPeerIds: [EnginePeer.Id])
|
||||||
}
|
}
|
||||||
|
|
||||||
private let context: AccountContext
|
private let context: AccountContext
|
||||||
|
Loading…
x
Reference in New Issue
Block a user