@hanwha-ss1/plugin 0.1.4 → 0.1.7
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.
- package/ios/Plugin/ContactPlugin.swift +4 -2
- package/ios/Plugin/PreventCapturePlugin.swift +30 -0
- package/package.json +1 -1
- package/ios/Plugin/PreventCapture.swift +0 -35
- /package/ios/Plugin/{Contact.h → Plugin.h} +0 -0
- /package/ios/Plugin/{ContactPlugin.m → Plugin.m} +0 -0
- /package/ios/Plugin/{Contact.swift → Plugin.swift} +0 -0
|
@@ -32,7 +32,7 @@ public class Plugin: CAPPlugin {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
@objc func setScreenCaptureDisabled(_ call: CAPPluginCall) {
|
|
35
|
-
screenCapture.screenCapturePrevent(
|
|
35
|
+
screenCapture.screenCapturePrevent(view: self.bridge?.viewController!.view ?? self.webView!) { success in
|
|
36
36
|
if success {
|
|
37
37
|
call.resolve([
|
|
38
38
|
"result": true,
|
|
@@ -44,7 +44,9 @@ public class Plugin: CAPPlugin {
|
|
|
44
44
|
"message": "실패"
|
|
45
45
|
])
|
|
46
46
|
}
|
|
47
|
-
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import UIKit
|
|
3
|
+
import WebKit
|
|
4
|
+
|
|
5
|
+
@objc public class PreventCapture: NSObject {
|
|
6
|
+
|
|
7
|
+
@objc public func screenCapturePrevent(view: UIView, completion: @escaping (Bool) -> Void) {
|
|
8
|
+
view.makeSecure()
|
|
9
|
+
completion(true)
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
extension UIView {
|
|
14
|
+
@objc public func makeSecure() {
|
|
15
|
+
DispatchQueue.main.async {
|
|
16
|
+
let textField = UITextField()
|
|
17
|
+
textField.isSecureTextEntry = true
|
|
18
|
+
self.addSubview(textField)
|
|
19
|
+
|
|
20
|
+
if UIDevice.current.userInterfaceIdiom == .phone {
|
|
21
|
+
textField.centerYAnchor.constraint(equalTo: self.centerYAnchor).isActive = true
|
|
22
|
+
textField.centerXAnchor.constraint(equalTo: self.centerXAnchor).isActive = true
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
self.layer.superlayer?.insertSublayer(textField.layer, at: 0)
|
|
26
|
+
textField.layer.sublayers?.last?.addSublayer(self.layer)
|
|
27
|
+
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import Foundation
|
|
2
|
-
import UIKit
|
|
3
|
-
import WebKit
|
|
4
|
-
|
|
5
|
-
@objc public class PreventCapture: NSObject {
|
|
6
|
-
|
|
7
|
-
@objc public func screenCapturePrevent(webview: WKWebView, completion: @escaping (Bool) -> Void) {
|
|
8
|
-
webview.makeSecure()
|
|
9
|
-
completion(true)
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
extension UIView {
|
|
14
|
-
func makeSecure() {
|
|
15
|
-
DispatchQueue.main.async {
|
|
16
|
-
let textField = UITextField()
|
|
17
|
-
textField.isSecureTextEntry = true
|
|
18
|
-
self.addSubview(textField)
|
|
19
|
-
|
|
20
|
-
let backView = UIView(frame: self.frame)
|
|
21
|
-
let image = UIImageView(image: UIImage(named: "background", in: Bundle(for: PreventCapture.self), compatibleWith: nil))
|
|
22
|
-
image.frame = backView.bounds
|
|
23
|
-
|
|
24
|
-
backView.backgroundColor = UIColor.lightGray
|
|
25
|
-
backView.addSubview(image)
|
|
26
|
-
|
|
27
|
-
textField.insertSubview(backView, at: 0)
|
|
28
|
-
|
|
29
|
-
textField.layer.removeFromSuperlayer()
|
|
30
|
-
self.layer.superlayer?.insertSublayer(textField.layer, at: 0)
|
|
31
|
-
textField.layer.sublayers?.last?.addSublayer(self.layer)
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|