aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt
diff options
context:
space:
mode:
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.kt38
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