فهرست منبع

copy group invites to clipboard

B. Petersen 2 سال پیش
والد
کامیت
68d49e682d
1فایلهای تغییر یافته به همراه19 افزوده شده و 0 حذف شده
  1. 19 0
      deltachat-ios/Controller/QrViewController.swift

+ 19 - 0
deltachat-ios/Controller/QrViewController.swift

@@ -43,6 +43,14 @@ class QrViewController: UIViewController {
         title = String.localized("qrshow_title")
         title = String.localized("qrshow_title")
         setupSubviews()
         setupSubviews()
         view.backgroundColor = DcColors.defaultBackgroundColor
         view.backgroundColor = DcColors.defaultBackgroundColor
+
+        let image: UIImage?
+        if #available(iOS 13.0, *) {
+            image = UIImage(systemName: "ellipsis.circle")
+        } else {
+            image = UIImage(named: "ic_more")
+        }
+        self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: image, style: .plain, target: self, action: #selector(showMoreOptions))
     }
     }
 
 
     override func viewDidDisappear(_ animated: Bool) {
     override func viewDidDisappear(_ animated: Bool) {
@@ -71,4 +79,15 @@ class QrViewController: UIViewController {
         return nil
         return nil
     }
     }
 
 
+    // MARK: - actions
+    @objc private func showMoreOptions() {
+        let alert = UIAlertController(title: String.localized("qrshow_title"), message: nil, preferredStyle: .safeActionSheet)
+        alert.addAction(UIAlertAction(title: String.localized("menu_copy_to_clipboard"), style: .default, handler: copyToClipboard(_:)))
+        alert.addAction(UIAlertAction(title: String.localized("cancel"), style: .cancel, handler: nil))
+        self.present(alert, animated: true, completion: nil)
+    }
+
+    @objc func copyToClipboard(_ action: UIAlertAction) {
+        UIPasteboard.general.string = dcContext.getSecurejoinQr(chatId: chatId)
+    }
 }
 }