From 442350ea476b4203bd9e006a63e20de7d57ad5c3 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 31 Dec 2017 12:44:17 -0500 Subject: Use less aggressive link retrieval --- .../main/kotlin/com/pitchedapps/frost/utils/Utils.kt | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'app/src/main/kotlin/com') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt index 72b2324a..92e1bd05 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt @@ -224,15 +224,25 @@ inline val String?.isVideoUrl */ inline val String?.isIndependent: Boolean get() { - if (this == null || length < 5) return false // ignore short queries - if (this[0] == '#' && !contains('/')) return false // ignore element values - if (startsWith("http") && !isFacebookUrl) return true // ignore non facebook urls - if (dependentSet.any { contains(it) }) return false // ignore known dependent segments + if (this == null || length < 5) return false // ignore short queries + if (this[0] == '#' && !contains('/')) return false // ignore element values + if (startsWith("http") && !isFacebookUrl) return true // ignore non facebook urls + if (independentSegments.any { contains(it) }) return true // known independent segments + if (this.startsWith("#!/")) return false // ignore these links for now + if (dependentSegments.any { contains(it) }) return false // ignore known dependent segments return true } -val dependentSet = setOf( +val independentSegments = arrayOf( + "messages/read/?tid=cid" +) + +val dependentSegments = arrayOf( "photoset_token", "direct_action_execute", "messages/?pageNum", "sharer.php", + /** + * Editing images + */ + "/confirmation/?", /* * Facebook messages have the following cases for the tid query * mid* or id* for newer threads, which can be launched in new windows -- cgit v1.2.3