@hanwha-ss1/plugin 0.5.9 → 0.7.0-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.
|
@@ -8,7 +8,7 @@ public class CapturePlugin: CAPPlugin {
|
|
|
8
8
|
DispatchQueue.main.async {
|
|
9
9
|
if let topController = UIViewController.topViewController(controller: bridge.viewController) {
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
bridge.webView?.makeSecure()
|
|
12
12
|
if let webView = bridge.webView {
|
|
13
13
|
self.constraintZero(topController.view, webView)
|
|
14
14
|
} else {
|
|
@@ -17,50 +17,36 @@ public class DownloadPlugin: CAPPlugin {
|
|
|
17
17
|
if aData2.count > 1 {
|
|
18
18
|
let sData = aData2[1]
|
|
19
19
|
|
|
20
|
-
if let
|
|
20
|
+
if let data = Data(base64Encoded: sData, options: .ignoreUnknownCharacters) {
|
|
21
21
|
let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
|
|
22
22
|
let documentsDirectory = paths[0]
|
|
23
23
|
let filePath = documentsDirectory.appendingPathComponent(fileName)
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
width: 0,
|
|
36
|
-
height: 0
|
|
37
|
-
)
|
|
38
|
-
popover.permittedArrowDirections = []
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// UIActivityViewController 표시
|
|
42
|
-
DispatchQueue.main.async {
|
|
43
|
-
if let topController = UIViewController.topViewController(controller: _bridge.viewController) {
|
|
44
|
-
topController.present(activityViewController, animated: true, completion: {
|
|
45
|
-
call.resolve([
|
|
46
|
-
"result": true
|
|
47
|
-
])
|
|
48
|
-
})
|
|
49
|
-
} else {
|
|
25
|
+
DispatchQueue.global(qos: .userInitiated).async {
|
|
26
|
+
do {
|
|
27
|
+
try data.write(to: filePath)
|
|
28
|
+
DispatchQueue.main.async {
|
|
29
|
+
call.resolve([
|
|
30
|
+
"result": true,
|
|
31
|
+
])
|
|
32
|
+
}
|
|
33
|
+
} catch {
|
|
34
|
+
DispatchQueue.main.async {
|
|
50
35
|
call.resolve([
|
|
51
36
|
"result": false,
|
|
52
37
|
])
|
|
53
38
|
}
|
|
54
39
|
}
|
|
55
|
-
} catch {
|
|
56
|
-
call.reject("Failed to save file: \(error.localizedDescription)")
|
|
57
40
|
}
|
|
58
41
|
} else {
|
|
59
|
-
|
|
42
|
+
DispatchQueue.main.async {
|
|
43
|
+
call.resolve([
|
|
44
|
+
"result": false,
|
|
45
|
+
])
|
|
46
|
+
}
|
|
60
47
|
}
|
|
61
48
|
}
|
|
62
49
|
}
|
|
63
50
|
}
|
|
64
|
-
|
|
65
51
|
}
|
|
66
52
|
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// UIViewController+Extention.swift
|
|
3
|
+
// Plugin
|
|
4
|
+
//
|
|
5
|
+
// Created by 구정현 on 10/30/24.
|
|
6
|
+
// Copyright © 2024 Max Lynch. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
import Foundation
|
|
10
|
+
import UIKit
|
|
11
|
+
|
|
1
12
|
extension UIViewController {
|
|
2
13
|
static func topViewController(controller: UIViewController? = UIApplication.shared.keyWindow?.rootViewController) -> UIViewController? {
|
|
3
14
|
if let navigationController = controller as? UINavigationController {
|
|
@@ -8,7 +19,6 @@ extension UIViewController {
|
|
|
8
19
|
return topViewController(controller: selected)
|
|
9
20
|
}
|
|
10
21
|
}
|
|
11
|
-
|
|
12
22
|
if let presented = controller?.presentedViewController {
|
|
13
23
|
return topViewController(controller: presented)
|
|
14
24
|
}
|
package/ios/Plugin/Plugin.swift
CHANGED
|
@@ -7,6 +7,23 @@ import Contacts
|
|
|
7
7
|
*/
|
|
8
8
|
@objc(Plugin)
|
|
9
9
|
public class Plugin: CAPPlugin {
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
override public func load() {
|
|
13
|
+
// 문서뷰어 요청 이벤트
|
|
14
|
+
NotificationCenter.default.addObserver(self, selector: #selector(handleDocumentViewRequest(_:)), name: .documentViewRequest, object: nil)
|
|
15
|
+
// NotificationCenter.default.addObserver(self, selector: #selector(handleCustomEvent(_:)), name: .myCustomEvent, object: nil)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@objc func documentViewRequest(_ notification: Notification) {
|
|
19
|
+
if let userInfo = notification.userInfo as? [String: Any] {
|
|
20
|
+
notifyListeners("DocumentViewer", data: userInfo)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
deinit {
|
|
25
|
+
NotificationCenter.default.removeObserver(self)
|
|
26
|
+
}
|
|
10
27
|
|
|
11
28
|
/**
|
|
12
29
|
안드로이드에서만 사용
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanwha-ss1/plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-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
|
+
}
|