diff options
author | Allan Wang <me@allanwang.ca> | 2019-12-08 00:29:40 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-08 00:29:40 -0800 |
commit | 15494d3b42315fa6fa7ae5daeb5ddf1f964b3932 (patch) | |
tree | c53221689ddeef3619572276fa530e8368abbde0 /app/src/main/kotlin/com/pitchedapps/frost/debugger | |
parent | f9129dd7b59b4b3119805a49c21315e1f5a5e336 (diff) | |
download | frost-15494d3b42315fa6fa7ae5daeb5ddf1f964b3932.tar.gz frost-15494d3b42315fa6fa7ae5daeb5ddf1f964b3932.tar.bz2 frost-15494d3b42315fa6fa7ae5daeb5ddf1f964b3932.zip |
Update versions (#1591)
* Update versions
* Update travis android sdk
* Fix api updates
* Update dex plugin version
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/debugger')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/debugger/OfflineWebsite.kt | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/debugger/OfflineWebsite.kt b/app/src/main/kotlin/com/pitchedapps/frost/debugger/OfflineWebsite.kt index bc453250..75a13295 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/debugger/OfflineWebsite.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/debugger/OfflineWebsite.kt @@ -31,6 +31,7 @@ import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.withContext import kotlinx.coroutines.yield import okhttp3.HttpUrl +import okhttp3.HttpUrl.Companion.toHttpUrlOrNull import okhttp3.Request import org.jsoup.Jsoup import org.jsoup.nodes.Document @@ -66,8 +67,8 @@ class OfflineWebsite( * Supplied url without the queries */ private val baseUrl: String = baseUrl ?: run { - val url: HttpUrl = HttpUrl.parse(url) ?: throw IllegalArgumentException("Malformed url") - return@run "${url.scheme()}://${url.host()}" + val url: HttpUrl = url.toHttpUrlOrNull() ?: throw IllegalArgumentException("Malformed url") + return@run "${url.scheme}://${url.host}" } private val mainFile = File(baseDir, "index.html") @@ -237,7 +238,7 @@ class OfflineWebsite( return try { val file = File(assetDir, fileName(url)) file.createNewFile() - val stream = request(url).execute().body()?.byteStream() + val stream = request(url).execute().body?.byteStream() ?: throw IllegalArgumentException("Response body not found for $url") file.copyFromInputStream(stream) true @@ -252,7 +253,7 @@ class OfflineWebsite( val file = File(assetDir, fileName(url)) file.createNewFile() - var content = request(url).execute().body()?.string() + var content = request(url).execute().body?.string() ?: throw IllegalArgumentException("Response body not found for $url") val links = FB_CSS_URL_MATCHER.findAll(content).mapNotNull { it[1] } val absLinks = links.mapNotNull { |