aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2021-11-19 21:35:49 -0800
committerAllan Wang <me@allanwang.ca>2021-11-19 21:35:49 -0800
commit4135d5e7734592deb7107ea9a751b153536d01f7 (patch)
tree600be889a83fc832443344357fef12aaef607008 /app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt
parente6a45b29cae18161edd05337ae6ba3482ba3068c (diff)
downloadfrost-4135d5e7734592deb7107ea9a751b153536d01f7.tar.gz
frost-4135d5e7734592deb7107ea9a751b153536d01f7.tar.bz2
frost-4135d5e7734592deb7107ea9a751b153536d01f7.zip
Clean up and fix changes from compose test
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt8
1 files changed, 2 insertions, 6 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt
index 37f8fab3..70f911a8 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt
@@ -31,15 +31,12 @@ import kotlinx.coroutines.withTimeout
/**
* Attempts to get the fbcdn url of the supplied image redirect url
*/
-suspend fun String.getFullSizedImageUrl(url: String, timeout: Long = 3000): String? {
- L.v { "Image full size 1 from $url" }
- return withContext(Dispatchers.IO) {
+suspend fun String.getFullSizedImageUrl(url: String, timeout: Long = 3000): String? =
+ withContext(Dispatchers.IO) {
try {
withTimeout(timeout) {
- L.v { "Image full size from $url" }
val redirect = requestBuilder().url(url).get().call()
.execute().body?.string() ?: return@withTimeout null
- L.v { "Image full size from redirect $redirect" }
FB_REDIRECT_URL_MATCHER.find(redirect)[1]?.formattedFbUrl
}
} catch (e: Exception) {
@@ -47,4 +44,3 @@ suspend fun String.getFullSizedImageUrl(url: String, timeout: Long = 3000): Stri
null
}
}
-}