diff options
author | Allan Wang <me@allanwang.ca> | 2018-04-13 00:13:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-13 00:13:28 -0400 |
commit | c5e769deabeb80d7257b85c5c3d802cf46e6b191 (patch) | |
tree | b3ac48678e893495b932c6500025db73a83e3d2b /app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt | |
parent | d9e2562267e549ee407e683262406581f2c4888e (diff) | |
download | frost-c5e769deabeb80d7257b85c5c3d802cf46e6b191.tar.gz frost-c5e769deabeb80d7257b85c5c3d802cf46e6b191.tar.bz2 frost-c5e769deabeb80d7257b85c5c3d802cf46e6b191.zip |
Fix view full image (#882)v2.0.1
* Test including full photo viewer
* Test cookie in glide
* Fix parser and add redirects to view full image
* Update changelog
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt index f1d03f35..a1fd594f 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt @@ -7,7 +7,9 @@ import android.webkit.WebResourceResponse import android.webkit.WebView import android.webkit.WebViewClient import com.pitchedapps.frost.facebook.FB_URL_BASE +import com.pitchedapps.frost.facebook.FbCookie import com.pitchedapps.frost.facebook.FbItem +import com.pitchedapps.frost.facebook.formattedFbUrl import com.pitchedapps.frost.injectors.* import com.pitchedapps.frost.utils.* import com.pitchedapps.frost.views.FrostWebView @@ -57,7 +59,6 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() { ) } - override fun onPageCommitVisible(view: WebView, url: String?) { super.onPageCommitVisible(view, url) injectBackgroundColor() @@ -91,7 +92,7 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() { onPageFinishedActions(url) } - open internal fun onPageFinishedActions(url: String) { + internal open fun onPageFinishedActions(url: String) { if (url.startsWith("${FbItem.MESSAGES.url}/read/") && Prefs.messageScrollToBottom) web.pageDown(true) injectAndFinish() @@ -125,9 +126,9 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() { return web.requestWebOverlay(request.url.toString()) } - private fun launchImage(url: String, text: String? = null): Boolean { + private fun launchImage(url: String, text: String? = null, cookie: String? = null): Boolean { v { "Launching image: $url" } - web.context.launchImageActivity(url, text) + web.context.launchImageActivity(url, text, cookie) if (web.canGoBack()) web.goBack() return true } @@ -143,7 +144,9 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() { } if (path.startsWith("/composer/")) return launchRequest(request) if (url.isImageUrl) - return launchImage(url) + return launchImage(url.formattedFbUrl) + if (url.isIndirectImageUrl) + return launchImage(url.formattedFbUrl, cookie = FbCookie.webCookie) if (Prefs.linksInDefaultApp && view.context.resolveActivityForUri(request.url)) return true return super.shouldOverrideUrlLoading(view, request) } |