diff options
author | Allan Wang <me@allanwang.ca> | 2017-12-31 02:44:46 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-31 02:44:46 -0500 |
commit | 725d6a99a07f91f940a07e6b49dd6224a6aa32d1 (patch) | |
tree | 4e0b1b3b9ffe9b5aef3c8d0f154ea9ab1058fd5e /app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt | |
parent | 3076d9a97c203497aec1415d8ac6037d10eebb46 (diff) | |
download | frost-725d6a99a07f91f940a07e6b49dd6224a6aa32d1.tar.gz frost-725d6a99a07f91f940a07e6b49dd6224a6aa32d1.tar.bz2 frost-725d6a99a07f91f940a07e6b49dd6224a6aa32d1.zip |
Enhancement/proguard (#589)
* Add error log
* Rewrite logger
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt index 960fe4c2..8c016e5c 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt @@ -20,30 +20,6 @@ import io.reactivex.subjects.Subject */ /** - * Fully quiet client that disables any prompts relating to the UI - * (as nothing is attached) - */ -class HeadlessChromeClient : WebChromeClient() { - - override fun onConsoleMessage(consoleMessage: ConsoleMessage) = true - - override fun onJsAlert(view: WebView, url: String?, message: String?, result: JsResult): Boolean { - result.cancel() - return true - } - - override fun onJsConfirm(view: WebView, url: String?, message: String?, result: JsResult): Boolean { - result.cancel() - return true - } - - override fun onJsPrompt(view: WebView, url: String?, message: String?, defaultValue: String?, result: JsPromptResult): Boolean { - result.cancel() - return true - } -} - -/** * The default chrome client */ class FrostChromeClient(web: FrostWebView) : WebChromeClient() { @@ -55,7 +31,7 @@ class FrostChromeClient(web: FrostWebView) : WebChromeClient() { override fun onConsoleMessage(consoleMessage: ConsoleMessage): Boolean { if (consoleBlacklist.any { consoleMessage.message().contains(it) }) return true - L.v("Chrome Console ${consoleMessage.lineNumber()}: ${consoleMessage.message()}") + L.v { "Chrome Console ${consoleMessage.lineNumber()}: ${consoleMessage.message()}" } return true } @@ -76,9 +52,9 @@ class FrostChromeClient(web: FrostWebView) : WebChromeClient() { } override fun onGeolocationPermissionsShowPrompt(origin: String, callback: GeolocationPermissions.Callback) { - L.i("Requesting geolocation") + L.i { "Requesting geolocation" } context.kauRequestPermissions(PERMISSION_ACCESS_FINE_LOCATION) { granted, _ -> - L.i("Geolocation response received; ${if (granted) "granted" else "denied"}") + L.i { "Geolocation response received; ${if (granted) "granted" else "denied"}" } callback(origin, granted, true) } } |