diff options
author | Allan Wang <me@allanwang.ca> | 2018-01-18 23:23:56 -0500 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2018-01-20 16:42:37 -0500 |
commit | d766100c297bc094491de150f24c04719ffa8f4e (patch) | |
tree | b69863dace2fcb45d5fd25c276ca450e07305c44 /app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt | |
parent | 78b3cc41e4c9f8d141ad46ee75e476fa2d177f19 (diff) | |
download | frost-d766100c297bc094491de150f24c04719ffa8f4e.tar.gz frost-d766100c297bc094491de150f24c04719ffa8f4e.tar.bz2 frost-d766100c297bc094491de150f24c04719ffa8f4e.zip |
Enhancement/speed up (#650)
* Revert back to m.facebook
* Add initial speedup
* Update theme
* Fix link press for event status
* Move web states to fb const
* Fix images and email
* Fix up flyweight for requests
* Ensure frost request is synchronous
* Prepare diff utils
* Improve speed and fix blank overlay
* Update comments
* Add debugger and fix searchview
* Theme discover pages. Resolves #654
* Fix duplicate reload
* Fix image loading
* Update changelog
* Update tests
* Rename test
Update dependencies
Update gitignore
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 | 5 |
1 files changed, 3 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 76eb2c0c..cbb6087a 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt @@ -32,8 +32,10 @@ class FbUrlFormatter(url: String) { fun clean(url: String): String { if (url.isBlank()) return "" var cleanedUrl = url + if (cleanedUrl.startsWith("#!")) cleanedUrl = cleanedUrl.substring(2) + val urlRef = cleanedUrl discardable.forEach { cleanedUrl = cleanedUrl.replace(it, "", true) } - val changed = cleanedUrl != url + val changed = cleanedUrl != urlRef converter.forEach { (k, v) -> cleanedUrl = cleanedUrl.replace(k, v, true) } try { cleanedUrl = URLDecoder.decode(cleanedUrl, StandardCharsets.UTF_8.name()) @@ -54,7 +56,6 @@ class FbUrlFormatter(url: String) { discardableQueries.forEach { queries.remove(it) } //final cleanup misc.forEach { (k, v) -> cleanedUrl = cleanedUrl.replace(k, v, true) } - if (cleanedUrl.startsWith("#!")) cleanedUrl = cleanedUrl.substring(2) if (cleanedUrl.startsWith("/")) cleanedUrl = FB_URL_BASE + cleanedUrl.substring(1) cleanedUrl = cleanedUrl.replaceFirst(".facebook.com//", ".facebook.com/") //sometimes we are given a bad url L.v { "Formatted url from $url to $cleanedUrl" } |