|
@@ -108,6 +108,7 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
|
|
|
var groupImages: [String:[ImageGrouping]] = [:]
|
|
|
var titleText: String!
|
|
|
var lastY: CGFloat = 0
|
|
|
+ var isEditAction: Bool = false
|
|
|
|
|
|
public override func viewDidDisappear(_ animated: Bool) {
|
|
|
if self.isMovingFromParent {
|
|
@@ -3587,33 +3588,33 @@ extension EditorPersonal: UIContextMenuInteractionDelegate {
|
|
|
self.tableChatView.reloadData()
|
|
|
}
|
|
|
})
|
|
|
- let edit = UIAction(title: "Edit".localized(), image: UIImage(systemName: "pencil"), handler: {(_) in
|
|
|
- if self.removed {
|
|
|
- return
|
|
|
- }
|
|
|
- if self.isSearching {
|
|
|
- self.cancelAction()
|
|
|
- }
|
|
|
- if self.reffId != nil {
|
|
|
- self.deleteReplyView()
|
|
|
- }
|
|
|
- DispatchQueue.main.asyncAfter(deadline: .now() + 0.35) {
|
|
|
- let handler = CustomUIContextMenu()
|
|
|
- let nextInteraction = UIContextMenuInteraction(delegate: handler)
|
|
|
- interaction.view!.addInteraction(nextInteraction)
|
|
|
- guard let interaction = interaction.view!.interactions.first,
|
|
|
- let data = Data(base64Encoded: "X3ByZXNlbnRNZW51QXRMb2NhdGlvbjo="),
|
|
|
- let str = String(data: data, encoding: .utf8)
|
|
|
- else {
|
|
|
- return
|
|
|
- }
|
|
|
- let selector = NSSelectorFromString(str)
|
|
|
- guard interaction.responds(to: selector) else {
|
|
|
- return
|
|
|
- }
|
|
|
- nextInteraction.perform(selector, with: self.view)
|
|
|
- }
|
|
|
- })
|
|
|
+// let edit = UIAction(title: "Edit".localized(), image: UIImage(systemName: "pencil"), handler: {(_) in
|
|
|
+// if self.removed {
|
|
|
+// return
|
|
|
+// }
|
|
|
+// if self.isSearching {
|
|
|
+// self.cancelAction()
|
|
|
+// }
|
|
|
+// if self.reffId != nil {
|
|
|
+// self.deleteReplyView()
|
|
|
+// }
|
|
|
+// self.isEditAction = true
|
|
|
+// DispatchQueue.main.asyncAfter(deadline: .now() + 0.35) {
|
|
|
+// let nextInteraction = UIContextMenuInteraction(delegate: self)
|
|
|
+// interaction.view!.addInteraction(nextInteraction)
|
|
|
+// guard let interaction = interaction.view!.interactions.first,
|
|
|
+// let data = Data(base64Encoded: "X3ByZXNlbnRNZW51QXRMb2NhdGlvbjo="),
|
|
|
+// let str = String(data: data, encoding: .utf8)
|
|
|
+// else {
|
|
|
+// return
|
|
|
+// }
|
|
|
+// let selector = NSSelectorFromString(str)
|
|
|
+// guard interaction.responds(to: selector) else {
|
|
|
+// return
|
|
|
+// }
|
|
|
+// nextInteraction.perform(selector, with: self.view)
|
|
|
+// }
|
|
|
+// })
|
|
|
let info = UIAction(title: "Info".localized(), image: UIImage(systemName: "info.circle.fill"), handler: {(_) in
|
|
|
if self.removed {
|
|
|
return
|
|
@@ -3711,7 +3712,7 @@ extension EditorPersonal: UIContextMenuInteractionDelegate {
|
|
|
Nexilis.addQueueMessage(message: message)
|
|
|
})
|
|
|
|
|
|
- var children: [UIMenuElement] = [star, reply, forward, copy, edit, delete]
|
|
|
+ var children: [UIMenuElement] = [star, reply, forward, copy, delete]
|
|
|
// let copyOption = self.copyOption(indexPath: indexPath!)
|
|
|
let idMe = UserDefaults.standard.string(forKey: "me") as String?
|
|
|
if dataMessages[indexPath!.row]["status"] as! String == "0" {
|
|
@@ -3750,7 +3751,15 @@ extension EditorPersonal: UIContextMenuInteractionDelegate {
|
|
|
children.insert(info, at: children.count - 1)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ if isEditAction {
|
|
|
+ return UIContextMenuConfiguration(identifier: nil,
|
|
|
+ previewProvider: {
|
|
|
+ self.textFieldSend.becomeFirstResponder()
|
|
|
+ return nil
|
|
|
+ }) { _ in
|
|
|
+ return nil
|
|
|
+ }
|
|
|
+ }
|
|
|
return UIContextMenuConfiguration(identifier: nil,
|
|
|
previewProvider: nil) { _ in
|
|
|
UIMenu(title: "", children: children)
|
|
@@ -6786,28 +6795,6 @@ class segmentedControllerObject: UISegmentedControl {
|
|
|
var navigation = UINavigationController()
|
|
|
}
|
|
|
|
|
|
-class CustomUIContextMenu: NSObject, UIContextMenuInteractionDelegate {
|
|
|
- func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? {
|
|
|
- // Return the menu configuration
|
|
|
- return UIContextMenuConfiguration(identifier: nil, previewProvider: nil) { _ in
|
|
|
- let action1 = UIAction(title: "Action 1", handler: { _ in
|
|
|
- // Handle action 1
|
|
|
- })
|
|
|
- let action2 = UIAction(title: "Action 2", handler: { _ in
|
|
|
- // Handle action 2
|
|
|
- })
|
|
|
- return UIMenu(title: "", children: [action1, action2])
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configuration: UIContextMenuConfiguration, highlightPreviewForItemWithIdentifier identifier: any NSCopying) -> UITargetedPreview? {
|
|
|
- let previewView = UIView()
|
|
|
- previewView.frame = CGRect(x: 0, y: 0, width: 100, height: 50)
|
|
|
- previewView.backgroundColor = .green
|
|
|
- return UITargetedPreview(view: previewView)
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
public class ImageGrouping {
|
|
|
public var messageId = ""
|
|
|
public var thumbId = ""
|