diff options
author | Allan Wang <me@allanwang.ca> | 2017-07-04 17:22:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-04 17:22:36 -0400 |
commit | a67f99fcf210792da5e028570efbad61407aeab2 (patch) | |
tree | 3a2d617e9d9649828f13e581d8491c0371c67223 /app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt | |
parent | 4cf368be0cd2f179485b05a3d2cd9b7bc236ba8e (diff) | |
download | frost-a67f99fcf210792da5e028570efbad61407aeab2.tar.gz frost-a67f99fcf210792da5e028570efbad61407aeab2.tar.bz2 frost-a67f99fcf210792da5e028570efbad61407aeab2.zip |
Dev (#21) - fix search and file chooser
* Fix up search and add file chooser
* Fix repeating file chooser
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt index 709ab7ac..62c28527 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt @@ -11,10 +11,7 @@ import com.pitchedapps.frost.SelectorActivity import com.pitchedapps.frost.facebook.FACEBOOK_COM import com.pitchedapps.frost.facebook.FbCookie import com.pitchedapps.frost.injectors.* -import com.pitchedapps.frost.utils.L -import com.pitchedapps.frost.utils.Prefs -import com.pitchedapps.frost.utils.cookies -import com.pitchedapps.frost.utils.launchNewTask +import com.pitchedapps.frost.utils.* import io.reactivex.subjects.Subject /** @@ -76,8 +73,20 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : WebViewClient() { L.d("Emit $flag") } - override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest?): Boolean { - L.i("Url Loading ${request?.url?.path}") + /** + * Helper to format the request and launch it + * returns true to override the url + */ + private fun launchRequest(request: WebResourceRequest): Boolean { + L.d("Launching ${request.url}") + webCore.context.launchWebOverlay(request.url.toString()) + return true + } + + override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean { + L.i("Url Loading ${request.url}") + val path = request.url.path + if (path.startsWith("/composer/")) return launchRequest(request) return super.shouldOverrideUrlLoading(view, request) } |