@hanwha-ss1/plugin 0.6.3-beta.7 → 0.6.3-beta.8

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.
@@ -109,8 +109,9 @@ class KeyboardMenu: UIStackView {
109
109
  }
110
110
 
111
111
  @IBAction func menuTapped(_ sender: UIButton) {
112
- print("menuTapped", sender.accessibilityHint!);
112
+ // print("menuTapped", sender.accessibilityHint!);
113
113
  self.delegate?.menuTapped(sender)
114
+
114
115
  }
115
116
 
116
117
  deinit {
@@ -9,14 +9,40 @@ import Contacts
9
9
  * here: https://capacitorjs.com/docs/plugins/ios
10
10
  */
11
11
 
12
- public class KeyboardMenuPlugin: CAPPlugin {
12
+ public class KeyboardMenuPlugin: CAPPlugin, KeyboardMenuDelegate {
13
+ func menuTapped(_ sender: UIButton) {
14
+ let name = sender.accessibilityHint!;
15
+
16
+ if let _listener = self.listener {
17
+ _listener.notifyListeners("keyboardMenuTapped", data: ["name":name]);
18
+ }
19
+
20
+ }
21
+ private static var keyboardMenu: KeyboardMenu?
22
+ private var listener: CAPPlugin?
23
+ // implement remove keyboardmenu view
24
+ @objc func remove(_ call: CAPPluginCall) {
25
+  
26
+ DispatchQueue.main.async {
27
+ if let menu = KeyboardMenuPlugin.keyboardMenu {
28
+ menu.removeFromSuperview()
29
+ KeyboardMenuPlugin.keyboardMenu = nil
30
+ }
31
+ }
32
+
33
+
34
+ }
13
35
 
14
- @objc func add(_ call: CAPPluginCall, _bridge: CAPBridgeProtocol) {
36
+ @objc func add(_ call: CAPPluginCall, _bridge: CAPBridgeProtocol, listener: CAPPlugin) {
37
+ self.listener = listener;
38
+
15
39
 
16
40
  DispatchQueue.main.async {
17
- let keyboardMenu = KeyboardMenu(frame: CGRectZero)
41
+ KeyboardMenuPlugin.keyboardMenu = KeyboardMenu(frame: CGRectZero)
42
+ KeyboardMenuPlugin.keyboardMenu?.delegate = self;
43
+
18
44
  // add keyboard menu main view
19
- _bridge.viewController!.view.addSubview(keyboardMenu)
45
+ _bridge.viewController!.view.addSubview(KeyboardMenuPlugin.keyboardMenu!)
20
46
  }
21
47
 
22
48
 
@@ -14,4 +14,5 @@ CAP_PLUGIN(Plugin, "Plugin",
14
14
  CAP_PLUGIN_METHOD(fileDownload, CAPPluginReturnPromise);
15
15
  CAP_PLUGIN_METHOD(doDisabledCapture, CAPPluginReturnPromise);
16
16
  CAP_PLUGIN_METHOD(addKeyboardMenu, CAPPluginReturnPromise);
17
+ CAP_PLUGIN_METHOD(removeKeyboardMenu, CAPPluginReturnPromise);
17
18
  )
@@ -57,8 +57,13 @@ public class Plugin: CAPPlugin {
57
57
  }
58
58
  @objc func addKeyboardMenu(_ call: CAPPluginCall) {
59
59
 
60
- KeyboardMenuPlugin().add(call, _bridge: self.bridge!)
60
+ KeyboardMenuPlugin().add(call, _bridge: self.bridge!, listener: self)
61
61
  }
62
+ @objc func removeKeyboardMenu(_ call: CAPPluginCall) {
63
+
64
+ KeyboardMenuPlugin().remove(call)
65
+ }
66
+
62
67
 
63
68
 
64
69
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanwha-ss1/plugin",
3
- "version": "0.6.3-beta.7",
3
+ "version": "0.6.3-beta.8",
4
4
  "description": "Plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",