Autoremove fixes

This commit is contained in:
Ali 2021-02-12 22:28:08 +04:00
parent 713becceb4
commit b9103139ec
24 changed files with 37047 additions and 36804 deletions

View File

@ -3,51 +3,7 @@
<plist version="1.0">
<dict>
<key>INEnums</key>
<array>
<dict>
<key>INEnumDisplayName</key>
<string>Display Chats</string>
<key>INEnumDisplayNameID</key>
<string>k9oGrF</string>
<key>INEnumGeneratesHeader</key>
<true/>
<key>INEnumName</key>
<string>Contents</string>
<key>INEnumType</key>
<string>Regular</string>
<key>INEnumValues</key>
<array>
<dict>
<key>INEnumValueDisplayName</key>
<string>unknown</string>
<key>INEnumValueDisplayNameID</key>
<string>OnVgw0</string>
<key>INEnumValueName</key>
<string>unknown</string>
</dict>
<dict>
<key>INEnumValueDisplayName</key>
<string>Recent Chats</string>
<key>INEnumValueDisplayNameID</key>
<string>X0HAPm</string>
<key>INEnumValueIndex</key>
<integer>1</integer>
<key>INEnumValueName</key>
<string>recent</string>
</dict>
<dict>
<key>INEnumValueDisplayName</key>
<string>Custom</string>
<key>INEnumValueDisplayNameID</key>
<string>VpZ0cC</string>
<key>INEnumValueIndex</key>
<integer>2</integer>
<key>INEnumValueName</key>
<string>custom</string>
</dict>
</array>
</dict>
</array>
<array/>
<key>INIntentDefinitionModelVersion</key>
<string>1.2</string>
<key>INIntentDefinitionNamespace</key>
@ -55,9 +11,9 @@
<key>INIntentDefinitionSystemVersion</key>
<string>20C69</string>
<key>INIntentDefinitionToolsBuildVersion</key>
<string>12C33</string>
<string>12D4e</string>
<key>INIntentDefinitionToolsVersion</key>
<string>12.3</string>
<string>12.4</string>
<key>INIntents</key>
<array>
<dict>
@ -80,7 +36,7 @@
<array>
<dict>
<key>INIntentParameterArraySizeSize</key>
<integer>4</integer>
<integer>1</integer>
<key>INIntentParameterArraySizeSizeClass</key>
<string>Small</string>
</dict>
@ -92,7 +48,7 @@
</dict>
<dict>
<key>INIntentParameterArraySizeSize</key>
<integer>16</integer>
<integer>8</integer>
<key>INIntentParameterArraySizeSizeClass</key>
<string>Large</string>
</dict>
@ -176,6 +132,111 @@
<key>INIntentVerb</key>
<string>View</string>
</dict>
<dict>
<key>INIntentCategory</key>
<string>information</string>
<key>INIntentDescriptionID</key>
<string>zzS0gJ</string>
<key>INIntentEligibleForWidgets</key>
<true/>
<key>INIntentIneligibleForSuggestions</key>
<true/>
<key>INIntentLastParameterTag</key>
<integer>3</integer>
<key>INIntentName</key>
<string>SelectAvatarFriends</string>
<key>INIntentParameters</key>
<array>
<dict>
<key>INIntentParameterArraySizes</key>
<array>
<dict>
<key>INIntentParameterArraySizeSize</key>
<integer>1</integer>
<key>INIntentParameterArraySizeSizeClass</key>
<string>Small</string>
</dict>
<dict>
<key>INIntentParameterArraySizeSize</key>
<integer>4</integer>
<key>INIntentParameterArraySizeSizeClass</key>
<string>Medium</string>
</dict>
<dict>
<key>INIntentParameterArraySizeSize</key>
<integer>8</integer>
<key>INIntentParameterArraySizeSizeClass</key>
<string>Large</string>
</dict>
</array>
<key>INIntentParameterConfigurable</key>
<true/>
<key>INIntentParameterDisplayPriority</key>
<integer>1</integer>
<key>INIntentParameterFixedSizeArray</key>
<integer>1</integer>
<key>INIntentParameterName</key>
<string>friends</string>
<key>INIntentParameterObjectType</key>
<string>Friend</string>
<key>INIntentParameterObjectTypeNamespace</key>
<string>p74MWb</string>
<key>INIntentParameterPromptDialogs</key>
<array>
<dict>
<key>INIntentParameterPromptDialogCustom</key>
<true/>
<key>INIntentParameterPromptDialogFormatString</key>
<string>Search</string>
<key>INIntentParameterPromptDialogFormatStringID</key>
<string>xeb2pd</string>
<key>INIntentParameterPromptDialogType</key>
<string>Configuration</string>
</dict>
<dict>
<key>INIntentParameterPromptDialogCustom</key>
<true/>
<key>INIntentParameterPromptDialogType</key>
<string>Primary</string>
</dict>
</array>
<key>INIntentParameterSupportsDynamicEnumeration</key>
<true/>
<key>INIntentParameterSupportsMultipleValues</key>
<true/>
<key>INIntentParameterSupportsSearch</key>
<true/>
<key>INIntentParameterTag</key>
<integer>3</integer>
<key>INIntentParameterType</key>
<string>Object</string>
</dict>
</array>
<key>INIntentResponse</key>
<dict>
<key>INIntentResponseCodes</key>
<array>
<dict>
<key>INIntentResponseCodeName</key>
<string>success</string>
<key>INIntentResponseCodeSuccess</key>
<true/>
</dict>
<dict>
<key>INIntentResponseCodeName</key>
<string>failure</string>
</dict>
</array>
</dict>
<key>INIntentTitle</key>
<string>Select</string>
<key>INIntentTitleID</key>
<string>kiqCaL</string>
<key>INIntentType</key>
<string>Custom</string>
<key>INIntentVerb</key>
<string>View</string>
</dict>
</array>
<key>INTypes</key>
<array>

View File

@ -54,7 +54,7 @@ enum IntentHandlingError {
@available(iOSApplicationExtension 10.0, iOS 10.0, *)
@objc(IntentHandler)
class IntentHandler: INExtension, INSendMessageIntentHandling, INSearchForMessagesIntentHandling, INSetMessageAttributeIntentHandling, INStartAudioCallIntentHandling, INSearchCallHistoryIntentHandling, SelectFriendsIntentHandling {
class IntentHandler: INExtension, INSendMessageIntentHandling, INSearchForMessagesIntentHandling, INSetMessageAttributeIntentHandling, INStartAudioCallIntentHandling, INSearchCallHistoryIntentHandling, SelectFriendsIntentHandling, SelectAvatarFriendsIntentHandling {
private let accountPromise = Promise<Account?>()
private let allAccounts = Promise<[(AccountRecordId, PeerId)]>()
@ -845,74 +845,69 @@ class IntentHandler: INExtension, INSendMessageIntentHandling, INSearchForMessag
}, error: { error in
completion(nil, error)
}))
}
@available(iOSApplicationExtension 14.0, iOS 14.0, *)
func provideFriendsOptionsCollection(for intent: SelectAvatarFriendsIntent, searchTerm: String?, with completion: @escaping (INObjectCollection<Friend>?, Error?) -> Void) {
guard let rootPath = self.rootPath, let _ = self.accountManager, let encryptionParameters = self.encryptionParameters else {
completion(nil, nil)
return
}
/*let _ = (self.accountPromise.get()
|> take(1)
|> mapToSignal { account -> Signal<[Friend], NoError> in
guard let account = account else {
return .single([])
if let data = try? Data(contentsOf: URL(fileURLWithPath: appLockStatePath(rootPath: rootPath))), let state = try? JSONDecoder().decode(LockState.self, from: data) {
if state.isManuallyLocked || state.autolockTimeout != nil {
let error = NSError(domain: "Locked", code: 1, userInfo: [
NSLocalizedDescriptionKey: "Open Telegram and enter passcode to edit widget."
])
completion(nil, error)
return
}
}
self.searchDisposable.set((self.allAccounts.get()
|> castError(Error.self)
|> take(1)
|> mapToSignal { accounts -> Signal<INObjectCollection<Friend>, Error> in
var accountResults: [Signal<INObjectSection<Friend>, Error>] = []
if let searchTerm = searchTerm {
if !searchTerm.isEmpty {
return account.postbox.searchPeers(query: searchTerm)
|> map { renderedPeers -> [Friend] in
var peers: [Peer] = []
for renderedPeer in renderedPeers {
if let peer = renderedPeer.peer, !(peer is TelegramSecretChat) {
for (accountId, accountPeerId) in accounts {
accountResults.append(accountTransaction(rootPath: rootPath, id: accountId, encryptionParameters: encryptionParameters, transaction: { postbox, transaction -> INObjectSection<Friend> in
var accountTitle: String = ""
if let peer = transaction.getPeer(accountPeerId) as? TelegramUser {
if let username = peer.username, !username.isEmpty {
accountTitle = "@\(username)"
} else {
accountTitle = peer.debugDisplayTitle
}
}
var peers: [Peer] = []
if let searchTerm = searchTerm {
if !searchTerm.isEmpty {
for renderedPeer in transaction.searchPeers(query: searchTerm) {
if let peer = renderedPeer.peer, !(peer is TelegramSecretChat), !peer.isDeleted {
peers.append(peer)
}
}
if peers.count > 30 {
peers = Array(peers.dropLast(peers.count - 30))
}
}
} else {
for renderedPeer in transaction.getTopChatListEntries(groupId: .root, count: 50) {
if let peer = renderedPeer.peer, !(peer is TelegramSecretChat), !peer.isDeleted {
peers.append(peer)
}
}
peers.sort(by: { lhs, rhs in
return lhs.debugDisplayTitle < rhs.debugDisplayTitle
})
if peers.count > 30 {
peers = Array(peers.dropLast(peers.count - 30))
}
var result: [Friend] = []
for peer in peers {
let profileImage = smallestImageRepresentation(peer.profileImageRepresentations).flatMap { representation in
return account.postbox.mediaBox.resourcePath(representation.resource)
}.flatMap { path -> INImage? in
if let data = try? Data(contentsOf: URL(fileURLWithPath: path)) {
return INImage(imageData: data)
} else {
return nil
}
}
result.append(Friend(identifier: "\(peer.id.toInt64())", display: peer.debugDisplayTitle, subtitle: nil, image: nil))
}
return result
}
} else {
return .single([])
}
} else {
return account.postbox.transaction { transaction -> [Friend] in
var peers: [Peer] = []
for peerId in transaction.getContactPeerIds() {
if let peer = transaction.getPeer(peerId) as? TelegramUser {
peers.append(peer)
}
}
peers.sort(by: { lhs, rhs in
return lhs.debugDisplayTitle < rhs.debugDisplayTitle
})
if peers.count > 50 {
peers = Array(peers.dropLast(peers.count - 50))
}
var result: [Friend] = []
var items: [Friend] = []
for peer in peers {
let profileImage = smallestImageRepresentation(peer.profileImageRepresentations).flatMap { representation in
return account.postbox.mediaBox.resourcePath(representation.resource)
return postbox.mediaBox.resourcePath(representation.resource)
}.flatMap { path -> INImage? in
if let data = try? Data(contentsOf: URL(fileURLWithPath: path)) {
return INImage(imageData: data)
@ -920,15 +915,29 @@ class IntentHandler: INExtension, INSendMessageIntentHandling, INSearchForMessag
return nil
}
}
result.append(Friend(identifier: "\(peer.id.toInt64())", display: peer.debugDisplayTitle, subtitle: nil, image: nil))
items.append(Friend(identifier: "\(accountId.int64):\(peer.id.toInt64())", display: peer.debugDisplayTitle, subtitle: nil, image: nil))
}
return result
return INObjectSection<Friend>(title: accountTitle, items: items)
})
|> castError(Error.self))
}
return combineLatest(accountResults)
|> map { accountResults -> INObjectCollection<Friend> in
let filteredSections = accountResults.filter { section in
return !section.items.isEmpty
}
if filteredSections.count == 1 {
return INObjectCollection<Friend>(items: filteredSections[0].items)
} else {
return INObjectCollection<Friend>(sections: filteredSections)
}
}
}
|> deliverOnMainQueue).start(next: { result in
let collection = INObjectCollection(items: result)
completion(collection, nil)
})*/
}).start(next: { result in
completion(result, nil)
}, error: { error in
completion(nil, error)
}))
}
}

View File

@ -6072,3 +6072,6 @@ Sorry for the inconvenience.";
"BroadcastGroups.LimitAlert.Title" = "Limit Reached";
"BroadcastGroups.LimitAlert.Text" = "Your group has reached a limit of **%@** members. You can increase this limit by converting the group to a **broadcast group** where only admins can post. Interested?";
"BroadcastGroups.LimitAlert.LearnMore" = "Learn More";
"Channel.AdminLog.MessageChangedAutoremoveTimeoutSet" = "%1$@ set auto-remove timer to %2$@";
"Channel.AdminLog.MessageChangedAutoremoveTimeoutRemove" = "%1$@ disabled auto-remove timer";

View File

@ -233,15 +233,96 @@ struct Provider: IntentTimelineProvider {
let result = ParsedPeers(peers: orderedPeers, updateTimestamp: Int32(Date().timeIntervalSince1970))
completion(Timeline(entries: [SimpleEntry(date: entryDate, contents: .peers(result))], policy: .atEnd))
})
}
}
struct AvatarsProvider: IntentTimelineProvider {
public typealias Entry = SimpleEntry
func placeholder(in context: Context) -> SimpleEntry {
return SimpleEntry(date: Date(), contents: .recent)
}
func getSnapshot(for configuration: SelectAvatarFriendsIntent, in context: Context, completion: @escaping (SimpleEntry) -> ()) {
let entry = SimpleEntry(date: Date(), contents: .peers(ParsedPeers(accountId: 0, peers: WidgetDataPeers(accountPeerId: 0, peers: [], updateTimestamp: 0))))
completion(entry)
}
func getTimeline(for configuration: SelectAvatarFriendsIntent, in context: Context, completion: @escaping (Timeline<Entry>) -> ()) {
let currentDate = Date()
let entryDate = Calendar.current.date(byAdding: .hour, value: 0, to: currentDate)!
/*let _ = (accountTransaction(rootPath: rootPath, id: AccountRecordId(rawValue: widgetData.accountId), encryptionParameters: encryptionParameters, transaction: { postbox, transaction -> ParsedPeers in
var peers: [ParsedPeer] = []
if let items = configuration.friends {
for item in items {
guard let identifier = item.identifier, let peerIdValue = Int64(identifier) else {
continue
}
guard let peer = transaction.getPeer(PeerId(peerIdValue)) else {
guard let appBundleIdentifier = Bundle.main.bundleIdentifier, let lastDotRange = appBundleIdentifier.range(of: ".", options: [.backwards]) else {
completion(Timeline(entries: [SimpleEntry(date: entryDate, contents: .recent)], policy: .atEnd))
return
}
let baseAppBundleId = String(appBundleIdentifier[..<lastDotRange.lowerBound])
let appGroupName = "group.\(baseAppBundleId)"
let maybeAppGroupUrl = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupName)
guard let appGroupUrl = maybeAppGroupUrl else {
completion(Timeline(entries: [SimpleEntry(date: entryDate, contents: .recent)], policy: .atEnd))
return
}
let rootPath = rootPathForBasePath(appGroupUrl.path)
let dataPath = rootPath + "/widget-data"
guard let data = try? Data(contentsOf: URL(fileURLWithPath: dataPath)), let widgetData = try? JSONDecoder().decode(WidgetData.self, from: data), case let .peers(widgetPeers) = widgetData.content else {
completion(Timeline(entries: [SimpleEntry(date: entryDate, contents: .recent)], policy: .atEnd))
return
}
TempBox.initializeShared(basePath: rootPath, processType: "widget", launchSpecificId: arc4random64())
let logsPath = rootPath + "/widget-logs"
let _ = try? FileManager.default.createDirectory(atPath: logsPath, withIntermediateDirectories: true, attributes: nil)
setupSharedLogger(rootPath: rootPath, path: logsPath)
initializeAccountManagement()
let deviceSpecificEncryptionParameters = BuildConfig.deviceSpecificEncryptionParameters(rootPath, baseAppBundleId: baseAppBundleId)
let encryptionParameters = ValueBoxEncryptionParameters(forceEncryptionIfNoSet: false, key: ValueBoxEncryptionParameters.Key(data: deviceSpecificEncryptionParameters.key)!, salt: ValueBoxEncryptionParameters.Salt(data: deviceSpecificEncryptionParameters.salt)!)
var itemsByAccount: [Int64: [(Int64, Friend)]] = [:]
var itemOrder: [(Int64, Int64)] = []
if let friends = configuration.friends {
for item in friends {
guard let identifier = item.identifier else {
continue
}
guard let index = identifier.firstIndex(of: ":") else {
continue
}
guard let accountId = Int64(identifier[identifier.startIndex ..< index]) else {
continue
}
guard let peerId = Int64(identifier[identifier.index(after: index)...]) else {
continue
}
if itemsByAccount[accountId] == nil {
itemsByAccount[accountId] = []
}
itemsByAccount[accountId]?.append((peerId, item))
itemOrder.append((accountId, peerId))
}
}
var friendsByAccount: [Signal<[ParsedPeer], NoError>] = []
for (accountId, items) in itemsByAccount {
friendsByAccount.append(accountTransaction(rootPath: rootPath, id: AccountRecordId(rawValue: accountId), encryptionParameters: encryptionParameters, transaction: { postbox, transaction -> [ParsedPeer] in
guard let state = transaction.getState() as? AuthorizedAccountState else {
return []
}
var result: [ParsedPeer] = []
for (peerId, _) in items {
guard let peer = transaction.getPeer(PeerId(peerId)) else {
continue
}
@ -281,16 +362,34 @@ struct Provider: IntentTimelineProvider {
}
}
peers.append(WidgetDataPeer(id: peer.id.toInt64(), name: name, lastName: lastName, letters: peer.displayLetters, avatarPath: smallestImageRepresentation(peer.profileImageRepresentations).flatMap { representation in
let widgetPeer = WidgetDataPeer(id: peer.id.toInt64(), name: name, lastName: lastName, letters: peer.displayLetters, avatarPath: smallestImageRepresentation(peer.profileImageRepresentations).flatMap { representation in
return postbox.mediaBox.resourcePath(representation.resource)
}, badge: badge, message: mappedMessage))
}, badge: badge, message: mappedMessage)
result.append(ParsedPeer(accountId: accountId, accountPeerId: state.peerId.toInt64(), peer: widgetPeer))
}
return result
}))
}
let _ = combineLatest(friendsByAccount).start(next: { allPeers in
var orderedPeers: [ParsedPeer] = []
outer: for (accountId, peerId) in itemOrder {
for peerSet in allPeers {
for peer in peerSet {
if peer.accountId == accountId && peer.peer.id == peerId {
orderedPeers.append(peer)
continue outer
}
}
}
}
return ParsedPeers(peers: peers, updateTimestamp: Int32(Date().timeIntervalSince1970))
let result = ParsedPeers(peers: orderedPeers, updateTimestamp: Int32(Date().timeIntervalSince1970))
completion(Timeline(entries: [SimpleEntry(date: entryDate, contents: .peers(result))], policy: .atEnd))
})
|> deliverOnMainQueue).start(next: { peers in
completion(Timeline(entries: [SimpleEntry(date: entryDate, contents: .peers(peers))], policy: .atEnd))
})*/
}
}
@ -783,9 +882,9 @@ struct WidgetView: View {
func getSeparatorColor() -> Color {
switch colorScheme {
case .light:
return Color(.sRGB, red: 200.0 / 255.0, green: 199.0 / 255.0, blue: 204.0 / 255.0, opacity: 1.0)
return Color(.sRGB, red: 216.0 / 255.0, green: 216.0 / 255.0, blue: 216.0 / 255.0, opacity: 1.0)
case .dark:
return Color(.sRGB, red: 61.0 / 255.0, green: 61.0 / 255.0, blue: 64.0 / 255.0, opacity: 1.0)
return Color(.sRGB, red: 0.0 / 255.0, green: 0.0 / 255.0, blue: 0.0 / 255.0, opacity: 1.0)
@unknown default:
return .secondary
}
@ -816,9 +915,9 @@ struct WidgetView: View {
func getPlaceholderColor() -> Color {
switch colorScheme {
case .light:
return Color(.sRGB, red: 242.0 / 255.0, green: 242.0 / 255.0, blue: 247.0 / 255.0, opacity: 1.0)
return Color(.sRGB, red: 235.0 / 255.0, green: 235.0 / 255.0, blue: 241.0 / 255.0, opacity: 1.0)
case .dark:
return Color(.sRGB, red: 21.0 / 255.0, green: 21.0 / 255.0, blue: 21.0 / 255.0, opacity: 1.0)
return Color(.sRGB, red: 38.0 / 255.0, green: 38.0 / 255.0, blue: 41.0 / 255.0, opacity: 1.0)
@unknown default:
return .secondary
}
@ -921,7 +1020,6 @@ func getWidgetData(contents: SimpleEntry.Contents) -> PeersWidgetData {
}
}
@main
struct Static_Widget: Widget {
private let kind: String = "Static_Widget"
@ -934,3 +1032,24 @@ struct Static_Widget: Widget {
.description(presentationData.widgetGalleryDescription)
}
}
struct Static_AvatarsWidget: Widget {
private let kind: String = "Static_AvatarsWidget"
public var body: some WidgetConfiguration {
return IntentConfiguration(kind: kind, intent: SelectAvatarFriendsIntent.self, provider: AvatarsProvider(), content: { entry in
Spacer()
})
.supportedFamilies([.systemMedium])
.configurationDisplayName(presentationData.widgetGalleryTitle)
.description(presentationData.widgetGalleryDescription)
}
}
@main
struct AllWidgets: WidgetBundle {
var body: some Widget {
Static_Widget()
//Static_AvatarsWidget()
}
}

View File

@ -219,7 +219,14 @@ private final class ImportManager {
break
}
if self.pendingEntries.isEmpty {
Logger.shared.log("ChatImportScreen", "updateState no more pending entries, stop searching")
Logger.shared.log("ChatImportScreen", "updateState no more pending entries, stop searching (active entries: \(self.activeEntries.keys))")
if self.activeEntries.isEmpty {
Logger.shared.log("ChatImportScreen", "no active entries, completing")
self.complete()
return
}
break
}

View File

@ -175,7 +175,7 @@ const CGFloat TGPhotoEditorSliderViewInternalMargin = 7.0f;
CGContextSetBlendMode(context, kCGBlendModeCopy);
}
if (_minimumUndottedValue > -1 && self.positionsCount > 1) {
if (false && _minimumUndottedValue > -1 && self.positionsCount > 1) {
CGContextSetLineWidth(context, backFrame.size.height);
CGContextSetLineCap(context, kCGLineCapRound);
@ -223,7 +223,7 @@ const CGFloat TGPhotoEditorSliderViewInternalMargin = 7.0f;
CGContextSetBlendMode(context, kCGBlendModeNormal);
if (_minimumUndottedValue > -1) {
if (false && _minimumUndottedValue > -1) {
} else {
CGContextSetFillColorWithColor(context, _trackColor.CGColor);
[self drawRectangle:trackFrame cornerRadius:self.trackCornerRadius context:context];

View File

@ -468,7 +468,7 @@ private func channelPermissionsControllerEntries(presentationData: PresentationD
if channel.flags.contains(.isCreator) && effectiveRightsFlags.contains(.banSendMessages) {
entries.append(.conversionHeader(presentationData.theme, presentationData.strings.GroupInfo_Permissions_BroadcastTitle.uppercased()))
entries.append(.conversion(presentationData.theme, presentationData.strings.GroupInfo_Permissions_BroadcastConvert))
entries.append(.conversionInfo(presentationData.theme, presentationData.strings.GroupInfo_Permissions_BroadcastConvertInfo))
entries.append(.conversionInfo(presentationData.theme, presentationData.strings.GroupInfo_Permissions_BroadcastConvertInfo("200,000").0))
} else {
entries.append(.slowmodeHeader(presentationData.theme, presentationData.strings.GroupInfo_Permissions_SlowmodeHeader))
entries.append(.slowmode(presentationData.theme, presentationData.strings, state.modifiedSlowmodeTimeout ?? (cachedData.slowModeTimeout ?? 0)))

View File

@ -30,16 +30,13 @@ private enum PeerAutoremoveSetupSection: Int32 {
private enum PeerAutoremoveSetupEntry: ItemListNodeEntry {
case header
case timeHeader(String)
case timeValue(Int32, Int32, [Int32])
case timeValue(Int32, [Int32])
case timeComment(String)
case globalSwitch(String, Bool, Bool)
var section: ItemListSectionId {
switch self {
case .header, .timeHeader, .timeValue, .timeComment:
return PeerAutoremoveSetupSection.time.rawValue
case .globalSwitch:
return PeerAutoremoveSetupSection.global.rawValue
}
}
@ -53,8 +50,6 @@ private enum PeerAutoremoveSetupEntry: ItemListNodeEntry {
return 2
case .timeComment:
return 3
case .globalSwitch:
return 4
}
}
@ -72,8 +67,8 @@ private enum PeerAutoremoveSetupEntry: ItemListNodeEntry {
} else {
return false
}
case let .timeValue(lhsValue, lhsMaxValue, lhsAvailableValues):
if case let .timeValue(rhsValue, rhsMaxValue, rhsAvailableValues) = rhs, lhsValue == rhsValue, lhsMaxValue == rhsMaxValue, lhsAvailableValues == rhsAvailableValues {
case let .timeValue(lhsValue, lhsAvailableValues):
if case let .timeValue(rhsValue, rhsAvailableValues) = rhs, lhsValue == rhsValue, lhsAvailableValues == rhsAvailableValues {
return true
} else {
return false
@ -84,12 +79,6 @@ private enum PeerAutoremoveSetupEntry: ItemListNodeEntry {
} else {
return false
}
case let .globalSwitch(lhsText, lhsValue, lhsEnable):
if case let .globalSwitch(rhsText, rhsValue, rhsEnable) = rhs, lhsText == rhsText, lhsValue == rhsValue, lhsEnable == rhsEnable {
return true
} else {
return false
}
}
}
@ -104,16 +93,12 @@ private enum PeerAutoremoveSetupEntry: ItemListNodeEntry {
return ChatListFilterSettingsHeaderItem(theme: presentationData.theme, text: "", animation: .autoRemove, sectionId: self.section)
case let .timeHeader(text):
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
case let .timeValue(value, maxValue, availableValues):
return PeerRemoveTimeoutItem(presentationData: presentationData, value: value, maxValue: maxValue, availableValues: availableValues, enabled: true, sectionId: self.section, updated: { value in
case let .timeValue(value, availableValues):
return PeerRemoveTimeoutItem(presentationData: presentationData, value: value, availableValues: availableValues, enabled: true, sectionId: self.section, updated: { value in
arguments.updateValue(value)
}, tag: nil)
case let .timeComment(text):
return ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: self.section)
case let .globalSwitch(text, value, enabled):
return ItemListSwitchItem(presentationData: presentationData, title: text, value: value, enabled: enabled, maximumNumberOfLines: 2, sectionId: self.section, style: .blocks, updated: { value in
arguments.toggleGlobal(value)
})
}
}
}
@ -126,17 +111,13 @@ private struct PeerAutoremoveSetupState: Equatable {
private func peerAutoremoveSetupEntries(peer: Peer?, presentationData: PresentationData, isDebug: Bool, defaultMyValue: Int32, peerValue: Int32, defaultGlobalValue: Bool, state: PeerAutoremoveSetupState) -> [PeerAutoremoveSetupEntry] {
var entries: [PeerAutoremoveSetupEntry] = []
let globalValue = state.changedGlobalValue ?? defaultGlobalValue
let resolvedValue: Int32
let resolvedMaxValue: Int32
if peer is TelegramUser {
resolvedValue = state.changedValue ?? defaultMyValue
resolvedMaxValue = peerValue
} else {
resolvedValue = state.changedValue ?? peerValue
resolvedMaxValue = Int32.max
}
//TODO:localize
@ -144,26 +125,19 @@ private func peerAutoremoveSetupEntries(peer: Peer?, presentationData: Presentat
entries.append(.timeHeader("AUTO-DELETE MESSAGES"))
var availableValues: [Int32] = [
Int32.max,
24 * 60 * 60,
24 * 60 * 60 * 7,
Int32.max
24 * 60 * 60 * 7
]
if isDebug || true {
availableValues[0] = 60
availableValues[1] = 5 * 60
availableValues[1] = 60
availableValues[2] = 5 * 60
}
entries.append(.timeValue(resolvedValue, resolvedMaxValue, availableValues))
entries.append(.timeValue(resolvedValue, availableValues))
if let channel = peer as? TelegramChannel, case .broadcast = channel.info {
entries.append(.timeComment("Automatically delete messages sent in this channel after a certain period of time."))
} else {
if resolvedMaxValue != Int32.max {
entries.append(.timeComment("\(peer?.compactDisplayTitle ?? "") has set messages to auto-delete in \(timeIntervalString(strings: presentationData.strings, value: resolvedMaxValue)). You can't cancel it or make this interval longer."))
} else {
entries.append(.timeComment("Automatically delete messages sent in this chat after a certain period of time."))
}
}
if let user = peer as? TelegramUser {
entries.append(.globalSwitch("Also auto-delete for \(user.compactDisplayTitle)", globalValue, resolvedValue != Int32.max))
entries.append(.timeComment("Automatically delete messages sent in this chat after a certain period of time."))
}
return entries

View File

@ -14,8 +14,14 @@ import AppBundle
private func mapTimeoutToSliderValue(_ value: Int32, availableValues: [Int32]) -> CGFloat {
for i in 0 ..< availableValues.count {
if value <= availableValues[i] {
return CGFloat(i)
if availableValues[i] == Int32.max {
if value == Int32.max {
return CGFloat(i)
}
} else {
if value <= availableValues[i] {
return CGFloat(i)
}
}
}
return CGFloat(availableValues.count - 1)
@ -23,7 +29,9 @@ private func mapTimeoutToSliderValue(_ value: Int32, availableValues: [Int32]) -
private func mapSliderValueToTimeout(_ value: CGFloat, availableValues: [Int32]) -> Int32 {
let intValue = Int(round(value))
if intValue >= 0 && intValue < availableValues.count {
if intValue == 0 {
return Int32.max
} else if intValue >= 0 && intValue < availableValues.count {
return availableValues[intValue]
} else {
return availableValues[availableValues.count - 1]
@ -33,17 +41,15 @@ private func mapSliderValueToTimeout(_ value: CGFloat, availableValues: [Int32])
class PeerRemoveTimeoutItem: ListViewItem, ItemListItem {
let presentationData: ItemListPresentationData
let value: Int32
let maxValue: Int32
let availableValues: [Int32]
let enabled: Bool
let sectionId: ItemListSectionId
let updated: (Int32) -> Void
let tag: ItemListItemTag?
init(presentationData: ItemListPresentationData, value: Int32, maxValue: Int32, availableValues: [Int32], enabled: Bool = true, sectionId: ItemListSectionId, updated: @escaping (Int32) -> Void, tag: ItemListItemTag? = nil) {
init(presentationData: ItemListPresentationData, value: Int32, availableValues: [Int32], enabled: Bool = true, sectionId: ItemListSectionId, updated: @escaping (Int32) -> Void, tag: ItemListItemTag? = nil) {
self.presentationData = presentationData
self.value = value
self.maxValue = maxValue
self.availableValues = availableValues
self.enabled = enabled
self.sectionId = sectionId
@ -154,12 +160,8 @@ class PeerRemoveTimeoutItemNode: ListViewItemNode, ItemListItemNode {
if let item = self.item, let params = self.layoutParams {
sliderView.isUserInteractionEnabled = item.enabled
sliderView.minimumUndottedValue = 0
sliderView.value = mapTimeoutToSliderValue(item.value, availableValues: item.availableValues)
sliderView.minimumUndottedValue = Int32(mapTimeoutToSliderValue(item.maxValue, availableValues: item.availableValues))
sliderView.backgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor
sliderView.backColor = item.presentationData.theme.list.disclosureArrowColor
sliderView.trackColor = item.enabled ? item.presentationData.theme.list.itemAccentColor : item.presentationData.theme.list.itemDisabledTextColor
@ -282,7 +284,6 @@ class PeerRemoveTimeoutItemNode: ListViewItemNode, ItemListItemNode {
if let sliderView = strongSelf.sliderView {
sliderView.isUserInteractionEnabled = item.enabled
sliderView.trackColor = item.enabled ? item.presentationData.theme.list.itemAccentColor : item.presentationData.theme.list.itemDisabledTextColor
sliderView.minimumUndottedValue = Int32(mapTimeoutToSliderValue(item.maxValue, availableValues: item.availableValues))
if themeUpdated {
sliderView.backgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor

View File

@ -11,8 +11,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-457104426] = { return Api.InputGeoPoint.parse_inputGeoPointEmpty($0) }
dict[1210199983] = { return Api.InputGeoPoint.parse_inputGeoPoint($0) }
dict[-784000893] = { return Api.payments.ValidatedRequestedInfo.parse_validatedRequestedInfo($0) }
dict[2086843688] = { return Api.ChatFull.parse_channelFull($0) }
dict[-500874592] = { return Api.ChatFull.parse_chatFull($0) }
dict[2086843688] = { return Api.ChatFull.parse_channelFull($0) }
dict[-1159937629] = { return Api.PollResults.parse_pollResults($0) }
dict[-925415106] = { return Api.ChatParticipant.parse_chatParticipant($0) }
dict[-636267638] = { return Api.ChatParticipant.parse_chatParticipantCreator($0) }
@ -33,20 +33,20 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1216809369] = { return Api.PageBlock.parse_pageBlockFooter($0) }
dict[-618614392] = { return Api.PageBlock.parse_pageBlockDivider($0) }
dict[-837994576] = { return Api.PageBlock.parse_pageBlockAnchor($0) }
dict[-454524911] = { return Api.PageBlock.parse_pageBlockList($0) }
dict[641563686] = { return Api.PageBlock.parse_pageBlockBlockquote($0) }
dict[1329878739] = { return Api.PageBlock.parse_pageBlockPullquote($0) }
dict[972174080] = { return Api.PageBlock.parse_pageBlockCover($0) }
dict[-283684427] = { return Api.PageBlock.parse_pageBlockChannel($0) }
dict[504660880] = { return Api.PageBlock.parse_pageBlockKicker($0) }
dict[-1085412734] = { return Api.PageBlock.parse_pageBlockTable($0) }
dict[391759200] = { return Api.PageBlock.parse_pageBlockPhoto($0) }
dict[2089805750] = { return Api.PageBlock.parse_pageBlockVideo($0) }
dict[-2143067670] = { return Api.PageBlock.parse_pageBlockAudio($0) }
dict[972174080] = { return Api.PageBlock.parse_pageBlockCover($0) }
dict[-1468953147] = { return Api.PageBlock.parse_pageBlockEmbed($0) }
dict[-229005301] = { return Api.PageBlock.parse_pageBlockEmbedPost($0) }
dict[1705048653] = { return Api.PageBlock.parse_pageBlockCollage($0) }
dict[52401552] = { return Api.PageBlock.parse_pageBlockSlideshow($0) }
dict[-454524911] = { return Api.PageBlock.parse_pageBlockList($0) }
dict[-283684427] = { return Api.PageBlock.parse_pageBlockChannel($0) }
dict[-2143067670] = { return Api.PageBlock.parse_pageBlockAudio($0) }
dict[504660880] = { return Api.PageBlock.parse_pageBlockKicker($0) }
dict[-1085412734] = { return Api.PageBlock.parse_pageBlockTable($0) }
dict[-1702174239] = { return Api.PageBlock.parse_pageBlockOrderedList($0) }
dict[1987480557] = { return Api.PageBlock.parse_pageBlockDetails($0) }
dict[370236054] = { return Api.PageBlock.parse_pageBlockRelatedArticles($0) }
@ -66,10 +66,10 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[590459437] = { return Api.Photo.parse_photoEmpty($0) }
dict[-82216347] = { return Api.Photo.parse_photo($0) }
dict[-1683826688] = { return Api.Chat.parse_chatEmpty($0) }
dict[120753115] = { return Api.Chat.parse_chatForbidden($0) }
dict[681420594] = { return Api.Chat.parse_channelForbidden($0) }
dict[1004149726] = { return Api.Chat.parse_chat($0) }
dict[120753115] = { return Api.Chat.parse_chatForbidden($0) }
dict[-753232354] = { return Api.Chat.parse_channel($0) }
dict[681420594] = { return Api.Chat.parse_channelForbidden($0) }
dict[1202287072] = { return Api.StatsURL.parse_statsURL($0) }
dict[1516793212] = { return Api.ChatInvite.parse_chatInviteAlready($0) }
dict[-540871282] = { return Api.ChatInvite.parse_chatInvite($0) }
@ -113,10 +113,11 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[414687501] = { return Api.DcOption.parse_dcOption($0) }
dict[997055186] = { return Api.PollAnswerVoters.parse_pollAnswerVoters($0) }
dict[-1705233435] = { return Api.account.PasswordSettings.parse_passwordSettings($0) }
dict[-1945767479] = { return Api.help.SupportName.parse_supportName($0) }
dict[-288727837] = { return Api.LangPackLanguage.parse_langPackLanguage($0) }
dict[-399391402] = { return Api.VideoSize.parse_videoSize($0) }
dict[-1000708810] = { return Api.help.AppUpdate.parse_noAppUpdate($0) }
dict[497489295] = { return Api.help.AppUpdate.parse_appUpdate($0) }
dict[-1000708810] = { return Api.help.AppUpdate.parse_noAppUpdate($0) }
dict[-209337866] = { return Api.LangPackDifference.parse_langPackDifference($0) }
dict[-815649386] = { return Api.PeerHistoryTTL.parse_peerHistoryTTLPM($0) }
dict[1041354473] = { return Api.PeerHistoryTTL.parse_peerHistoryTTL($0) }
@ -141,10 +142,12 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1690108678] = { return Api.InputEncryptedFile.parse_inputEncryptedFileUploaded($0) }
dict[1511503333] = { return Api.InputEncryptedFile.parse_inputEncryptedFile($0) }
dict[767652808] = { return Api.InputEncryptedFile.parse_inputEncryptedFileBigUploaded($0) }
dict[1304052993] = { return Api.account.Takeout.parse_takeout($0) }
dict[-1456996667] = { return Api.messages.InactiveChats.parse_inactiveChats($0) }
dict[1690708501] = { return Api.GroupCallParticipant.parse_groupCallParticipant($0) }
dict[1443858741] = { return Api.messages.SentEncryptedMessage.parse_sentEncryptedMessage($0) }
dict[-1802240206] = { return Api.messages.SentEncryptedMessage.parse_sentEncryptedFile($0) }
dict[289586518] = { return Api.SavedContact.parse_savedPhoneContact($0) }
dict[1571494644] = { return Api.ExportedMessageLink.parse_exportedMessageLink($0) }
dict[-855308010] = { return Api.auth.Authorization.parse_authorization($0) }
dict[1148485274] = { return Api.auth.Authorization.parse_authorizationSignUpRequired($0) }
@ -208,12 +211,14 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-337352679] = { return Api.Update.parse_updateServiceNotification($0) }
dict[-298113238] = { return Api.Update.parse_updatePrivacy($0) }
dict[314130811] = { return Api.Update.parse_updateUserPhone($0) }
dict[-1667805217] = { return Api.Update.parse_updateReadHistoryInbox($0) }
dict[791617983] = { return Api.Update.parse_updateReadHistoryOutbox($0) }
dict[2139689491] = { return Api.Update.parse_updateWebPage($0) }
dict[1757493555] = { return Api.Update.parse_updateReadMessagesContents($0) }
dict[-352032773] = { return Api.Update.parse_updateChannelTooLong($0) }
dict[-1227598250] = { return Api.Update.parse_updateChannel($0) }
dict[1656358105] = { return Api.Update.parse_updateNewChannelMessage($0) }
dict[856380452] = { return Api.Update.parse_updateReadChannelInbox($0) }
dict[-1015733815] = { return Api.Update.parse_updateDeleteChannelMessages($0) }
dict[-1734268085] = { return Api.Update.parse_updateChannelMessageViews($0) }
dict[-1232070311] = { return Api.Update.parse_updateChatParticipantAdmin($0) }
@ -221,6 +226,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[196268545] = { return Api.Update.parse_updateStickerSetsOrder($0) }
dict[1135492588] = { return Api.Update.parse_updateStickerSets($0) }
dict[-1821035490] = { return Api.Update.parse_updateSavedGifs($0) }
dict[1059076315] = { return Api.Update.parse_updateBotInlineQuery($0) }
dict[239663460] = { return Api.Update.parse_updateBotInlineSend($0) }
dict[457133559] = { return Api.Update.parse_updateEditChannelMessage($0) }
dict[-415938591] = { return Api.Update.parse_updateBotCallbackQuery($0) }
@ -233,25 +239,23 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1574314746] = { return Api.Update.parse_updateConfig($0) }
dict[861169551] = { return Api.Update.parse_updatePtsChanged($0) }
dict[1081547008] = { return Api.Update.parse_updateChannelWebPage($0) }
dict[1852826908] = { return Api.Update.parse_updateDialogPinned($0) }
dict[-99664734] = { return Api.Update.parse_updatePinnedDialogs($0) }
dict[-2095595325] = { return Api.Update.parse_updateBotWebhookJSON($0) }
dict[-1684914010] = { return Api.Update.parse_updateBotWebhookJSONQuery($0) }
dict[-523384512] = { return Api.Update.parse_updateBotShippingQuery($0) }
dict[1563376297] = { return Api.Update.parse_updateBotPrecheckoutQuery($0) }
dict[-1425052898] = { return Api.Update.parse_updatePhoneCall($0) }
dict[1180041828] = { return Api.Update.parse_updateLangPackTooLong($0) }
dict[1442983757] = { return Api.Update.parse_updateLangPack($0) }
dict[-451831443] = { return Api.Update.parse_updateFavedStickers($0) }
dict[-1987495099] = { return Api.Update.parse_updateChannelReadMessagesContents($0) }
dict[1887741886] = { return Api.Update.parse_updateContactsReset($0) }
dict[1893427255] = { return Api.Update.parse_updateChannelAvailableMessages($0) }
dict[-513517117] = { return Api.Update.parse_updateDialogUnreadMark($0) }
dict[1180041828] = { return Api.Update.parse_updateLangPackTooLong($0) }
dict[-1398708869] = { return Api.Update.parse_updateMessagePoll($0) }
dict[1421875280] = { return Api.Update.parse_updateChatDefaultBannedRights($0) }
dict[422972864] = { return Api.Update.parse_updateFolderPeers($0) }
dict[1852826908] = { return Api.Update.parse_updateDialogPinned($0) }
dict[-99664734] = { return Api.Update.parse_updatePinnedDialogs($0) }
dict[856380452] = { return Api.Update.parse_updateReadChannelInbox($0) }
dict[-1667805217] = { return Api.Update.parse_updateReadHistoryInbox($0) }
dict[1786671974] = { return Api.Update.parse_updatePeerSettings($0) }
dict[-1263546448] = { return Api.Update.parse_updatePeerLocated($0) }
dict[967122427] = { return Api.Update.parse_updateNewScheduledMessage($0) }
@ -275,16 +279,15 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[321954198] = { return Api.Update.parse_updateChat($0) }
dict[-219423922] = { return Api.Update.parse_updateGroupCallParticipants($0) }
dict[-1537295973] = { return Api.Update.parse_updateGroupCall($0) }
dict[1059076315] = { return Api.Update.parse_updateBotInlineQuery($0) }
dict[19291112] = { return Api.Update.parse_updatePeerHistoryTTL($0) }
dict[136574537] = { return Api.messages.VotesList.parse_votesList($0) }
dict[1558266229] = { return Api.PopularContact.parse_popularContact($0) }
dict[-373643672] = { return Api.FolderPeer.parse_folderPeer($0) }
dict[367766557] = { return Api.ChannelParticipant.parse_channelParticipant($0) }
dict[-1557620115] = { return Api.ChannelParticipant.parse_channelParticipantSelf($0) }
dict[470789295] = { return Api.ChannelParticipant.parse_channelParticipantBanned($0) }
dict[-859915345] = { return Api.ChannelParticipant.parse_channelParticipantAdmin($0) }
dict[1149094475] = { return Api.ChannelParticipant.parse_channelParticipantCreator($0) }
dict[-859915345] = { return Api.ChannelParticipant.parse_channelParticipantAdmin($0) }
dict[470789295] = { return Api.ChannelParticipant.parse_channelParticipantBanned($0) }
dict[-1010402965] = { return Api.ChannelParticipant.parse_channelParticipantLeft($0) }
dict[-1567730343] = { return Api.MessageUserVote.parse_messageUserVote($0) }
dict[909603888] = { return Api.MessageUserVote.parse_messageUserVoteInputOption($0) }
@ -293,9 +296,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-513392236] = { return Api.contacts.Blocked.parse_blockedSlice($0) }
dict[-55902537] = { return Api.InputDialogPeer.parse_inputDialogPeer($0) }
dict[1684014375] = { return Api.InputDialogPeer.parse_inputDialogPeerFolder($0) }
dict[-994444869] = { return Api.Error.parse_error($0) }
dict[-1560655744] = { return Api.KeyboardButton.parse_keyboardButton($0) }
dict[629866245] = { return Api.KeyboardButton.parse_keyboardButtonUrl($0) }
dict[901503851] = { return Api.KeyboardButton.parse_keyboardButtonCallback($0) }
dict[-1318425559] = { return Api.KeyboardButton.parse_keyboardButtonRequestPhone($0) }
dict[-59151553] = { return Api.KeyboardButton.parse_keyboardButtonRequestGeoLocation($0) }
dict[90744648] = { return Api.KeyboardButton.parse_keyboardButtonSwitchInline($0) }
@ -304,7 +307,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[280464681] = { return Api.KeyboardButton.parse_keyboardButtonUrlAuth($0) }
dict[-802258988] = { return Api.KeyboardButton.parse_inputKeyboardButtonUrlAuth($0) }
dict[-1144565411] = { return Api.KeyboardButton.parse_keyboardButtonRequestPoll($0) }
dict[901503851] = { return Api.KeyboardButton.parse_keyboardButtonCallback($0) }
dict[-748155807] = { return Api.ContactStatus.parse_contactStatus($0) }
dict[1679398724] = { return Api.SecureFile.parse_secureFileEmpty($0) }
dict[-534283678] = { return Api.SecureFile.parse_secureFile($0) }
@ -326,33 +328,32 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1881892265] = { return Api.account.WallPapers.parse_wallPapers($0) }
dict[1012306921] = { return Api.InputTheme.parse_inputTheme($0) }
dict[-175567375] = { return Api.InputTheme.parse_inputThemeSlug($0) }
dict[1158290442] = { return Api.messages.FoundGifs.parse_foundGifs($0) }
dict[-1132476723] = { return Api.FileLocation.parse_fileLocationToBeDeprecated($0) }
dict[-2032041631] = { return Api.Poll.parse_poll($0) }
dict[-1195615476] = { return Api.InputNotifyPeer.parse_inputNotifyPeer($0) }
dict[423314455] = { return Api.InputNotifyPeer.parse_inputNotifyUsers($0) }
dict[1251338318] = { return Api.InputNotifyPeer.parse_inputNotifyChats($0) }
dict[-1311015810] = { return Api.InputNotifyPeer.parse_inputNotifyBroadcasts($0) }
dict[-1195615476] = { return Api.InputNotifyPeer.parse_inputNotifyPeer($0) }
dict[-317144808] = { return Api.EncryptedMessage.parse_encryptedMessage($0) }
dict[594758406] = { return Api.EncryptedMessage.parse_encryptedMessageService($0) }
dict[-566281095] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsRecent($0) }
dict[-1268741783] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsAdmins($0) }
dict[-1548400251] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsKicked($0) }
dict[-1328445861] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsBots($0) }
dict[338142689] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsBanned($0) }
dict[106343499] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsSearch($0) }
dict[-1548400251] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsKicked($0) }
dict[-1150621555] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsContacts($0) }
dict[-531931925] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsMentions($0) }
dict[-350980120] = { return Api.WebPage.parse_webPageEmpty($0) }
dict[-981018084] = { return Api.WebPage.parse_webPagePending($0) }
dict[-392411726] = { return Api.WebPage.parse_webPage($0) }
dict[1930545681] = { return Api.WebPage.parse_webPageNotModified($0) }
dict[1036876423] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageText($0) }
dict[1262639204] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageGame($0) }
dict[864077702] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaAuto($0) }
dict[1036876423] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageText($0) }
dict[-1768777083] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaGeo($0) }
dict[1098628881] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaVenue($0) }
dict[-1494368259] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaContact($0) }
dict[-1768777083] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaGeo($0) }
dict[1262639204] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageGame($0) }
dict[2002815875] = { return Api.KeyboardButtonRow.parse_keyboardButtonRow($0) }
dict[1088567208] = { return Api.StickerSet.parse_stickerSet($0) }
dict[-1111085620] = { return Api.messages.ExportedChatInvites.parse_exportedChatInvites($0) }
@ -381,21 +382,20 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[2131196633] = { return Api.contacts.ResolvedPeer.parse_resolvedPeer($0) }
dict[-1964327229] = { return Api.SecureData.parse_secureData($0) }
dict[-1771768449] = { return Api.InputMedia.parse_inputMediaEmpty($0) }
dict[-104578748] = { return Api.InputMedia.parse_inputMediaGeoPoint($0) }
dict[1212395773] = { return Api.InputMedia.parse_inputMediaGifExternal($0) }
dict[-750828557] = { return Api.InputMedia.parse_inputMediaGame($0) }
dict[-1052959727] = { return Api.InputMedia.parse_inputMediaVenue($0) }
dict[-186607933] = { return Api.InputMedia.parse_inputMediaInvoice($0) }
dict[505969924] = { return Api.InputMedia.parse_inputMediaUploadedPhoto($0) }
dict[1530447553] = { return Api.InputMedia.parse_inputMediaUploadedDocument($0) }
dict[-1279654347] = { return Api.InputMedia.parse_inputMediaPhoto($0) }
dict[-104578748] = { return Api.InputMedia.parse_inputMediaGeoPoint($0) }
dict[-122978821] = { return Api.InputMedia.parse_inputMediaContact($0) }
dict[1530447553] = { return Api.InputMedia.parse_inputMediaUploadedDocument($0) }
dict[860303448] = { return Api.InputMedia.parse_inputMediaDocument($0) }
dict[-1052959727] = { return Api.InputMedia.parse_inputMediaVenue($0) }
dict[-440664550] = { return Api.InputMedia.parse_inputMediaPhotoExternal($0) }
dict[-78455655] = { return Api.InputMedia.parse_inputMediaDocumentExternal($0) }
dict[-122978821] = { return Api.InputMedia.parse_inputMediaContact($0) }
dict[-750828557] = { return Api.InputMedia.parse_inputMediaGame($0) }
dict[-186607933] = { return Api.InputMedia.parse_inputMediaInvoice($0) }
dict[-1759532989] = { return Api.InputMedia.parse_inputMediaGeoLive($0) }
dict[261416433] = { return Api.InputMedia.parse_inputMediaPoll($0) }
dict[-428884101] = { return Api.InputMedia.parse_inputMediaDice($0) }
dict[-1759532989] = { return Api.InputMedia.parse_inputMediaGeoLive($0) }
dict[860303448] = { return Api.InputMedia.parse_inputMediaDocument($0) }
dict[2134579434] = { return Api.InputPeer.parse_inputPeerEmpty($0) }
dict[2107670217] = { return Api.InputPeer.parse_inputPeerSelf($0) }
dict[396093539] = { return Api.InputPeer.parse_inputPeerChat($0) }
@ -408,8 +408,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1078332329] = { return Api.help.PassportConfig.parse_passportConfigNotModified($0) }
dict[-1600596305] = { return Api.help.PassportConfig.parse_passportConfig($0) }
dict[1648543603] = { return Api.FileHash.parse_fileHash($0) }
dict[400266251] = { return Api.BotInlineResult.parse_botInlineMediaResult($0) }
dict[295067450] = { return Api.BotInlineResult.parse_botInlineResult($0) }
dict[400266251] = { return Api.BotInlineResult.parse_botInlineMediaResult($0) }
dict[911761060] = { return Api.messages.BotCallbackAnswer.parse_botCallbackAnswer($0) }
dict[1314881805] = { return Api.payments.PaymentResult.parse_paymentResult($0) }
dict[-666824391] = { return Api.payments.PaymentResult.parse_paymentVerificationNeeded($0) }
@ -432,6 +432,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-421545947] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeTitle($0) }
dict[1427671598] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeAbout($0) }
dict[1783299128] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeUsername($0) }
dict[1129042607] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangePhoto($0) }
dict[460916654] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionToggleInvites($0) }
dict[648939889] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionToggleSignatures($0) }
dict[-370660328] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionUpdatePinned($0) }
@ -446,7 +447,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1599903217] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionTogglePreHistoryHidden($0) }
dict[771095562] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionDefaultBannedRights($0) }
dict[-1895328189] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionStopPoll($0) }
dict[1129042607] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangePhoto($0) }
dict[-1569748965] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeLinkedChat($0) }
dict[241923758] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeLocation($0) }
dict[1401984889] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionToggleSlowMode($0) }
@ -455,10 +455,10 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-115071790] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionParticipantMute($0) }
dict[-431740480] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionParticipantUnmute($0) }
dict[1456906823] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionToggleGroupCallSetting($0) }
dict[1557846647] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionParticipantJoinByInvite($0) }
dict[1515256996] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionExportedInviteDelete($0) }
dict[1091179342] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionExportedInviteRevoke($0) }
dict[-384910503] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionExportedInviteEdit($0) }
dict[1557846647] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionParticipantJoinByInvite($0) }
dict[1048537159] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionParticipantVolume($0) }
dict[1855199800] = { return Api.ChannelAdminLogEventAction.parse_channelAdminLogEventActionChangeHistoryTTL($0) }
dict[-543777747] = { return Api.auth.ExportedAuthorization.parse_exportedAuthorization($0) }
@ -471,6 +471,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1036572727] = { return Api.account.PasswordInputSettings.parse_passwordInputSettings($0) }
dict[878078826] = { return Api.PageTableCell.parse_pageTableCell($0) }
dict[-1626209256] = { return Api.ChatBannedRights.parse_chatBannedRights($0) }
dict[1968737087] = { return Api.InputClientProxy.parse_inputClientProxy($0) }
dict[649453030] = { return Api.messages.MessageEditData.parse_messageEditData($0) }
dict[-886477832] = { return Api.LabeledPrice.parse_labeledPrice($0) }
dict[-438840932] = { return Api.messages.ChatFull.parse_chatFull($0) }
@ -484,15 +485,15 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1490799288] = { return Api.ReportReason.parse_inputReportReasonSpam($0) }
dict[505595789] = { return Api.ReportReason.parse_inputReportReasonViolence($0) }
dict[777640226] = { return Api.ReportReason.parse_inputReportReasonPornography($0) }
dict[-1685456582] = { return Api.ReportReason.parse_inputReportReasonCopyright($0) }
dict[-1376497949] = { return Api.ReportReason.parse_inputReportReasonChildAbuse($0) }
dict[-1041980751] = { return Api.ReportReason.parse_inputReportReasonOther($0) }
dict[-1685456582] = { return Api.ReportReason.parse_inputReportReasonCopyright($0) }
dict[-606798099] = { return Api.ReportReason.parse_inputReportReasonGeoIrrelevant($0) }
dict[-170010905] = { return Api.ReportReason.parse_inputReportReasonFake($0) }
dict[-1041980751] = { return Api.ReportReason.parse_inputReportReasonOther($0) }
dict[-247351839] = { return Api.InputEncryptedChat.parse_inputEncryptedChat($0) }
dict[-524237339] = { return Api.PageTableRow.parse_pageTableRow($0) }
dict[-40996577] = { return Api.DraftMessage.parse_draftMessage($0) }
dict[453805082] = { return Api.DraftMessage.parse_draftMessageEmpty($0) }
dict[-40996577] = { return Api.DraftMessage.parse_draftMessage($0) }
dict[-1014526429] = { return Api.help.Country.parse_country($0) }
dict[418631927] = { return Api.StatsGroupTopPoster.parse_statsGroupTopPoster($0) }
dict[-2128640689] = { return Api.account.SentEmailCode.parse_sentEmailCode($0) }
@ -508,13 +509,13 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-2036501105] = { return Api.SecureValueError.parse_secureValueError($0) }
dict[-1592506512] = { return Api.SecureValueError.parse_secureValueErrorTranslationFile($0) }
dict[878931416] = { return Api.SecureValueError.parse_secureValueErrorTranslationFiles($0) }
dict[-6249322] = { return Api.InputStickerSetItem.parse_inputStickerSetItem($0) }
dict[-1728664459] = { return Api.help.PromoData.parse_promoDataEmpty($0) }
dict[-1942390465] = { return Api.help.PromoData.parse_promoData($0) }
dict[-1613493288] = { return Api.NotifyPeer.parse_notifyPeer($0) }
dict[-1261946036] = { return Api.NotifyPeer.parse_notifyUsers($0) }
dict[-1073230141] = { return Api.NotifyPeer.parse_notifyChats($0) }
dict[-703403793] = { return Api.NotifyPeer.parse_notifyBroadcasts($0) }
dict[-582464156] = { return Api.wallet.KeySecretSalt.parse_secretSalt($0) }
dict[1335282456] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyStatusTimestamp($0) }
dict[-1107622874] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyChatInvite($0) }
dict[-88417185] = { return Api.InputPrivacyKey.parse_inputPrivacyKeyPhoneCall($0) }
@ -536,13 +537,13 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-316748368] = { return Api.SecureValueHash.parse_secureValueHash($0) }
dict[1722485756] = { return Api.phone.GroupCall.parse_groupCall($0) }
dict[-398136321] = { return Api.messages.SearchCounter.parse_searchCounter($0) }
dict[-2128698738] = { return Api.auth.CheckedPhone.parse_checkedPhone($0) }
dict[-1188055347] = { return Api.PageListItem.parse_pageListItemText($0) }
dict[635466748] = { return Api.PageListItem.parse_pageListItemBlocks($0) }
dict[-386039788] = { return Api.PeerBlocked.parse_peerBlocked($0) }
dict[-1182234929] = { return Api.InputUser.parse_inputUserEmpty($0) }
dict[-138301121] = { return Api.InputUser.parse_inputUserSelf($0) }
dict[-668391402] = { return Api.InputUser.parse_inputUser($0) }
dict[756118935] = { return Api.InputUser.parse_inputUserFromMessage($0) }
dict[-1738178803] = { return Api.Page.parse_page($0) }
dict[871426631] = { return Api.SecureCredentialsEncrypted.parse_secureCredentialsEncrypted($0) }
dict[-875679776] = { return Api.StatsPercentValue.parse_statsPercentValue($0) }
@ -575,51 +576,50 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1502174430] = { return Api.InputMessage.parse_inputMessageID($0) }
dict[-1160215659] = { return Api.InputMessage.parse_inputMessageReplyTo($0) }
dict[-2037963464] = { return Api.InputMessage.parse_inputMessagePinned($0) }
dict[-1392895362] = { return Api.InputMessage.parse_inputMessageCallbackQuery($0) }
dict[-58224696] = { return Api.PhoneCallProtocol.parse_phoneCallProtocol($0) }
dict[-1237848657] = { return Api.StatsDateRangeDays.parse_statsDateRangeDays($0) }
dict[-275956116] = { return Api.messages.AffectedFoundMessages.parse_affectedFoundMessages($0) }
dict[-1567175714] = { return Api.MessageFwdAuthor.parse_messageFwdAuthor($0) }
dict[-1539849235] = { return Api.WallPaper.parse_wallPaper($0) }
dict[-1963717851] = { return Api.WallPaper.parse_wallPaperNoFile($0) }
dict[-1938715001] = { return Api.messages.Messages.parse_messages($0) }
dict[1951620897] = { return Api.messages.Messages.parse_messagesNotModified($0) }
dict[1682413576] = { return Api.messages.Messages.parse_channelMessages($0) }
dict[978610270] = { return Api.messages.Messages.parse_messagesSlice($0) }
dict[1682413576] = { return Api.messages.Messages.parse_channelMessages($0) }
dict[1951620897] = { return Api.messages.Messages.parse_messagesNotModified($0) }
dict[-1022713000] = { return Api.Invoice.parse_invoice($0) }
dict[1933519201] = { return Api.PeerSettings.parse_peerSettings($0) }
dict[1577067778] = { return Api.auth.SentCode.parse_sentCode($0) }
dict[480546647] = { return Api.InputChatPhoto.parse_inputChatPhotoEmpty($0) }
dict[-1991004873] = { return Api.InputChatPhoto.parse_inputChatPhoto($0) }
dict[-968723890] = { return Api.InputChatPhoto.parse_inputChatUploadedPhoto($0) }
dict[-1991004873] = { return Api.InputChatPhoto.parse_inputChatPhoto($0) }
dict[-1228606141] = { return Api.messages.MessageViews.parse_messageViews($0) }
dict[375566091] = { return Api.messages.HistoryImport.parse_historyImport($0) }
dict[-368917890] = { return Api.PaymentCharge.parse_paymentCharge($0) }
dict[-1387279939] = { return Api.MessageInteractionCounters.parse_messageInteractionCounters($0) }
dict[-1107852396] = { return Api.stats.BroadcastStats.parse_broadcastStats($0) }
dict[-484987010] = { return Api.Updates.parse_updatesTooLong($0) }
dict[-84936653] = { return Api.Updates.parse_updateShortMessage($0) }
dict[290961496] = { return Api.Updates.parse_updateShortChatMessage($0) }
dict[2027216577] = { return Api.Updates.parse_updateShort($0) }
dict[1918567619] = { return Api.Updates.parse_updatesCombined($0) }
dict[1957577280] = { return Api.Updates.parse_updates($0) }
dict[-84936653] = { return Api.Updates.parse_updateShortMessage($0) }
dict[290961496] = { return Api.Updates.parse_updateShortChatMessage($0) }
dict[-1877614335] = { return Api.Updates.parse_updateShortSentMessage($0) }
dict[-276825834] = { return Api.stats.MegagroupStats.parse_megagroupStats($0) }
dict[-884757282] = { return Api.StatsAbsValueAndPrev.parse_statsAbsValueAndPrev($0) }
dict[1038967584] = { return Api.MessageMedia.parse_messageMediaEmpty($0) }
dict[1766936791] = { return Api.MessageMedia.parse_messageMediaPhoto($0) }
dict[1457575028] = { return Api.MessageMedia.parse_messageMediaGeo($0) }
dict[-873313984] = { return Api.MessageMedia.parse_messageMediaContact($0) }
dict[-1618676578] = { return Api.MessageMedia.parse_messageMediaUnsupported($0) }
dict[-1666158377] = { return Api.MessageMedia.parse_messageMediaDocument($0) }
dict[-1557277184] = { return Api.MessageMedia.parse_messageMediaWebPage($0) }
dict[784356159] = { return Api.MessageMedia.parse_messageMediaVenue($0) }
dict[-38694904] = { return Api.MessageMedia.parse_messageMediaGame($0) }
dict[-2074799289] = { return Api.MessageMedia.parse_messageMediaInvoice($0) }
dict[784356159] = { return Api.MessageMedia.parse_messageMediaVenue($0) }
dict[1766936791] = { return Api.MessageMedia.parse_messageMediaPhoto($0) }
dict[-1666158377] = { return Api.MessageMedia.parse_messageMediaDocument($0) }
dict[-873313984] = { return Api.MessageMedia.parse_messageMediaContact($0) }
dict[-1186937242] = { return Api.MessageMedia.parse_messageMediaGeoLive($0) }
dict[1272375192] = { return Api.MessageMedia.parse_messageMediaPoll($0) }
dict[1065280907] = { return Api.MessageMedia.parse_messageMediaDice($0) }
dict[-1186937242] = { return Api.MessageMedia.parse_messageMediaGeoLive($0) }
dict[-842892769] = { return Api.PaymentSavedCredentials.parse_paymentSavedCredentialsCard($0) }
dict[1450380236] = { return Api.Null.parse_null($0) }
dict[1923290508] = { return Api.auth.CodeType.parse_codeTypeSms($0) }
dict[1948046307] = { return Api.auth.CodeType.parse_codeTypeCall($0) }
dict[577556219] = { return Api.auth.CodeType.parse_codeTypeFlashCall($0) }
@ -649,21 +649,21 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1231326505] = { return Api.messages.ChatAdminsWithInvites.parse_chatAdminsWithInvites($0) }
dict[-1729618630] = { return Api.BotInfo.parse_botInfo($0) }
dict[-1519637954] = { return Api.updates.State.parse_state($0) }
dict[372165663] = { return Api.FoundGif.parse_foundGif($0) }
dict[-1670052855] = { return Api.FoundGif.parse_foundGifCached($0) }
dict[537022650] = { return Api.User.parse_userEmpty($0) }
dict[-1820043071] = { return Api.User.parse_user($0) }
dict[678405636] = { return Api.Message.parse_messageService($0) }
dict[-1868117372] = { return Api.Message.parse_messageEmpty($0) }
dict[-1125940270] = { return Api.Message.parse_message($0) }
dict[721967202] = { return Api.Message.parse_messageService($0) }
dict[831924812] = { return Api.StatsGroupTopInviter.parse_statsGroupTopInviter($0) }
dict[186120336] = { return Api.messages.RecentStickers.parse_recentStickersNotModified($0) }
dict[586395571] = { return Api.messages.RecentStickers.parse_recentStickers($0) }
dict[-182231723] = { return Api.InputFileLocation.parse_inputEncryptedFileLocation($0) }
dict[-876089816] = { return Api.InputFileLocation.parse_inputSecureFileLocation($0) }
dict[-539317279] = { return Api.InputFileLocation.parse_inputFileLocation($0) }
dict[1075322878] = { return Api.InputFileLocation.parse_inputPhotoFileLocation($0) }
dict[-182231723] = { return Api.InputFileLocation.parse_inputEncryptedFileLocation($0) }
dict[-1160743548] = { return Api.InputFileLocation.parse_inputDocumentFileLocation($0) }
dict[-876089816] = { return Api.InputFileLocation.parse_inputSecureFileLocation($0) }
dict[700340377] = { return Api.InputFileLocation.parse_inputTakeoutFileLocation($0) }
dict[1075322878] = { return Api.InputFileLocation.parse_inputPhotoFileLocation($0) }
dict[-667654413] = { return Api.InputFileLocation.parse_inputPhotoLegacyFileLocation($0) }
dict[668375447] = { return Api.InputFileLocation.parse_inputPeerPhotoFileLocation($0) }
dict[230353641] = { return Api.InputFileLocation.parse_inputStickerSetThumb($0) }
dict[286776671] = { return Api.GeoPoint.parse_geoPointEmpty($0) }
@ -710,8 +710,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1816636575] = { return Api.LangPackString.parse_langPackStringPluralized($0) }
dict[695856818] = { return Api.LangPackString.parse_langPackStringDeleted($0) }
dict[-1036396922] = { return Api.InputWebFileLocation.parse_inputWebFileLocation($0) }
dict[1430205163] = { return Api.InputWebFileLocation.parse_inputWebFileGeoMessageLocation($0) }
dict[-1625153079] = { return Api.InputWebFileLocation.parse_inputWebFileGeoPointLocation($0) }
dict[-1275374751] = { return Api.EmojiLanguage.parse_emojiLanguage($0) }
dict[1601666510] = { return Api.MessageFwdHeader.parse_messageFwdHeader($0) }
dict[-1012849566] = { return Api.BaseTheme.parse_baseThemeClassic($0) }
dict[-69724536] = { return Api.BaseTheme.parse_baseThemeDay($0) }
@ -723,7 +723,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1777752804] = { return Api.MessagesFilter.parse_inputMessagesFilterPhotos($0) }
dict[-1614803355] = { return Api.MessagesFilter.parse_inputMessagesFilterVideo($0) }
dict[1458172132] = { return Api.MessagesFilter.parse_inputMessagesFilterPhotoVideo($0) }
dict[-648121413] = { return Api.MessagesFilter.parse_inputMessagesFilterPhotoVideoDocuments($0) }
dict[-1629621880] = { return Api.MessagesFilter.parse_inputMessagesFilterDocument($0) }
dict[2129714567] = { return Api.MessagesFilter.parse_inputMessagesFilterUrl($0) }
dict[-3644025] = { return Api.MessagesFilter.parse_inputMessagesFilterGif($0) }
@ -734,7 +733,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[2054952868] = { return Api.MessagesFilter.parse_inputMessagesFilterRoundVoice($0) }
dict[-1253451181] = { return Api.MessagesFilter.parse_inputMessagesFilterRoundVideo($0) }
dict[-1040652646] = { return Api.MessagesFilter.parse_inputMessagesFilterMyMentions($0) }
dict[1187706024] = { return Api.MessagesFilter.parse_inputMessagesFilterMyMentionsUnread($0) }
dict[-419271411] = { return Api.MessagesFilter.parse_inputMessagesFilterGeo($0) }
dict[-530392189] = { return Api.MessagesFilter.parse_inputMessagesFilterContacts($0) }
dict[464520273] = { return Api.MessagesFilter.parse_inputMessagesFilterPinned($0) }
@ -746,13 +744,12 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[594408994] = { return Api.EmojiKeyword.parse_emojiKeywordDeleted($0) }
dict[-290921362] = { return Api.upload.CdnFile.parse_cdnFileReuploadNeeded($0) }
dict[-1449145777] = { return Api.upload.CdnFile.parse_cdnFile($0) }
dict[1984136919] = { return Api.wallet.LiteResponse.parse_liteResponse($0) }
dict[415997816] = { return Api.help.InviteText.parse_inviteText($0) }
dict[-1937807902] = { return Api.BotInlineMessage.parse_botInlineMessageText($0) }
dict[1984755728] = { return Api.BotInlineMessage.parse_botInlineMessageMediaAuto($0) }
dict[-1937807902] = { return Api.BotInlineMessage.parse_botInlineMessageText($0) }
dict[85477117] = { return Api.BotInlineMessage.parse_botInlineMessageMediaGeo($0) }
dict[-1970903652] = { return Api.BotInlineMessage.parse_botInlineMessageMediaVenue($0) }
dict[416402882] = { return Api.BotInlineMessage.parse_botInlineMessageMediaContact($0) }
dict[85477117] = { return Api.BotInlineMessage.parse_botInlineMessageMediaGeo($0) }
dict[-1673717362] = { return Api.InputPeerNotifySettings.parse_inputPeerNotifySettings($0) }
dict[-1634752813] = { return Api.messages.FavedStickers.parse_favedStickersNotModified($0) }
dict[-209768682] = { return Api.messages.FavedStickers.parse_favedStickers($0) }
@ -783,10 +780,10 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-732254058] = { return Api.PasswordKdfAlgo.parse_passwordKdfAlgoUnknown($0) }
dict[982592842] = { return Api.PasswordKdfAlgo.parse_passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow($0) }
dict[-1390001672] = { return Api.account.Password.parse_password($0) }
dict[-2000710887] = { return Api.InputBotInlineResult.parse_inputBotInlineResult($0) }
dict[-1462213465] = { return Api.InputBotInlineResult.parse_inputBotInlineResultPhoto($0) }
dict[-459324] = { return Api.InputBotInlineResult.parse_inputBotInlineResultDocument($0) }
dict[1336154098] = { return Api.InputBotInlineResult.parse_inputBotInlineResultGame($0) }
dict[-2000710887] = { return Api.InputBotInlineResult.parse_inputBotInlineResult($0) }
dict[1352683077] = { return Api.account.PrivacyRules.parse_privacyRules($0) }
dict[-123988] = { return Api.PrivacyRule.parse_privacyValueAllowContacts($0) }
dict[1698855810] = { return Api.PrivacyRule.parse_privacyValueAllowAll($0) }
@ -833,8 +830,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1674235686] = { return Api.account.AutoDownloadSettings.parse_autoDownloadSettings($0) }
dict[-445792507] = { return Api.DialogPeer.parse_dialogPeer($0) }
dict[1363483106] = { return Api.DialogPeer.parse_dialogPeerFolder($0) }
dict[-104284986] = { return Api.WebDocument.parse_webDocumentNoProxy($0) }
dict[475467473] = { return Api.WebDocument.parse_webDocument($0) }
dict[-104284986] = { return Api.WebDocument.parse_webDocumentNoProxy($0) }
dict[42930452] = { return Api.Theme.parse_theme($0) }
dict[-1290580579] = { return Api.contacts.Found.parse_found($0) }
dict[-368018716] = { return Api.ChannelAdminLogEventsFilter.parse_channelAdminLogEventsFilter($0) }
@ -847,8 +844,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[1775479590] = { return Api.UserProfilePhoto.parse_userProfilePhoto($0) }
dict[-74456004] = { return Api.payments.SavedInfo.parse_savedInfo($0) }
dict[1041346555] = { return Api.updates.ChannelDifference.parse_channelDifferenceEmpty($0) }
dict[543450958] = { return Api.updates.ChannelDifference.parse_channelDifference($0) }
dict[-1531132162] = { return Api.updates.ChannelDifference.parse_channelDifferenceTooLong($0) }
dict[543450958] = { return Api.updates.ChannelDifference.parse_channelDifference($0) }
dict[-1815339214] = { return Api.help.CountriesList.parse_countriesListNotModified($0) }
dict[-2016381538] = { return Api.help.CountriesList.parse_countriesList($0) }
dict[-309659827] = { return Api.channels.AdminLogResults.parse_adminLogResults($0) }
@ -886,8 +883,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1730311882] = { return Api.PageListOrderedItem.parse_pageListOrderedItemBlocks($0) }
dict[-1417756512] = { return Api.EncryptedChat.parse_encryptedChatEmpty($0) }
dict[1006044124] = { return Api.EncryptedChat.parse_encryptedChatWaiting($0) }
dict[-94974410] = { return Api.EncryptedChat.parse_encryptedChat($0) }
dict[1651608194] = { return Api.EncryptedChat.parse_encryptedChatRequested($0) }
dict[-94974410] = { return Api.EncryptedChat.parse_encryptedChat($0) }
dict[505183301] = { return Api.EncryptedChat.parse_encryptedChatDiscarded($0) }
dict[-901375139] = { return Api.PeerLocated.parse_peerLocated($0) }
dict[-118740917] = { return Api.PeerLocated.parse_peerSelfLocated($0) }
@ -1016,6 +1013,8 @@ public struct Api {
_1.serialize(buffer, boxed)
case let _1 as Api.account.PasswordSettings:
_1.serialize(buffer, boxed)
case let _1 as Api.help.SupportName:
_1.serialize(buffer, boxed)
case let _1 as Api.LangPackLanguage:
_1.serialize(buffer, boxed)
case let _1 as Api.VideoSize:
@ -1042,12 +1041,16 @@ public struct Api {
_1.serialize(buffer, boxed)
case let _1 as Api.InputEncryptedFile:
_1.serialize(buffer, boxed)
case let _1 as Api.account.Takeout:
_1.serialize(buffer, boxed)
case let _1 as Api.messages.InactiveChats:
_1.serialize(buffer, boxed)
case let _1 as Api.GroupCallParticipant:
_1.serialize(buffer, boxed)
case let _1 as Api.messages.SentEncryptedMessage:
_1.serialize(buffer, boxed)
case let _1 as Api.SavedContact:
_1.serialize(buffer, boxed)
case let _1 as Api.ExportedMessageLink:
_1.serialize(buffer, boxed)
case let _1 as Api.auth.Authorization:
@ -1086,8 +1089,6 @@ public struct Api {
_1.serialize(buffer, boxed)
case let _1 as Api.InputDialogPeer:
_1.serialize(buffer, boxed)
case let _1 as Api.Error:
_1.serialize(buffer, boxed)
case let _1 as Api.KeyboardButton:
_1.serialize(buffer, boxed)
case let _1 as Api.ContactStatus:
@ -1110,8 +1111,6 @@ public struct Api {
_1.serialize(buffer, boxed)
case let _1 as Api.InputTheme:
_1.serialize(buffer, boxed)
case let _1 as Api.messages.FoundGifs:
_1.serialize(buffer, boxed)
case let _1 as Api.FileLocation:
_1.serialize(buffer, boxed)
case let _1 as Api.Poll:
@ -1208,6 +1207,8 @@ public struct Api {
_1.serialize(buffer, boxed)
case let _1 as Api.ChatBannedRights:
_1.serialize(buffer, boxed)
case let _1 as Api.InputClientProxy:
_1.serialize(buffer, boxed)
case let _1 as Api.messages.MessageEditData:
_1.serialize(buffer, boxed)
case let _1 as Api.LabeledPrice:
@ -1246,12 +1247,12 @@ public struct Api {
_1.serialize(buffer, boxed)
case let _1 as Api.SecureValueError:
_1.serialize(buffer, boxed)
case let _1 as Api.InputStickerSetItem:
_1.serialize(buffer, boxed)
case let _1 as Api.help.PromoData:
_1.serialize(buffer, boxed)
case let _1 as Api.NotifyPeer:
_1.serialize(buffer, boxed)
case let _1 as Api.wallet.KeySecretSalt:
_1.serialize(buffer, boxed)
case let _1 as Api.InputPrivacyKey:
_1.serialize(buffer, boxed)
case let _1 as Api.help.RecentMeUrls:
@ -1274,8 +1275,6 @@ public struct Api {
_1.serialize(buffer, boxed)
case let _1 as Api.messages.SearchCounter:
_1.serialize(buffer, boxed)
case let _1 as Api.auth.CheckedPhone:
_1.serialize(buffer, boxed)
case let _1 as Api.PageListItem:
_1.serialize(buffer, boxed)
case let _1 as Api.PeerBlocked:
@ -1334,8 +1333,6 @@ public struct Api {
_1.serialize(buffer, boxed)
case let _1 as Api.messages.AffectedFoundMessages:
_1.serialize(buffer, boxed)
case let _1 as Api.MessageFwdAuthor:
_1.serialize(buffer, boxed)
case let _1 as Api.WallPaper:
_1.serialize(buffer, boxed)
case let _1 as Api.messages.Messages:
@ -1368,8 +1365,6 @@ public struct Api {
_1.serialize(buffer, boxed)
case let _1 as Api.PaymentSavedCredentials:
_1.serialize(buffer, boxed)
case let _1 as Api.Null:
_1.serialize(buffer, boxed)
case let _1 as Api.auth.CodeType:
_1.serialize(buffer, boxed)
case let _1 as Api.DocumentAttribute:
@ -1398,8 +1393,6 @@ public struct Api {
_1.serialize(buffer, boxed)
case let _1 as Api.updates.State:
_1.serialize(buffer, boxed)
case let _1 as Api.FoundGif:
_1.serialize(buffer, boxed)
case let _1 as Api.User:
_1.serialize(buffer, boxed)
case let _1 as Api.Message:
@ -1464,6 +1457,8 @@ public struct Api {
_1.serialize(buffer, boxed)
case let _1 as Api.InputWebFileLocation:
_1.serialize(buffer, boxed)
case let _1 as Api.EmojiLanguage:
_1.serialize(buffer, boxed)
case let _1 as Api.MessageFwdHeader:
_1.serialize(buffer, boxed)
case let _1 as Api.BaseTheme:
@ -1480,8 +1475,6 @@ public struct Api {
_1.serialize(buffer, boxed)
case let _1 as Api.upload.CdnFile:
_1.serialize(buffer, boxed)
case let _1 as Api.wallet.LiteResponse:
_1.serialize(buffer, boxed)
case let _1 as Api.help.InviteText:
_1.serialize(buffer, boxed)
case let _1 as Api.BotInlineMessage:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -63,6 +63,7 @@ public enum AdminLogEventAction {
case revokeExportedInvitation(ExportedInvitation)
case editExportedInvitation(previous: ExportedInvitation, updated: ExportedInvitation)
case participantJoinedViaInvite(ExportedInvitation)
case changeHistoryTTL(previousValue: Int32?, updatedValue: Int32?)
}
public enum ChannelAdminLogEventError {
@ -248,7 +249,7 @@ public func channelAdminLogEvents(postbox: Postbox, network: Network, peerId: Pe
let parsedParticipant = GroupCallParticipantsContext.Update.StateUpdate.ParticipantUpdate(participant)
action = .groupCallUpdateParticipantVolume(peerId: parsedParticipant.peerId, volume: parsedParticipant.volume ?? 10000)
case let .channelAdminLogEventActionChangeHistoryTTL(prevValue, newValue):
action = nil
action = .changeHistoryTTL(previousValue: prevValue, updatedValue: newValue)
}
let peerId = PeerId(namespace: Namespaces.Peer.CloudUser, id: userId)
if let action = action {

View File

@ -384,7 +384,14 @@ private func clearHistory(transaction: Transaction, postbox: Postbox, network: N
return .complete()
}
} else if peer.id.namespace == Namespaces.Peer.CloudChannel, let inputChannel = apiInputChannel(peer) {
return network.request(Api.functions.channels.deleteHistory(channel: inputChannel, maxId: operation.topMessageId.id))
var flags: Int32 = 0
switch operation.type {
case .forEveryone:
flags |= 1 << 0
default:
break
}
return network.request(Api.functions.channels.deleteHistory(flags: flags, channel: inputChannel, maxId: operation.topMessageId.id))
|> `catch` { _ -> Signal<Api.Bool, NoError> in
return .single(.boolFalse)
}

View File

@ -126,7 +126,7 @@ func apiMessagePeerId(_ messsage: Api.Message) -> PeerId? {
} else {
return nil
}
case let .messageService(flags, _, fromId, chatPeerId, _, _, _):
case let .messageService(flags, _, fromId, chatPeerId, _, _, _, _):
return chatPeerId.peerId
}
}
@ -185,7 +185,7 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
return result
case .messageEmpty:
return []
case let .messageService(flags, _, fromId, chatPeerId, _, _, action):
case let .messageService(flags, _, fromId, chatPeerId, _, _, action, _):
let peerId: PeerId = chatPeerId.peerId
var result = [peerId]
@ -240,7 +240,7 @@ func apiMessageAssociatedMessageIds(_ message: Api.Message) -> [MessageId]? {
}
case .messageEmpty:
break
case let .messageService(_, _, _, chatPeerId, replyHeader, _, _):
case let .messageService(_, _, _, chatPeerId, replyHeader, _, _, _):
if let replyHeader = replyHeader {
switch replyHeader {
case let .messageReplyHeader(_, replyToMsgId, replyToPeerId, _):
@ -620,7 +620,7 @@ extension StoreMessage {
self.init(id: MessageId(peerId: peerId, namespace: namespace, id: id), globallyUniqueId: nil, groupingKey: groupingId, threadId: threadId, timestamp: date, flags: storeFlags, tags: tags, globalTags: globalTags, localTags: [], forwardInfo: forwardInfo, authorId: authorId, text: messageText, attributes: attributes, media: medias)
case .messageEmpty:
return nil
case let .messageService(flags, id, fromId, chatPeerId, replyTo, date, action):
case let .messageService(flags, id, fromId, chatPeerId, replyTo, date, action, ttlPeriod):
let peerId: PeerId = chatPeerId.peerId
let authorId: PeerId? = fromId?.peerId ?? chatPeerId.peerId
@ -673,6 +673,10 @@ extension StoreMessage {
media.append(action)
}
if let ttlPeriod = ttlPeriod {
attributes.append(AutoremoveTimeoutMessageAttribute(timeout: ttlPeriod, countdownBeginTime: date))
}
let (tags, globalTags) = tagsForStoreMessage(incoming: storeFlags.contains(.Incoming), attributes: attributes, media: media, textEntities: nil, isPinned: false)
storeFlags.insert(.CanBeGroupedIntoFeed)

View File

@ -101,7 +101,7 @@ extension Api.Message {
return message.id
case let .messageEmpty(_, id, _):
return id
case let .messageService(_, id, _, _, _, _, _):
case let .messageService(_, id, _, _, _, _, _, _):
return id
}
}
@ -121,7 +121,7 @@ extension Api.Message {
} else {
return nil
}
case let .messageService(flags, id, fromId, chatPeerId, _, _, _):
case let .messageService(flags, id, fromId, chatPeerId, _, _, _, _):
let peerId: PeerId = chatPeerId.peerId
return MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: id)
}

View File

@ -5567,7 +5567,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
}
} else if let user = peer as? TelegramUser {
if user.id != strongSelf.context.account.peerId {
if user.id != strongSelf.context.account.peerId && user.botInfo == nil {
canSetupAutoremoveTimeout = true
}
} else if let channel = peer as? TelegramChannel {
@ -7749,7 +7749,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
}
} else if let user = self.presentationInterfaceState.renderedPeer?.peer as? TelegramUser {
if user.id != self.context.account.peerId {
if user.id != self.context.account.peerId && user.botInfo == nil {
canSetupAutoremoveTimeout = true
}
} else if let channel = self.presentationInterfaceState.renderedPeer?.peer as? TelegramChannel {

View File

@ -246,8 +246,10 @@ func inputTextPanelStateForChatPresentationInterfaceState(_ chatPresentationInte
canSetupAutoremoveTimeout = true
}
}
} else if let _ = chatPresentationInterfaceState.renderedPeer?.peer as? TelegramUser {
canSetupAutoremoveTimeout = true
} else if let user = chatPresentationInterfaceState.renderedPeer?.peer as? TelegramUser {
if user.botInfo == nil {
canSetupAutoremoveTimeout = true
}
} else if let channel = chatPresentationInterfaceState.renderedPeer?.peer as? TelegramChannel {
if channel.hasPermission(.deleteAllMessages) {
canSetupAutoremoveTimeout = true

View File

@ -1304,6 +1304,37 @@ struct ChatRecentActionsEntry: Comparable, Identifiable {
let action = TelegramMediaActionType.customText(text: text, entities: entities)
let message = Message(stableId: self.entry.stableId, stableVersion: 0, id: MessageId(peerId: peer.id, namespace: Namespaces.Message.Cloud, id: Int32(bitPattern: self.entry.stableId)), globallyUniqueId: self.entry.event.id, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: self.entry.event.date, flags: [.Incoming], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: author, text: "", attributes: [], media: [TelegramMediaAction(action: action)], peers: peers, associatedMessages: SimpleDictionary(), associatedMessageIds: [])
return ChatMessageItem(presentationData: self.presentationData, context: context, chatLocation: .peer(peer.id), associatedData: ChatMessageItemAssociatedData(automaticDownloadPeerType: .channel, automaticDownloadNetworkType: .cellular, isRecentActions: true), controllerInteraction: controllerInteraction, content: .message(message: message, read: true, selection: .none, attributes: ChatMessageEntryAttributes()))
case let .changeHistoryTTL(_, updatedValue):
var peers = SimpleDictionary<PeerId, Peer>()
var author: Peer?
if let peer = self.entry.peers[self.entry.event.peerId] {
author = peer
peers[peer.id] = peer
}
var text: String = ""
var entities: [MessageTextEntity] = []
let rawText: (String, [(Int, NSRange)])
if let updatedValue = updatedValue {
rawText = self.presentationData.strings.Channel_AdminLog_MessageChangedAutoremoveTimeoutSet(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? "", timeIntervalString(strings: self.presentationData.strings, value: updatedValue))
} else {
rawText = self.presentationData.strings.Channel_AdminLog_MessageChangedAutoremoveTimeoutRemove(author?.displayTitle(strings: self.presentationData.strings, displayOrder: self.presentationData.nameDisplayOrder) ?? "")
}
appendAttributedText(text: rawText, generateEntities: { index in
if index == 0, let author = author {
return [.TextMention(peerId: author.id)]
} else if index == 1 {
return [.Bold]
}
return []
}, to: &text, entities: &entities)
let action = TelegramMediaActionType.customText(text: text, entities: entities)
let message = Message(stableId: self.entry.stableId, stableVersion: 0, id: MessageId(peerId: peer.id, namespace: Namespaces.Message.Cloud, id: Int32(bitPattern: self.entry.stableId)), globallyUniqueId: self.entry.event.id, groupingKey: nil, groupInfo: nil, threadId: nil, timestamp: self.entry.event.date, flags: [.Incoming], tags: [], globalTags: [], localTags: [], forwardInfo: nil, author: author, text: "", attributes: [], media: [TelegramMediaAction(action: action)], peers: peers, associatedMessages: SimpleDictionary(), associatedMessageIds: [])
return ChatMessageItem(presentationData: self.presentationData, context: context, chatLocation: .peer(peer.id), associatedData: ChatMessageItemAssociatedData(automaticDownloadPeerType: .channel, automaticDownloadNetworkType: .cellular, isRecentActions: true), controllerInteraction: controllerInteraction, content: .message(message: message, read: true, selection: .none, attributes: ChatMessageEntryAttributes()))
}

View File

@ -657,6 +657,7 @@ final class UndoOverlayControllerNode: ViewControllerTracingNode {
self.validLayout = layout
var preferredSize: CGSize?
var verticalOffset: CGFloat = 0.0
if let animationNode = self.animationNode, let iconSize = animationNode.preferredSize() {
if case .messagesUnpinned = self.content {
let factor: CGFloat = 0.5
@ -668,7 +669,8 @@ final class UndoOverlayControllerNode: ViewControllerTracingNode {
let factor: CGFloat = 0.08
preferredSize = CGSize(width: floor(iconSize.width * factor), height: floor(iconSize.height * factor))
} else if case .autoDelete = self.content {
let factor: CGFloat = 0.06
let factor: CGFloat = 0.07
verticalOffset = -3.0
preferredSize = CGSize(width: floor(iconSize.width * factor), height: floor(iconSize.height * factor))
} else {
preferredSize = iconSize
@ -735,7 +737,7 @@ final class UndoOverlayControllerNode: ViewControllerTracingNode {
transition.updateFrame(node: self.textNode, frame: CGRect(origin: CGPoint(x: leftInset, y: textContentOrigin + textOffset), size: textSize))
if let iconNode = self.iconNode, let iconSize = iconNode.image?.size {
let iconFrame = CGRect(origin: CGPoint(x: floor((leftInset - iconSize.width) / 2.0), y: floor((contentHeight - iconSize.height) / 2.0)), size: iconSize)
let iconFrame = CGRect(origin: CGPoint(x: floor((leftInset - iconSize.width) / 2.0), y: floor((contentHeight - iconSize.height) / 2.0) + verticalOffset), size: iconSize)
transition.updateFrame(node: iconNode, frame: iconFrame)
if let iconCheckNode = self.iconCheckNode {
@ -749,7 +751,7 @@ final class UndoOverlayControllerNode: ViewControllerTracingNode {
}
if let animationNode = self.animationNode, let iconSize = preferredSize {
let iconFrame = CGRect(origin: CGPoint(x: floor((leftInset - iconSize.width) / 2.0), y: floor((contentHeight - iconSize.height) / 2.0)), size: iconSize)
let iconFrame = CGRect(origin: CGPoint(x: floor((leftInset - iconSize.width) / 2.0), y: floor((contentHeight - iconSize.height) / 2.0) + verticalOffset), size: iconSize)
transition.updateFrame(node: animationNode, frame: iconFrame)
}