@hanwha-ss1/plugin 0.5.1 → 0.5.3
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.
|
@@ -120,12 +120,9 @@ public class WebViewActivity extends AppCompatActivity {
|
|
|
120
120
|
startActivity(intent);
|
|
121
121
|
return true;
|
|
122
122
|
} else if(url.startsWith("viewer://")) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
intent.putExtra("url", param.get("downloadUrl"));
|
|
127
|
-
sendBroadcast(intent);
|
|
128
|
-
}
|
|
123
|
+
Intent intent = new Intent("com.hanwha.cleverselite.OPEN_URL");
|
|
124
|
+
intent.putExtra("url",url);
|
|
125
|
+
sendBroadcast(intent);
|
|
129
126
|
return true;
|
|
130
127
|
} else {
|
|
131
128
|
return super.shouldOverrideUrlLoading(view, url);
|
|
@@ -146,6 +143,7 @@ public class WebViewActivity extends AppCompatActivity {
|
|
|
146
143
|
* extension=pdf
|
|
147
144
|
* @return file 주소
|
|
148
145
|
*/
|
|
146
|
+
@Deprecated
|
|
149
147
|
private Map<String, String> parseViewerParam(String uriString) {
|
|
150
148
|
try {
|
|
151
149
|
URI uri = new URI(uriString);
|
|
@@ -176,12 +174,8 @@ public class WebViewActivity extends AppCompatActivity {
|
|
|
176
174
|
webView.loadUrl(url);
|
|
177
175
|
|
|
178
176
|
if(url.startsWith("viewer://")) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
Intent intent = new Intent("com.hanwha.cleverselite.OPEN_URL");
|
|
182
|
-
intent.putExtra("url", param.get("downloadUrl"));
|
|
183
|
-
sendBroadcast(intent);
|
|
184
|
-
}
|
|
177
|
+
Intent intent = new Intent("com.hanwha.cleverselite.OPEN_URL");
|
|
178
|
+
intent.putExtra("url", url);
|
|
185
179
|
}
|
|
186
180
|
}
|
|
187
181
|
|
|
@@ -17,8 +17,9 @@ public class OpenBrowserPlugin: CAPPlugin {
|
|
|
17
17
|
DispatchQueue.main.async {
|
|
18
18
|
let controller = self.implementation.builder(url: url, isCloseBtn: isCloseBtn, clear: clear)
|
|
19
19
|
controller.modalPresentationStyle = .fullScreen
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
// 브라우저 중첩되게 호출하는 경우가 있어서 아래와 같이 처리
|
|
21
|
+
let topController = UIViewController.topViewController(controller: _bridge.viewController)
|
|
22
|
+
topController?.present(controller, animated: true)
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
|
|
12
|
+
extension UIViewController {
|
|
13
|
+
static func topViewController(controller: UIViewController? = UIApplication.shared.keyWindow?.rootViewController) -> UIViewController? {
|
|
14
|
+
if let navigationController = controller as? UINavigationController {
|
|
15
|
+
return topViewController(controller: navigationController.visibleViewController)
|
|
16
|
+
}
|
|
17
|
+
if let tabController = controller as? UITabBarController {
|
|
18
|
+
if let selected = tabController.selectedViewController {
|
|
19
|
+
return topViewController(controller: selected)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if let presented = controller?.presentedViewController {
|
|
23
|
+
return topViewController(controller: presented)
|
|
24
|
+
}
|
|
25
|
+
return controller
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -17,14 +17,14 @@ class ViewController: UIViewController {
|
|
|
17
17
|
@IBOutlet var constraintPanelHeight: NSLayoutConstraint!
|
|
18
18
|
@IBOutlet var btnClose: UIButton!
|
|
19
19
|
@IBOutlet var indicator: UIActivityIndicatorView!
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
|
|
21
|
+
|
|
22
22
|
var url: String = ""
|
|
23
23
|
var isCloseBtn: Bool = false
|
|
24
24
|
var clear: Bool = false
|
|
25
25
|
var naviTitle: String = ""
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
override func viewDidLoad() {
|
|
29
29
|
super.viewDidLoad()
|
|
30
30
|
if isCloseBtn {
|
|
@@ -44,16 +44,26 @@ class ViewController: UIViewController {
|
|
|
44
44
|
wkWebview.load(URLRequest.init(url: URL(string: url)!))
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
/*
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
// MARK: - Navigation
|
|
50
|
+
|
|
51
|
+
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
52
|
+
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
|
53
|
+
// Get the new view controller using segue.destination.
|
|
54
|
+
// Pass the selected object to the new view controller.
|
|
55
|
+
}
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
@IBAction func callFileViewer(urlString: String) {
|
|
59
|
+
|
|
60
|
+
let userInfo:[AnyHashable:Any] = ["payload":urlString]
|
|
61
|
+
|
|
62
|
+
NotificationCenter.default.post(name: Notification.Name("CallFileViewer"), object: nil, userInfo: userInfo)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
55
66
|
}
|
|
56
|
-
*/
|
|
57
67
|
|
|
58
68
|
@IBAction func doClose() {
|
|
59
69
|
self.dismiss(animated: true)
|
|
@@ -77,7 +87,7 @@ extension ViewController: WKNavigationDelegate, WKUIDelegate {
|
|
|
77
87
|
}
|
|
78
88
|
|
|
79
89
|
func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Swift.Void) {
|
|
80
|
-
|
|
90
|
+
|
|
81
91
|
let alertController = UIAlertController(title: message, message: nil, preferredStyle: .alert);
|
|
82
92
|
|
|
83
93
|
let cancelAction = UIAlertAction(title: "확인", style: .cancel) {
|
|
@@ -107,13 +117,16 @@ extension ViewController: WKNavigationDelegate, WKUIDelegate {
|
|
|
107
117
|
|
|
108
118
|
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
|
|
109
119
|
|
|
110
|
-
let url = navigationAction.request.url?.absoluteString
|
|
120
|
+
let url = navigationAction.request.url?.absoluteString ?? ""
|
|
111
121
|
|
|
112
122
|
if "close://" == url {
|
|
113
123
|
doClose()
|
|
124
|
+
}else if url.contains("viewer://") {
|
|
125
|
+
callFileViewer(urlString: url)
|
|
114
126
|
}
|
|
115
|
-
|
|
116
127
|
|
|
128
|
+
|
|
129
|
+
|
|
117
130
|
decisionHandler(.allow)
|
|
118
131
|
}
|
|
119
132
|
}
|