From 55bf3e4b5b4af5baa3c230ca82f74988608971a3 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Tue, 6 Aug 2019 00:49:58 -0700 Subject: Format kotlin --- .../com/pitchedapps/frost/web/FrostChromeClients.kt | 5 ++++- .../pitchedapps/frost/web/FrostRequestInterceptor.kt | 3 ++- .../kotlin/com/pitchedapps/frost/web/LoginWebView.kt | 19 ++++++++++--------- 3 files changed, 16 insertions(+), 11 deletions(-) (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web') 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 da90e7e5..9577aeb0 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostChromeClients.kt @@ -73,7 +73,10 @@ class FrostChromeClient(web: FrostWebView) : WebChromeClient() { return activity != null } - override fun onGeolocationPermissionsShowPrompt(origin: String, callback: GeolocationPermissions.Callback) { + override fun onGeolocationPermissionsShowPrompt( + origin: String, + callback: GeolocationPermissions.Callback + ) { L.i { "Requesting geolocation" } context.kauRequestPermissions(PERMISSION_ACCESS_FINE_LOCATION) { granted, _ -> L.i { "Geolocation response received; ${if (granted) "granted" else "denied"}" } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt index bd696b02..ab910ebc 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostRequestInterceptor.kt @@ -76,4 +76,5 @@ fun WebResourceResponse?.filter(filter: Boolean): WebResourceResponse? = this fun WebResourceResponse?.filterCss(request: WebResourceRequest): WebResourceResponse? = filter(request) { it.endsWith(".css") } -fun WebResourceResponse?.filterImage(request: WebResourceRequest): WebResourceResponse? = filter(request.isImage) +fun WebResourceResponse?.filterImage(request: WebResourceRequest): WebResourceResponse? = + filter(request.isImage) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt index 79c6d5ba..09796b15 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt @@ -62,16 +62,17 @@ class LoginWebView @JvmOverloads constructor( webChromeClient = LoginChromeClient() } - suspend fun loadLogin(progressCallback: (Int) -> Unit): CompletableDeferred = coroutineScope { - this@LoginWebView.progressCallback = progressCallback - L.d { "Begin loading login" } - launchMain { - FbCookie.reset() - setupWebview() - loadUrl(FB_LOGIN_URL) + suspend fun loadLogin(progressCallback: (Int) -> Unit): CompletableDeferred = + coroutineScope { + this@LoginWebView.progressCallback = progressCallback + L.d { "Begin loading login" } + launchMain { + FbCookie.reset() + setupWebview() + loadUrl(FB_LOGIN_URL) + } + completable } - completable - } private inner class LoginClient : BaseWebViewClient() { -- cgit v1.2.3