mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 21:45:19 +00:00
Folder improvements
This commit is contained in:
parent
dfe8e80232
commit
65bcef3ee2
@ -9125,4 +9125,4 @@ Sorry for the inconvenience.";
|
||||
|
||||
"Channel.AdminLog.JoinedViaFolderInviteLink" = "%1$@ joined via invite link %2$@ (community)";
|
||||
|
||||
"Conversation.OpenChatFolder" = "Open Shared Folder";
|
||||
"Conversation.OpenChatFolder" = "VIEW CHAT LIST";
|
||||
|
@ -665,6 +665,9 @@ private func chatListFilterPresetControllerEntries(presentationData: Presentatio
|
||||
if let inviteLinks, !inviteLinks.isEmpty {
|
||||
hasLinks = true
|
||||
}
|
||||
if let currentPreset, let data = currentPreset.data, data.hasSharedLinks {
|
||||
hasLinks = true
|
||||
}
|
||||
|
||||
entries.append(.inviteLinkHeader(hasLinks: hasLinks || hadLinks))
|
||||
entries.append(.inviteLinkCreate(hasLinks: hasLinks))
|
||||
@ -1393,9 +1396,11 @@ func chatListFilterPresetController(context: AccountContext, currentPreset: Chat
|
||||
var attemptNavigationImpl: (() -> Bool)?
|
||||
applyImpl = { completed in
|
||||
let state = stateValue.with { $0 }
|
||||
|
||||
var includePeers = ChatListFilterIncludePeers()
|
||||
includePeers.setPeers(state.additionallyIncludePeers)
|
||||
|
||||
let _ = (context.engine.peers.updateChatListFiltersInteractively { filters in
|
||||
var includePeers = ChatListFilterIncludePeers()
|
||||
includePeers.setPeers(state.additionallyIncludePeers)
|
||||
|
||||
var filterId = currentPreset?.id ?? -1
|
||||
if currentPreset == nil {
|
||||
@ -1434,7 +1439,29 @@ func chatListFilterPresetController(context: AccountContext, currentPreset: Chat
|
||||
}
|
||||
|> deliverOnMainQueue).start(next: { filters in
|
||||
updated(filters)
|
||||
completed()
|
||||
|
||||
if let currentPreset {
|
||||
let _ = (context.engine.peers.updatedChatListFilters()
|
||||
|> filter { filters -> Bool in
|
||||
for filter in filters {
|
||||
if filter.id == currentPreset.id {
|
||||
if let data = filter.data {
|
||||
if Set(data.includePeers.peers) == Set(includePeers.peers) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|> take(1)
|
||||
|> delay(1.0, queue: .mainQueue())
|
||||
|> deliverOnMainQueue).start(next: { _ in
|
||||
completed()
|
||||
})
|
||||
} else {
|
||||
completed()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -1473,8 +1500,10 @@ func chatListFilterPresetController(context: AccountContext, currentPreset: Chat
|
||||
if previousStateValue.expandedSections != state.expandedSections {
|
||||
skipStateAnimation = true
|
||||
}
|
||||
var crossfadeAnimation = false
|
||||
if previousSharedLinks == nil && sharedLinks != nil {
|
||||
skipStateAnimation = true
|
||||
crossfadeAnimation = true
|
||||
}
|
||||
previousSharedLinks = sharedLinks
|
||||
|
||||
@ -1483,7 +1512,7 @@ func chatListFilterPresetController(context: AccountContext, currentPreset: Chat
|
||||
}
|
||||
|
||||
let controllerState = ItemListControllerState(presentationData: ItemListPresentationData(presentationData), title: .text(currentPreset != nil ? presentationData.strings.ChatListFolder_TitleEdit : presentationData.strings.ChatListFolder_TitleCreate), leftNavigationButton: leftNavigationButton, rightNavigationButton: rightNavigationButton, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: false)
|
||||
let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: chatListFilterPresetControllerEntries(presentationData: presentationData, isNewFilter: currentPreset == nil, currentPreset: currentPreset, state: state, includePeers: includePeers, excludePeers: excludePeers, isPremium: isPremium, limit: premiumLimits.maxFolderChatsCount, inviteLinks: sharedLinks, hadLinks: hadLinks), style: .blocks, emptyStateItem: nil, animateChanges: !skipStateAnimation)
|
||||
let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: chatListFilterPresetControllerEntries(presentationData: presentationData, isNewFilter: currentPreset == nil, currentPreset: currentPreset, state: state, includePeers: includePeers, excludePeers: excludePeers, isPremium: isPremium, limit: premiumLimits.maxFolderChatsCount, inviteLinks: sharedLinks, hadLinks: hadLinks), style: .blocks, emptyStateItem: nil, crossfadeState: crossfadeAnimation, animateChanges: !skipStateAnimation)
|
||||
skipStateAnimation = false
|
||||
|
||||
return (controllerState, (listState, arguments))
|
||||
|
@ -231,6 +231,13 @@ class ChatListStorageInfoItemNode: ItemListRevealOptionsItemNode {
|
||||
}
|
||||
}
|
||||
|
||||
override public func animateInsertion(_ currentTimestamp: Double, duration: Double, short: Bool) {
|
||||
super.animateInsertion(currentTimestamp, duration: duration, short: short)
|
||||
|
||||
//self.transitionOffset = self.bounds.size.height * 1.6
|
||||
//self.addTransitionOffsetAnimation(0.0, duration: duration, beginAt: currentTimestamp)
|
||||
}
|
||||
|
||||
override public func updateRevealOffset(offset: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||
super.updateRevealOffset(offset: offset, transition: transition)
|
||||
|
||||
|
@ -521,7 +521,7 @@ public func folderInviteLinkListController(context: AccountContext, updatedPrese
|
||||
text = "You can't share private chats"
|
||||
}
|
||||
} else {
|
||||
text = "you can't invite others here"
|
||||
text = "You don't have the admin rights to share invite links to this group chat."
|
||||
}
|
||||
dismissTooltipsImpl?()
|
||||
displayTooltipImpl?(.peers(context: context, peers: [peer], title: nil, text: text, customUndoText: nil))
|
||||
@ -560,6 +560,11 @@ public func folderInviteLinkListController(context: AccountContext, updatedPrese
|
||||
|
||||
let applyChangesImpl: (() -> Void)? = {
|
||||
let state = stateValue.with({ $0 })
|
||||
|
||||
if state.selectedPeerIds.isEmpty {
|
||||
return
|
||||
}
|
||||
|
||||
if let currentLink = state.currentLink {
|
||||
if currentLink.title != state.title || Set(currentLink.peerIds) != state.selectedPeerIds {
|
||||
updateState { state in
|
||||
@ -625,6 +630,8 @@ public func folderInviteLinkListController(context: AccountContext, updatedPrese
|
||||
allPeers
|
||||
)
|
||||
|> map { presentationData, state, allPeers -> (ItemListControllerState, (ItemListNodeState, Any)) in
|
||||
let allPeers = allPeers.compactMap { $0 }
|
||||
|
||||
let crossfade = false
|
||||
|
||||
var animateChanges = false
|
||||
@ -644,7 +651,12 @@ public func folderInviteLinkListController(context: AccountContext, updatedPrese
|
||||
title = .text(folderTitle)
|
||||
|
||||
var doneButton: ItemListNavigationButton?
|
||||
if state.isSaving {
|
||||
|
||||
let canShareChats = !allPeers.allSatisfy({ !canShareLinkToPeer(peer: $0) })
|
||||
|
||||
if !canShareChats {
|
||||
doneButton = nil
|
||||
} else if state.isSaving {
|
||||
doneButton = ItemListNavigationButton(content: .none, style: .activity, enabled: true, action: {})
|
||||
} else {
|
||||
doneButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Save), style: .bold, enabled: !state.selectedPeerIds.isEmpty, action: {
|
||||
@ -657,7 +669,7 @@ public func folderInviteLinkListController(context: AccountContext, updatedPrese
|
||||
presentationData: presentationData,
|
||||
state: state,
|
||||
title: filterTitle,
|
||||
allPeers: allPeers.compactMap { $0 }
|
||||
allPeers: allPeers
|
||||
), style: .blocks, emptyStateItem: nil, crossfadeState: crossfade, animateChanges: animateChanges)
|
||||
|
||||
return (controllerState, (listState, arguments))
|
||||
|
@ -4,7 +4,7 @@ public enum Api {
|
||||
public enum auth {}
|
||||
public enum bots {}
|
||||
public enum channels {}
|
||||
public enum communities {}
|
||||
public enum chatlists {}
|
||||
public enum contacts {}
|
||||
public enum help {}
|
||||
public enum messages {}
|
||||
@ -22,7 +22,7 @@ public enum Api {
|
||||
public enum auth {}
|
||||
public enum bots {}
|
||||
public enum channels {}
|
||||
public enum communities {}
|
||||
public enum chatlists {}
|
||||
public enum contacts {}
|
||||
public enum folders {}
|
||||
public enum help {}
|
||||
@ -193,7 +193,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[-712374074] = { return Api.Dialog.parse_dialog($0) }
|
||||
dict[1908216652] = { return Api.Dialog.parse_dialogFolder($0) }
|
||||
dict[1949890536] = { return Api.DialogFilter.parse_dialogFilter($0) }
|
||||
dict[-665432009] = { return Api.DialogFilter.parse_dialogFilterCommunity($0) }
|
||||
dict[-699792216] = { return Api.DialogFilter.parse_dialogFilterChatlist($0) }
|
||||
dict[909284270] = { return Api.DialogFilter.parse_dialogFilterDefault($0) }
|
||||
dict[2004110666] = { return Api.DialogFilterSuggested.parse_dialogFilterSuggested($0) }
|
||||
dict[-445792507] = { return Api.DialogPeer.parse_dialogPeer($0) }
|
||||
@ -238,7 +238,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[594758406] = { return Api.EncryptedMessage.parse_encryptedMessageService($0) }
|
||||
dict[179611673] = { return Api.ExportedChatInvite.parse_chatInviteExported($0) }
|
||||
dict[-317687113] = { return Api.ExportedChatInvite.parse_chatInvitePublicJoinRequests($0) }
|
||||
dict[-337788502] = { return Api.ExportedCommunityInvite.parse_exportedCommunityInvite($0) }
|
||||
dict[206668204] = { return Api.ExportedChatlistInvite.parse_exportedChatlistInvite($0) }
|
||||
dict[1103040667] = { return Api.ExportedContactToken.parse_exportedContactToken($0) }
|
||||
dict[1571494644] = { return Api.ExportedMessageLink.parse_exportedMessageLink($0) }
|
||||
dict[-207944868] = { return Api.FileHash.parse_fileHash($0) }
|
||||
@ -287,10 +287,10 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[-1991004873] = { return Api.InputChatPhoto.parse_inputChatPhoto($0) }
|
||||
dict[480546647] = { return Api.InputChatPhoto.parse_inputChatPhotoEmpty($0) }
|
||||
dict[-1110593856] = { return Api.InputChatPhoto.parse_inputChatUploadedPhoto($0) }
|
||||
dict[-203367885] = { return Api.InputChatlist.parse_inputChatlistDialogFilter($0) }
|
||||
dict[-1736378792] = { return Api.InputCheckPasswordSRP.parse_inputCheckPasswordEmpty($0) }
|
||||
dict[-763367294] = { return Api.InputCheckPasswordSRP.parse_inputCheckPasswordSRP($0) }
|
||||
dict[1968737087] = { return Api.InputClientProxy.parse_inputClientProxy($0) }
|
||||
dict[450955169] = { return Api.InputCommunity.parse_inputCommunityDialogFilter($0) }
|
||||
dict[-208488460] = { return Api.InputContact.parse_inputPhoneContact($0) }
|
||||
dict[-55902537] = { return Api.InputDialogPeer.parse_inputDialogPeer($0) }
|
||||
dict[1684014375] = { return Api.InputDialogPeer.parse_inputDialogPeerFolder($0) }
|
||||
@ -478,6 +478,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
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[-632006598] = { return Api.MessageAction.parse_messageActionSetSameChatWallPaper($0) }
|
||||
dict[1474192222] = { return Api.MessageAction.parse_messageActionSuggestProfilePhoto($0) }
|
||||
dict[228168278] = { return Api.MessageAction.parse_messageActionTopicCreate($0) }
|
||||
dict[-1064024032] = { return Api.MessageAction.parse_messageActionTopicEdit($0) }
|
||||
@ -998,11 +999,11 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
||||
dict[-1699676497] = { return Api.channels.ChannelParticipants.parse_channelParticipants($0) }
|
||||
dict[-266911767] = { return Api.channels.ChannelParticipants.parse_channelParticipantsNotModified($0) }
|
||||
dict[-191450938] = { return Api.channels.SendAsPeers.parse_sendAsPeers($0) }
|
||||
dict[59080097] = { return Api.communities.CommunityInvite.parse_communityInvite($0) }
|
||||
dict[-951718393] = { return Api.communities.CommunityInvite.parse_communityInviteAlready($0) }
|
||||
dict[-414818125] = { return Api.communities.CommunityUpdates.parse_communityUpdates($0) }
|
||||
dict[1805101290] = { return Api.communities.ExportedCommunityInvite.parse_exportedCommunityInvite($0) }
|
||||
dict[-2662489] = { return Api.communities.ExportedInvites.parse_exportedInvites($0) }
|
||||
dict[500007837] = { return Api.chatlists.ChatlistInvite.parse_chatlistInvite($0) }
|
||||
dict[-91752871] = { return Api.chatlists.ChatlistInvite.parse_chatlistInviteAlready($0) }
|
||||
dict[-1816295539] = { return Api.chatlists.ChatlistUpdates.parse_chatlistUpdates($0) }
|
||||
dict[283567014] = { return Api.chatlists.ExportedChatlistInvite.parse_exportedChatlistInvite($0) }
|
||||
dict[279670215] = { return Api.chatlists.ExportedInvites.parse_exportedInvites($0) }
|
||||
dict[182326673] = { return Api.contacts.Blocked.parse_blocked($0) }
|
||||
dict[-513392236] = { return Api.contacts.Blocked.parse_blockedSlice($0) }
|
||||
dict[-353862078] = { return Api.contacts.Contacts.parse_contacts($0) }
|
||||
@ -1354,7 +1355,7 @@ public extension Api {
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.ExportedChatInvite:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.ExportedCommunityInvite:
|
||||
case let _1 as Api.ExportedChatlistInvite:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.ExportedContactToken:
|
||||
_1.serialize(buffer, boxed)
|
||||
@ -1408,12 +1409,12 @@ public extension Api {
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.InputChatPhoto:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.InputChatlist:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.InputCheckPasswordSRP:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.InputClientProxy:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.InputCommunity:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.InputContact:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.InputDialogPeer:
|
||||
@ -1802,13 +1803,13 @@ public extension Api {
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.channels.SendAsPeers:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.communities.CommunityInvite:
|
||||
case let _1 as Api.chatlists.ChatlistInvite:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.communities.CommunityUpdates:
|
||||
case let _1 as Api.chatlists.ChatlistUpdates:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.communities.ExportedCommunityInvite:
|
||||
case let _1 as Api.chatlists.ExportedChatlistInvite:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.communities.ExportedInvites:
|
||||
case let _1 as Api.chatlists.ExportedInvites:
|
||||
_1.serialize(buffer, boxed)
|
||||
case let _1 as Api.contacts.Blocked:
|
||||
_1.serialize(buffer, boxed)
|
||||
|
@ -263,6 +263,7 @@ public extension Api {
|
||||
case messageActionSetChatTheme(emoticon: String)
|
||||
case messageActionSetChatWallPaper(wallpaper: Api.WallPaper)
|
||||
case messageActionSetMessagesTTL(flags: Int32, period: Int32, autoSettingFrom: Int64?)
|
||||
case messageActionSetSameChatWallPaper
|
||||
case messageActionSuggestProfilePhoto(photo: Api.Photo)
|
||||
case messageActionTopicCreate(flags: Int32, title: String, iconColor: Int32, iconEmojiId: Int64?)
|
||||
case messageActionTopicEdit(flags: Int32, title: String?, iconEmojiId: Int64?, closed: Api.Bool?, hidden: Api.Bool?)
|
||||
@ -520,6 +521,12 @@ public extension Api {
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeInt32(period, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 0) != 0 {serializeInt64(autoSettingFrom!, buffer: buffer, boxed: false)}
|
||||
break
|
||||
case .messageActionSetSameChatWallPaper:
|
||||
if boxed {
|
||||
buffer.appendInt32(-632006598)
|
||||
}
|
||||
|
||||
break
|
||||
case .messageActionSuggestProfilePhoto(let photo):
|
||||
if boxed {
|
||||
@ -630,6 +637,8 @@ public extension Api {
|
||||
return ("messageActionSetChatWallPaper", [("wallpaper", wallpaper as Any)])
|
||||
case .messageActionSetMessagesTTL(let flags, let period, let autoSettingFrom):
|
||||
return ("messageActionSetMessagesTTL", [("flags", flags as Any), ("period", period as Any), ("autoSettingFrom", autoSettingFrom as Any)])
|
||||
case .messageActionSetSameChatWallPaper:
|
||||
return ("messageActionSetSameChatWallPaper", [])
|
||||
case .messageActionSuggestProfilePhoto(let photo):
|
||||
return ("messageActionSuggestProfilePhoto", [("photo", photo as Any)])
|
||||
case .messageActionTopicCreate(let flags, let title, let iconColor, let iconEmojiId):
|
||||
@ -1082,6 +1091,9 @@ public extension Api {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_messageActionSetSameChatWallPaper(_ reader: BufferReader) -> MessageAction? {
|
||||
return Api.MessageAction.messageActionSetSameChatWallPaper
|
||||
}
|
||||
public static func parse_messageActionSuggestProfilePhoto(_ reader: BufferReader) -> MessageAction? {
|
||||
var _1: Api.Photo?
|
||||
if let signature = reader.readInt32() {
|
||||
|
@ -894,16 +894,16 @@ public extension Api.channels {
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.communities {
|
||||
enum CommunityInvite: TypeConstructorDescription {
|
||||
case communityInvite(flags: Int32, title: String, emoticon: String?, peers: [Api.Peer], chats: [Api.Chat], users: [Api.User])
|
||||
case communityInviteAlready(filterId: Int32, missingPeers: [Api.Peer], alreadyPeers: [Api.Peer], chats: [Api.Chat], users: [Api.User])
|
||||
public extension Api.chatlists {
|
||||
enum ChatlistInvite: TypeConstructorDescription {
|
||||
case chatlistInvite(flags: Int32, title: String, emoticon: String?, peers: [Api.Peer], chats: [Api.Chat], users: [Api.User])
|
||||
case chatlistInviteAlready(filterId: Int32, missingPeers: [Api.Peer], alreadyPeers: [Api.Peer], chats: [Api.Chat], users: [Api.User])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .communityInvite(let flags, let title, let emoticon, let peers, let chats, let users):
|
||||
case .chatlistInvite(let flags, let title, let emoticon, let peers, let chats, let users):
|
||||
if boxed {
|
||||
buffer.appendInt32(59080097)
|
||||
buffer.appendInt32(500007837)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(title, buffer: buffer, boxed: false)
|
||||
@ -924,9 +924,9 @@ public extension Api.communities {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
break
|
||||
case .communityInviteAlready(let filterId, let missingPeers, let alreadyPeers, let chats, let users):
|
||||
case .chatlistInviteAlready(let filterId, let missingPeers, let alreadyPeers, let chats, let users):
|
||||
if boxed {
|
||||
buffer.appendInt32(-951718393)
|
||||
buffer.appendInt32(-91752871)
|
||||
}
|
||||
serializeInt32(filterId, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
@ -955,14 +955,14 @@ public extension Api.communities {
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .communityInvite(let flags, let title, let emoticon, let peers, let chats, let users):
|
||||
return ("communityInvite", [("flags", flags as Any), ("title", title as Any), ("emoticon", emoticon as Any), ("peers", peers as Any), ("chats", chats as Any), ("users", users as Any)])
|
||||
case .communityInviteAlready(let filterId, let missingPeers, let alreadyPeers, let chats, let users):
|
||||
return ("communityInviteAlready", [("filterId", filterId as Any), ("missingPeers", missingPeers as Any), ("alreadyPeers", alreadyPeers as Any), ("chats", chats as Any), ("users", users as Any)])
|
||||
case .chatlistInvite(let flags, let title, let emoticon, let peers, let chats, let users):
|
||||
return ("chatlistInvite", [("flags", flags as Any), ("title", title as Any), ("emoticon", emoticon as Any), ("peers", peers as Any), ("chats", chats as Any), ("users", users as Any)])
|
||||
case .chatlistInviteAlready(let filterId, let missingPeers, let alreadyPeers, let chats, let users):
|
||||
return ("chatlistInviteAlready", [("filterId", filterId as Any), ("missingPeers", missingPeers as Any), ("alreadyPeers", alreadyPeers as Any), ("chats", chats as Any), ("users", users as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_communityInvite(_ reader: BufferReader) -> CommunityInvite? {
|
||||
public static func parse_chatlistInvite(_ reader: BufferReader) -> ChatlistInvite? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: String?
|
||||
@ -988,13 +988,13 @@ public extension Api.communities {
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||
return Api.communities.CommunityInvite.communityInvite(flags: _1!, title: _2!, emoticon: _3, peers: _4!, chats: _5!, users: _6!)
|
||||
return Api.chatlists.ChatlistInvite.chatlistInvite(flags: _1!, title: _2!, emoticon: _3, peers: _4!, chats: _5!, users: _6!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_communityInviteAlready(_ reader: BufferReader) -> CommunityInvite? {
|
||||
public static func parse_chatlistInviteAlready(_ reader: BufferReader) -> ChatlistInvite? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: [Api.Peer]?
|
||||
@ -1019,7 +1019,7 @@ public extension Api.communities {
|
||||
let _c4 = _4 != nil
|
||||
let _c5 = _5 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||
return Api.communities.CommunityInvite.communityInviteAlready(filterId: _1!, missingPeers: _2!, alreadyPeers: _3!, chats: _4!, users: _5!)
|
||||
return Api.chatlists.ChatlistInvite.chatlistInviteAlready(filterId: _1!, missingPeers: _2!, alreadyPeers: _3!, chats: _4!, users: _5!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
@ -1028,15 +1028,15 @@ public extension Api.communities {
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.communities {
|
||||
enum CommunityUpdates: TypeConstructorDescription {
|
||||
case communityUpdates(missingPeers: [Api.Peer], chats: [Api.Chat], users: [Api.User])
|
||||
public extension Api.chatlists {
|
||||
enum ChatlistUpdates: TypeConstructorDescription {
|
||||
case chatlistUpdates(missingPeers: [Api.Peer], chats: [Api.Chat], users: [Api.User])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .communityUpdates(let missingPeers, let chats, let users):
|
||||
case .chatlistUpdates(let missingPeers, let chats, let users):
|
||||
if boxed {
|
||||
buffer.appendInt32(-414818125)
|
||||
buffer.appendInt32(-1816295539)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(missingPeers.count))
|
||||
@ -1059,12 +1059,12 @@ public extension Api.communities {
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .communityUpdates(let missingPeers, let chats, let users):
|
||||
return ("communityUpdates", [("missingPeers", missingPeers as Any), ("chats", chats as Any), ("users", users as Any)])
|
||||
case .chatlistUpdates(let missingPeers, let chats, let users):
|
||||
return ("chatlistUpdates", [("missingPeers", missingPeers as Any), ("chats", chats as Any), ("users", users as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_communityUpdates(_ reader: BufferReader) -> CommunityUpdates? {
|
||||
public static func parse_chatlistUpdates(_ reader: BufferReader) -> ChatlistUpdates? {
|
||||
var _1: [Api.Peer]?
|
||||
if let _ = reader.readInt32() {
|
||||
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self)
|
||||
@ -1081,7 +1081,7 @@ public extension Api.communities {
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
if _c1 && _c2 && _c3 {
|
||||
return Api.communities.CommunityUpdates.communityUpdates(missingPeers: _1!, chats: _2!, users: _3!)
|
||||
return Api.chatlists.ChatlistUpdates.chatlistUpdates(missingPeers: _1!, chats: _2!, users: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
@ -1090,15 +1090,15 @@ public extension Api.communities {
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api.communities {
|
||||
enum ExportedCommunityInvite: TypeConstructorDescription {
|
||||
case exportedCommunityInvite(filter: Api.DialogFilter, invite: Api.ExportedCommunityInvite)
|
||||
public extension Api.chatlists {
|
||||
enum ExportedChatlistInvite: TypeConstructorDescription {
|
||||
case exportedChatlistInvite(filter: Api.DialogFilter, invite: Api.ExportedChatlistInvite)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .exportedCommunityInvite(let filter, let invite):
|
||||
case .exportedChatlistInvite(let filter, let invite):
|
||||
if boxed {
|
||||
buffer.appendInt32(1805101290)
|
||||
buffer.appendInt32(283567014)
|
||||
}
|
||||
filter.serialize(buffer, true)
|
||||
invite.serialize(buffer, true)
|
||||
@ -1108,24 +1108,24 @@ public extension Api.communities {
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .exportedCommunityInvite(let filter, let invite):
|
||||
return ("exportedCommunityInvite", [("filter", filter as Any), ("invite", invite as Any)])
|
||||
case .exportedChatlistInvite(let filter, let invite):
|
||||
return ("exportedChatlistInvite", [("filter", filter as Any), ("invite", invite as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_exportedCommunityInvite(_ reader: BufferReader) -> ExportedCommunityInvite? {
|
||||
public static func parse_exportedChatlistInvite(_ reader: BufferReader) -> ExportedChatlistInvite? {
|
||||
var _1: Api.DialogFilter?
|
||||
if let signature = reader.readInt32() {
|
||||
_1 = Api.parse(reader, signature: signature) as? Api.DialogFilter
|
||||
}
|
||||
var _2: Api.ExportedCommunityInvite?
|
||||
var _2: Api.ExportedChatlistInvite?
|
||||
if let signature = reader.readInt32() {
|
||||
_2 = Api.parse(reader, signature: signature) as? Api.ExportedCommunityInvite
|
||||
_2 = Api.parse(reader, signature: signature) as? Api.ExportedChatlistInvite
|
||||
}
|
||||
let _c1 = _1 != nil
|
||||
let _c2 = _2 != nil
|
||||
if _c1 && _c2 {
|
||||
return Api.communities.ExportedCommunityInvite.exportedCommunityInvite(filter: _1!, invite: _2!)
|
||||
return Api.chatlists.ExportedChatlistInvite.exportedChatlistInvite(filter: _1!, invite: _2!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
|
@ -1,12 +1,12 @@
|
||||
public extension Api.communities {
|
||||
public extension Api.chatlists {
|
||||
enum ExportedInvites: TypeConstructorDescription {
|
||||
case exportedInvites(invites: [Api.ExportedCommunityInvite], chats: [Api.Chat], users: [Api.User])
|
||||
case exportedInvites(invites: [Api.ExportedChatlistInvite], chats: [Api.Chat], users: [Api.User])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .exportedInvites(let invites, let chats, let users):
|
||||
if boxed {
|
||||
buffer.appendInt32(-2662489)
|
||||
buffer.appendInt32(279670215)
|
||||
}
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(invites.count))
|
||||
@ -35,9 +35,9 @@ public extension Api.communities {
|
||||
}
|
||||
|
||||
public static func parse_exportedInvites(_ reader: BufferReader) -> ExportedInvites? {
|
||||
var _1: [Api.ExportedCommunityInvite]?
|
||||
var _1: [Api.ExportedChatlistInvite]?
|
||||
if let _ = reader.readInt32() {
|
||||
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ExportedCommunityInvite.self)
|
||||
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ExportedChatlistInvite.self)
|
||||
}
|
||||
var _2: [Api.Chat]?
|
||||
if let _ = reader.readInt32() {
|
||||
@ -51,7 +51,7 @@ public extension Api.communities {
|
||||
let _c2 = _2 != nil
|
||||
let _c3 = _3 != nil
|
||||
if _c1 && _c2 && _c3 {
|
||||
return Api.communities.ExportedInvites.exportedInvites(invites: _1!, chats: _2!, users: _3!)
|
||||
return Api.chatlists.ExportedInvites.exportedInvites(invites: _1!, chats: _2!, users: _3!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
|
@ -1369,13 +1369,14 @@ public extension Api.functions.account {
|
||||
}
|
||||
}
|
||||
public extension Api.functions.account {
|
||||
static func uploadWallPaper(file: Api.InputFile, mimeType: String, settings: Api.WallPaperSettings) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.WallPaper>) {
|
||||
static func uploadWallPaper(flags: Int32, file: Api.InputFile, mimeType: String, settings: Api.WallPaperSettings) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.WallPaper>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-578472351)
|
||||
buffer.appendInt32(-476410109)
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
file.serialize(buffer, true)
|
||||
serializeString(mimeType, buffer: buffer, boxed: false)
|
||||
settings.serialize(buffer, true)
|
||||
return (FunctionDescription(name: "account.uploadWallPaper", parameters: [("file", String(describing: file)), ("mimeType", String(describing: mimeType)), ("settings", String(describing: settings))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.WallPaper? in
|
||||
return (FunctionDescription(name: "account.uploadWallPaper", parameters: [("flags", String(describing: flags)), ("file", String(describing: file)), ("mimeType", String(describing: mimeType)), ("settings", String(describing: settings))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.WallPaper? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.WallPaper?
|
||||
if let signature = reader.readInt32() {
|
||||
@ -2952,28 +2953,28 @@ public extension Api.functions.channels {
|
||||
})
|
||||
}
|
||||
}
|
||||
public extension Api.functions.communities {
|
||||
static func checkCommunityInvite(slug: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.communities.CommunityInvite>) {
|
||||
public extension Api.functions.chatlists {
|
||||
static func checkChatlistInvite(slug: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.chatlists.ChatlistInvite>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(161196517)
|
||||
buffer.appendInt32(1103171583)
|
||||
serializeString(slug, buffer: buffer, boxed: false)
|
||||
return (FunctionDescription(name: "communities.checkCommunityInvite", parameters: [("slug", String(describing: slug))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.communities.CommunityInvite? in
|
||||
return (FunctionDescription(name: "chatlists.checkChatlistInvite", parameters: [("slug", String(describing: slug))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.chatlists.ChatlistInvite? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.communities.CommunityInvite?
|
||||
var result: Api.chatlists.ChatlistInvite?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.communities.CommunityInvite
|
||||
result = Api.parse(reader, signature: signature) as? Api.chatlists.ChatlistInvite
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
}
|
||||
public extension Api.functions.communities {
|
||||
static func deleteExportedInvite(community: Api.InputCommunity, slug: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||
public extension Api.functions.chatlists {
|
||||
static func deleteExportedInvite(chatlist: Api.InputChatlist, slug: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-110213610)
|
||||
community.serialize(buffer, true)
|
||||
buffer.appendInt32(1906072670)
|
||||
chatlist.serialize(buffer, true)
|
||||
serializeString(slug, buffer: buffer, boxed: false)
|
||||
return (FunctionDescription(name: "communities.deleteExportedInvite", parameters: [("community", String(describing: community)), ("slug", String(describing: slug))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
|
||||
return (FunctionDescription(name: "chatlists.deleteExportedInvite", parameters: [("chatlist", String(describing: chatlist)), ("slug", String(describing: slug))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Bool?
|
||||
if let signature = reader.readInt32() {
|
||||
@ -2983,12 +2984,12 @@ public extension Api.functions.communities {
|
||||
})
|
||||
}
|
||||
}
|
||||
public extension Api.functions.communities {
|
||||
static func editExportedInvite(flags: Int32, community: Api.InputCommunity, slug: String, title: String?, peers: [Api.InputPeer]?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.ExportedCommunityInvite>) {
|
||||
public extension Api.functions.chatlists {
|
||||
static func editExportedInvite(flags: Int32, chatlist: Api.InputChatlist, slug: String, title: String?, peers: [Api.InputPeer]?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.ExportedChatlistInvite>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(655623442)
|
||||
buffer.appendInt32(1698543165)
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
community.serialize(buffer, true)
|
||||
chatlist.serialize(buffer, true)
|
||||
serializeString(slug, buffer: buffer, boxed: false)
|
||||
if Int(flags) & Int(1 << 1) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
|
||||
if Int(flags) & Int(1 << 2) != 0 {buffer.appendInt32(481674261)
|
||||
@ -2996,73 +2997,73 @@ public extension Api.functions.communities {
|
||||
for item in peers! {
|
||||
item.serialize(buffer, true)
|
||||
}}
|
||||
return (FunctionDescription(name: "communities.editExportedInvite", parameters: [("flags", String(describing: flags)), ("community", String(describing: community)), ("slug", String(describing: slug)), ("title", String(describing: title)), ("peers", String(describing: peers))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.ExportedCommunityInvite? in
|
||||
return (FunctionDescription(name: "chatlists.editExportedInvite", parameters: [("flags", String(describing: flags)), ("chatlist", String(describing: chatlist)), ("slug", String(describing: slug)), ("title", String(describing: title)), ("peers", String(describing: peers))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.ExportedChatlistInvite? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.ExportedCommunityInvite?
|
||||
var result: Api.ExportedChatlistInvite?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.ExportedCommunityInvite
|
||||
result = Api.parse(reader, signature: signature) as? Api.ExportedChatlistInvite
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
}
|
||||
public extension Api.functions.communities {
|
||||
static func exportCommunityInvite(community: Api.InputCommunity, title: String, peers: [Api.InputPeer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.communities.ExportedCommunityInvite>) {
|
||||
public extension Api.functions.chatlists {
|
||||
static func exportChatlistInvite(chatlist: Api.InputChatlist, title: String, peers: [Api.InputPeer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.chatlists.ExportedChatlistInvite>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(1107192281)
|
||||
community.serialize(buffer, true)
|
||||
buffer.appendInt32(-2072885362)
|
||||
chatlist.serialize(buffer, true)
|
||||
serializeString(title, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(peers.count))
|
||||
for item in peers {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
return (FunctionDescription(name: "communities.exportCommunityInvite", parameters: [("community", String(describing: community)), ("title", String(describing: title)), ("peers", String(describing: peers))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.communities.ExportedCommunityInvite? in
|
||||
return (FunctionDescription(name: "chatlists.exportChatlistInvite", parameters: [("chatlist", String(describing: chatlist)), ("title", String(describing: title)), ("peers", String(describing: peers))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.chatlists.ExportedChatlistInvite? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.communities.ExportedCommunityInvite?
|
||||
var result: Api.chatlists.ExportedChatlistInvite?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.communities.ExportedCommunityInvite
|
||||
result = Api.parse(reader, signature: signature) as? Api.chatlists.ExportedChatlistInvite
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
}
|
||||
public extension Api.functions.communities {
|
||||
static func getCommunityUpdates(community: Api.InputCommunity) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.communities.CommunityUpdates>) {
|
||||
public extension Api.functions.chatlists {
|
||||
static func getChatlistUpdates(chatlist: Api.InputChatlist) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.chatlists.ChatlistUpdates>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(693556789)
|
||||
community.serialize(buffer, true)
|
||||
return (FunctionDescription(name: "communities.getCommunityUpdates", parameters: [("community", String(describing: community))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.communities.CommunityUpdates? in
|
||||
buffer.appendInt32(-1992190687)
|
||||
chatlist.serialize(buffer, true)
|
||||
return (FunctionDescription(name: "chatlists.getChatlistUpdates", parameters: [("chatlist", String(describing: chatlist))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.chatlists.ChatlistUpdates? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.communities.CommunityUpdates?
|
||||
var result: Api.chatlists.ChatlistUpdates?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.communities.CommunityUpdates
|
||||
result = Api.parse(reader, signature: signature) as? Api.chatlists.ChatlistUpdates
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
}
|
||||
public extension Api.functions.communities {
|
||||
static func getExportedInvites(community: Api.InputCommunity) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.communities.ExportedInvites>) {
|
||||
public extension Api.functions.chatlists {
|
||||
static func getExportedInvites(chatlist: Api.InputChatlist) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.chatlists.ExportedInvites>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(1183359901)
|
||||
community.serialize(buffer, true)
|
||||
return (FunctionDescription(name: "communities.getExportedInvites", parameters: [("community", String(describing: community))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.communities.ExportedInvites? in
|
||||
buffer.appendInt32(-838608253)
|
||||
chatlist.serialize(buffer, true)
|
||||
return (FunctionDescription(name: "chatlists.getExportedInvites", parameters: [("chatlist", String(describing: chatlist))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.chatlists.ExportedInvites? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.communities.ExportedInvites?
|
||||
var result: Api.chatlists.ExportedInvites?
|
||||
if let signature = reader.readInt32() {
|
||||
result = Api.parse(reader, signature: signature) as? Api.communities.ExportedInvites
|
||||
result = Api.parse(reader, signature: signature) as? Api.chatlists.ExportedInvites
|
||||
}
|
||||
return result
|
||||
})
|
||||
}
|
||||
}
|
||||
public extension Api.functions.communities {
|
||||
static func getLeaveCommunitySuggestions(community: Api.InputCommunity) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.Peer]>) {
|
||||
public extension Api.functions.chatlists {
|
||||
static func getLeaveChatlistSuggestions(chatlist: Api.InputChatlist) -> (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
|
||||
buffer.appendInt32(-37955820)
|
||||
chatlist.serialize(buffer, true)
|
||||
return (FunctionDescription(name: "chatlists.getLeaveChatlistSuggestions", parameters: [("chatlist", String(describing: chatlist))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.Peer]? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: [Api.Peer]?
|
||||
if let _ = reader.readInt32() {
|
||||
@ -3072,12 +3073,12 @@ public extension Api.functions.communities {
|
||||
})
|
||||
}
|
||||
}
|
||||
public extension Api.functions.communities {
|
||||
static func hideCommunityUpdates(community: Api.InputCommunity) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||
public extension Api.functions.chatlists {
|
||||
static func hideChatlistUpdates(chatlist: Api.InputChatlist) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(224889775)
|
||||
community.serialize(buffer, true)
|
||||
return (FunctionDescription(name: "communities.hideCommunityUpdates", parameters: [("community", String(describing: community))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
|
||||
buffer.appendInt32(1726252795)
|
||||
chatlist.serialize(buffer, true)
|
||||
return (FunctionDescription(name: "chatlists.hideChatlistUpdates", parameters: [("chatlist", String(describing: chatlist))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Bool?
|
||||
if let signature = reader.readInt32() {
|
||||
@ -3087,17 +3088,17 @@ public extension Api.functions.communities {
|
||||
})
|
||||
}
|
||||
}
|
||||
public extension Api.functions.communities {
|
||||
static func joinCommunityInvite(slug: String, peers: [Api.InputPeer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||
public extension Api.functions.chatlists {
|
||||
static func joinChatlistInvite(slug: String, peers: [Api.InputPeer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(82835751)
|
||||
buffer.appendInt32(-1498291302)
|
||||
serializeString(slug, buffer: buffer, boxed: false)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(peers.count))
|
||||
for item in peers {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
return (FunctionDescription(name: "communities.joinCommunityInvite", parameters: [("slug", String(describing: slug)), ("peers", String(describing: peers))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||
return (FunctionDescription(name: "chatlists.joinChatlistInvite", parameters: [("slug", String(describing: slug)), ("peers", String(describing: peers))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Updates?
|
||||
if let signature = reader.readInt32() {
|
||||
@ -3107,17 +3108,17 @@ public extension Api.functions.communities {
|
||||
})
|
||||
}
|
||||
}
|
||||
public extension Api.functions.communities {
|
||||
static func joinCommunityUpdates(community: Api.InputCommunity, peers: [Api.InputPeer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||
public extension Api.functions.chatlists {
|
||||
static func joinChatlistUpdates(chatlist: Api.InputChatlist, peers: [Api.InputPeer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(1372856854)
|
||||
community.serialize(buffer, true)
|
||||
buffer.appendInt32(-527828747)
|
||||
chatlist.serialize(buffer, true)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(peers.count))
|
||||
for item in peers {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
return (FunctionDescription(name: "communities.joinCommunityUpdates", parameters: [("community", String(describing: community)), ("peers", String(describing: peers))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||
return (FunctionDescription(name: "chatlists.joinChatlistUpdates", parameters: [("chatlist", String(describing: chatlist)), ("peers", String(describing: peers))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Updates?
|
||||
if let signature = reader.readInt32() {
|
||||
@ -3127,17 +3128,17 @@ public extension Api.functions.communities {
|
||||
})
|
||||
}
|
||||
}
|
||||
public extension Api.functions.communities {
|
||||
static func leaveCommunity(community: Api.InputCommunity, peers: [Api.InputPeer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||
public extension Api.functions.chatlists {
|
||||
static func leaveChatlist(chatlist: Api.InputChatlist, peers: [Api.InputPeer]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(903443807)
|
||||
community.serialize(buffer, true)
|
||||
buffer.appendInt32(1962598714)
|
||||
chatlist.serialize(buffer, true)
|
||||
buffer.appendInt32(481674261)
|
||||
buffer.appendInt32(Int32(peers.count))
|
||||
for item in peers {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
return (FunctionDescription(name: "communities.leaveCommunity", parameters: [("community", String(describing: community)), ("peers", String(describing: peers))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||
return (FunctionDescription(name: "chatlists.leaveChatlist", parameters: [("chatlist", String(describing: chatlist)), ("peers", String(describing: peers))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Updates?
|
||||
if let signature = reader.readInt32() {
|
||||
@ -6881,13 +6882,15 @@ 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>) {
|
||||
static func setChatWallPaper(flags: Int32, peer: Api.InputPeer, wallpaper: Api.InputWallPaper?, settings: Api.WallPaperSettings?, id: Int32?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
|
||||
let buffer = Buffer()
|
||||
buffer.appendInt32(-1109557590)
|
||||
buffer.appendInt32(-609568219)
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
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
|
||||
if Int(flags) & Int(1 << 0) != 0 {wallpaper!.serialize(buffer, true)}
|
||||
if Int(flags) & Int(1 << 0) != 0 {settings!.serialize(buffer, true)}
|
||||
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(id!, buffer: buffer, boxed: false)}
|
||||
return (FunctionDescription(name: "messages.setChatWallPaper", parameters: [("flags", String(describing: flags)), ("peer", String(describing: peer)), ("wallpaper", String(describing: wallpaper)), ("settings", String(describing: settings)), ("id", String(describing: id))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in
|
||||
let reader = BufferReader(buffer)
|
||||
var result: Api.Updates?
|
||||
if let signature = reader.readInt32() {
|
||||
|
@ -1015,7 +1015,7 @@ public extension Api {
|
||||
public extension Api {
|
||||
enum DialogFilter: TypeConstructorDescription {
|
||||
case dialogFilter(flags: Int32, id: Int32, title: String, emoticon: String?, pinnedPeers: [Api.InputPeer], includePeers: [Api.InputPeer], excludePeers: [Api.InputPeer])
|
||||
case dialogFilterCommunity(flags: Int32, id: Int32, title: String, emoticon: String?, pinnedPeers: [Api.InputPeer], includePeers: [Api.InputPeer])
|
||||
case dialogFilterChatlist(flags: Int32, id: Int32, title: String, emoticon: String?, pinnedPeers: [Api.InputPeer], includePeers: [Api.InputPeer])
|
||||
case dialogFilterDefault
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
@ -1044,9 +1044,9 @@ public extension Api {
|
||||
item.serialize(buffer, true)
|
||||
}
|
||||
break
|
||||
case .dialogFilterCommunity(let flags, let id, let title, let emoticon, let pinnedPeers, let includePeers):
|
||||
case .dialogFilterChatlist(let flags, let id, let title, let emoticon, let pinnedPeers, let includePeers):
|
||||
if boxed {
|
||||
buffer.appendInt32(-665432009)
|
||||
buffer.appendInt32(-699792216)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeInt32(id, buffer: buffer, boxed: false)
|
||||
@ -1076,8 +1076,8 @@ public extension Api {
|
||||
switch self {
|
||||
case .dialogFilter(let flags, let id, let title, let emoticon, let pinnedPeers, let includePeers, let excludePeers):
|
||||
return ("dialogFilter", [("flags", flags as Any), ("id", id as Any), ("title", title as Any), ("emoticon", emoticon as Any), ("pinnedPeers", pinnedPeers as Any), ("includePeers", includePeers as Any), ("excludePeers", excludePeers as Any)])
|
||||
case .dialogFilterCommunity(let flags, let id, let title, let emoticon, let pinnedPeers, let includePeers):
|
||||
return ("dialogFilterCommunity", [("flags", flags as Any), ("id", id as Any), ("title", title as Any), ("emoticon", emoticon as Any), ("pinnedPeers", pinnedPeers as Any), ("includePeers", includePeers as Any)])
|
||||
case .dialogFilterChatlist(let flags, let id, let title, let emoticon, let pinnedPeers, let includePeers):
|
||||
return ("dialogFilterChatlist", [("flags", flags as Any), ("id", id as Any), ("title", title as Any), ("emoticon", emoticon as Any), ("pinnedPeers", pinnedPeers as Any), ("includePeers", includePeers as Any)])
|
||||
case .dialogFilterDefault:
|
||||
return ("dialogFilterDefault", [])
|
||||
}
|
||||
@ -1118,7 +1118,7 @@ public extension Api {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
public static func parse_dialogFilterCommunity(_ reader: BufferReader) -> DialogFilter? {
|
||||
public static func parse_dialogFilterChatlist(_ reader: BufferReader) -> DialogFilter? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: Int32?
|
||||
@ -1142,7 +1142,7 @@ public extension Api {
|
||||
let _c5 = _5 != nil
|
||||
let _c6 = _6 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||
return Api.DialogFilter.dialogFilterCommunity(flags: _1!, id: _2!, title: _3!, emoticon: _4, pinnedPeers: _5!, includePeers: _6!)
|
||||
return Api.DialogFilter.dialogFilterChatlist(flags: _1!, id: _2!, title: _3!, emoticon: _4, pinnedPeers: _5!, includePeers: _6!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
|
@ -1025,14 +1025,14 @@ public extension Api {
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum ExportedCommunityInvite: TypeConstructorDescription {
|
||||
case exportedCommunityInvite(flags: Int32, title: String, url: String, peers: [Api.Peer])
|
||||
enum ExportedChatlistInvite: TypeConstructorDescription {
|
||||
case exportedChatlistInvite(flags: Int32, title: String, url: String, peers: [Api.Peer])
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .exportedCommunityInvite(let flags, let title, let url, let peers):
|
||||
case .exportedChatlistInvite(let flags, let title, let url, let peers):
|
||||
if boxed {
|
||||
buffer.appendInt32(-337788502)
|
||||
buffer.appendInt32(206668204)
|
||||
}
|
||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||
serializeString(title, buffer: buffer, boxed: false)
|
||||
@ -1048,12 +1048,12 @@ public extension Api {
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .exportedCommunityInvite(let flags, let title, let url, let peers):
|
||||
return ("exportedCommunityInvite", [("flags", flags as Any), ("title", title as Any), ("url", url as Any), ("peers", peers as Any)])
|
||||
case .exportedChatlistInvite(let flags, let title, let url, let peers):
|
||||
return ("exportedChatlistInvite", [("flags", flags as Any), ("title", title as Any), ("url", url as Any), ("peers", peers as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_exportedCommunityInvite(_ reader: BufferReader) -> ExportedCommunityInvite? {
|
||||
public static func parse_exportedChatlistInvite(_ reader: BufferReader) -> ExportedChatlistInvite? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
var _2: String?
|
||||
@ -1069,7 +1069,7 @@ public extension Api {
|
||||
let _c3 = _3 != nil
|
||||
let _c4 = _4 != nil
|
||||
if _c1 && _c2 && _c3 && _c4 {
|
||||
return Api.ExportedCommunityInvite.exportedCommunityInvite(flags: _1!, title: _2!, url: _3!, peers: _4!)
|
||||
return Api.ExportedChatlistInvite.exportedChatlistInvite(flags: _1!, title: _2!, url: _3!, peers: _4!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
|
@ -436,6 +436,42 @@ public extension Api {
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum InputChatlist: TypeConstructorDescription {
|
||||
case inputChatlistDialogFilter(filterId: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .inputChatlistDialogFilter(let filterId):
|
||||
if boxed {
|
||||
buffer.appendInt32(-203367885)
|
||||
}
|
||||
serializeInt32(filterId, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .inputChatlistDialogFilter(let filterId):
|
||||
return ("inputChatlistDialogFilter", [("filterId", filterId as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_inputChatlistDialogFilter(_ reader: BufferReader) -> InputChatlist? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
if _c1 {
|
||||
return Api.InputChatlist.inputChatlistDialogFilter(filterId: _1!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum InputCheckPasswordSRP: TypeConstructorDescription {
|
||||
case inputCheckPasswordEmpty
|
||||
@ -532,42 +568,6 @@ public extension Api {
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum InputCommunity: TypeConstructorDescription {
|
||||
case inputCommunityDialogFilter(filterId: Int32)
|
||||
|
||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||
switch self {
|
||||
case .inputCommunityDialogFilter(let filterId):
|
||||
if boxed {
|
||||
buffer.appendInt32(450955169)
|
||||
}
|
||||
serializeInt32(filterId, buffer: buffer, boxed: false)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||
switch self {
|
||||
case .inputCommunityDialogFilter(let filterId):
|
||||
return ("inputCommunityDialogFilter", [("filterId", filterId as Any)])
|
||||
}
|
||||
}
|
||||
|
||||
public static func parse_inputCommunityDialogFilter(_ reader: BufferReader) -> InputCommunity? {
|
||||
var _1: Int32?
|
||||
_1 = reader.readInt32()
|
||||
let _c1 = _1 != nil
|
||||
if _c1 {
|
||||
return Api.InputCommunity.inputCommunityDialogFilter(filterId: _1!)
|
||||
}
|
||||
else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public extension Api {
|
||||
enum InputContact: TypeConstructorDescription {
|
||||
case inputPhoneContact(clientId: Int64, phone: String, firstName: String, lastName: String)
|
||||
|
@ -205,7 +205,7 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
|
||||
}
|
||||
|
||||
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, .messageActionSetChatWallPaper:
|
||||
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, .messageActionSetSameChatWallPaper:
|
||||
break
|
||||
case let .messageActionChannelMigrateFrom(_, chatId):
|
||||
result.append(PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)))
|
||||
|
@ -110,6 +110,8 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
|
||||
return TelegramMediaAction(action: .requestedPeer(buttonId: buttonId, peerId: peer.peerId))
|
||||
case let .messageActionSetChatWallPaper(wallpaper):
|
||||
return TelegramMediaAction(action: .setChatWallpaper(wallpaper: TelegramWallpaper(apiWallpaper: wallpaper)))
|
||||
case .messageActionSetSameChatWallPaper:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,7 @@ extension ChatListFilter {
|
||||
}
|
||||
)
|
||||
)
|
||||
case let .dialogFilterCommunity(flags, id, title, emoticon, pinnedPeers, includePeers):
|
||||
case let .dialogFilterChatlist(flags, id, title, emoticon, pinnedPeers, includePeers):
|
||||
self = .filter(
|
||||
id: id,
|
||||
title: title,
|
||||
@ -401,7 +401,7 @@ extension ChatListFilter {
|
||||
if emoticon != nil {
|
||||
flags |= 1 << 25
|
||||
}
|
||||
return .dialogFilterCommunity(flags: flags, id: id, title: title, emoticon: emoticon, pinnedPeers: data.includePeers.pinnedPeers.compactMap { peerId -> Api.InputPeer? in
|
||||
return .dialogFilterChatlist(flags: flags, id: id, title: title, emoticon: emoticon, pinnedPeers: data.includePeers.pinnedPeers.compactMap { peerId -> Api.InputPeer? in
|
||||
return transaction.getPeer(peerId).flatMap(apiInputPeer)
|
||||
}, includePeers: data.includePeers.peers.compactMap { peerId -> Api.InputPeer? in
|
||||
if data.includePeers.pinnedPeers.contains(peerId) {
|
||||
@ -539,7 +539,7 @@ private func requestChatListFilters(accountPeerId: PeerId, postbox: Postbox, net
|
||||
}
|
||||
}
|
||||
}
|
||||
case let .dialogFilterCommunity(_, _, _, _, pinnedPeers, includePeers):
|
||||
case let .dialogFilterChatlist(_, _, _, _, pinnedPeers, includePeers):
|
||||
for peer in pinnedPeers + includePeers {
|
||||
var peerId: PeerId?
|
||||
switch peer {
|
||||
|
@ -10,11 +10,17 @@ public func canShareLinkToPeer(peer: EnginePeer) -> Bool {
|
||||
if channel.flags.contains(.isCreator) || (channel.adminRights?.rights.contains(.canInviteUsers) == true) {
|
||||
isEnabled = true
|
||||
} else if channel.username != nil {
|
||||
isEnabled = true
|
||||
if !channel.flags.contains(.requestToJoin) {
|
||||
isEnabled = true
|
||||
}
|
||||
}
|
||||
case let .legacyGroup(group):
|
||||
if !group.hasBannedPermission(.banAddMembers) {
|
||||
if case .creator = group.role {
|
||||
isEnabled = true
|
||||
} else if case let .admin(rights, _) = group.role {
|
||||
if rights.rights.contains(.canInviteUsers) {
|
||||
isEnabled = true
|
||||
}
|
||||
}
|
||||
default:
|
||||
break
|
||||
@ -63,18 +69,18 @@ func _internal_exportChatFolder(account: Account, filterId: Int32, title: String
|
||||
}
|
||||
|> castError(ExportChatFolderError.self)
|
||||
|> mapToSignal { inputPeers -> Signal<ExportedChatFolderLink, ExportChatFolderError> in
|
||||
return account.network.request(Api.functions.communities.exportCommunityInvite(community: .inputCommunityDialogFilter(filterId: filterId), title: title, peers: inputPeers))
|
||||
|> `catch` { error -> Signal<Api.communities.ExportedCommunityInvite, ExportChatFolderError> in
|
||||
if error.errorDescription == "INVITES_TOO_MUCH" || error.errorDescription == "COMMUNITIES_TOO_MUCH" {
|
||||
return account.network.request(Api.functions.chatlists.exportChatlistInvite(chatlist: .inputChatlistDialogFilter(filterId: filterId), title: title, peers: inputPeers))
|
||||
|> `catch` { error -> Signal<Api.chatlists.ExportedChatlistInvite, ExportChatFolderError> in
|
||||
if error.errorDescription == "INVITES_TOO_MUCH" || error.errorDescription == "CHATLISTS_TOO_MUCH" {
|
||||
return account.postbox.transaction { transaction -> (AppConfiguration, Bool) in
|
||||
return (currentAppConfiguration(transaction: transaction), transaction.getPeer(account.peerId)?.isPremium ?? false)
|
||||
}
|
||||
|> castError(ExportChatFolderError.self)
|
||||
|> mapToSignal { appConfiguration, isPremium -> Signal<Api.communities.ExportedCommunityInvite, ExportChatFolderError> in
|
||||
|> mapToSignal { appConfiguration, isPremium -> Signal<Api.chatlists.ExportedChatlistInvite, ExportChatFolderError> in
|
||||
let userDefaultLimits = UserLimitsConfiguration(appConfiguration: appConfiguration, isPremium: false)
|
||||
let userPremiumLimits = UserLimitsConfiguration(appConfiguration: appConfiguration, isPremium: true)
|
||||
|
||||
if error.errorDescription == "COMMUNITIES_TOO_MUCH" {
|
||||
if error.errorDescription == "CHATLISTS_TOO_MUCH" {
|
||||
if isPremium {
|
||||
return .fail(.sharedFolderLimitExceeded(limit: userPremiumLimits.maxSharedFolderJoin, premiumLimit: userPremiumLimits.maxSharedFolderJoin))
|
||||
} else {
|
||||
@ -95,7 +101,7 @@ func _internal_exportChatFolder(account: Account, filterId: Int32, title: String
|
||||
|> mapToSignal { result -> Signal<ExportedChatFolderLink, ExportChatFolderError> in
|
||||
return account.postbox.transaction { transaction -> Signal<ExportedChatFolderLink, ExportChatFolderError> in
|
||||
switch result {
|
||||
case let .exportedCommunityInvite(filter, invite):
|
||||
case let .exportedChatlistInvite(filter, invite):
|
||||
let parsedFilter = ChatListFilter(apiFilter: filter)
|
||||
|
||||
let _ = updateChatListFiltersState(transaction: transaction, { state in
|
||||
@ -110,7 +116,7 @@ func _internal_exportChatFolder(account: Account, filterId: Int32, title: String
|
||||
})
|
||||
|
||||
switch invite {
|
||||
case let .exportedCommunityInvite(flags, title, url, peers):
|
||||
case let .exportedChatlistInvite(flags, title, url, peers):
|
||||
return .single(ExportedChatFolderLink(
|
||||
title: title,
|
||||
link: url,
|
||||
@ -127,9 +133,9 @@ func _internal_exportChatFolder(account: Account, filterId: Int32, title: String
|
||||
}
|
||||
|
||||
func _internal_getExportedChatFolderLinks(account: Account, id: Int32) -> Signal<[ExportedChatFolderLink]?, NoError> {
|
||||
return account.network.request(Api.functions.communities.getExportedInvites(community: .inputCommunityDialogFilter(filterId: id)))
|
||||
return account.network.request(Api.functions.chatlists.getExportedInvites(chatlist: .inputChatlistDialogFilter(filterId: id)))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.communities.ExportedInvites?, NoError> in
|
||||
|> `catch` { _ -> Signal<Api.chatlists.ExportedInvites?, NoError> in
|
||||
return .single(nil)
|
||||
}
|
||||
|> mapToSignal { result -> Signal<[ExportedChatFolderLink]?, NoError> in
|
||||
@ -161,7 +167,7 @@ func _internal_getExportedChatFolderLinks(account: Account, id: Int32) -> Signal
|
||||
var result: [ExportedChatFolderLink] = []
|
||||
for invite in invites {
|
||||
switch invite {
|
||||
case let .exportedCommunityInvite(flags, title, url, peers):
|
||||
case let .exportedChatlistInvite(flags, title, url, peers):
|
||||
result.append(ExportedChatFolderLink(
|
||||
title: title,
|
||||
link: url,
|
||||
@ -195,13 +201,13 @@ func _internal_editChatFolderLink(account: Account, filterId: Int32, link: Expor
|
||||
flags |= 1 << 2
|
||||
peers = peerIds.compactMap(transaction.getPeer).compactMap(apiInputPeer)
|
||||
}
|
||||
return account.network.request(Api.functions.communities.editExportedInvite(flags: flags, community: .inputCommunityDialogFilter(filterId: filterId), slug: link.slug, title: title, peers: peers))
|
||||
return account.network.request(Api.functions.chatlists.editExportedInvite(flags: flags, chatlist: .inputChatlistDialogFilter(filterId: filterId), slug: link.slug, title: title, peers: peers))
|
||||
|> mapError { _ -> EditChatFolderLinkError in
|
||||
return .generic
|
||||
}
|
||||
|> map { result in
|
||||
switch result {
|
||||
case let .exportedCommunityInvite(flags, title, url, peers):
|
||||
case let .exportedChatlistInvite(flags, title, url, peers):
|
||||
return ExportedChatFolderLink(
|
||||
title: title,
|
||||
link: url,
|
||||
@ -213,7 +219,6 @@ func _internal_editChatFolderLink(account: Account, filterId: Int32, link: Expor
|
||||
}
|
||||
|> castError(EditChatFolderLinkError.self)
|
||||
|> switchToLatest
|
||||
|
||||
}
|
||||
|
||||
public enum RevokeChatFolderLinkError {
|
||||
@ -221,7 +226,7 @@ public enum RevokeChatFolderLinkError {
|
||||
}
|
||||
|
||||
func _internal_deleteChatFolderLink(account: Account, filterId: Int32, link: ExportedChatFolderLink) -> Signal<Never, RevokeChatFolderLinkError> {
|
||||
return account.network.request(Api.functions.communities.deleteExportedInvite(community: .inputCommunityDialogFilter(filterId: filterId), slug: link.slug))
|
||||
return account.network.request(Api.functions.chatlists.deleteExportedInvite(chatlist: .inputChatlistDialogFilter(filterId: filterId), slug: link.slug))
|
||||
|> mapError { error -> RevokeChatFolderLinkError in
|
||||
return .generic
|
||||
}
|
||||
@ -255,14 +260,14 @@ public final class ChatFolderLinkContents {
|
||||
}
|
||||
|
||||
func _internal_checkChatFolderLink(account: Account, slug: String) -> Signal<ChatFolderLinkContents, CheckChatFolderLinkError> {
|
||||
return account.network.request(Api.functions.communities.checkCommunityInvite(slug: slug))
|
||||
return account.network.request(Api.functions.chatlists.checkChatlistInvite(slug: slug))
|
||||
|> mapError { _ -> CheckChatFolderLinkError in
|
||||
return .generic
|
||||
}
|
||||
|> mapToSignal { result -> Signal<ChatFolderLinkContents, CheckChatFolderLinkError> in
|
||||
return account.postbox.transaction { transaction -> ChatFolderLinkContents in
|
||||
switch result {
|
||||
case let .communityInvite(_, title, emoticon, peers, chats, users):
|
||||
case let .chatlistInvite(_, title, emoticon, peers, chats, users):
|
||||
let _ = emoticon
|
||||
|
||||
var allPeers: [Peer] = []
|
||||
@ -304,7 +309,7 @@ func _internal_checkChatFolderLink(account: Account, slug: String) -> Signal<Cha
|
||||
alreadyMemberPeerIds.removeAll()
|
||||
|
||||
return ChatFolderLinkContents(localFilterId: nil, title: title, peers: resultPeers, alreadyMemberPeerIds: alreadyMemberPeerIds, memberCounts: memberCounts)
|
||||
case let .communityInviteAlready(filterId, missingPeers, alreadyPeers, chats, users):
|
||||
case let .chatlistInviteAlready(filterId, missingPeers, alreadyPeers, chats, users):
|
||||
let _ = alreadyPeers
|
||||
|
||||
var allPeers: [Peer] = []
|
||||
@ -375,6 +380,12 @@ func _internal_checkChatFolderLink(account: Account, slug: String) -> Signal<Cha
|
||||
}
|
||||
}
|
||||
|> castError(CheckChatFolderLinkError.self)
|
||||
|> mapToSignal { result -> Signal<ChatFolderLinkContents, CheckChatFolderLinkError> in
|
||||
if result.localFilterId == nil && result.peers.isEmpty {
|
||||
return .fail(.generic)
|
||||
}
|
||||
return .single(result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -410,7 +421,7 @@ func _internal_joinChatFolderLink(account: Account, slug: String, peerIds: [Engi
|
||||
}
|
||||
|> castError(JoinChatFolderLinkError.self)
|
||||
|> mapToSignal { inputPeers, newChatCount -> Signal<JoinChatFolderResult, JoinChatFolderLinkError> in
|
||||
return account.network.request(Api.functions.communities.joinCommunityInvite(slug: slug, peers: inputPeers))
|
||||
return account.network.request(Api.functions.chatlists.joinChatlistInvite(slug: slug, peers: inputPeers))
|
||||
|> `catch` { error -> Signal<Api.Updates, JoinChatFolderLinkError> in
|
||||
if error.errorDescription == "USER_CHANNELS_TOO_MUCH" {
|
||||
return account.postbox.transaction { transaction -> (AppConfiguration, Bool) in
|
||||
@ -442,7 +453,7 @@ func _internal_joinChatFolderLink(account: Account, slug: String, peerIds: [Engi
|
||||
return .fail(.dialogFilterLimitExceeded(limit: userDefaultLimits.maxFoldersCount, premiumLimit: userPremiumLimits.maxFoldersCount))
|
||||
}
|
||||
}
|
||||
} else if error.errorDescription == "COMMUNITIES_TOO_MUCH" {
|
||||
} else if error.errorDescription == "CHATLISTS_TOO_MUCH" {
|
||||
return account.postbox.transaction { transaction -> (AppConfiguration, Bool) in
|
||||
return (currentAppConfiguration(transaction: transaction), transaction.getPeer(account.peerId)?.isPremium ?? false)
|
||||
}
|
||||
@ -551,7 +562,7 @@ func _internal_pollChatFolderUpdatesOnce(account: Account, folderId: Int32) -> S
|
||||
var updateInterval: Int32 = 3600
|
||||
|
||||
if let data = appConfig.data {
|
||||
if let value = data["community_update_period"] as? Double {
|
||||
if let value = data["chatlist_update_period"] as? Double {
|
||||
updateInterval = Int32(value)
|
||||
}
|
||||
}
|
||||
@ -569,9 +580,9 @@ func _internal_pollChatFolderUpdatesOnce(account: Account, folderId: Int32) -> S
|
||||
firstTimeFolderUpdates.insert(key)
|
||||
}
|
||||
|
||||
return account.network.request(Api.functions.communities.getCommunityUpdates(community: .inputCommunityDialogFilter(filterId: folderId)))
|
||||
return account.network.request(Api.functions.chatlists.getChatlistUpdates(chatlist: .inputChatlistDialogFilter(filterId: folderId)))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.communities.CommunityUpdates?, NoError> in
|
||||
|> `catch` { _ -> Signal<Api.chatlists.ChatlistUpdates?, NoError> in
|
||||
return .single(nil)
|
||||
}
|
||||
|> mapToSignal { result -> Signal<Never, NoError> in
|
||||
@ -589,7 +600,7 @@ func _internal_pollChatFolderUpdatesOnce(account: Account, folderId: Int32) -> S
|
||||
|> ignoreValues
|
||||
}
|
||||
switch result {
|
||||
case let .communityUpdates(missingPeers, chats, users):
|
||||
case let .chatlistUpdates(missingPeers, chats, users):
|
||||
return account.postbox.transaction { transaction -> Void in
|
||||
var peers: [Peer] = []
|
||||
var peerPresences: [PeerId: Api.User] = [:]
|
||||
@ -682,7 +693,7 @@ func _internal_joinAvailableChatsInFolder(account: Account, updates: ChatFolderU
|
||||
}
|
||||
|> castError(JoinChatFolderLinkError.self)
|
||||
|> mapToSignal { inputPeers -> Signal<Never, JoinChatFolderLinkError> in
|
||||
return account.network.request(Api.functions.communities.joinCommunityUpdates(community: .inputCommunityDialogFilter(filterId: updates.folderId), peers: inputPeers))
|
||||
return account.network.request(Api.functions.chatlists.joinChatlistUpdates(chatlist: .inputChatlistDialogFilter(filterId: updates.folderId), peers: inputPeers))
|
||||
|> `catch` { error -> Signal<Api.Updates, JoinChatFolderLinkError> in
|
||||
if error.errorDescription == "DIALOG_FILTERS_TOO_MUCH" {
|
||||
return account.postbox.transaction { transaction -> (AppConfiguration, Bool) in
|
||||
@ -737,7 +748,7 @@ func _internal_hideChatFolderUpdates(account: Account, folderId: Int32) -> Signa
|
||||
})
|
||||
}
|
||||
|> mapToSignal { _ -> Signal<Never, NoError> in
|
||||
return account.network.request(Api.functions.communities.hideCommunityUpdates(community: .inputCommunityDialogFilter(filterId: folderId)))
|
||||
return account.network.request(Api.functions.chatlists.hideChatlistUpdates(chatlist: .inputChatlistDialogFilter(filterId: folderId)))
|
||||
|> `catch` { _ -> Signal<Api.Bool, NoError> in
|
||||
return .single(.boolFalse)
|
||||
}
|
||||
@ -750,7 +761,7 @@ func _internal_leaveChatFolder(account: Account, folderId: Int32, removePeerIds:
|
||||
return removePeerIds.compactMap(transaction.getPeer).compactMap(apiInputPeer)
|
||||
}
|
||||
|> mapToSignal { inputPeers -> Signal<Never, NoError> in
|
||||
return account.network.request(Api.functions.communities.leaveCommunity(community: .inputCommunityDialogFilter(filterId: folderId), peers: inputPeers))
|
||||
return account.network.request(Api.functions.chatlists.leaveChatlist(chatlist: .inputChatlistDialogFilter(filterId: folderId), peers: inputPeers))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.Updates?, NoError> in
|
||||
return .single(nil)
|
||||
@ -767,7 +778,7 @@ 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)))
|
||||
return account.network.request(Api.functions.chatlists.getLeaveChatlistSuggestions(chatlist: .inputChatlistDialogFilter(filterId: folderId)))
|
||||
|> map { result -> [EnginePeer.Id] in
|
||||
return result.map(\.peerId)
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ func _internal_setChatWallpaper(account: Account, peerId: PeerId, wallpaper: Tel
|
||||
inputSettings = inputWallpaperAndInputSettings.1
|
||||
}
|
||||
|
||||
return account.network.request(Api.functions.messages.setChatWallPaper(peer: inputPeer, wallpaper: inputWallpaper ?? .inputWallPaperNoFile(id: 0), settings: inputSettings ?? apiWallpaperSettings(WallpaperSettings())))
|
||||
return account.network.request(Api.functions.messages.setChatWallPaper(flags: 0, peer: inputPeer, wallpaper: inputWallpaper ?? .inputWallPaperNoFile(id: 0), settings: inputSettings ?? apiWallpaperSettings(WallpaperSettings()), id: nil))
|
||||
|> `catch` { error in
|
||||
return .complete()
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public func uploadWallpaper(account: Account, resource: MediaResource, mimeType:
|
||||
case let .progress(progress):
|
||||
return .single((.progress(progress), result.resource))
|
||||
case let .inputFile(file):
|
||||
return account.network.request(Api.functions.account.uploadWallPaper(file: file, mimeType: mimeType, settings: apiWallpaperSettings(settings)))
|
||||
return account.network.request(Api.functions.account.uploadWallPaper(flags: 0, file: file, mimeType: mimeType, settings: apiWallpaperSettings(settings)))
|
||||
|> mapError { _ in return UploadWallpaperError.generic }
|
||||
|> map { wallpaper -> (UploadWallpaperStatus, MediaResource?) in
|
||||
return (.complete(TelegramWallpaper(apiWallpaper: wallpaper)), result.resource)
|
||||
|
@ -832,9 +832,23 @@ private final class ChatFolderLinkPreviewScreenComponent: Component {
|
||||
//TODO:localize
|
||||
let presentationData = context.sharedContext.currentPresentationData.with({ $0 })
|
||||
if case .updates = component.subject {
|
||||
chatListController.present(UndoOverlayController(presentationData: presentationData, content: .info(title: "Folder \(result.title) Updated", text: "You have joined \(result.newChatCount) new chats", timeout: nil), elevatedLayout: false, action: { _ in true }), in: .current)
|
||||
let chatCountString: String
|
||||
if result.newChatCount == 1 {
|
||||
chatCountString = "1 new chat"
|
||||
} else {
|
||||
chatCountString = "\(result.newChatCount) new chats"
|
||||
}
|
||||
|
||||
chatListController.present(UndoOverlayController(presentationData: presentationData, content: .info(title: "Folder \(result.title) Updated", text: "You have joined \(chatCountString)", timeout: nil), elevatedLayout: false, action: { _ in true }), in: .current)
|
||||
} else if result.newChatCount != 0 {
|
||||
chatListController.present(UndoOverlayController(presentationData: presentationData, content: .info(title: "Folder \(result.title) Added", text: "You also joined \(result.newChatCount) chats", timeout: nil), elevatedLayout: false, action: { _ in true }), in: .current)
|
||||
let chatCountString: String
|
||||
if result.newChatCount == 1 {
|
||||
chatCountString = "1 chat"
|
||||
} else {
|
||||
chatCountString = "\(result.newChatCount) chats"
|
||||
}
|
||||
|
||||
chatListController.present(UndoOverlayController(presentationData: presentationData, content: .info(title: "Folder \(result.title) Added", text: "You also joined \(chatCountString)", timeout: nil), elevatedLayout: false, action: { _ in true }), in: .current)
|
||||
} else {
|
||||
chatListController.present(UndoOverlayController(presentationData: presentationData, content: .info(title: nil, text: "Folder \(result.title) Added", timeout: nil), elevatedLayout: false, action: { _ in true }), in: .current)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user