|
@@ -22,12 +22,18 @@ class PreviewAttachmentImageVideo: UIViewController, UIScrollViewDelegate, UITex
|
|
@IBOutlet var heightTextFieldSend: NSLayoutConstraint!
|
|
@IBOutlet var heightTextFieldSend: NSLayoutConstraint!
|
|
@IBOutlet var constraintButtonSend: NSLayoutConstraint!
|
|
@IBOutlet var constraintButtonSend: NSLayoutConstraint!
|
|
@IBOutlet var scrollViewImage: UIScrollView!
|
|
@IBOutlet var scrollViewImage: UIScrollView!
|
|
|
|
+ @IBOutlet weak var buttonAckConfidential: UIButton!
|
|
|
|
+ @IBOutlet weak var constraintLeftTextField: NSLayoutConstraint!
|
|
var imageVideoData: [UIImagePickerController.InfoKey: Any]?
|
|
var imageVideoData: [UIImagePickerController.InfoKey: Any]?
|
|
var image: UIImage?
|
|
var image: UIImage?
|
|
var currentTextTextField: String?
|
|
var currentTextTextField: String?
|
|
var delegate: PreviewAttachmentImageVideoDelegate?
|
|
var delegate: PreviewAttachmentImageVideoDelegate?
|
|
var isHiddenTextField = false
|
|
var isHiddenTextField = false
|
|
var fromCopy = false
|
|
var fromCopy = false
|
|
|
|
+ var isConfidential = false
|
|
|
|
+ var isAck = false
|
|
|
|
+ var isGroup = false
|
|
|
|
+ var isCC = false
|
|
|
|
|
|
override func viewDidLoad() {
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
super.viewDidLoad()
|
|
@@ -74,6 +80,20 @@ class PreviewAttachmentImageVideo: UIViewController, UIScrollViewDelegate, UITex
|
|
|
|
|
|
buttonSend.circle()
|
|
buttonSend.circle()
|
|
buttonSend.addTarget(self, action: #selector(sendTapped), for: .touchUpInside)
|
|
buttonSend.addTarget(self, action: #selector(sendTapped), for: .touchUpInside)
|
|
|
|
+ if isCC {
|
|
|
|
+ buttonAckConfidential.isHidden = true
|
|
|
|
+ constraintLeftTextField.constant = 20
|
|
|
|
+ } else {
|
|
|
|
+ buttonAckConfidential.circle()
|
|
|
|
+ buttonAckConfidential.addTarget(self, action: #selector(showChooserACKConfidential), for: .touchUpInside)
|
|
|
|
+ let imageConfidential = resizeImage(image: UIImage(named: "confidential_icon", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withRenderingMode(.alwaysOriginal)
|
|
|
|
+ let imageAck = resizeImage(image: UIImage(named: "ack_icon", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withRenderingMode(.alwaysOriginal)
|
|
|
|
+ if isAck {
|
|
|
|
+ buttonAckConfidential.setImage(imageAck, for: .normal)
|
|
|
|
+ } else if isConfidential {
|
|
|
|
+ buttonAckConfidential.setImage(imageConfidential, for: .normal)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
textFieldSend.layer.cornerRadius = textFieldSend.maxCornerRadius()
|
|
textFieldSend.layer.cornerRadius = textFieldSend.maxCornerRadius()
|
|
textFieldSend.layer.borderWidth = 1.0
|
|
textFieldSend.layer.borderWidth = 1.0
|
|
@@ -102,6 +122,61 @@ class PreviewAttachmentImageVideo: UIViewController, UIScrollViewDelegate, UITex
|
|
buttonCancel.addTarget(self, action: #selector(cancelTapped), for: .touchUpInside)
|
|
buttonCancel.addTarget(self, action: #selector(cancelTapped), for: .touchUpInside)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @objc func showChooserACKConfidential() {
|
|
|
|
+ let alertController = UIAlertController(title: "Message Mode".localized(), message: "Select".localized() + " " + "Message Mode".localized(), preferredStyle: .actionSheet)
|
|
|
|
+ if !self.isGroup {
|
|
|
|
+ let imageConfidential = resizeImage(image: UIImage(named: "confidential_icon", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withRenderingMode(.alwaysOriginal)
|
|
|
|
+ let confidentialAction = UIAlertAction(title: "Confidential Message".localized(), style: .default, handler: { (UIAlertAction) in
|
|
|
|
+ if !self.isConfidential {
|
|
|
|
+ self.isConfidential = true
|
|
|
|
+ self.buttonAckConfidential.setImage(imageConfidential, for: .normal)
|
|
|
|
+ }
|
|
|
|
+ if self.isAck {
|
|
|
|
+ self.isAck = false
|
|
|
|
+ }
|
|
|
|
+ self.setPreviousVariableMessageMode()
|
|
|
|
+ })
|
|
|
|
+ confidentialAction.setValue(imageConfidential, forKey: "image")
|
|
|
|
+ alertController.addAction(confidentialAction)
|
|
|
|
+ }
|
|
|
|
+ let imageAck = resizeImage(image: UIImage(named: "ack_icon", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withRenderingMode(.alwaysOriginal)
|
|
|
|
+ let ackAction = UIAlertAction(title: "Confirmation Message".localized(), style: .default, handler: { (UIAlertAction) in
|
|
|
|
+ if !self.isAck {
|
|
|
|
+ self.isAck = true
|
|
|
|
+ self.buttonAckConfidential.setImage(imageAck, for: .normal)
|
|
|
|
+ }
|
|
|
|
+ if !self.isGroup {
|
|
|
|
+ if self.isConfidential {
|
|
|
|
+ self.isConfidential = false
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ self.setPreviousVariableMessageMode()
|
|
|
|
+ })
|
|
|
|
+ ackAction.setValue(imageAck, forKey: "image")
|
|
|
|
+ alertController.addAction(ackAction)
|
|
|
|
+ alertController.addAction(UIAlertAction(title: "Cancel".localized(), style: .cancel, handler: { (UIAlertAction) in
|
|
|
|
+ if !self.isGroup {
|
|
|
|
+ self.isConfidential = false
|
|
|
|
+ }
|
|
|
|
+ self.isAck = false
|
|
|
|
+ self.buttonAckConfidential.setImage(UIImage(systemName: "gearshape.fill", withConfiguration: UIImage.SymbolConfiguration(scale: .large))?.withTintColor(.white).withRenderingMode(.alwaysTemplate), for: .normal)
|
|
|
|
+ self.setPreviousVariableMessageMode()
|
|
|
|
+ }))
|
|
|
|
+ self.present(alertController, animated: true, completion: nil)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ func setPreviousVariableMessageMode() {
|
|
|
|
+ let stack = self.presentingViewController as! UINavigationController
|
|
|
|
+ let vc = stack.viewControllers[stack.viewControllers.count - 1]
|
|
|
|
+ if vc is EditorPersonal {
|
|
|
|
+ let editorVc = vc as! EditorPersonal
|
|
|
|
+ editorVc.setAckConfidential(isAck: self.isAck, isConfidential: self.isConfidential)
|
|
|
|
+ } else {
|
|
|
|
+ let editorVc = vc as! EditorGroup
|
|
|
|
+ editorVc.setAckConfidential(isAck: self.isAck, isConfidential: self.isConfidential)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
func textViewDidChange(_ textView: UITextView) {
|
|
func textViewDidChange(_ textView: UITextView) {
|
|
textView.attributedText = textView.text.richText(isEditing: true)
|
|
textView.attributedText = textView.text.richText(isEditing: true)
|
|
}
|
|
}
|