@hanwha-ss1/plugin 0.6.2 → 0.6.3-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,118 @@
1
+
2
+
3
+ import UIKit
4
+ import Foundation
5
+
6
+
7
+ protocol KeyboardMenuDelegate: AnyObject {
8
+ func menuTapped(_ sender: UIButton)
9
+ }
10
+
11
+ class KeyboardMenu: UIStackView {
12
+ // MARK: - Properties
13
+ var delegate: KeyboardMenuDelegate?
14
+ private var bottomConstraint: NSLayoutConstraint?
15
+
16
+ // MARK: - Initializer
17
+ override init(frame: CGRect) {
18
+ super.init(frame: frame)
19
+ self.setup()
20
+ self.setupKeyboardObservers()
21
+ }
22
+
23
+ required init(coder: NSCoder) {
24
+ super.init(coder: coder)
25
+ self.setup()
26
+ self.setupKeyboardObservers()
27
+ }
28
+
29
+ override func didMoveToSuperview() {
30
+ super.didMoveToSuperview()
31
+ if let superview = self.superview {
32
+ self.bottomConstraint = self.bottomAnchor.constraint(equalTo: superview.bottomAnchor)
33
+ self.bottomConstraint?.isActive = true
34
+ self.widthAnchor.constraint(equalTo: self.superview!.widthAnchor).isActive = true
35
+ self.createAddButton();
36
+
37
+ }
38
+ }
39
+ //create add button
40
+ func createAddButton() {
41
+ let imgArray = ["todo.svg","img","file","collabo-link","url-link"];
42
+
43
+
44
+ for i in 0..<imgArray.count{
45
+ let addButton = UIButton()
46
+ // svg 이미지에서 file 이미지 가져와서 사용
47
+
48
+ let podBundle = Bundle(for: KeyboardMenu.self)
49
+
50
+ let imageSource = UIImage(named: imgArray[i], in: podBundle, compatibleWith: nil);
51
+
52
+
53
+
54
+ addButton.setImage(imageSource, for: .normal);
55
+ addButton.accessibilityHint = imgArray[i];
56
+ addButton.backgroundColor = .white
57
+ addButton.addTarget(self, action: #selector(menuTapped(_:)), for: .touchUpInside)
58
+ self.addArrangedSubview(addButton)
59
+ }
60
+ }
61
+
62
+ // MARK: - Setup
63
+ private func setup() {
64
+ self.axis = .horizontal
65
+ self.distribution = .fillEqually
66
+ self.spacing = 0
67
+ self.translatesAutoresizingMaskIntoConstraints = false
68
+ self.heightAnchor.constraint(equalToConstant: 66).isActive = true
69
+
70
+ // keyboardMenu.bottomAnchor.constraint(equalTo: self.view.bottomAnchor).isActive = true
71
+ // keyboardMenu.heightAnchor.constraint(equalToConstant: 50).isActive = true
72
+ //
73
+
74
+
75
+ self.isHidden = true;
76
+ // width constraint 100%
77
+ }
78
+
79
+ private func setupKeyboardObservers() {
80
+ NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
81
+ NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
82
+ }
83
+
84
+ @objc private func keyboardWillShow(_ notification: Notification) {
85
+ self.isHidden = false;
86
+ if let userInfo = notification.userInfo,
87
+ let keyboardFrame = userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect,
88
+ let superview = self.superview {
89
+ let keyboardHeight = keyboardFrame.height
90
+ self.bottomConstraint?.constant = -keyboardHeight
91
+ UIView.animate(withDuration: 0.3) {
92
+ superview.layoutIfNeeded()
93
+ }
94
+ }
95
+ }
96
+
97
+ @objc private func keyboardWillHide(_ notification: Notification) {
98
+ self.isHidden = true;
99
+ // self.removeFromSuperview();
100
+
101
+ //remove from superview
102
+ self.bottomConstraint?.constant = 0
103
+ UIView.animate(withDuration: 0.3) {
104
+ self.superview?.layoutIfNeeded()
105
+
106
+ }
107
+ }
108
+
109
+ @IBAction func menuTapped(_ sender: UIButton) {
110
+ print("menuTapped", sender.accessibilityHint!);
111
+ self.delegate?.menuTapped(sender)
112
+ }
113
+
114
+ deinit {
115
+ NotificationCenter.default.removeObserver(self)
116
+ }
117
+ }
118
+
@@ -0,0 +1,24 @@
1
+
2
+
3
+
4
+ import Foundation
5
+ import Capacitor
6
+ import Contacts
7
+ /**
8
+ * Please read the Capacitor iOS Plugin Development Guide
9
+ * here: https://capacitorjs.com/docs/plugins/ios
10
+ */
11
+
12
+ public class KeyboardMenuPlugin: CAPPlugin {
13
+
14
+ @objc func add(_ call: CAPPluginCall, _bridge: CAPBridgeProtocol) {
15
+
16
+ DispatchQueue.main.async {
17
+ let keyboardMenu = KeyboardMenu(frame: CGRectZero)
18
+ // add keyboard menu main view
19
+ _bridge.viewController!.view.addSubview(keyboardMenu)
20
+ }
21
+
22
+
23
+ }
24
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "info" : {
3
+ "author" : "xcode",
4
+ "version" : 1
5
+ }
6
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "images" : [
3
+ {
4
+ "idiom" : "universal",
5
+ "scale" : "1x"
6
+ },
7
+ {
8
+ "idiom" : "universal",
9
+ "scale" : "2x"
10
+ },
11
+ {
12
+ "filename" : "icon-collabo-link.svg",
13
+ "idiom" : "universal",
14
+ "scale" : "3x"
15
+ }
16
+ ],
17
+ "info" : {
18
+ "author" : "xcode",
19
+ "version" : 1
20
+ }
21
+ }
@@ -0,0 +1,12 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#vadub7xtna)" stroke="#AAA" stroke-width="1.6" stroke-linejoin="round">
3
+ <path d="M3.61 6.286A9.988 9.988 0 0 1 11.819 2c3.398 0 6.4 1.695 8.208 4.286l.364-2.857M20.39 17.714A9.989 9.989 0 0 1 12.182 22a9.988 9.988 0 0 1-8.207-4.286l-.364 2.857" stroke-linecap="round"/>
4
+ <path d="m6.105 9.856 5.714-4.286 5.714 4.286-5.714 4.286-5.714-4.286z"/>
5
+ <path d="m4.675 12.715 7.143 5.714 7.143-5.714" stroke-linecap="round"/>
6
+ </g>
7
+ <defs>
8
+ <clipPath id="vadub7xtna">
9
+ <path fill="#fff" d="M0 0h24v24H0z"/>
10
+ </clipPath>
11
+ </defs>
12
+ </svg>
@@ -0,0 +1,21 @@
1
+ {
2
+ "images" : [
3
+ {
4
+ "idiom" : "universal",
5
+ "scale" : "1x"
6
+ },
7
+ {
8
+ "idiom" : "universal",
9
+ "scale" : "2x"
10
+ },
11
+ {
12
+ "filename" : "icon-file.svg",
13
+ "idiom" : "universal",
14
+ "scale" : "3x"
15
+ }
16
+ ],
17
+ "info" : {
18
+ "author" : "xcode",
19
+ "version" : 1
20
+ }
21
+ }
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M19.118 10.65V7.32c0-1.512 0-2.268-.289-2.846a2.674 2.674 0 0 0-1.157-1.18C17.106 3 16.365 3 14.882 3H9.235c-1.482 0-2.223 0-2.79.294a2.674 2.674 0 0 0-1.156 1.18C5 5.052 5 5.808 5 7.32v9.36c0 1.512 0 2.268.289 2.846.253.508.658.92 1.156 1.18.567.294 1.308.294 2.79.294h2.824m5.294-.9v-5.4m-2.647 2.7H20" stroke="#AAA" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -0,0 +1,21 @@
1
+ {
2
+ "images" : [
3
+ {
4
+ "idiom" : "universal",
5
+ "scale" : "1x"
6
+ },
7
+ {
8
+ "idiom" : "universal",
9
+ "scale" : "2x"
10
+ },
11
+ {
12
+ "filename" : "icon-img.svg",
13
+ "idiom" : "universal",
14
+ "scale" : "3x"
15
+ }
16
+ ],
17
+ "info" : {
18
+ "author" : "xcode",
19
+ "version" : 1
20
+ }
21
+ }
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M12 3.5H7.3c-1.68 0-2.52 0-3.162.327a3 3 0 0 0-1.311 1.311C2.5 5.78 2.5 6.62 2.5 8.3v8.4c0 1.68 0 2.52.327 3.162a3 3 0 0 0 1.311 1.311c.642.327 1.482.327 3.162.327h9.2c.93 0 1.395 0 1.776-.102a3 3 0 0 0 2.122-2.122c.102-.381.102-.846.102-1.776m-2-9v-6m-3 3h6M10 9a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm4.49 3.418-8.459 7.69c-.476.433-.714.649-.735.836a.5.5 0 0 0 .167.431c.142.125.463.125 1.106.125h9.387c1.44 0 2.159 0 2.724-.242a3 3 0 0 0 1.578-1.578c.242-.565.242-1.285.242-2.724 0-.484 0-.726-.053-.952a2.001 2.001 0 0 0-.374-.778c-.143-.182-.332-.333-.71-.636l-2.797-2.237c-.379-.303-.568-.454-.776-.508a1 1 0 0 0-.557.018c-.205.066-.384.23-.743.555z" stroke="#AAA" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -0,0 +1,21 @@
1
+ {
2
+ "images" : [
3
+ {
4
+ "idiom" : "universal",
5
+ "scale" : "1x"
6
+ },
7
+ {
8
+ "idiom" : "universal",
9
+ "scale" : "2x"
10
+ },
11
+ {
12
+ "filename" : "icon-todo.svg",
13
+ "idiom" : "universal",
14
+ "scale" : "3x"
15
+ }
16
+ ],
17
+ "info" : {
18
+ "author" : "xcode",
19
+ "version" : 1
20
+ }
21
+ }
@@ -0,0 +1,4 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M22.5 4 10.715 14.5l-2.358-2.327-1.178-1.164" stroke="#AAA" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
3
+ <path d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2c1.422 0 2.775.297 4 .832" stroke="#AAA" stroke-width="1.6" stroke-linecap="round"/>
4
+ </svg>
@@ -0,0 +1,21 @@
1
+ {
2
+ "images" : [
3
+ {
4
+ "idiom" : "universal",
5
+ "scale" : "1x"
6
+ },
7
+ {
8
+ "idiom" : "universal",
9
+ "scale" : "2x"
10
+ },
11
+ {
12
+ "filename" : "icon-url-link.svg",
13
+ "idiom" : "universal",
14
+ "scale" : "3x"
15
+ }
16
+ ],
17
+ "info" : {
18
+ "author" : "xcode",
19
+ "version" : 1
20
+ }
21
+ }
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="m12.688 18.197-1.377 1.377a4.869 4.869 0 0 1-6.885-6.886l1.377-1.377m12.394 1.377 1.377-1.377a4.869 4.869 0 0 0-6.886-6.885l-1.377 1.377m-2.72 9.605 6.817-6.816" stroke="#AAA" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -13,4 +13,5 @@ CAP_PLUGIN(Plugin, "Plugin",
13
13
  CAP_PLUGIN_METHOD(edgeSwipe, CAPPluginReturnPromise);
14
14
  CAP_PLUGIN_METHOD(fileDownload, CAPPluginReturnPromise);
15
15
  CAP_PLUGIN_METHOD(doDisabledCapture, CAPPluginReturnPromise);
16
+ CAP_PLUGIN_METHOD(addKeyboardMenu, CAPPluginReturnPromise);
16
17
  )
@@ -55,6 +55,12 @@ public class Plugin: CAPPlugin {
55
55
  @objc func auth(_ call: CAPPluginCall) {
56
56
  AuthPlugin().auth(call)
57
57
  }
58
+ @objc func addKeyboardMenu(_ call: CAPPluginCall) {
59
+
60
+ KeyboardMenuPlugin().add(call, _bridge: self.bridge!)
61
+ }
62
+
63
+
58
64
 
59
65
  @objc func addContact(_ call: CAPPluginCall) {
60
66
  ContactPlugin().addContact(call)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanwha-ss1/plugin",
3
- "version": "0.6.2",
3
+ "version": "0.6.3-beta.2",
4
4
  "description": "Plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",