mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-29 03:21:29 +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
|
peer = chatPeer.chatMainPeer
|
||||||
}
|
}
|
||||||
|
|
||||||
messageText = messages[0].text
|
messageText = ""
|
||||||
|
for message in messages {
|
||||||
|
if !message.text.isEmpty {
|
||||||
|
messageText = message.text
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var textIsReady = false
|
var textIsReady = false
|
||||||
if messages.count > 1 {
|
if messages.count > 1 {
|
||||||
|
|||||||
@ -39,14 +39,25 @@ public func unarchiveAutomaticallyArchivedPeer(account: Account, peerId: PeerId)
|
|||||||
let _ = (account.postbox.transaction { transaction -> Void in
|
let _ = (account.postbox.transaction { transaction -> Void in
|
||||||
updatePeerGroupIdInteractively(transaction: transaction, peerId: peerId, groupId: .root)
|
updatePeerGroupIdInteractively(transaction: transaction, peerId: peerId, groupId: .root)
|
||||||
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in
|
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 {
|
||||||
return current
|
|
||||||
}
|
|
||||||
var statusSettings = currentStatusSettings
|
var statusSettings = currentStatusSettings
|
||||||
statusSettings.flags.remove(.canBlock)
|
statusSettings.flags.remove(.canBlock)
|
||||||
statusSettings.flags.remove(.canReport)
|
statusSettings.flags.remove(.canReport)
|
||||||
statusSettings.flags.remove(.autoArchived)
|
statusSettings.flags.remove(.autoArchived)
|
||||||
return currentData.withUpdatedPeerStatusSettings(statusSettings)
|
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
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|> deliverOnMainQueue).start()
|
|> deliverOnMainQueue).start()
|
||||||
|
|||||||
@ -87,6 +87,9 @@ private func peerButtons(_ state: ChatPresentationInterfaceState) -> [ChatReport
|
|||||||
} else if let _ = state.renderedPeer?.chatMainPeer {
|
} else if let _ = state.renderedPeer?.chatMainPeer {
|
||||||
if let contactStatus = state.contactStatus, contactStatus.canReportIrrelevantLocation, let peerStatusSettings = contactStatus.peerStatusSettings, peerStatusSettings.contains(.canReportIrrelevantGeoLocation) {
|
if let contactStatus = state.contactStatus, contactStatus.canReportIrrelevantLocation, let peerStatusSettings = contactStatus.peerStatusSettings, peerStatusSettings.contains(.canReportIrrelevantGeoLocation) {
|
||||||
buttons.append(.reportIrrelevantGeoLocation)
|
buttons.append(.reportIrrelevantGeoLocation)
|
||||||
|
} else if let contactStatus = state.contactStatus, let peerStatusSettings = contactStatus.peerStatusSettings, peerStatusSettings.contains(.autoArchived) {
|
||||||
|
buttons.append(.reportUserSpam)
|
||||||
|
buttons.append(.unarchive)
|
||||||
} else {
|
} else {
|
||||||
buttons.append(.reportSpam)
|
buttons.append(.reportSpam)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user