mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Enable Report Spam for deleted accounts
This commit is contained in:
parent
d78e5af007
commit
8583e45ebc
@ -7015,16 +7015,6 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
])])
|
])])
|
||||||
|
|
||||||
self.present(actionSheet, in: .window(.root))
|
self.present(actionSheet, in: .window(.root))
|
||||||
|
|
||||||
/*self.present(peerReportOptionsController(context: self.context, subject: .peer(peer.id), present: { [weak self] c, a in
|
|
||||||
self?.present(c, in: .window(.root))
|
|
||||||
}, completion: { [weak self] success in
|
|
||||||
guard let strongSelf = self, success else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
let _ = removePeerChat(account: strongSelf.context.account, peerId: chatPeer.id, reportChatSpam: false).start()
|
|
||||||
(strongSelf.navigationController as? NavigationController)?.filterController(strongSelf, animated: true)
|
|
||||||
}), in: .window(.root))*/
|
|
||||||
} else if let _ = peer as? TelegramUser {
|
} else if let _ = peer as? TelegramUser {
|
||||||
let presentationData = self.presentationData
|
let presentationData = self.presentationData
|
||||||
let controller = ActionSheetController(presentationData: presentationData)
|
let controller = ActionSheetController(presentationData: presentationData)
|
||||||
@ -7033,9 +7023,11 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
}
|
}
|
||||||
var reportSpam = true
|
var reportSpam = true
|
||||||
var deleteChat = true
|
var deleteChat = true
|
||||||
controller.setItemGroups([
|
var items: [ActionSheetItem] = []
|
||||||
ActionSheetItemGroup(items: [
|
if !peer.isDeleted {
|
||||||
ActionSheetTextItem(title: presentationData.strings.UserInfo_BlockConfirmationTitle(peer.compactDisplayTitle).0),
|
items.append(ActionSheetTextItem(title: presentationData.strings.UserInfo_BlockConfirmationTitle(peer.compactDisplayTitle).0))
|
||||||
|
}
|
||||||
|
items.append(contentsOf: [
|
||||||
ActionSheetCheckboxItem(title: presentationData.strings.Conversation_Moderate_Report, label: "", value: reportSpam, action: { [weak controller] checkValue in
|
ActionSheetCheckboxItem(title: presentationData.strings.Conversation_Moderate_Report, label: "", value: reportSpam, action: { [weak controller] checkValue in
|
||||||
reportSpam = checkValue
|
reportSpam = checkValue
|
||||||
controller?.updateItem(groupIndex: 0, itemIndex: 1, { item in
|
controller?.updateItem(groupIndex: 0, itemIndex: 1, { item in
|
||||||
@ -7072,7 +7064,10 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
let _ = TelegramCore.reportPeer(account: strongSelf.context.account, peerId: peer.id, reason: .spam).start()
|
let _ = TelegramCore.reportPeer(account: strongSelf.context.account, peerId: peer.id, reason: .spam).start()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
]),
|
] as [ActionSheetItem])
|
||||||
|
|
||||||
|
controller.setItemGroups([
|
||||||
|
ActionSheetItemGroup(items: items),
|
||||||
ActionSheetItemGroup(items: [ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, action: { dismissAction() })])
|
ActionSheetItemGroup(items: [ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, action: { dismissAction() })])
|
||||||
])
|
])
|
||||||
self.present(controller, in: .window(.root), with: ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
|
self.present(controller, in: .window(.root), with: ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
|
||||||
|
@ -13,6 +13,7 @@ private enum ChatReportPeerTitleButton: Equatable {
|
|||||||
case addContact(String?)
|
case addContact(String?)
|
||||||
case shareMyPhoneNumber
|
case shareMyPhoneNumber
|
||||||
case reportSpam
|
case reportSpam
|
||||||
|
case reportUserSpam
|
||||||
case reportIrrelevantGeoLocation
|
case reportIrrelevantGeoLocation
|
||||||
|
|
||||||
func title(strings: PresentationStrings) -> String {
|
func title(strings: PresentationStrings) -> String {
|
||||||
@ -29,6 +30,8 @@ private enum ChatReportPeerTitleButton: Equatable {
|
|||||||
return strings.Conversation_ShareMyPhoneNumber
|
return strings.Conversation_ShareMyPhoneNumber
|
||||||
case .reportSpam:
|
case .reportSpam:
|
||||||
return strings.Conversation_ReportSpamAndLeave
|
return strings.Conversation_ReportSpamAndLeave
|
||||||
|
case .reportUserSpam:
|
||||||
|
return strings.Conversation_ReportSpam
|
||||||
case .reportIrrelevantGeoLocation:
|
case .reportIrrelevantGeoLocation:
|
||||||
return strings.Conversation_ReportGroupLocation
|
return strings.Conversation_ReportGroupLocation
|
||||||
}
|
}
|
||||||
@ -49,6 +52,16 @@ private func peerButtons(_ state: ChatPresentationInterfaceState) -> [ChatReport
|
|||||||
} else {
|
} else {
|
||||||
buttons.append(.addContact(nil))
|
buttons.append(.addContact(nil))
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if peerStatusSettings.contains(.canBlock) || peerStatusSettings.contains(.canReport) {
|
||||||
|
if peer.isDeleted {
|
||||||
|
buttons.append(.reportUserSpam)
|
||||||
|
} else {
|
||||||
|
if !state.peerIsBlocked {
|
||||||
|
buttons.append(.block)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if buttons.isEmpty {
|
if buttons.isEmpty {
|
||||||
if peerStatusSettings.contains(.canShareContact) {
|
if peerStatusSettings.contains(.canShareContact) {
|
||||||
@ -134,7 +147,7 @@ final class ChatReportPeerTitlePanelNode: ChatTitleAccessoryPanelNode {
|
|||||||
view.setTitle(button.title(strings: interfaceState.strings), for: [])
|
view.setTitle(button.title(strings: interfaceState.strings), for: [])
|
||||||
view.titleLabel?.font = Font.regular(16.0)
|
view.titleLabel?.font = Font.regular(16.0)
|
||||||
switch button {
|
switch button {
|
||||||
case .block, .reportSpam:
|
case .block, .reportSpam, .reportUserSpam:
|
||||||
view.setTitleColor(interfaceState.theme.chat.inputPanel.panelControlDestructiveColor, for: [])
|
view.setTitleColor(interfaceState.theme.chat.inputPanel.panelControlDestructiveColor, for: [])
|
||||||
view.setTitleColor(interfaceState.theme.chat.inputPanel.panelControlDestructiveColor.withAlphaComponent(0.7), for: [.highlighted])
|
view.setTitleColor(interfaceState.theme.chat.inputPanel.panelControlDestructiveColor.withAlphaComponent(0.7), for: [.highlighted])
|
||||||
default:
|
default:
|
||||||
@ -188,7 +201,7 @@ final class ChatReportPeerTitlePanelNode: ChatTitleAccessoryPanelNode {
|
|||||||
switch button {
|
switch button {
|
||||||
case .shareMyPhoneNumber:
|
case .shareMyPhoneNumber:
|
||||||
self.interfaceInteraction?.shareAccountContact()
|
self.interfaceInteraction?.shareAccountContact()
|
||||||
case .block, .reportSpam:
|
case .block, .reportSpam, .reportUserSpam:
|
||||||
self.interfaceInteraction?.reportPeer()
|
self.interfaceInteraction?.reportPeer()
|
||||||
case .addContact:
|
case .addContact:
|
||||||
self.interfaceInteraction?.presentPeerContact()
|
self.interfaceInteraction?.presentPeerContact()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user