cordova-plugin-mserviceinterface-2.0 1.0.101 → 1.0.102

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cordova-plugin-mserviceinterface-2.0",
3
- "version": "1.0.101",
3
+ "version": "1.0.102",
4
4
  "description": "This plugin establishes the connection to the native interface and performs the requested task.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/plugin.xml CHANGED
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
3
- xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-mserviceinterface-2.0" version="1.0.101">
3
+ xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-mserviceinterface-2.0" version="1.0.102">
4
4
  <name>mserviceinterface-2.0</name>
5
5
  <description>This plugin establishes the connection to the native interface and performs the requested task.</description>
6
6
  <author>selfservit@gmail.com</author>
@@ -8,6 +8,7 @@
8
8
 
9
9
  import UIKit
10
10
  import Cordova
11
+ import WebKit
11
12
 
12
13
  class SceneDelegate: CDVSceneDelegate {
13
14
 
@@ -199,52 +200,56 @@ class SceneDelegate: CDVSceneDelegate {
199
200
  * allowing native code to confirm whether the app-side
200
201
  * handler was actually available.
201
202
  */
202
- viewController.webViewEngine.evaluateJavaScript(
203
- javaScript
204
- ) { [weak self] result, error in
203
+ guard let webView =
204
+ viewController.webViewEngine.engineWebView as? WKWebView
205
+ else {
206
+ print(
207
+ "[MService Deep Link] " +
208
+ "WKWebView is not ready"
209
+ )
205
210
 
206
- DispatchQueue.main.async {
207
- guard let self = self else {
208
- return
209
- }
211
+ self.retrySendingDeepLink()
212
+ return
213
+ }
210
214
 
211
- if let error = error {
212
- print(
213
- "[MService Deep Link] " +
214
- "JavaScript execution failed: " +
215
- error.localizedDescription
216
- )
215
+ webView.evaluateJavaScript(
216
+ javaScript
217
+ ) { [weak self] result, error in
217
218
 
218
- self.retrySendingDeepLink()
219
- return
220
- }
219
+ DispatchQueue.main.async {
220
+ guard let self = self else {
221
+ return
222
+ }
221
223
 
222
- let status =
223
- result as? String ?? ""
224
+ if let error = error {
225
+ print(
226
+ "[MService Deep Link] " +
227
+ "JavaScript execution failed: " +
228
+ error.localizedDescription
229
+ )
224
230
 
225
- print(
226
- "[MService Deep Link] " +
227
- "JavaScript status: \(status)"
228
- )
229
-
230
- if status == "PROCESSED" {
231
- /*
232
- * Clear native state only after JavaScript
233
- * confirms that handleOpenURL was invoked.
234
- */
235
- self.pendingDeepLinkURL = nil
236
- self.deepLinkRetryCount = 0
237
- } else {
238
- /*
239
- * The WebView exists, but the Cordova page or
240
- * application libraries are still loading.
241
- */
242
- self.retrySendingDeepLink()
243
- }
244
- }
231
+ self.retrySendingDeepLink()
232
+ return
233
+ }
234
+
235
+ let status =
236
+ result as? String ?? ""
237
+
238
+ print(
239
+ "[MService Deep Link] " +
240
+ "JavaScript status: \(status)"
241
+ )
242
+
243
+ if status == "PROCESSED" {
244
+ self.pendingDeepLinkURL = nil
245
+ self.deepLinkRetryCount = 0
246
+ } else {
247
+ self.retrySendingDeepLink()
245
248
  }
246
249
  }
247
250
  }
251
+ }
252
+ }
248
253
 
249
254
  private func retrySendingDeepLink() {
250
255
  if self.deepLinkRetryCount <