Fix username sharing

This commit is contained in:
Ali 2020-02-11 17:03:36 +01:00
parent be0ccabe2a
commit cae526172f

View File

@ -2110,7 +2110,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
} }
private func openUsername(value: String) { private func openUsername(value: String) {
let shareController = ShareController(context: context, subject: .url("\(value)")) let shareController = ShareController(context: self.context, subject: .url("https://t.me/\(value)"))
self.view.endEditing(true) self.view.endEditing(true)
self.controller?.present(shareController, in: .window(.root)) self.controller?.present(shareController, in: .window(.root))
} }
@ -2645,7 +2645,7 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
case .link: case .link:
if let addressName = peer.addressName { if let addressName = peer.addressName {
let contextMenuController = ContextMenuController(actions: [ContextMenuAction(content: .text(title: self.presentationData.strings.Conversation_ContextMenuCopy, accessibilityLabel: self.presentationData.strings.Conversation_ContextMenuCopy), action: { let contextMenuController = ContextMenuController(actions: [ContextMenuAction(content: .text(title: self.presentationData.strings.Conversation_ContextMenuCopy, accessibilityLabel: self.presentationData.strings.Conversation_ContextMenuCopy), action: {
UIPasteboard.general.string = addressName UIPasteboard.general.string = "@" + addressName
})]) })])
controller.present(contextMenuController, in: .window(.root), with: ContextMenuControllerPresentationArguments(sourceNodeAndRect: { [weak self, weak sourceNode] in controller.present(contextMenuController, in: .window(.root), with: ContextMenuControllerPresentationArguments(sourceNodeAndRect: { [weak self, weak sourceNode] in
if let controller = self?.controller, let sourceNode = sourceNode { if let controller = self?.controller, let sourceNode = sourceNode {