From d294bc32eabf288b7444bb31202aaf41cf590ab3 Mon Sep 17 00:00:00 2001 From: Brahim Date: Thu, 7 Mar 2019 16:50:47 -0300 Subject: [PATCH] =?UTF-8?q?Se=20modifica=20l=C3=B3gica=20que=20verifica=20?= =?UTF-8?q?la=20existencia=20de=20plugin=20wkwebview-polyfill?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cl/kunder/webview/WebViewActivity.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/android/cl/kunder/webview/WebViewActivity.java b/src/android/cl/kunder/webview/WebViewActivity.java index a355a26..18bad13 100644 --- a/src/android/cl/kunder/webview/WebViewActivity.java +++ b/src/android/cl/kunder/webview/WebViewActivity.java @@ -35,7 +35,7 @@ public void onCreate(Bundle savedInstanceState) { showLoading(); } - loadUrl((url.matches("^(.*://|javascript:)[\\s\\S]*$") ? "" : "file:///android_asset/www/" + (isPluginCryptFileActive() ? "+++/" : "")) + url); + loadUrl((url.matches("^(.*://|javascript:)[\\s\\S]*$") ? "" : "file:///android_asset/www/" + (isPluginWkwebviewPolyfillActive() ? "+++/" : "")) + url); } public static boolean showLoading() { @@ -95,12 +95,23 @@ public void run() { } /** - * Revisa si existe el plugin cordova-plugin-crypt-file + * Revisa si existe el plugin cordova-plugin-wkwebview-polyfill * @return boolean */ - private boolean isPluginCryptFileActive() { + private boolean isPluginWkwebviewPolyfillActive() { + return classExists("com.tkyj.cdv.DR") || classExists("com.tkyaji.cordova.DecryptResource"); + } + + + /** + * Revisa si existe la clase con nombre className dentro del + * contexto donde esté integrado este plugin + * @param className Nombre de clase + * @return boolean + */ + private boolean classExists(String className) { try { - Class.forName("com.tkyaji.cordova.DecryptResource"); + Class.forName(className); return true; } catch(Exception e) { return false;