diff options
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web')
3 files changed, 13 insertions, 9 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt index 9941c90c..6bdb459e 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt @@ -56,6 +56,7 @@ class FrostJSI(val webView: FrostWebViewCore) { @JavascriptInterface fun contextMenu(url: String, text: String?) { + if (!text.isIndependent) return //url will be formatted through webcontext webView.post { context.showWebContextMenu(WebContext(url, text)) } } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt index e8f9fee9..d1f144a6 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt @@ -18,7 +18,7 @@ import org.jetbrains.anko.runOnUiThread * cannot be resolved on a new window and must instead * by loaded in the current page * This helper method will collect all known cases and launch the overlay accordingly - * Returns {@code true} (default) if action is consumed, {@code false} otherwise + * Returns [true] (default) if action is consumed, [false] otherwise * * Note that this is not always called on the main thread! * UI related methods should always be posted or they may not be properly executed. @@ -28,7 +28,10 @@ import org.jetbrains.anko.runOnUiThread * as we have no need of sending a new intent to the same activity */ fun FrostWebViewCore.requestWebOverlay(url: String): Boolean { - if (url == "#") return false + if (url == "#" || !url.isIndependent) { + L.i("Forbid overlay switch", url) + return false + } if (url.isVideoUrl && context is VideoViewHolder) { L.i("Found video", url) context.runOnUiThread { (context as VideoViewHolder).showVideo(url) } 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 c8c7e2e7..67881ada 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt @@ -144,15 +144,15 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : BaseWebViewClient L.i("Url Loading", request.url?.toString()) val path = request.url?.path ?: return super.shouldOverrideUrlLoading(view, request) L.v("Url Loading Path", path) - request.url?.toString()?.apply { - if (contains("intent") && contains("com.facebook")) { - L.i("Skip facebook intent request") - return true - } + val url = request.url.toString() + if (url.isExplicitIntent) { + if (!url.contains("com.facebook")) + view.context.resolveActivityForUri(request.url) + return true } if (path.startsWith("/composer/")) return launchRequest(request) - if (request.url.toString().contains("scontent-sea1-1.xx.fbcdn.net") && (path.endsWith(".jpg") || path.endsWith(".png"))) - return launchImage(request.url.toString()) + if (url.contains("scontent-sea1-1.xx.fbcdn.net") && (path.endsWith(".jpg") || path.endsWith(".png"))) + return launchImage(url) if (Prefs.linksInDefaultApp && view.context.resolveActivityForUri(request.url)) return true return super.shouldOverrideUrlLoading(view, request) } |