aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt
diff options
context:
space:
mode:
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)
}