mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-28 19:05:49 +00:00
Support autoarchive for groups and channels
This commit is contained in:
parent
1137de2781
commit
401e4798fa
@ -54,7 +54,13 @@ public func chatListItemStrings(strings: PresentationStrings, nameDisplayOrder:
|
||||
peer = chatPeer.chatMainPeer
|
||||
}
|
||||
|
||||
messageText = messages[0].text
|
||||
messageText = ""
|
||||
for message in messages {
|
||||
if !message.text.isEmpty {
|
||||
messageText = message.text
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
var textIsReady = false
|
||||
if messages.count > 1 {
|
||||
|
||||
@ -39,14 +39,25 @@ public func unarchiveAutomaticallyArchivedPeer(account: Account, peerId: PeerId)
|
||||
let _ = (account.postbox.transaction { transaction -> Void in
|
||||
updatePeerGroupIdInteractively(transaction: transaction, peerId: peerId, groupId: .root)
|
||||
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in
|
||||
guard let currentData = current as? CachedUserData, let currentStatusSettings = currentData.peerStatusSettings else {
|
||||
if let currentData = current as? CachedUserData, let currentStatusSettings = currentData.peerStatusSettings {
|
||||
var statusSettings = currentStatusSettings
|
||||
statusSettings.flags.remove(.canBlock)
|
||||
statusSettings.flags.remove(.canReport)
|
||||
statusSettings.flags.remove(.autoArchived)
|
||||
return currentData.withUpdatedPeerStatusSettings(statusSettings)
|
||||
} else if let currentData = current as? CachedGroupData, let currentStatusSettings = currentData.peerStatusSettings {
|
||||
var statusSettings = currentStatusSettings
|
||||
statusSettings.flags.remove(.canReport)
|
||||
statusSettings.flags.remove(.autoArchived)
|
||||
return currentData.withUpdatedPeerStatusSettings(statusSettings)
|
||||
} else if let currentData = current as? CachedChannelData, let currentStatusSettings = currentData.peerStatusSettings {
|
||||
var statusSettings = currentStatusSettings
|
||||
statusSettings.flags.remove(.canReport)
|
||||
statusSettings.flags.remove(.autoArchived)
|
||||
return currentData.withUpdatedPeerStatusSettings(statusSettings)
|
||||
}else {
|
||||
return current
|
||||
}
|
||||
var statusSettings = currentStatusSettings
|
||||
statusSettings.flags.remove(.canBlock)
|
||||
statusSettings.flags.remove(.canReport)
|
||||
statusSettings.flags.remove(.autoArchived)
|
||||
return currentData.withUpdatedPeerStatusSettings(statusSettings)
|
||||
})
|
||||
}
|
||||
|> deliverOnMainQueue).start()
|
||||
|
||||
@ -87,6 +87,9 @@ private func peerButtons(_ state: ChatPresentationInterfaceState) -> [ChatReport
|
||||
} else if let _ = state.renderedPeer?.chatMainPeer {
|
||||
if let contactStatus = state.contactStatus, contactStatus.canReportIrrelevantLocation, let peerStatusSettings = contactStatus.peerStatusSettings, peerStatusSettings.contains(.canReportIrrelevantGeoLocation) {
|
||||
buttons.append(.reportIrrelevantGeoLocation)
|
||||
} else if let contactStatus = state.contactStatus, let peerStatusSettings = contactStatus.peerStatusSettings, peerStatusSettings.contains(.autoArchived) {
|
||||
buttons.append(.reportUserSpam)
|
||||
buttons.append(.unarchive)
|
||||
} else {
|
||||
buttons.append(.reportSpam)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user