Use okhttp 3.8.1
This commit is contained in:
parent
b2727019c5
commit
704503b9f5
4 changed files with 24 additions and 15 deletions
|
@ -162,7 +162,7 @@ dependencies {
|
|||
forFDroidCompile 'com.github.ligi.snackengage:snackengage-playrate:0.13'
|
||||
forAmazonCompile 'com.github.ligi.snackengage:snackengage-amazonrate:0.13'
|
||||
|
||||
compile 'com.squareup.okhttp3:okhttp:3.7.0'
|
||||
compile 'com.squareup.okhttp3:okhttp:3.8.1'
|
||||
compile 'com.larswerkman:HoloColorPicker:1.5'
|
||||
compile 'com.google.code.findbugs:jsr305:3.0.2'
|
||||
compile 'com.squareup.moshi:moshi:1.4.0'
|
||||
|
|
|
@ -63,7 +63,10 @@ private fun fromOKHttp(uri: Uri): InputStreamWithSource? {
|
|||
|
||||
val response = client.newCall(request).execute()
|
||||
|
||||
return InputStreamWithSource(uri.toString(), response.body().byteStream())
|
||||
val body = response.body()
|
||||
if (body != null) {
|
||||
return InputStreamWithSource(uri.toString(), body.byteStream())
|
||||
}
|
||||
} catch (e: MalformedURLException) {
|
||||
App.tracker.trackException("MalformedURLException in ImportAsyncTask", e, false)
|
||||
} catch (e: IOException) {
|
||||
|
|
|
@ -38,16 +38,19 @@ class ExtractURLAsIphoneActivity : PassAndroidActivity() {
|
|||
requestBuilder.header("User-Agent", IPHONE_USER_AGENT)
|
||||
|
||||
val body = client.newCall(requestBuilder.build()).execute().body()
|
||||
val bodyString = body.string()
|
||||
body.close()
|
||||
|
||||
val url = extractURL(bodyString) ?: return null
|
||||
if (body != null) {
|
||||
val bodyString = body.string()
|
||||
body.close()
|
||||
|
||||
if (!url.startsWith("http")) {
|
||||
return intent.data.scheme + "://" + intent.data.host + "/" + url
|
||||
val url = extractURL(bodyString) ?: return null
|
||||
|
||||
if (!url.startsWith("http")) {
|
||||
return intent.data.scheme + "://" + intent.data.host + "/" + url
|
||||
}
|
||||
|
||||
return url
|
||||
}
|
||||
|
||||
return url
|
||||
} catch (e: IOException) {
|
||||
tracker.trackException("ExtractURLAsIphoneActivity", e, false)
|
||||
} catch (e: URISyntaxException) {
|
||||
|
|
|
@ -184,12 +184,15 @@ open class PassViewActivityBase : PassAndroidActivity() {
|
|||
val response: Response
|
||||
try {
|
||||
response = client.newCall(request).execute()
|
||||
val inputStreamWithSource = InputStreamWithSource(url, response.body().byteStream())
|
||||
val spec = InputStreamUnzipControllerSpec(inputStreamWithSource, this@PassViewActivityBase, passStore,
|
||||
MyUnzipSuccessCallback(dlg),
|
||||
MyUnzipFailCallback(dlg))
|
||||
spec.overwrite = true
|
||||
UnzipPassController.processInputStream(spec)
|
||||
val body = response.body()
|
||||
if (body != null) {
|
||||
val inputStreamWithSource = InputStreamWithSource(url, body.byteStream())
|
||||
val spec = InputStreamUnzipControllerSpec(inputStreamWithSource, this@PassViewActivityBase, passStore,
|
||||
MyUnzipSuccessCallback(dlg),
|
||||
MyUnzipFailCallback(dlg))
|
||||
spec.overwrite = true
|
||||
UnzipPassController.processInputStream(spec)
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue