diff options
author | Allan Wang <me@allanwang.ca> | 2017-12-21 20:55:51 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-21 20:55:51 -0500 |
commit | f1e1aec8487fd148eb8e75fe016a8438958989ad (patch) | |
tree | c4d614e6a3e7d6ef9fa7c04452c357d06bc50279 /app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt | |
parent | d683cae6ffe644a9f63eea6cf3b7e59d2bde617b (diff) | |
download | frost-f1e1aec8487fd148eb8e75fe016a8438958989ad.tar.gz frost-f1e1aec8487fd148eb8e75fe016a8438958989ad.tar.bz2 frost-f1e1aec8487fd148eb8e75fe016a8438958989ad.zip |
misc (#566)
* Fix click validator
* Update tests
* Feature/fb requests (#567)
* Add initial requesting interface
* Update unit tests and dependencies
* Resolve lint
* Fix lint 2
* Fix toolbar location, closes #439
* Add prev version code, closes #551
* Clear test val
* Update changelog
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt | 38 |
1 files changed, 7 insertions, 31 deletions
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 9255b5bb..253d4801 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt @@ -29,15 +29,16 @@ import org.jetbrains.anko.runOnUiThread * as we have no need of sending a new intent to the same activity */ fun FrostWebView.requestWebOverlay(url: String): Boolean { - if (url == "#" || !url.isIndependent) { - L.i("Forbid overlay switch", url) - return false - } + val context = context // finalize reference if (url.isVideoUrl && context is VideoViewHolder) { L.i("Found video", url) - context.runOnUiThread { (context as VideoViewHolder).showVideo(url) } + context.runOnUiThread { context.showVideo(url) } return true } + if (!url.isIndependent) { + L.i("Forbid overlay switch", url) + return false + } if (!Prefs.overlayEnabled) return false if (context is WebOverlayActivityBase) { L.v("Check web request from overlay", url) @@ -55,26 +56,6 @@ fun FrostWebView.requestWebOverlay(url: String): Boolean { L.i("return false switch") return false } - /* - * Non facebook urls can be loaded - */ - if (!url.formattedFbUrl.isFacebookUrl) { - context.launchWebOverlay(url) - L.d("Request web overlay is not a facebook url", url) - return true - } - /* - * Check blacklist - */ - if (overlayBlacklist.any { url.contains(it) }) return false - /* - * Facebook messages have the following cases for the tid query - * mid* or id* for newer threads, which can be launched in new windows - * or a hash for old threads, which must be loaded on old threads - */ - if (url.contains("/messages/read/?tid=")) { - if (!url.contains("?tid=id") && !url.contains("?tid=mid")) return false - } L.v("Request web overlay passed", url) context.launchWebOverlay(url) return true @@ -87,9 +68,4 @@ val messageWhitelist = setOf(FbItem.MESSAGES, FbItem.CHAT, FbItem.FEED_MOST_RECE val String.shouldUseBasicAgent get() = !contains("story.php") //we will use basic agent for anything that isn't a comment section -// get() = (messageWhitelist.any { contains(it) }) || this == FB_URL_BASE - -/** - * The following components should never be launched in a new overlay - */ -val overlayBlacklist = setOf("messages/?pageNum", "photoset_token", "sharer.php")
\ No newline at end of file +// get() = (messageWhitelist.any { contains(it) }) || this == FB_URL_BASE
\ No newline at end of file |