Skip to content

Commit

Permalink
Moved some code to fix a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
CookieJarApps committed Oct 11, 2020
1 parent c4c64e2 commit 50a09c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,6 @@ class SmartCookieWebClient(
}

override fun onPageFinished(view: WebView, url: String) {
if(userPreferences.cookieBlockEnabled){
view.evaluateJavascript(cookieBlock.provideJs(), null)
}
if(url.contains(BuildConfig.APPLICATION_ID + "/files/homepage.html")) {
view.evaluateJavascript("javascript:(function() {"
+ "link1var = '" + userPreferences.link1 + "';"
Expand Down Expand Up @@ -294,22 +291,7 @@ class SmartCookieWebClient(
if (userPreferences.darkModeExtension && !WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) {
view.evaluateJavascript(darkMode.provideJs(), null)
}
val letDirectory = File(activity.getFilesDir(), "extensions")
letDirectory.mkdirs()
val file = File(letDirectory, "extension_file.txt")
if(file.exists()){
var contents = file.readText() // Read file

contents = contents.replace("(\\\\n)+".toRegex(), "")

contents = contents.replace("(\\\\\")+".toRegex(), "\"")


Log.d("extensions", contents)
view.settings.javaScriptEnabled = true
view.loadUrl("javascript:(function() {" + contents.toString() + "})()")
view.settings.javaScriptEnabled = userPreferences.javaScriptEnabled
}
if (userPreferences.blockMalwareEnabled) {
val inputStream: InputStream = activity.assets.open("malware.txt")
val inputString = inputStream.bufferedReader().use { it.readText() }
Expand Down Expand Up @@ -422,6 +404,9 @@ class SmartCookieWebClient(
uiController.tabChanged(smartCookieView)
}
}
if(userPreferences.cookieBlockEnabled){
view.evaluateJavascript(cookieBlock.provideJs(), null)
}
}

fun stringContainsItemFromList(inputStr: String, items: Array<String>): Boolean {
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/js/CookieBlock.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 50a09c0

Please sign in to comment.