Disallow forward of shared media in secret chats

This commit is contained in:
Ilya Laktyushin 2021-02-06 22:39:48 +04:00
parent 1f6b5ba9e0
commit 0b5242e47f

View File

@ -1691,6 +1691,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
}))) })))
} }
if message.id.peerId.namespace != Namespaces.Peer.SecretChat {
items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.Conversation_ContextMenuForward, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: theme.contextMenu.primaryColor) }, action: { c, _ in items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.Conversation_ContextMenuForward, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
c.dismiss(completion: { c.dismiss(completion: {
if let strongSelf = self { if let strongSelf = self {
@ -1698,6 +1699,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
} }
}) })
}))) })))
}
if actions.options.contains(.deleteLocally) || actions.options.contains(.deleteGlobally) { if actions.options.contains(.deleteLocally) || actions.options.contains(.deleteGlobally) {
let context = strongSelf.context let context = strongSelf.context
let presentationData = strongSelf.presentationData let presentationData = strongSelf.presentationData
@ -1802,6 +1804,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
}) })
}))) })))
if message.id.peerId.namespace != Namespaces.Peer.SecretChat {
items.append(.action(ContextMenuActionItem(text: strings.Conversation_ContextMenuForward, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: theme.contextMenu.primaryColor) }, action: { c, f in items.append(.action(ContextMenuActionItem(text: strings.Conversation_ContextMenuForward, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Forward"), color: theme.contextMenu.primaryColor) }, action: { c, f in
c.dismiss(completion: { c.dismiss(completion: {
if let strongSelf = self { if let strongSelf = self {
@ -1809,6 +1812,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
} }
}) })
}))) })))
}
if actions.options.contains(.deleteLocally) || actions.options.contains(.deleteGlobally) { if actions.options.contains(.deleteLocally) || actions.options.contains(.deleteGlobally) {
items.append(.action(ContextMenuActionItem(text: strings.Conversation_ContextMenuDelete, textColor: .destructive, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor) }, action: { c, f in items.append(.action(ContextMenuActionItem(text: strings.Conversation_ContextMenuDelete, textColor: .destructive, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor) }, action: { c, f in