Skip to content

Commit

Permalink
Se modifica lógica que verifica la existencia de plugin wkwebview-pol…
Browse files Browse the repository at this point in the history
…yfill
  • Loading branch information
busenm committed Mar 7, 2019
1 parent b72dd78 commit d294bc3
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/android/cl/kunder/webview/WebViewActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d294bc3

Please sign in to comment.