mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
committed by
Greyson Parrelli
parent
9824cc2cbe
commit
8ba57a2733
@@ -67,10 +67,10 @@ class ApkUpdateJob private constructor(parameters: Parameters) : BaseJob(paramet
|
||||
val request = Request.Builder().url(BuildConfig.APK_UPDATE_MANIFEST_URL).build()
|
||||
|
||||
val rawUpdateDescriptor: String = client.newCall(request).execute().use { response ->
|
||||
if (!response.isSuccessful || response.body() == null) {
|
||||
if (!response.isSuccessful || response.body == null) {
|
||||
throw IOException("Failed to read update descriptor")
|
||||
}
|
||||
response.body()!!.string()
|
||||
response.body!!.string()
|
||||
}
|
||||
|
||||
val updateDescriptor: UpdateDescriptor = JsonUtils.fromJson(rawUpdateDescriptor, UpdateDescriptor::class.java)
|
||||
|
||||
@@ -400,7 +400,7 @@ class AttachmentDownloadJob private constructor(
|
||||
) {
|
||||
try {
|
||||
S3.getObject(attachment.fileName!!).use { response ->
|
||||
val body = response.body()
|
||||
val body = response.body
|
||||
if (body != null) {
|
||||
if (body.contentLength() > RemoteConfig.maxAttachmentReceiveSizeBytes) {
|
||||
throw MmsException("Attachment too large, failing download")
|
||||
|
||||
@@ -42,7 +42,7 @@ class FetchRemoteMegaphoneImageJob(parameters: Parameters, private val uuid: Str
|
||||
override fun onRun() {
|
||||
try {
|
||||
S3.getObject(imageUrl).use { response ->
|
||||
val body: ResponseBody? = response.body()
|
||||
val body: ResponseBody? = response.body
|
||||
if (body != null) {
|
||||
val uri = BlobProvider.getInstance()
|
||||
.forData(body.byteStream(), body.contentLength())
|
||||
|
||||
@@ -53,10 +53,10 @@ object S3 {
|
||||
fun getString(endpoint: String): String {
|
||||
getObject(endpoint).use { response ->
|
||||
if (!response.isSuccessful) {
|
||||
throw NonSuccessfulResponseCodeException(response.code())
|
||||
throw NonSuccessfulResponseCodeException(response.code)
|
||||
}
|
||||
|
||||
return response.body()?.string()?.trim() ?: throw IOException()
|
||||
return response.body?.string()?.trim() ?: throw IOException()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,13 +110,13 @@ object S3 {
|
||||
getObject(endpoint).use { response ->
|
||||
if (!response.isSuccessful) {
|
||||
return ServiceResponse.forApplicationError(
|
||||
DefaultErrorMapper.getDefault().parseError(response.code()),
|
||||
response.code(),
|
||||
DefaultErrorMapper.getDefault().parseError(response.code),
|
||||
response.code,
|
||||
""
|
||||
)
|
||||
}
|
||||
|
||||
val source = response.body()?.source()
|
||||
val source = response.body?.source()
|
||||
|
||||
val outputStream = ByteArrayOutputStream()
|
||||
|
||||
@@ -166,7 +166,7 @@ object S3 {
|
||||
}
|
||||
|
||||
getObject(objectPathOnNetwork).use { response ->
|
||||
val source = response.body()?.source()
|
||||
val source = response.body?.source()
|
||||
|
||||
val outputStream: OutputStream = if (doNotEncrypt) {
|
||||
FileOutputStream(objectFileOnDisk)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.thoughtcrime.securesms.util
|
||||
|
||||
import okhttp3.HttpUrl
|
||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||
import org.thoughtcrime.securesms.stickers.StickerUrl
|
||||
import java.net.URI
|
||||
import java.net.URISyntaxException
|
||||
@@ -43,7 +43,7 @@ object LinkUtil {
|
||||
return false
|
||||
}
|
||||
|
||||
return HttpUrl.parse(linkUrl)?.scheme() == "https"
|
||||
return linkUrl.toHttpUrlOrNull()?.scheme == "https"
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user