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

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,107 @@
1
+
2
+
3
+ import UIKit
4
+ import Foundation
5
+
6
+ protocol KeyboardMenuDelegate: AnyObject {
7
+ func menuTapped(_ sender: UIButton)
8
+ }
9
+
10
+ class KeyboardMenu: UIStackView {
11
+ // MARK: - Properties
12
+ var delegate: KeyboardMenuDelegate?
13
+ private var bottomConstraint: NSLayoutConstraint?
14
+
15
+ // MARK: - Initializer
16
+ override init(frame: CGRect) {
17
+ super.init(frame: frame)
18
+ self.setup()
19
+ self.setupKeyboardObservers()
20
+ }
21
+
22
+ required init(coder: NSCoder) {
23
+ super.init(coder: coder)
24
+ self.setup()
25
+ self.setupKeyboardObservers()
26
+ }
27
+
28
+ override func didMoveToSuperview() {
29
+ super.didMoveToSuperview()
30
+ if let superview = self.superview {
31
+ self.bottomConstraint = self.bottomAnchor.constraint(equalTo: superview.bottomAnchor)
32
+ self.bottomConstraint?.isActive = true
33
+ self.widthAnchor.constraint(equalTo: self.superview!.widthAnchor).isActive = true
34
+ self.createAddButton();
35
+
36
+ }
37
+ }
38
+ //create add button
39
+ func createAddButton() {
40
+ let imgArray = ["todo","img","file","collabo-link","url-link"];
41
+
42
+
43
+ for i in 0..<imgArray.count{
44
+ let addButton = UIButton()
45
+ // aseets 이미지에서 file 이미지 가져와서 사용
46
+ addButton.setImage(UIImage(named: imgArray[i]), for: .normal);
47
+ addButton.accessibilityHint = imgArray[i];
48
+ addButton.backgroundColor = .white
49
+ addButton.addTarget(self, action: #selector(menuTapped(_:)), for: .touchUpInside)
50
+ self.addArrangedSubview(addButton)
51
+ }
52
+ }
53
+
54
+ // MARK: - Setup
55
+ private func setup() {
56
+ self.axis = .horizontal
57
+ self.distribution = .fillEqually
58
+ self.spacing = 0
59
+ self.translatesAutoresizingMaskIntoConstraints = false
60
+ self.heightAnchor.constraint(equalToConstant: 66).isActive = true
61
+
62
+ // keyboardMenu.bottomAnchor.constraint(equalTo: self.view.bottomAnchor).isActive = true
63
+ // keyboardMenu.heightAnchor.constraint(equalToConstant: 50).isActive = true
64
+ //
65
+
66
+
67
+ self.isHidden = true;
68
+ // width constraint 100%
69
+ }
70
+
71
+ private func setupKeyboardObservers() {
72
+ NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
73
+ NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
74
+ }
75
+
76
+ @objc private func keyboardWillShow(_ notification: Notification) {
77
+ self.isHidden = false;
78
+ if let userInfo = notification.userInfo,
79
+ let keyboardFrame = userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? CGRect,
80
+ let superview = self.superview {
81
+ let keyboardHeight = keyboardFrame.height
82
+ self.bottomConstraint?.constant = -keyboardHeight
83
+ UIView.animate(withDuration: 0.3) {
84
+ superview.layoutIfNeeded()
85
+ }
86
+ }
87
+ }
88
+
89
+ @objc private func keyboardWillHide(_ notification: Notification) {
90
+ self.isHidden = true;
91
+
92
+ self.bottomConstraint?.constant = 0
93
+ UIView.animate(withDuration: 0.3) {
94
+ self.superview?.layoutIfNeeded()
95
+ }
96
+ }
97
+
98
+ @IBAction func menuTapped(_ sender: UIButton) {
99
+ print("menuTapped", sender.accessibilityHint!);
100
+ self.delegate?.menuTapped(sender)
101
+ }
102
+
103
+ deinit {
104
+ NotificationCenter.default.removeObserver(self)
105
+ }
106
+ }
107
+
@@ -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>
@@ -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, 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.1",
4
4
  "description": "Plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",