diff options
author | Allan Wang <me@allanwang.ca> | 2017-07-13 13:50:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-13 13:50:00 -0700 |
commit | 91119de328bf5f4e8c945f8fb470453319b9f0ed (patch) | |
tree | 9ba1786f9cd8488a0cc0dfb247e1b387a4161cfb /app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt | |
parent | de34d09f975079d5c044eae6da7ed92605009faf (diff) | |
download | frost-91119de328bf5f4e8c945f8fb470453319b9f0ed.tar.gz frost-91119de328bf5f4e8c945f8fb470453319b9f0ed.tar.bz2 frost-91119de328bf5f4e8c945f8fb470453319b9f0ed.zip |
Dev 1.2.2 - Add framework for messenger notifications (#47)
* Update KAU to v2.0
* Only inject theme for facebook and inject js after
* Clean up menu loading logic
* Add path null check
* Remove .idea files
* Add url formatter testers
* Update tests and check url nullability - Fixes
* Create instant messaging parser
* Shorted notification log and remove unnecessary null checks
* Make migration buildable
* Test message parser
* finalize messenger notifs for now
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt index 1090f1f3..e53bb202 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt @@ -15,8 +15,9 @@ class FbUrlFormatter(url: String) { init { var cleanedUrl = url discardable.forEach { cleanedUrl = cleanedUrl.replace(it, "") } + val changed = cleanedUrl != url //note that discardables strip away the first ? decoder.forEach { (k, v) -> cleanedUrl = cleanedUrl.replace(k, v) } - val qm = cleanedUrl.indexOf("?") + val qm = cleanedUrl.indexOf(if (changed)"&" else "?") if (qm > -1) { cleanedUrl.substring(qm + 1).split("&").forEach { val p = it.split("=") @@ -58,7 +59,8 @@ class FbUrlFormatter(url: String) { "http://m.facebook.com/l.php?u=", "https://m.facebook.com/l.php?u=", "http://touch.facebook.com/l.php?u=", - "https://touch.facebook.com/l.php?u=" + "https://touch.facebook.com/l.php?u=", + "/video_redirect/?src=" ) @JvmStatic val discardableQueries = arrayOf("ref", "refid") |