diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/content/ContentUrlResolver.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/content/ContentUrlResolver.kt index 56e3cd9796..3dd096e144 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/content/ContentUrlResolver.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/content/ContentUrlResolver.kt @@ -63,6 +63,6 @@ interface ContentUrlResolver { sealed class ResolvedMethod { data class GET(val url: String) : ResolvedMethod() - data class POST(val url:String, val jsonBody: String): ResolvedMethod() + data class POST(val url: String, val jsonBody: String) : ResolvedMethod() } } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/contentscanner/ContentScannerService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/contentscanner/ContentScannerService.kt index 0c45e6a132..1dd7bab01c 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/contentscanner/ContentScannerService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/contentscanner/ContentScannerService.kt @@ -25,18 +25,16 @@ interface ContentScannerService { val serverPublicKey: String? fun getContentScannerServer(): String? + fun setScannerUrl(url: String?) + fun enableScanner(enabled: Boolean) + fun isScannerEnabled(): Boolean + fun getLiveStatusForFile(mxcUrl: String, fetchIfNeeded: Boolean = true, fileInfo: ElementToDecrypt? = null): LiveData> + fun getCachedScanResultForFile(mxcUrl: String): ScanStatusInfo? + /** * Get the current public curve25519 key that the AV server is advertising. * @param callback on success callback containing the server public key */ suspend fun getServerPublicKey(forceDownload: Boolean = false): String? - suspend fun getScanResultForAttachment(mxcUrl: String, fileInfo: ElementToDecrypt? = null): ScanStatusInfo - - fun setScannerUrl(url: String?) - - fun enableScanner(enabled: Boolean) - fun isScannerEnabled(): Boolean - fun getLiveStatusForFile(mxcUrl: String, fetchIfNeeded: Boolean = true, fileInfo: ElementToDecrypt? = null): LiveData> - fun getCachedScanResultForFile(mxcUrl: String): ScanStatusInfo? } diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/contentscanner/ScanState.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/contentscanner/ScanState.kt index aeb1551cf7..da209080ac 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/contentscanner/ScanState.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/session/contentscanner/ScanState.kt @@ -24,7 +24,7 @@ enum class ScanState { } data class ScanStatusInfo( - val state : ScanState, + val state: ScanState, val scanDateTimestamp: Long?, val humanReadableMessage: String? ) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultSession.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultSession.kt index f0ad0f87b0..32e88bafb4 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultSession.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/DefaultSession.kt @@ -278,7 +278,7 @@ internal class DefaultSession @Inject constructor( override fun cryptoService(): CryptoService = cryptoService.get() override fun contentScannerService(): ContentScannerService = contentScannerService.get() - + override fun identityService() = identityService override fun fileService(): FileService = defaultFileService.get() diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionComponent.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionComponent.kt index a3f8f5dc6d..76e5d84e56 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionComponent.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/SessionComponent.kt @@ -18,7 +18,6 @@ package org.matrix.android.sdk.internal.session import dagger.BindsInstance import dagger.Component -import org.matrix.android.sdk.internal.session.contentscanner.ContentScannerModule import org.matrix.android.sdk.api.MatrixCoroutineDispatchers import org.matrix.android.sdk.api.auth.data.SessionParams import org.matrix.android.sdk.api.session.Session @@ -37,6 +36,7 @@ import org.matrix.android.sdk.internal.session.cache.CacheModule import org.matrix.android.sdk.internal.session.call.CallModule import org.matrix.android.sdk.internal.session.content.ContentModule import org.matrix.android.sdk.internal.session.content.UploadContentWorker +import org.matrix.android.sdk.internal.session.contentscanner.ContentScannerModule import org.matrix.android.sdk.internal.session.filter.FilterModule import org.matrix.android.sdk.internal.session.group.GetGroupDataWorker import org.matrix.android.sdk.internal.session.group.GroupModule diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/DisabledContentScannerService.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/DisabledContentScannerService.kt index 240a8deaba..9087c71566 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/DisabledContentScannerService.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/DisabledContentScannerService.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 New Vector Ltd + * Copyright 2021 The Matrix.org Foundation C.I.C. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/db/ContentScanResultEntity.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/db/ContentScanResultEntity.kt index 8befba17e2..0ffff441f8 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/db/ContentScanResultEntity.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/db/ContentScanResultEntity.kt @@ -43,7 +43,7 @@ internal open class ContentScanResultEntity( scanStatusString = result.name } - fun toModel() : ScanStatusInfo { + fun toModel(): ScanStatusInfo { return ScanStatusInfo( state = this.scanResult, humanReadableMessage = humanReadableMessage, diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/db/RealmContentScannerStore.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/db/RealmContentScannerStore.kt index 11b9439c2f..947a66c8b9 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/db/RealmContentScannerStore.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/db/RealmContentScannerStore.kt @@ -19,18 +19,18 @@ package org.matrix.android.sdk.internal.session.contentscanner.db import androidx.lifecycle.LiveData import androidx.lifecycle.Transformations import com.zhuinden.monarchy.Monarchy -import org.matrix.android.sdk.internal.session.contentscanner.data.ContentScannerStore -import org.matrix.android.sdk.api.session.contentscanner.ScanState -import org.matrix.android.sdk.api.session.contentscanner.ScanStatusInfo import io.realm.Realm import io.realm.RealmConfiguration import io.realm.kotlin.createObject import io.realm.kotlin.where import org.matrix.android.sdk.api.extensions.orFalse +import org.matrix.android.sdk.api.session.contentscanner.ScanState +import org.matrix.android.sdk.api.session.contentscanner.ScanStatusInfo import org.matrix.android.sdk.api.util.Optional import org.matrix.android.sdk.api.util.toOptional import org.matrix.android.sdk.internal.di.ContentScannerDatabase import org.matrix.android.sdk.internal.session.SessionScope +import org.matrix.android.sdk.internal.session.contentscanner.data.ContentScannerStore import org.matrix.android.sdk.internal.util.isValidUrl import javax.inject.Inject @@ -121,7 +121,8 @@ internal class RealmContentScannerStore @Inject constructor( } }, { it.toModel() - }).firstOrNull() + }) + .firstOrNull() } override fun getLiveScanResult(mxcUrl: String): LiveData> { diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/model/ServerPublicKeyResponse.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/model/ServerPublicKeyResponse.kt index 688d030197..2e97a85bca 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/model/ServerPublicKeyResponse.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/contentscanner/model/ServerPublicKeyResponse.kt @@ -22,5 +22,5 @@ import com.squareup.moshi.JsonClass @JsonClass(generateAdapter = true) internal data class ServerPublicKeyResponse( @Json(name = "public_key") - val publicKey : String? + val publicKey: String? ) diff --git a/tools/check/forbidden_strings_in_code.txt b/tools/check/forbidden_strings_in_code.txt index 29077c3a76..b135954f63 100644 --- a/tools/check/forbidden_strings_in_code.txt +++ b/tools/check/forbidden_strings_in_code.txt @@ -160,7 +160,7 @@ Formatter\.formatShortFileSize===1 # android\.text\.TextUtils ### This is not a rule, but a warning: the number of "enum class" has changed. For Json classes, it is mandatory that they have `@JsonClass(generateAdapter = false)`. If the enum is not used as a Json class, change the value in file forbidden_strings_in_code.txt -enum class===107 +enum class===108 ### Do not import temporary legacy classes import org.matrix.android.sdk.internal.legacy.riot===3