Fix lint errors

This commit is contained in:
yostyle 2021-11-10 17:38:11 +01:00
parent 7a78bc6866
commit 6ddf3f6e5a
10 changed files with 19 additions and 20 deletions

View File

@ -63,6 +63,6 @@ interface ContentUrlResolver {
sealed class ResolvedMethod { sealed class ResolvedMethod {
data class GET(val url: String) : 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()
} }
} }

View File

@ -25,18 +25,16 @@ interface ContentScannerService {
val serverPublicKey: String? val serverPublicKey: String?
fun getContentScannerServer(): 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<Optional<ScanStatusInfo>>
fun getCachedScanResultForFile(mxcUrl: String): ScanStatusInfo?
/** /**
* Get the current public curve25519 key that the AV server is advertising. * Get the current public curve25519 key that the AV server is advertising.
* @param callback on success callback containing the server public key * @param callback on success callback containing the server public key
*/ */
suspend fun getServerPublicKey(forceDownload: Boolean = false): String? suspend fun getServerPublicKey(forceDownload: Boolean = false): String?
suspend fun getScanResultForAttachment(mxcUrl: String, fileInfo: ElementToDecrypt? = null): ScanStatusInfo 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<Optional<ScanStatusInfo>>
fun getCachedScanResultForFile(mxcUrl: String): ScanStatusInfo?
} }

View File

@ -24,7 +24,7 @@ enum class ScanState {
} }
data class ScanStatusInfo( data class ScanStatusInfo(
val state : ScanState, val state: ScanState,
val scanDateTimestamp: Long?, val scanDateTimestamp: Long?,
val humanReadableMessage: String? val humanReadableMessage: String?
) )

View File

@ -18,7 +18,6 @@ package org.matrix.android.sdk.internal.session
import dagger.BindsInstance import dagger.BindsInstance
import dagger.Component 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.MatrixCoroutineDispatchers
import org.matrix.android.sdk.api.auth.data.SessionParams import org.matrix.android.sdk.api.auth.data.SessionParams
import org.matrix.android.sdk.api.session.Session 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.call.CallModule
import org.matrix.android.sdk.internal.session.content.ContentModule 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.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.filter.FilterModule
import org.matrix.android.sdk.internal.session.group.GetGroupDataWorker import org.matrix.android.sdk.internal.session.group.GetGroupDataWorker
import org.matrix.android.sdk.internal.session.group.GroupModule import org.matrix.android.sdk.internal.session.group.GroupModule

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.

View File

@ -43,7 +43,7 @@ internal open class ContentScanResultEntity(
scanStatusString = result.name scanStatusString = result.name
} }
fun toModel() : ScanStatusInfo { fun toModel(): ScanStatusInfo {
return ScanStatusInfo( return ScanStatusInfo(
state = this.scanResult, state = this.scanResult,
humanReadableMessage = humanReadableMessage, humanReadableMessage = humanReadableMessage,

View File

@ -19,18 +19,18 @@ package org.matrix.android.sdk.internal.session.contentscanner.db
import androidx.lifecycle.LiveData import androidx.lifecycle.LiveData
import androidx.lifecycle.Transformations import androidx.lifecycle.Transformations
import com.zhuinden.monarchy.Monarchy 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.Realm
import io.realm.RealmConfiguration import io.realm.RealmConfiguration
import io.realm.kotlin.createObject import io.realm.kotlin.createObject
import io.realm.kotlin.where import io.realm.kotlin.where
import org.matrix.android.sdk.api.extensions.orFalse 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.Optional
import org.matrix.android.sdk.api.util.toOptional import org.matrix.android.sdk.api.util.toOptional
import org.matrix.android.sdk.internal.di.ContentScannerDatabase import org.matrix.android.sdk.internal.di.ContentScannerDatabase
import org.matrix.android.sdk.internal.session.SessionScope 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 org.matrix.android.sdk.internal.util.isValidUrl
import javax.inject.Inject import javax.inject.Inject
@ -121,7 +121,8 @@ internal class RealmContentScannerStore @Inject constructor(
} }
}, { }, {
it.toModel() it.toModel()
}).firstOrNull() })
.firstOrNull()
} }
override fun getLiveScanResult(mxcUrl: String): LiveData<Optional<ScanStatusInfo>> { override fun getLiveScanResult(mxcUrl: String): LiveData<Optional<ScanStatusInfo>> {

View File

@ -22,5 +22,5 @@ import com.squareup.moshi.JsonClass
@JsonClass(generateAdapter = true) @JsonClass(generateAdapter = true)
internal data class ServerPublicKeyResponse( internal data class ServerPublicKeyResponse(
@Json(name = "public_key") @Json(name = "public_key")
val publicKey : String? val publicKey: String?
) )

View File

@ -160,7 +160,7 @@ Formatter\.formatShortFileSize===1
# android\.text\.TextUtils # 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 ### 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 ### Do not import temporary legacy classes
import org.matrix.android.sdk.internal.legacy.riot===3 import org.matrix.android.sdk.internal.legacy.riot===3