mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 13:38:49 +03:00
Move to content scanner matrix SDK to FOSS
This commit is contained in:
parent
80a42d0a55
commit
0ad66446e7
22 changed files with 94 additions and 174 deletions
|
@ -1,112 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2020 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.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.content
|
|
||||||
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.ScanEncryptorUtils
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.model.toJson
|
|
||||||
import org.matrix.android.sdk.api.MatrixUrls
|
|
||||||
import org.matrix.android.sdk.api.MatrixUrls.isMxcUrl
|
|
||||||
import org.matrix.android.sdk.api.auth.data.HomeServerConnectionConfig
|
|
||||||
import org.matrix.android.sdk.api.session.content.ContentUrlResolver
|
|
||||||
import org.matrix.android.sdk.api.session.contentscanning.ContentScannerService
|
|
||||||
import org.matrix.android.sdk.internal.crypto.attachments.ElementToDecrypt
|
|
||||||
import org.matrix.android.sdk.internal.network.NetworkConstants
|
|
||||||
import org.matrix.android.sdk.internal.util.ensureTrailingSlash
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
internal class ElementContentUrlResolver @Inject constructor(
|
|
||||||
homeServerConnectionConfig: HomeServerConnectionConfig,
|
|
||||||
private val scannerService: ContentScannerService
|
|
||||||
) : ContentUrlResolver {
|
|
||||||
|
|
||||||
private val baseUrl = homeServerConnectionConfig.homeServerUriBase.toString().ensureTrailingSlash()
|
|
||||||
|
|
||||||
override val uploadUrl = baseUrl + NetworkConstants.URI_API_MEDIA_PREFIX_PATH_R0 + "upload"
|
|
||||||
|
|
||||||
override fun resolveForDownload(contentUrl: String?, elementToDecrypt: ElementToDecrypt?): ContentUrlResolver.ResolvedMethod? {
|
|
||||||
return if (scannerService.isScannerEnabled() && elementToDecrypt != null) {
|
|
||||||
val baseUrl = scannerService.getContentScannerServer()
|
|
||||||
val sep = if (baseUrl?.endsWith("/") == true) "" else "/"
|
|
||||||
|
|
||||||
val url = baseUrl + sep + NetworkConstants.URI_API_PREFIX_PATH_MEDIA_PROXY_UNSTABLE + "download_encrypted"
|
|
||||||
|
|
||||||
ContentUrlResolver.ResolvedMethod.POST(
|
|
||||||
url = url,
|
|
||||||
jsonBody = ScanEncryptorUtils
|
|
||||||
.getDownloadBodyAndEncryptIfNeeded(scannerService.serverPublicKey, contentUrl ?: "", elementToDecrypt)
|
|
||||||
.toJson()
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
resolveFullSize(contentUrl)?.let { ContentUrlResolver.ResolvedMethod.GET(it) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun resolveFullSize(contentUrl: String?): String? {
|
|
||||||
return contentUrl
|
|
||||||
// do not allow non-mxc content URLs
|
|
||||||
?.takeIf { it.isMxcUrl() }
|
|
||||||
?.let {
|
|
||||||
resolve(
|
|
||||||
contentUrl = it,
|
|
||||||
toThumbnail = false
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun resolveThumbnail(contentUrl: String?, width: Int, height: Int, method: ContentUrlResolver.ThumbnailMethod): String? {
|
|
||||||
return contentUrl
|
|
||||||
// do not allow non-mxc content URLs
|
|
||||||
?.takeIf { it.isMxcUrl() }
|
|
||||||
?.let {
|
|
||||||
resolve(
|
|
||||||
contentUrl = it,
|
|
||||||
toThumbnail = true,
|
|
||||||
params = "?width=$width&height=$height&method=${method.value}"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun resolve(contentUrl: String,
|
|
||||||
toThumbnail: Boolean,
|
|
||||||
params: String = ""): String? {
|
|
||||||
var serverAndMediaId = contentUrl.removePrefix(MatrixUrls.MATRIX_CONTENT_URI_SCHEME)
|
|
||||||
|
|
||||||
val apiPath = if (scannerService.isScannerEnabled()) {
|
|
||||||
NetworkConstants.URI_API_PREFIX_PATH_MEDIA_PROXY_UNSTABLE
|
|
||||||
} else {
|
|
||||||
NetworkConstants.URI_API_MEDIA_PREFIX_PATH_R0
|
|
||||||
}
|
|
||||||
val prefix = if (toThumbnail) {
|
|
||||||
apiPath + "thumbnail/"
|
|
||||||
} else {
|
|
||||||
apiPath + "download/"
|
|
||||||
}
|
|
||||||
val fragmentOffset = serverAndMediaId.indexOf("#")
|
|
||||||
var fragment = ""
|
|
||||||
if (fragmentOffset >= 0) {
|
|
||||||
fragment = serverAndMediaId.substring(fragmentOffset)
|
|
||||||
serverAndMediaId = serverAndMediaId.substring(0, fragmentOffset)
|
|
||||||
}
|
|
||||||
|
|
||||||
val resolvedUrl = if (scannerService.isScannerEnabled()) {
|
|
||||||
scannerService.getContentScannerServer()!!.ensureTrailingSlash()
|
|
||||||
} else {
|
|
||||||
baseUrl
|
|
||||||
}
|
|
||||||
return resolvedUrl + prefix + serverAndMediaId + params + fragment
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -18,7 +18,7 @@ package org.matrix.android.sdk.internal.session
|
||||||
|
|
||||||
import dagger.BindsInstance
|
import dagger.BindsInstance
|
||||||
import dagger.Component
|
import dagger.Component
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.ContentScannerModule
|
import org.matrix.android.sdk.internal.session.contentscanning.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
|
||||||
|
|
|
@ -23,6 +23,8 @@ import org.matrix.android.sdk.api.session.content.ContentUrlResolver
|
||||||
import org.matrix.android.sdk.api.session.contentscanning.ContentScannerService
|
import org.matrix.android.sdk.api.session.contentscanning.ContentScannerService
|
||||||
import org.matrix.android.sdk.internal.crypto.attachments.ElementToDecrypt
|
import org.matrix.android.sdk.internal.crypto.attachments.ElementToDecrypt
|
||||||
import org.matrix.android.sdk.internal.network.NetworkConstants
|
import org.matrix.android.sdk.internal.network.NetworkConstants
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.ScanEncryptorUtils
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.model.toJson
|
||||||
import org.matrix.android.sdk.internal.util.ensureTrailingSlash
|
import org.matrix.android.sdk.internal.util.ensureTrailingSlash
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
@ -35,6 +37,24 @@ internal class DefaultContentUrlResolver @Inject constructor(
|
||||||
|
|
||||||
override val uploadUrl = baseUrl + NetworkConstants.URI_API_MEDIA_PREFIX_PATH_R0 + "upload"
|
override val uploadUrl = baseUrl + NetworkConstants.URI_API_MEDIA_PREFIX_PATH_R0 + "upload"
|
||||||
|
|
||||||
|
override fun resolveForDownload(contentUrl: String?, elementToDecrypt: ElementToDecrypt?): ContentUrlResolver.ResolvedMethod? {
|
||||||
|
return if (scannerService.isScannerEnabled() && elementToDecrypt != null) {
|
||||||
|
val baseUrl = scannerService.getContentScannerServer()
|
||||||
|
val sep = if (baseUrl?.endsWith("/") == true) "" else "/"
|
||||||
|
|
||||||
|
val url = baseUrl + sep + NetworkConstants.URI_API_PREFIX_PATH_MEDIA_PROXY_UNSTABLE + "download_encrypted"
|
||||||
|
|
||||||
|
ContentUrlResolver.ResolvedMethod.POST(
|
||||||
|
url = url,
|
||||||
|
jsonBody = ScanEncryptorUtils
|
||||||
|
.getDownloadBodyAndEncryptIfNeeded(scannerService.serverPublicKey, contentUrl ?: "", elementToDecrypt)
|
||||||
|
.toJson()
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
resolveFullSize(contentUrl)?.let { ContentUrlResolver.ResolvedMethod.GET(it) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun resolveFullSize(contentUrl: String?): String? {
|
override fun resolveFullSize(contentUrl: String?): String? {
|
||||||
return contentUrl
|
return contentUrl
|
||||||
// do not allow non-mxc content URLs
|
// do not allow non-mxc content URLs
|
||||||
|
@ -42,7 +62,7 @@ internal class DefaultContentUrlResolver @Inject constructor(
|
||||||
?.let {
|
?.let {
|
||||||
resolve(
|
resolve(
|
||||||
contentUrl = it,
|
contentUrl = it,
|
||||||
prefix = NetworkConstants.URI_API_MEDIA_PREFIX_PATH_R0 + "download/"
|
toThumbnail = false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,20 +74,27 @@ internal class DefaultContentUrlResolver @Inject constructor(
|
||||||
?.let {
|
?.let {
|
||||||
resolve(
|
resolve(
|
||||||
contentUrl = it,
|
contentUrl = it,
|
||||||
prefix = NetworkConstants.URI_API_MEDIA_PREFIX_PATH_R0 + "thumbnail/",
|
toThumbnail = true,
|
||||||
params = "?width=$width&height=$height&method=${method.value}"
|
params = "?width=$width&height=$height&method=${method.value}"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun resolveForDownload(contentUrl: String?, elementToDecrypt: ElementToDecrypt?): ContentUrlResolver.ResolvedMethod? {
|
|
||||||
return resolveFullSize(contentUrl)?.let { ContentUrlResolver.ResolvedMethod.GET(it) }
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun resolve(contentUrl: String,
|
private fun resolve(contentUrl: String,
|
||||||
prefix: String,
|
toThumbnail: Boolean,
|
||||||
params: String = ""): String? {
|
params: String = ""): String? {
|
||||||
var serverAndMediaId = contentUrl.removePrefix(MatrixUrls.MATRIX_CONTENT_URI_SCHEME)
|
var serverAndMediaId = contentUrl.removePrefix(MatrixUrls.MATRIX_CONTENT_URI_SCHEME)
|
||||||
|
|
||||||
|
val apiPath = if (scannerService.isScannerEnabled()) {
|
||||||
|
NetworkConstants.URI_API_PREFIX_PATH_MEDIA_PROXY_UNSTABLE
|
||||||
|
} else {
|
||||||
|
NetworkConstants.URI_API_MEDIA_PREFIX_PATH_R0
|
||||||
|
}
|
||||||
|
val prefix = if (toThumbnail) {
|
||||||
|
apiPath + "thumbnail/"
|
||||||
|
} else {
|
||||||
|
apiPath + "download/"
|
||||||
|
}
|
||||||
val fragmentOffset = serverAndMediaId.indexOf("#")
|
val fragmentOffset = serverAndMediaId.indexOf("#")
|
||||||
var fragment = ""
|
var fragment = ""
|
||||||
if (fragmentOffset >= 0) {
|
if (fragmentOffset >= 0) {
|
||||||
|
@ -75,6 +102,11 @@ internal class DefaultContentUrlResolver @Inject constructor(
|
||||||
serverAndMediaId = serverAndMediaId.substring(0, fragmentOffset)
|
serverAndMediaId = serverAndMediaId.substring(0, fragmentOffset)
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseUrl + prefix + serverAndMediaId + params + fragment
|
val resolvedUrl = if (scannerService.isScannerEnabled()) {
|
||||||
|
scannerService.getContentScannerServer()!!.ensureTrailingSlash()
|
||||||
|
} else {
|
||||||
|
baseUrl
|
||||||
|
}
|
||||||
|
return resolvedUrl + prefix + serverAndMediaId + params + fragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning
|
package org.matrix.android.sdk.internal.session.contentscanning
|
||||||
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.model.DownloadBody
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.model.ScanResponse
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.model.ServerPublicKeyResponse
|
|
||||||
import okhttp3.ResponseBody
|
import okhttp3.ResponseBody
|
||||||
import org.matrix.android.sdk.internal.network.NetworkConstants
|
import org.matrix.android.sdk.internal.network.NetworkConstants
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.model.DownloadBody
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.model.ScanResponse
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.model.ServerPublicKeyResponse
|
||||||
import retrofit2.http.Body
|
import retrofit2.http.Body
|
||||||
import retrofit2.http.GET
|
import retrofit2.http.GET
|
||||||
import retrofit2.http.POST
|
import retrofit2.http.POST
|
|
@ -4,22 +4,11 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning
|
package org.matrix.android.sdk.internal.session.contentscanning
|
||||||
|
|
||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.data.ContentScanningStore
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.db.ContentScannerRealmModule
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.db.RealmContentScannerStore
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.tasks.DefaultDownloadEncryptedTask
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.tasks.DefaultGetServerPublicKeyTask
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.tasks.DefaultScanEncryptedTask
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.tasks.DefaultScanMediaTask
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.tasks.DownloadEncryptedTask
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.tasks.GetServerPublicKeyTask
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.tasks.ScanEncryptedTask
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.tasks.ScanMediaTask
|
|
||||||
import io.realm.RealmConfiguration
|
import io.realm.RealmConfiguration
|
||||||
import org.matrix.android.sdk.api.session.contentscanning.ContentScannerService
|
import org.matrix.android.sdk.api.session.contentscanning.ContentScannerService
|
||||||
import org.matrix.android.sdk.internal.database.RealmKeysUtils
|
import org.matrix.android.sdk.internal.database.RealmKeysUtils
|
||||||
|
@ -28,6 +17,17 @@ import org.matrix.android.sdk.internal.di.SessionFilesDirectory
|
||||||
import org.matrix.android.sdk.internal.di.UserMd5
|
import org.matrix.android.sdk.internal.di.UserMd5
|
||||||
import org.matrix.android.sdk.internal.session.SessionModule
|
import org.matrix.android.sdk.internal.session.SessionModule
|
||||||
import org.matrix.android.sdk.internal.session.SessionScope
|
import org.matrix.android.sdk.internal.session.SessionScope
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.data.ContentScanningStore
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.db.ContentScannerRealmModule
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.db.RealmContentScannerStore
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.tasks.DefaultDownloadEncryptedTask
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.tasks.DefaultGetServerPublicKeyTask
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.tasks.DefaultScanEncryptedTask
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.tasks.DefaultScanMediaTask
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.tasks.DownloadEncryptedTask
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.tasks.GetServerPublicKeyTask
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.tasks.ScanEncryptedTask
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.tasks.ScanMediaTask
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@Module
|
@Module
|
|
@ -4,9 +4,10 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning
|
package org.matrix.android.sdk.internal.session.contentscanning
|
||||||
|
|
||||||
import org.matrix.android.sdk.internal.session.SessionScope
|
import org.matrix.android.sdk.internal.session.SessionScope
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.ContentScanApi
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@SessionScope
|
@SessionScope
|
|
@ -4,17 +4,14 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning
|
package org.matrix.android.sdk.internal.session.contentscanning
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import dagger.Lazy
|
import dagger.Lazy
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.data.ContentScanningStore
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.tasks.GetServerPublicKeyTask
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.tasks.ScanEncryptedTask
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.tasks.ScanMediaTask
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import org.matrix.android.sdk.api.MatrixCallback
|
import org.matrix.android.sdk.api.MatrixCallback
|
||||||
|
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
|
||||||
import org.matrix.android.sdk.api.NoOpMatrixCallback
|
import org.matrix.android.sdk.api.NoOpMatrixCallback
|
||||||
import org.matrix.android.sdk.api.session.contentscanning.ContentScannerService
|
import org.matrix.android.sdk.api.session.contentscanning.ContentScannerService
|
||||||
import org.matrix.android.sdk.api.session.contentscanning.ScanState
|
import org.matrix.android.sdk.api.session.contentscanning.ScanState
|
||||||
|
@ -24,9 +21,12 @@ import org.matrix.android.sdk.internal.crypto.attachments.ElementToDecrypt
|
||||||
import org.matrix.android.sdk.internal.di.Unauthenticated
|
import org.matrix.android.sdk.internal.di.Unauthenticated
|
||||||
import org.matrix.android.sdk.internal.network.RetrofitFactory
|
import org.matrix.android.sdk.internal.network.RetrofitFactory
|
||||||
import org.matrix.android.sdk.internal.session.SessionScope
|
import org.matrix.android.sdk.internal.session.SessionScope
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.data.ContentScanningStore
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.tasks.GetServerPublicKeyTask
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.tasks.ScanEncryptedTask
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.tasks.ScanMediaTask
|
||||||
import org.matrix.android.sdk.internal.task.TaskExecutor
|
import org.matrix.android.sdk.internal.task.TaskExecutor
|
||||||
import org.matrix.android.sdk.internal.task.launchToCallback
|
import org.matrix.android.sdk.internal.task.launchToCallback
|
||||||
import org.matrix.android.sdk.internal.util.MatrixCoroutineDispatchers
|
|
||||||
import org.matrix.android.sdk.internal.util.awaitCallback
|
import org.matrix.android.sdk.internal.util.awaitCallback
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
|
@ -4,15 +4,15 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning
|
package org.matrix.android.sdk.internal.session.contentscanning
|
||||||
|
|
||||||
import org.matrix.android.sdk.internal.crypto.attachments.ElementToDecrypt
|
import org.matrix.android.sdk.internal.crypto.attachments.ElementToDecrypt
|
||||||
import org.matrix.android.sdk.internal.crypto.model.rest.EncryptedFileInfo
|
import org.matrix.android.sdk.internal.crypto.model.rest.EncryptedFileInfo
|
||||||
import org.matrix.android.sdk.internal.crypto.model.rest.EncryptedFileKey
|
import org.matrix.android.sdk.internal.crypto.model.rest.EncryptedFileKey
|
||||||
import org.matrix.android.sdk.internal.crypto.tools.withOlmEncryption
|
import org.matrix.android.sdk.internal.crypto.tools.withOlmEncryption
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.model.DownloadBody
|
import org.matrix.android.sdk.internal.session.contentscanning.model.DownloadBody
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.model.EncryptedBody
|
import org.matrix.android.sdk.internal.session.contentscanning.model.EncryptedBody
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.model.toCanonicalJson
|
import org.matrix.android.sdk.internal.session.contentscanning.model.toCanonicalJson
|
||||||
|
|
||||||
object ScanEncryptorUtils {
|
object ScanEncryptorUtils {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning.data
|
package org.matrix.android.sdk.internal.session.contentscanning.data
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import org.matrix.android.sdk.api.session.contentscanning.ScanState
|
import org.matrix.android.sdk.api.session.contentscanning.ScanState
|
|
@ -4,7 +4,7 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning.db
|
package org.matrix.android.sdk.internal.session.contentscanning.db
|
||||||
|
|
||||||
import io.realm.RealmObject
|
import io.realm.RealmObject
|
||||||
import io.realm.annotations.Index
|
import io.realm.annotations.Index
|
|
@ -4,7 +4,7 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning.db
|
package org.matrix.android.sdk.internal.session.contentscanning.db
|
||||||
|
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
import io.realm.kotlin.createObject
|
import io.realm.kotlin.createObject
|
|
@ -4,7 +4,7 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning.db
|
package org.matrix.android.sdk.internal.session.contentscanning.db
|
||||||
|
|
||||||
import io.realm.RealmObject
|
import io.realm.RealmObject
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning.db
|
package org.matrix.android.sdk.internal.session.contentscanning.db
|
||||||
|
|
||||||
import io.realm.annotations.RealmModule
|
import io.realm.annotations.RealmModule
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning.db
|
package org.matrix.android.sdk.internal.session.contentscanning.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 im.vector.matrix.android.sdk.internal.session.contentscanning.data.ContentScanningStore
|
import org.matrix.android.sdk.internal.session.contentscanning.data.ContentScanningStore
|
||||||
import org.matrix.android.sdk.api.session.contentscanning.ScanState
|
import org.matrix.android.sdk.api.session.contentscanning.ScanState
|
||||||
import org.matrix.android.sdk.api.session.contentscanning.ScanStatusInfo
|
import org.matrix.android.sdk.api.session.contentscanning.ScanStatusInfo
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
|
@ -4,7 +4,7 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning.model
|
package org.matrix.android.sdk.internal.session.contentscanning.model
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
|
@ -4,7 +4,7 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning.model
|
package org.matrix.android.sdk.internal.session.contentscanning.model
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
|
@ -4,7 +4,7 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning.model
|
package org.matrix.android.sdk.internal.session.contentscanning.model
|
||||||
|
|
||||||
import com.squareup.moshi.Json
|
import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
|
@ -4,13 +4,13 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning.tasks
|
package org.matrix.android.sdk.internal.session.contentscanning.tasks
|
||||||
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.ContentScanningApiProvider
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.ScanEncryptorUtils
|
|
||||||
import okhttp3.ResponseBody
|
import okhttp3.ResponseBody
|
||||||
import org.matrix.android.sdk.internal.crypto.attachments.ElementToDecrypt
|
import org.matrix.android.sdk.internal.crypto.attachments.ElementToDecrypt
|
||||||
import org.matrix.android.sdk.internal.network.executeRequest
|
import org.matrix.android.sdk.internal.network.executeRequest
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.ContentScanningApiProvider
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.ScanEncryptorUtils
|
||||||
import org.matrix.android.sdk.internal.task.Task
|
import org.matrix.android.sdk.internal.task.Task
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -4,13 +4,12 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning.tasks
|
package org.matrix.android.sdk.internal.session.contentscanning.tasks
|
||||||
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.ContentScanApi
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.model.ServerPublicKeyResponse
|
|
||||||
import org.matrix.android.sdk.internal.network.executeRequest
|
import org.matrix.android.sdk.internal.network.executeRequest
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.ContentScanApi
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.model.ServerPublicKeyResponse
|
||||||
import org.matrix.android.sdk.internal.task.Task
|
import org.matrix.android.sdk.internal.task.Task
|
||||||
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
internal interface GetServerPublicKeyTask : Task<GetServerPublicKeyTask.Params, String?> {
|
internal interface GetServerPublicKeyTask : Task<GetServerPublicKeyTask.Params, String?> {
|
|
@ -4,16 +4,16 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning.tasks
|
package org.matrix.android.sdk.internal.session.contentscanning.tasks
|
||||||
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.ContentScanningApiProvider
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.ScanEncryptorUtils
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.data.ContentScanningStore
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.model.ScanResponse
|
|
||||||
import org.matrix.android.sdk.api.failure.toScanFailure
|
import org.matrix.android.sdk.api.failure.toScanFailure
|
||||||
import org.matrix.android.sdk.api.session.contentscanning.ScanState
|
import org.matrix.android.sdk.api.session.contentscanning.ScanState
|
||||||
import org.matrix.android.sdk.internal.crypto.attachments.ElementToDecrypt
|
import org.matrix.android.sdk.internal.crypto.attachments.ElementToDecrypt
|
||||||
import org.matrix.android.sdk.internal.network.executeRequest
|
import org.matrix.android.sdk.internal.network.executeRequest
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.ContentScanningApiProvider
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.ScanEncryptorUtils
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.data.ContentScanningStore
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.model.ScanResponse
|
||||||
import org.matrix.android.sdk.internal.task.Task
|
import org.matrix.android.sdk.internal.task.Task
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
* Proprietary and confidential
|
* Proprietary and confidential
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package im.vector.matrix.android.sdk.internal.session.contentscanning.tasks
|
package org.matrix.android.sdk.internal.session.contentscanning.tasks
|
||||||
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.ContentScanningApiProvider
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.data.ContentScanningStore
|
|
||||||
import im.vector.matrix.android.sdk.internal.session.contentscanning.model.ScanResponse
|
|
||||||
import org.matrix.android.sdk.api.failure.toScanFailure
|
import org.matrix.android.sdk.api.failure.toScanFailure
|
||||||
import org.matrix.android.sdk.api.session.contentscanning.ScanState
|
import org.matrix.android.sdk.api.session.contentscanning.ScanState
|
||||||
import org.matrix.android.sdk.internal.network.executeRequest
|
import org.matrix.android.sdk.internal.network.executeRequest
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.ContentScanningApiProvider
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.data.ContentScanningStore
|
||||||
|
import org.matrix.android.sdk.internal.session.contentscanning.model.ScanResponse
|
||||||
import org.matrix.android.sdk.internal.task.Task
|
import org.matrix.android.sdk.internal.task.Task
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
Loading…
Reference in a new issue