@hanwha-ss1/plugin 0.6.0 → 0.6.2-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.
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
package com.plugin.linker;
|
|
2
2
|
|
|
3
|
+
import android.os.Handler;
|
|
4
|
+
import android.os.Looper;
|
|
5
|
+
import android.os.Message;
|
|
6
|
+
|
|
3
7
|
import com.getcapacitor.JSObject;
|
|
4
8
|
import com.getcapacitor.Plugin;
|
|
5
9
|
import com.getcapacitor.PluginCall;
|
|
@@ -11,7 +15,6 @@ import com.plugin.download.FileDownload;
|
|
|
11
15
|
import com.plugin.openbrowser.OpenBrowser;
|
|
12
16
|
import com.plugin.opencamera.OpenCamera;
|
|
13
17
|
|
|
14
|
-
|
|
15
18
|
@CapacitorPlugin(name = "Plugin")
|
|
16
19
|
public class LinkerPlugin extends Plugin{
|
|
17
20
|
private Linker implementation = new Linker();
|
|
@@ -157,4 +160,20 @@ public class LinkerPlugin extends Plugin{
|
|
|
157
160
|
}
|
|
158
161
|
});
|
|
159
162
|
}
|
|
163
|
+
|
|
164
|
+
public void handleDocumentsViewer(String filePath) {
|
|
165
|
+
Handler handler = new Handler(Looper.getMainLooper()) {
|
|
166
|
+
@Override
|
|
167
|
+
public void handleMessage(Message msg) {
|
|
168
|
+
if(hasListeners("DocumentViewer")) {
|
|
169
|
+
JSObject data = new JSObject();
|
|
170
|
+
data.put("file", filePath);
|
|
171
|
+
notifyListeners("DocumentViewer", data);
|
|
172
|
+
} else {
|
|
173
|
+
sendEmptyMessageDelayed(-1, 200);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
handler.sendEmptyMessage(-1);
|
|
178
|
+
}
|
|
160
179
|
}
|
package/ios/Plugin/Plugin.swift
CHANGED
|
@@ -5,8 +5,42 @@ import Contacts
|
|
|
5
5
|
* Please read the Capacitor iOS Plugin Development Guide
|
|
6
6
|
* here: https://capacitorjs.com/docs/plugins/ios
|
|
7
7
|
*/
|
|
8
|
+
extension Notification.Name {
|
|
9
|
+
static let documentViewRequest = Notification.Name("documentViewRequest")
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
@objc(Plugin)
|
|
9
13
|
public class Plugin: CAPPlugin {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
override public func load() {
|
|
17
|
+
// 문서뷰어 요청 이벤트
|
|
18
|
+
NotificationCenter.default.addObserver(self, selector: #selector(handleDocumentViewRequest(_:)), name: .documentViewRequest, object: nil)
|
|
19
|
+
|
|
20
|
+
// keyboard event
|
|
21
|
+
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboard(_:)), name: UIResponder.keyboardDidShowNotification, object: nil)
|
|
22
|
+
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboard(_:)), name: UIResponder.keyboardWillShowNotification, object: nil)
|
|
23
|
+
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboard(_:)), name: UIResponder.keyboardWillHideNotification, object: nil)
|
|
24
|
+
NotificationCenter.default.addObserver(self, selector: #selector(handleKeyboard(_:)), name: UIResponder.keyboardDidHideNotification, object: nil)
|
|
25
|
+
}
|
|
26
|
+
@objc func handleKeyboard(_ notification: Notification) {
|
|
27
|
+
|
|
28
|
+
//calc keyboard height
|
|
29
|
+
let userInfo = notification.userInfo!
|
|
30
|
+
let keyboardSize = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue.size
|
|
31
|
+
// data 매개변수에 keyboardsize를 전달
|
|
32
|
+
self.notifyListeners(notification.name.rawValue, data: ["size": keyboardSize.height])
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@objc func handleDocumentViewRequest(_ notification: Notification) {
|
|
36
|
+
if let userInfo = notification.userInfo as? [String: Any] {
|
|
37
|
+
notifyListeners("DocumentViewer", data: userInfo)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
deinit {
|
|
42
|
+
NotificationCenter.default.removeObserver(self)
|
|
43
|
+
}
|
|
10
44
|
|
|
11
45
|
/**
|
|
12
46
|
안드로이드에서만 사용
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanwha-ss1/plugin",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2-beta.1",
|
|
4
4
|
"description": "Plugin",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -76,4 +76,4 @@
|
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
"gitHead": "dbc41811fcd3e5956cc77c6df41d831c9370c1b3"
|
|
79
|
-
}
|
|
79
|
+
}
|