You've already forked element-android
mirror of
https://github.com/vector-im/element-android.git
synced 2025-07-31 07:04:23 +03:00
Use local val and more compact code.
This commit is contained in:
@ -42,12 +42,10 @@ internal class DefaultScanEncryptedTask @Inject constructor(
|
|||||||
|
|
||||||
override suspend fun execute(params: ScanEncryptedTask.Params): ScanResponse {
|
override suspend fun execute(params: ScanEncryptedTask.Params): ScanResponse {
|
||||||
val mxcUrl = params.mxcUrl
|
val mxcUrl = params.mxcUrl
|
||||||
|
|
||||||
val scannerUrl = contentScannerStore.getScannerUrl()
|
val scannerUrl = contentScannerStore.getScannerUrl()
|
||||||
contentScannerStore.updateStateForContent(params.mxcUrl, ScanState.IN_PROGRESS, scannerUrl)
|
contentScannerStore.updateStateForContent(mxcUrl, ScanState.IN_PROGRESS, scannerUrl)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val dlBody = ScanEncryptorUtils.getDownloadBodyAndEncryptIfNeeded(params.publicServerKey, params.mxcUrl, params.encryptedInfo)
|
val dlBody = ScanEncryptorUtils.getDownloadBodyAndEncryptIfNeeded(params.publicServerKey, mxcUrl, params.encryptedInfo)
|
||||||
val api = contentScannerApiProvider.contentScannerApi ?: throw IllegalArgumentException()
|
val api = contentScannerApiProvider.contentScannerApi ?: throw IllegalArgumentException()
|
||||||
val executeRequest = executeRequest<ScanResponse>(null) {
|
val executeRequest = executeRequest<ScanResponse>(null) {
|
||||||
api.scanFile(dlBody)
|
api.scanFile(dlBody)
|
||||||
@ -60,7 +58,7 @@ internal class DefaultScanEncryptedTask @Inject constructor(
|
|||||||
)
|
)
|
||||||
return executeRequest
|
return executeRequest
|
||||||
} catch (failure: Throwable) {
|
} catch (failure: Throwable) {
|
||||||
contentScannerStore.updateStateForContent(params.mxcUrl, ScanState.UNKNOWN, scannerUrl)
|
contentScannerStore.updateStateForContent(mxcUrl, ScanState.UNKNOWN, scannerUrl)
|
||||||
throw failure.toScanFailure() ?: failure
|
throw failure.toScanFailure() ?: failure
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user