aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-08-29 13:49:54 -0400
committerGitHub <noreply@github.com>2017-08-29 13:49:54 -0400
commita6243384bc87548fd91fef5593f569c53750563b (patch)
treed45729ec2e835e954cfec000b716cd24482f8f14 /app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt
parent93bc40dbe9f2d3e2a126956caefc1bacbafa7be6 (diff)
downloadfrost-a6243384bc87548fd91fef5593f569c53750563b.tar.gz
frost-a6243384bc87548fd91fef5593f569c53750563b.tar.bz2
frost-a6243384bc87548fd91fef5593f569c53750563b.zip
Miscellaneous fixes (#223)
* Disable js dialogs for headless webviews * Update logging * Fix sharing theme * Add buddylist to drawer and theme update * Blacklist sharer.php from launching in overlay * Add whitelist for message related links
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.kt24
1 files changed, 20 insertions, 4 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 386c5339..b469659b 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt
@@ -19,10 +19,27 @@ import io.reactivex.subjects.Subject
*/
/**
- * Nothing more than a client without logging
+ * Fully quiet client that disables any prompts relating to the UI
+ * (as nothing is attached)
*/
-class QuietChromeClient : WebChromeClient() {
+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
+ }
}
/**
@@ -59,8 +76,7 @@ class FrostChromeClient(webCore: FrostWebViewCore) : WebChromeClient() {
override fun onGeolocationPermissionsShowPrompt(origin: String, callback: GeolocationPermissions.Callback) {
L.i("Requesting geolocation")
- context.kauRequestPermissions(PERMISSION_ACCESS_FINE_LOCATION) {
- granted, _ ->
+ context.kauRequestPermissions(PERMISSION_ACCESS_FINE_LOCATION) { granted, _ ->
L.i("Geolocation response received; ${if (granted) "granted" else "denied"}")
callback(origin, granted, true)
}