diff options
author | Allan Wang <me@allanwang.ca> | 2021-11-19 21:09:43 -0800 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2021-11-19 21:09:43 -0800 |
commit | 4799eebdc642f740b55aad2e0d9a3624fc11c53f (patch) | |
tree | a6a0431c0cd1ada5f3e185ed7208c866b44a0029 /app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt | |
parent | 8c343fd09cdf80cfbcdf49fd5cc72bec759478cf (diff) | |
download | frost-4799eebdc642f740b55aad2e0d9a3624fc11c53f.tar.gz frost-4799eebdc642f740b55aad2e0d9a3624fc11c53f.tar.bz2 frost-4799eebdc642f740b55aad2e0d9a3624fc11c53f.zip |
Snapshot work
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.kt | 8 |
1 files changed, 6 insertions, 2 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 70f911a8..37f8fab3 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,12 +31,15 @@ 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? = - withContext(Dispatchers.IO) { +suspend fun String.getFullSizedImageUrl(url: String, timeout: Long = 3000): String? { + L.v { "Image full size 1 from $url" } + return 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) { @@ -44,3 +47,4 @@ suspend fun String.getFullSizedImageUrl(url: String, timeout: Long = 3000): Stri null } } +} |