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-03 22:21:51 -0700
committerGitHub <noreply@github.com>2017-08-03 22:21:51 -0700
commit7746e63373c905faa6d7e45e45fffc48d3ffff85 (patch)
tree5d1bd4338a722619bb892abb308b369abc61f396 /app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt
parent5583f519dd7c4843f045029b0e48fd882dd79c71 (diff)
downloadfrost-7746e63373c905faa6d7e45e45fffc48d3ffff85.tar.gz
frost-7746e63373c905faa6d7e45e45fffc48d3ffff85.tar.bz2
frost-7746e63373c905faa6d7e45e45fffc48d3ffff85.zip
Add IM notifications, FAQ, video uploading, and geolocations (#107)
* Test canary * Update activities to use kau base * Update dependencies * Cherry pick faq * Update kau and add faq * Add readme badges * Add im notifications and video uploading * Update theme * Update and fix unit tests * Add geolocation * Prepare alpha test * Remove explicit nonnull request
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.kt16
1 files changed, 12 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 b8ba0d1d..343674d5 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt
@@ -1,10 +1,9 @@
package com.pitchedapps.frost.web
import android.net.Uri
-import android.webkit.ConsoleMessage
-import android.webkit.ValueCallback
-import android.webkit.WebChromeClient
-import android.webkit.WebView
+import android.webkit.*
+import ca.allanwang.kau.permissions.PERMISSION_ACCESS_FINE_LOCATION
+import ca.allanwang.kau.permissions.kauRequestPermissions
import ca.allanwang.kau.utils.snackbar
import com.pitchedapps.frost.contracts.ActivityWebContract
import com.pitchedapps.frost.utils.L
@@ -33,6 +32,7 @@ class FrostChromeClient(webCore: FrostWebViewCore) : WebChromeClient() {
val progressObservable: Subject<Int> = webCore.progressObservable
val titleObservable: BehaviorSubject<String> = webCore.titleObservable
val activityContract = (webCore.context as? ActivityWebContract)
+ val context = webCore.context!!
companion object {
val consoleBlacklist = setOf(
@@ -62,4 +62,12 @@ class FrostChromeClient(webCore: FrostWebViewCore) : WebChromeClient() {
return activityContract != null
}
+ override fun onGeolocationPermissionsShowPrompt(origin: String, callback: GeolocationPermissions.Callback) {
+ L.d("Requesting geolocation")
+ context.kauRequestPermissions(PERMISSION_ACCESS_FINE_LOCATION) {
+ granted, _ ->
+ L.d("Geolocation response received; ${if (granted) "granted" else "denied"}")
+ callback(origin, granted, true)
+ }
+ }
} \ No newline at end of file