mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-26 03:16:02 +03:00
Merge pull request #6064 from vector-im/feature/bma/detekt_end_period
Detekt: fix end period
This commit is contained in:
commit
3674ae7e63
718 changed files with 1680 additions and 1673 deletions
|
@ -17,7 +17,7 @@
|
||||||
package im.vector.lib.core.utils.epoxy.charsequence
|
package im.vector.lib.core.utils.epoxy.charsequence
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for a CharSequence, which support mutation of the CharSequence, which can happen during rendering
|
* Wrapper for a CharSequence, which support mutation of the CharSequence, which can happen during rendering.
|
||||||
*/
|
*/
|
||||||
class EpoxyCharSequence(val charSequence: CharSequence) {
|
class EpoxyCharSequence(val charSequence: CharSequence) {
|
||||||
private val hash = charSequence.toString().hashCode()
|
private val hash = charSequence.toString().hashCode()
|
||||||
|
|
|
@ -17,6 +17,6 @@
|
||||||
package im.vector.lib.core.utils.epoxy.charsequence
|
package im.vector.lib.core.utils.epoxy.charsequence
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extensions to wrap CharSequence to EpoxyCharSequence
|
* Extensions to wrap CharSequence to EpoxyCharSequence.
|
||||||
*/
|
*/
|
||||||
fun CharSequence.toEpoxyCharSequence() = EpoxyCharSequence(this)
|
fun CharSequence.toEpoxyCharSequence() = EpoxyCharSequence(this)
|
||||||
|
|
|
@ -22,7 +22,7 @@ import im.vector.lib.multipicker.entity.MultiPickerAudioType
|
||||||
import im.vector.lib.multipicker.utils.toMultiPickerAudioType
|
import im.vector.lib.multipicker.utils.toMultiPickerAudioType
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Audio file picker implementation
|
* Audio file picker implementation.
|
||||||
*/
|
*/
|
||||||
class AudioPicker : Picker<MultiPickerAudioType>() {
|
class AudioPicker : Picker<MultiPickerAudioType>() {
|
||||||
|
|
||||||
|
|
|
@ -28,12 +28,12 @@ import im.vector.lib.multipicker.utils.createTemporaryMediaFile
|
||||||
import im.vector.lib.multipicker.utils.toMultiPickerImageType
|
import im.vector.lib.multipicker.utils.toMultiPickerImageType
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of taking a photo with Camera
|
* Implementation of taking a photo with Camera.
|
||||||
*/
|
*/
|
||||||
class CameraPicker {
|
class CameraPicker {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start camera by using a ActivityResultLauncher
|
* Start camera by using a ActivityResultLauncher.
|
||||||
* @return Uri of taken photo or null if the operation is cancelled.
|
* @return Uri of taken photo or null if the operation is cancelled.
|
||||||
*/
|
*/
|
||||||
fun startWithExpectingFile(context: Context, activityResultLauncher: ActivityResultLauncher<Intent>): Uri {
|
fun startWithExpectingFile(context: Context, activityResultLauncher: ActivityResultLauncher<Intent>): Uri {
|
||||||
|
|
|
@ -28,12 +28,12 @@ import im.vector.lib.multipicker.utils.createTemporaryMediaFile
|
||||||
import im.vector.lib.multipicker.utils.toMultiPickerVideoType
|
import im.vector.lib.multipicker.utils.toMultiPickerVideoType
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of taking a video with Camera
|
* Implementation of taking a video with Camera.
|
||||||
*/
|
*/
|
||||||
class CameraVideoPicker {
|
class CameraVideoPicker {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start camera by using a ActivityResultLauncher
|
* Start camera by using a ActivityResultLauncher.
|
||||||
* @return Uri of taken photo or null if the operation is cancelled.
|
* @return Uri of taken photo or null if the operation is cancelled.
|
||||||
*/
|
*/
|
||||||
fun startWithExpectingFile(context: Context, activityResultLauncher: ActivityResultLauncher<Intent>): Uri {
|
fun startWithExpectingFile(context: Context, activityResultLauncher: ActivityResultLauncher<Intent>): Uri {
|
||||||
|
|
|
@ -26,7 +26,7 @@ import im.vector.lib.multipicker.entity.MultiPickerContactType
|
||||||
import im.vector.lib.multipicker.utils.getColumnIndexOrNull
|
import im.vector.lib.multipicker.utils.getColumnIndexOrNull
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contact Picker implementation
|
* Contact Picker implementation.
|
||||||
*/
|
*/
|
||||||
class ContactPicker : Picker<MultiPickerContactType>() {
|
class ContactPicker : Picker<MultiPickerContactType>() {
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ import im.vector.lib.multipicker.utils.toMultiPickerImageType
|
||||||
import im.vector.lib.multipicker.utils.toMultiPickerVideoType
|
import im.vector.lib.multipicker.utils.toMultiPickerVideoType
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of selecting any type of files
|
* Implementation of selecting any type of files.
|
||||||
*/
|
*/
|
||||||
class FilePicker : Picker<MultiPickerBaseType>() {
|
class FilePicker : Picker<MultiPickerBaseType>() {
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import im.vector.lib.multipicker.entity.MultiPickerImageType
|
||||||
import im.vector.lib.multipicker.utils.toMultiPickerImageType
|
import im.vector.lib.multipicker.utils.toMultiPickerImageType
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Image Picker implementation
|
* Image Picker implementation.
|
||||||
*/
|
*/
|
||||||
class ImagePicker : Picker<MultiPickerImageType>() {
|
class ImagePicker : Picker<MultiPickerImageType>() {
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import im.vector.lib.multipicker.utils.toMultiPickerImageType
|
||||||
import im.vector.lib.multipicker.utils.toMultiPickerVideoType
|
import im.vector.lib.multipicker.utils.toMultiPickerVideoType
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Image/Video Picker implementation
|
* Image/Video Picker implementation.
|
||||||
*/
|
*/
|
||||||
class MediaPicker : Picker<MultiPickerBaseMediaType>() {
|
class MediaPicker : Picker<MultiPickerBaseMediaType>() {
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ import android.net.Uri
|
||||||
import androidx.activity.result.ActivityResultLauncher
|
import androidx.activity.result.ActivityResultLauncher
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class to provide all types of Pickers
|
* Abstract class to provide all types of Pickers.
|
||||||
*/
|
*/
|
||||||
abstract class Picker<T> {
|
abstract class Picker<T> {
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import im.vector.lib.multipicker.entity.MultiPickerVideoType
|
||||||
import im.vector.lib.multipicker.utils.toMultiPickerVideoType
|
import im.vector.lib.multipicker.utils.toMultiPickerVideoType
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Video Picker implementation
|
* Video Picker implementation.
|
||||||
*/
|
*/
|
||||||
class VideoPicker : Picker<MultiPickerVideoType>() {
|
class VideoPicker : Picker<MultiPickerVideoType>() {
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ package org.matrix.android.sdk.api
|
||||||
interface MatrixCallback<in T> {
|
interface MatrixCallback<in T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On success method, default to no-op
|
* On success method, default to no-op.
|
||||||
* @param data the data successfully returned from the async function
|
* @param data the data successfully returned from the async function
|
||||||
*/
|
*/
|
||||||
fun onSuccess(data: T) {
|
fun onSuccess(data: T) {
|
||||||
|
@ -31,7 +31,7 @@ interface MatrixCallback<in T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On failure method, default to no-op
|
* On failure method, default to no-op.
|
||||||
* @param failure the failure data returned from the async function
|
* @param failure the failure data returned from the async function
|
||||||
*/
|
*/
|
||||||
fun onFailure(failure: Throwable) {
|
fun onFailure(failure: Throwable) {
|
||||||
|
@ -40,6 +40,6 @@ interface MatrixCallback<in T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic no op implementation
|
* Basic no op implementation.
|
||||||
*/
|
*/
|
||||||
class NoOpMatrixCallback<T> : MatrixCallback<T>
|
class NoOpMatrixCallback<T> : MatrixCallback<T>
|
||||||
|
|
|
@ -46,7 +46,7 @@ data class MatrixConfiguration(
|
||||||
*/
|
*/
|
||||||
val proxy: Proxy? = null,
|
val proxy: Proxy? = null,
|
||||||
/**
|
/**
|
||||||
* TLS versions and cipher suites limitation for unauthenticated requests
|
* TLS versions and cipher suites limitation for unauthenticated requests.
|
||||||
*/
|
*/
|
||||||
val connectionSpec: ConnectionSpec = ConnectionSpec.RESTRICTED_TLS,
|
val connectionSpec: ConnectionSpec = ConnectionSpec.RESTRICTED_TLS,
|
||||||
/**
|
/**
|
||||||
|
@ -62,7 +62,7 @@ data class MatrixConfiguration(
|
||||||
*/
|
*/
|
||||||
val roomDisplayNameFallbackProvider: RoomDisplayNameFallbackProvider,
|
val roomDisplayNameFallbackProvider: RoomDisplayNameFallbackProvider,
|
||||||
/**
|
/**
|
||||||
* Thread messages default enable/disabled value
|
* Thread messages default enable/disabled value.
|
||||||
*/
|
*/
|
||||||
val threadMessagesEnabledDefault: Boolean = false,
|
val threadMessagesEnabledDefault: Boolean = false,
|
||||||
)
|
)
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package org.matrix.android.sdk.api
|
package org.matrix.android.sdk.api
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This object define some global constants regarding the Matrix specification
|
* This object define some global constants regarding the Matrix specification.
|
||||||
*/
|
*/
|
||||||
object MatrixConstants {
|
object MatrixConstants {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -147,7 +147,7 @@ object MatrixPatterns {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract server name from a matrix id
|
* Extract server name from a matrix id.
|
||||||
*
|
*
|
||||||
* @param matrixId
|
* @param matrixId
|
||||||
* @return null if not found or if matrixId is null
|
* @return null if not found or if matrixId is null
|
||||||
|
@ -172,7 +172,7 @@ object MatrixPatterns {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the domain form a userId
|
* Return the domain form a userId.
|
||||||
* Examples:
|
* Examples:
|
||||||
* - "@alice:domain.org".getDomain() will return "domain.org"
|
* - "@alice:domain.org".getDomain() will return "domain.org"
|
||||||
* - "@bob:domain.org:3455".getDomain() will return "domain.org:3455"
|
* - "@bob:domain.org:3455".getDomain() will return "domain.org:3455"
|
||||||
|
|
|
@ -17,21 +17,21 @@
|
||||||
package org.matrix.android.sdk.api
|
package org.matrix.android.sdk.api
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class contains pattern to match Matrix Url, aka mxc urls
|
* This class contains pattern to match Matrix Url, aka mxc urls.
|
||||||
*/
|
*/
|
||||||
object MatrixUrls {
|
object MatrixUrls {
|
||||||
/**
|
/**
|
||||||
* "mxc" scheme, including "://". So "mxc://"
|
* "mxc" scheme, including "://". So "mxc://".
|
||||||
*/
|
*/
|
||||||
const val MATRIX_CONTENT_URI_SCHEME = "mxc://"
|
const val MATRIX_CONTENT_URI_SCHEME = "mxc://"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the String starts with "mxc://"
|
* Return true if the String starts with "mxc://".
|
||||||
*/
|
*/
|
||||||
fun String.isMxcUrl() = startsWith(MATRIX_CONTENT_URI_SCHEME)
|
fun String.isMxcUrl() = startsWith(MATRIX_CONTENT_URI_SCHEME)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the "mxc://" prefix. No op if the String is not a Mxc URL
|
* Remove the "mxc://" prefix. No op if the String is not a Mxc URL.
|
||||||
*/
|
*/
|
||||||
fun String.removeMxcPrefix() = removePrefix(MATRIX_CONTENT_URI_SCHEME)
|
fun String.removeMxcPrefix() = removePrefix(MATRIX_CONTENT_URI_SCHEME)
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,12 +40,12 @@ interface AuthenticationService {
|
||||||
suspend fun getLoginFlowOfSession(sessionId: String): LoginFlowResult
|
suspend fun getLoginFlowOfSession(sessionId: String): LoginFlowResult
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a SSO url
|
* Get a SSO url.
|
||||||
*/
|
*/
|
||||||
fun getSsoUrl(redirectUrl: String, deviceId: String?, providerId: String?): String?
|
fun getSsoUrl(redirectUrl: String, deviceId: String?, providerId: String?): String?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the sign in or sign up fallback URL
|
* Get the sign in or sign up fallback URL.
|
||||||
*/
|
*/
|
||||||
fun getFallbackUrl(forSignIn: Boolean, deviceId: String?): String?
|
fun getFallbackUrl(forSignIn: Boolean, deviceId: String?): String?
|
||||||
|
|
||||||
|
@ -64,17 +64,17 @@ interface AuthenticationService {
|
||||||
fun getRegistrationWizard(): RegistrationWizard
|
fun getRegistrationWizard(): RegistrationWizard
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True when login and password has been sent with success to the homeserver
|
* True when login and password has been sent with success to the homeserver.
|
||||||
*/
|
*/
|
||||||
val isRegistrationStarted: Boolean
|
val isRegistrationStarted: Boolean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel pending login or pending registration
|
* Cancel pending login or pending registration.
|
||||||
*/
|
*/
|
||||||
suspend fun cancelPendingLoginOrRegistration()
|
suspend fun cancelPendingLoginOrRegistration()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset all pending settings, including current HomeServerConnectionConfig
|
* Reset all pending settings, including current HomeServerConnectionConfig.
|
||||||
*/
|
*/
|
||||||
suspend fun reset()
|
suspend fun reset()
|
||||||
|
|
||||||
|
@ -91,20 +91,20 @@ interface AuthenticationService {
|
||||||
fun getLastAuthenticatedSession(): Session?
|
fun getLastAuthenticatedSession(): Session?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a session after a SSO successful login
|
* Create a session after a SSO successful login.
|
||||||
*/
|
*/
|
||||||
suspend fun createSessionFromSso(homeServerConnectionConfig: HomeServerConnectionConfig,
|
suspend fun createSessionFromSso(homeServerConnectionConfig: HomeServerConnectionConfig,
|
||||||
credentials: Credentials): Session
|
credentials: Credentials): Session
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform a wellknown request, using the domain from the matrixId
|
* Perform a wellknown request, using the domain from the matrixId.
|
||||||
*/
|
*/
|
||||||
suspend fun getWellKnownData(matrixId: String,
|
suspend fun getWellKnownData(matrixId: String,
|
||||||
homeServerConnectionConfig: HomeServerConnectionConfig?): WellknownResult
|
homeServerConnectionConfig: HomeServerConnectionConfig?): WellknownResult
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Authenticate with a matrixId and a password
|
* Authenticate with a matrixId and a password.
|
||||||
* Usually call this after a successful call to getWellKnownData()
|
* Usually call this after a successful call to getWellKnownData().
|
||||||
* @param homeServerConnectionConfig the information about the homeserver and other configuration
|
* @param homeServerConnectionConfig the information about the homeserver and other configuration
|
||||||
* @param matrixId the matrixId of the user
|
* @param matrixId the matrixId of the user
|
||||||
* @param password the password of the account
|
* @param password the password of the account
|
||||||
|
|
|
@ -20,7 +20,7 @@ import com.squareup.moshi.JsonClass
|
||||||
import org.matrix.android.sdk.api.auth.data.LoginFlowTypes
|
import org.matrix.android.sdk.api.auth.data.LoginFlowTypes
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides the authentication data by using user and password
|
* This class provides the authentication data by using user and password.
|
||||||
*/
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class TokenBasedAuth(
|
data class TokenBasedAuth(
|
||||||
|
|
|
@ -20,7 +20,7 @@ import com.squareup.moshi.JsonClass
|
||||||
import org.matrix.android.sdk.api.auth.data.LoginFlowTypes
|
import org.matrix.android.sdk.api.auth.data.LoginFlowTypes
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides the authentication data by using user and password
|
* This class provides the authentication data by using user and password.
|
||||||
*/
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class UserPasswordAuth(
|
data class UserPasswordAuth(
|
||||||
|
|
|
@ -37,7 +37,7 @@ data class Credentials(
|
||||||
*/
|
*/
|
||||||
@Json(name = "access_token") val accessToken: String,
|
@Json(name = "access_token") val accessToken: String,
|
||||||
/**
|
/**
|
||||||
* Not documented
|
* Not documented.
|
||||||
*/
|
*/
|
||||||
@Json(name = "refresh_token") val refreshToken: String?,
|
@Json(name = "refresh_token") val refreshToken: String?,
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -22,12 +22,12 @@ package org.matrix.android.sdk.api.auth.data
|
||||||
*/
|
*/
|
||||||
data class SessionParams(
|
data class SessionParams(
|
||||||
/**
|
/**
|
||||||
* Please consider using shortcuts instead
|
* Please consider using shortcuts instead.
|
||||||
*/
|
*/
|
||||||
val credentials: Credentials,
|
val credentials: Credentials,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Please consider using shortcuts instead
|
* Please consider using shortcuts instead.
|
||||||
*/
|
*/
|
||||||
val homeServerConnectionConfig: HomeServerConnectionConfig,
|
val homeServerConnectionConfig: HomeServerConnectionConfig,
|
||||||
|
|
||||||
|
@ -41,12 +41,12 @@ data class SessionParams(
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The userId of the session (Ex: "@user:domain.org")
|
* The userId of the session (Ex: "@user:domain.org").
|
||||||
*/
|
*/
|
||||||
val userId = credentials.userId
|
val userId = credentials.userId
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The deviceId of the session (Ex: "ABCDEFGH")
|
* The deviceId of the session (Ex: "ABCDEFGH").
|
||||||
*/
|
*/
|
||||||
val deviceId = credentials.deviceId
|
val deviceId = credentials.deviceId
|
||||||
|
|
||||||
|
@ -62,12 +62,12 @@ data class SessionParams(
|
||||||
val homeServerUrlBase = homeServerConnectionConfig.homeServerUriBase.toString()
|
val homeServerUrlBase = homeServerConnectionConfig.homeServerUriBase.toString()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current homeserver host, using what has been entered by the user during login phase
|
* The current homeserver host, using what has been entered by the user during login phase.
|
||||||
*/
|
*/
|
||||||
val homeServerHost = homeServerConnectionConfig.homeServerUri.host
|
val homeServerHost = homeServerConnectionConfig.homeServerUri.host
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default identity server url if any, returned by the homeserver during login phase
|
* The default identity server url if any, returned by the homeserver during login phase.
|
||||||
*/
|
*/
|
||||||
val defaultIdentityServerUrl = homeServerConnectionConfig.identityServerUri?.toString()
|
val defaultIdentityServerUrl = homeServerConnectionConfig.identityServerUri?.toString()
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ import org.matrix.android.sdk.api.util.JsonDict
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
|
* .
|
||||||
*/
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class WellKnown(
|
data class WellKnown(
|
||||||
|
|
|
@ -26,6 +26,7 @@ import com.squareup.moshi.JsonClass
|
||||||
* "base_url": "https://vector.im"
|
* "base_url": "https://vector.im"
|
||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
|
* .
|
||||||
*/
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class WellKnownBaseConfig(
|
data class WellKnownBaseConfig(
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.matrix.android.sdk.api.util.JsonDict
|
||||||
*/
|
*/
|
||||||
interface LoginWizard {
|
interface LoginWizard {
|
||||||
/**
|
/**
|
||||||
* Get some information about a matrixId: displayName and avatar url
|
* Get some information about a matrixId: displayName and avatar url.
|
||||||
*/
|
*/
|
||||||
suspend fun getProfileInfo(matrixId: String): LoginProfileInfo
|
suspend fun getProfileInfo(matrixId: String): LoginProfileInfo
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ data class RegistrationFlowResponse(
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert to something easier to handle on client side
|
* Convert to something easier to handle on client side.
|
||||||
*/
|
*/
|
||||||
fun RegistrationFlowResponse.toFlowResult(): FlowResult {
|
fun RegistrationFlowResponse.toFlowResult(): FlowResult {
|
||||||
// Get all the returned stages
|
// Get all the returned stages
|
||||||
|
|
|
@ -32,7 +32,7 @@ const val MXCRYPTO_ALGORITHM_MEGOLM = "m.megolm.v1.aes-sha2"
|
||||||
const val MXCRYPTO_ALGORITHM_MEGOLM_BACKUP = "m.megolm_backup.v1.curve25519-aes-sha2"
|
const val MXCRYPTO_ALGORITHM_MEGOLM_BACKUP = "m.megolm_backup.v1.curve25519-aes-sha2"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Secured Shared Storage algorithm constant
|
* Secured Shared Storage algorithm constant.
|
||||||
*/
|
*/
|
||||||
const val SSSS_ALGORITHM_CURVE25519_AES_SHA2 = "m.secret_storage.v1.curve25519-aes-sha2"
|
const val SSSS_ALGORITHM_CURVE25519_AES_SHA2 = "m.secret_storage.v1.curve25519-aes-sha2"
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.matrix.android.sdk.api.session.crypto.verification.EmojiRepresentatio
|
||||||
import org.matrix.android.sdk.internal.crypto.verification.getEmojiForCode
|
import org.matrix.android.sdk.internal.crypto.verification.getEmojiForCode
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide all the emojis used for SAS verification (for debug purpose)
|
* Provide all the emojis used for SAS verification (for debug purpose).
|
||||||
*/
|
*/
|
||||||
fun getAllVerificationEmojis(): List<EmojiRepresentation> {
|
fun getAllVerificationEmojis(): List<EmojiRepresentation> {
|
||||||
return (0..63).map { getEmojiForCode(it) }
|
return (0..63).map { getEmojiForCode(it) }
|
||||||
|
|
|
@ -24,6 +24,6 @@ fun CharSequence.ensurePrefix(prefix: CharSequence): CharSequence {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append a new line and then the provided string
|
* Append a new line and then the provided string.
|
||||||
*/
|
*/
|
||||||
fun StringBuilder.appendNl(str: String) = append("\n").append(str)
|
fun StringBuilder.appendNl(str: String) = append("\n").append(str)
|
||||||
|
|
|
@ -47,7 +47,7 @@ fun Throwable.shouldBeRetried() = this is Failure.NetworkConnection ||
|
||||||
isLimitExceededError()
|
isLimitExceededError()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the retry delay in case of rate limit exceeded error, adding 100 ms, of defaultValue otherwise
|
* Get the retry delay in case of rate limit exceeded error, adding 100 ms, of defaultValue otherwise.
|
||||||
*/
|
*/
|
||||||
fun Throwable.getRetryDelay(defaultValue: Long): Long {
|
fun Throwable.getRetryDelay(defaultValue: Long): Long {
|
||||||
return (this as? Failure.ServerError)
|
return (this as? Failure.ServerError)
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
package org.matrix.android.sdk.api.failure
|
package org.matrix.android.sdk.api.failure
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This enum provide the reason why the SDK request an initial sync to the application
|
* This enum provide the reason why the SDK request an initial sync to the application.
|
||||||
*/
|
*/
|
||||||
enum class InitialSyncRequestReason {
|
enum class InitialSyncRequestReason {
|
||||||
/**
|
/**
|
||||||
* The list of ignored users has changed, and at least one user who was ignored is not ignored anymore
|
* The list of ignored users has changed, and at least one user who was ignored is not ignored anymore.
|
||||||
*/
|
*/
|
||||||
IGNORED_USERS_LIST_CHANGE,
|
IGNORED_USERS_LIST_CHANGE,
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,9 @@ import org.matrix.android.sdk.api.util.JsonDict
|
||||||
*/
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class MatrixError(
|
data class MatrixError(
|
||||||
/** unique string which can be used to handle an error message */
|
/** unique string which can be used to handle an error message. */
|
||||||
@Json(name = "errcode") val code: String,
|
@Json(name = "errcode") val code: String,
|
||||||
/** human-readable error message */
|
/** human-readable error message. */
|
||||||
@Json(name = "error") val message: String,
|
@Json(name = "error") val message: String,
|
||||||
|
|
||||||
// For M_CONSENT_NOT_GIVEN
|
// For M_CONSENT_NOT_GIVEN
|
||||||
|
@ -92,19 +92,19 @@ data class MatrixError(
|
||||||
/** Sent when the room alias given to the createRoom API is already in use. */
|
/** Sent when the room alias given to the createRoom API is already in use. */
|
||||||
const val M_ROOM_IN_USE = "M_ROOM_IN_USE"
|
const val M_ROOM_IN_USE = "M_ROOM_IN_USE"
|
||||||
|
|
||||||
/** (Not documented yet) */
|
/** (Not documented yet). */
|
||||||
const val M_BAD_PAGINATION = "M_BAD_PAGINATION"
|
const val M_BAD_PAGINATION = "M_BAD_PAGINATION"
|
||||||
|
|
||||||
/** The request was not correctly authorized. Usually due to login failures. */
|
/** The request was not correctly authorized. Usually due to login failures. */
|
||||||
const val M_UNAUTHORIZED = "M_UNAUTHORIZED"
|
const val M_UNAUTHORIZED = "M_UNAUTHORIZED"
|
||||||
|
|
||||||
/** (Not documented yet) */
|
/** (Not documented yet). */
|
||||||
const val M_OLD_VERSION = "M_OLD_VERSION"
|
const val M_OLD_VERSION = "M_OLD_VERSION"
|
||||||
|
|
||||||
/** The server did not understand the request. */
|
/** The server did not understand the request. */
|
||||||
const val M_UNRECOGNIZED = "M_UNRECOGNIZED"
|
const val M_UNRECOGNIZED = "M_UNRECOGNIZED"
|
||||||
|
|
||||||
/** (Not documented yet) */
|
/** (Not documented yet). */
|
||||||
const val M_LOGIN_EMAIL_URL_NOT_YET = "M_LOGIN_EMAIL_URL_NOT_YET"
|
const val M_LOGIN_EMAIL_URL_NOT_YET = "M_LOGIN_EMAIL_URL_NOT_YET"
|
||||||
|
|
||||||
/** Authentication could not be performed on the third party identifier. */
|
/** Authentication could not be performed on the third party identifier. */
|
||||||
|
@ -122,7 +122,7 @@ data class MatrixError(
|
||||||
/** The request or entity was too large. */
|
/** The request or entity was too large. */
|
||||||
const val M_TOO_LARGE = "M_TOO_LARGE"
|
const val M_TOO_LARGE = "M_TOO_LARGE"
|
||||||
|
|
||||||
/** (Not documented yet) */
|
/** (Not documented yet). */
|
||||||
const val M_CONSENT_NOT_GIVEN = "M_CONSENT_NOT_GIVEN"
|
const val M_CONSENT_NOT_GIVEN = "M_CONSENT_NOT_GIVEN"
|
||||||
|
|
||||||
/** The request cannot be completed because the homeserver has reached a resource limit imposed on it. For example,
|
/** The request cannot be completed because the homeserver has reached a resource limit imposed on it. For example,
|
||||||
|
@ -176,10 +176,10 @@ data class MatrixError(
|
||||||
/** The user is unable to reject an invite to join the server notices room. See the Server Notices module for more information. */
|
/** The user is unable to reject an invite to join the server notices room. See the Server Notices module for more information. */
|
||||||
const val M_CANNOT_LEAVE_SERVER_NOTICE_ROOM = "M_CANNOT_LEAVE_SERVER_NOTICE_ROOM"
|
const val M_CANNOT_LEAVE_SERVER_NOTICE_ROOM = "M_CANNOT_LEAVE_SERVER_NOTICE_ROOM"
|
||||||
|
|
||||||
/** (Not documented yet) */
|
/** (Not documented yet). */
|
||||||
const val M_WRONG_ROOM_KEYS_VERSION = "M_WRONG_ROOM_KEYS_VERSION"
|
const val M_WRONG_ROOM_KEYS_VERSION = "M_WRONG_ROOM_KEYS_VERSION"
|
||||||
|
|
||||||
/** (Not documented yet) */
|
/** (Not documented yet). */
|
||||||
const val M_WEAK_PASSWORD = "M_WEAK_PASSWORD"
|
const val M_WEAK_PASSWORD = "M_WEAK_PASSWORD"
|
||||||
|
|
||||||
/** The provided password's length is shorter than the minimum length required by the server. */
|
/** The provided password's length is shorter than the minimum length required by the server. */
|
||||||
|
|
|
@ -18,7 +18,7 @@ package org.matrix.android.sdk.api.federation
|
||||||
|
|
||||||
interface FederationService {
|
interface FederationService {
|
||||||
/**
|
/**
|
||||||
* Get information about the homeserver
|
* Get information about the homeserver.
|
||||||
*/
|
*/
|
||||||
suspend fun getFederationVersion(): FederationVersion
|
suspend fun getFederationVersion(): FederationVersion
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package org.matrix.android.sdk.api.listeners
|
package org.matrix.android.sdk.api.listeners
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface to send a progress info
|
* Interface to send a progress info.
|
||||||
*/
|
*/
|
||||||
interface ProgressListener {
|
interface ProgressListener {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package org.matrix.android.sdk.api.listeners
|
package org.matrix.android.sdk.api.listeners
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface to send a progress info
|
* Interface to send a progress info.
|
||||||
*/
|
*/
|
||||||
interface StepProgressListener {
|
interface StepProgressListener {
|
||||||
|
|
||||||
|
|
|
@ -36,19 +36,19 @@ sealed interface QueryStringValue {
|
||||||
|
|
||||||
enum class Case {
|
enum class Case {
|
||||||
/**
|
/**
|
||||||
* Match query sensitive to case
|
* Match query sensitive to case.
|
||||||
*/
|
*/
|
||||||
SENSITIVE,
|
SENSITIVE,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Match query insensitive to case, this only works for Latin-1 character sets
|
* Match query insensitive to case, this only works for Latin-1 character sets.
|
||||||
*/
|
*/
|
||||||
INSENSITIVE,
|
INSENSITIVE,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Match query with input normalized (case insensitive)
|
* Match query with input normalized (case insensitive).
|
||||||
* Works around Realms inability to sort or filter by case for non Latin-1 character sets
|
* Works around Realms inability to sort or filter by case for non Latin-1 character sets.
|
||||||
* Expects the target field to contain normalized data
|
* Expects the target field to contain normalized data.
|
||||||
*
|
*
|
||||||
* @see org.matrix.android.sdk.internal.util.Normalizer.normalize
|
* @see org.matrix.android.sdk.internal.util.Normalizer.normalize
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -23,19 +23,19 @@ import org.matrix.android.sdk.api.cache.CacheStrategy
|
||||||
*/
|
*/
|
||||||
interface RawService {
|
interface RawService {
|
||||||
/**
|
/**
|
||||||
* Get a URL, either from cache or from the remote server, depending on the cache strategy
|
* Get a URL, either from cache or from the remote server, depending on the cache strategy.
|
||||||
*/
|
*/
|
||||||
suspend fun getUrl(url: String, cacheStrategy: CacheStrategy): String
|
suspend fun getUrl(url: String, cacheStrategy: CacheStrategy): String
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specific case for the well-known file. Cache validity is 8 hours
|
* Specific case for the well-known file. Cache validity is 8 hours.
|
||||||
* @param domain the domain to get the .well-known file, for instance "matrix.org".
|
* @param domain the domain to get the .well-known file, for instance "matrix.org".
|
||||||
* The URL will be "https://{domain}/.well-known/matrix/client"
|
* The URL will be "https://{domain}/.well-known/matrix/client"
|
||||||
*/
|
*/
|
||||||
suspend fun getWellknown(domain: String): String
|
suspend fun getWellknown(domain: String): String
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear all the cache data
|
* Clear all the cache data.
|
||||||
*/
|
*/
|
||||||
suspend fun clearCache()
|
suspend fun clearCache()
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,23 +72,23 @@ interface Session {
|
||||||
val coroutineDispatchers: MatrixCoroutineDispatchers
|
val coroutineDispatchers: MatrixCoroutineDispatchers
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The params associated to the session
|
* The params associated to the session.
|
||||||
*/
|
*/
|
||||||
val sessionParams: SessionParams
|
val sessionParams: SessionParams
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The session is valid, i.e. it has a valid token so far
|
* The session is valid, i.e. it has a valid token so far.
|
||||||
*/
|
*/
|
||||||
val isOpenable: Boolean
|
val isOpenable: Boolean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Useful shortcut to get access to the userId
|
* Useful shortcut to get access to the userId.
|
||||||
*/
|
*/
|
||||||
val myUserId: String
|
val myUserId: String
|
||||||
get() = sessionParams.userId
|
get() = sessionParams.userId
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The sessionId
|
* The sessionId.
|
||||||
*/
|
*/
|
||||||
val sessionId: String
|
val sessionId: String
|
||||||
|
|
||||||
|
@ -99,16 +99,16 @@ interface Session {
|
||||||
fun open()
|
fun open()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requires a one time background sync
|
* Requires a one time background sync.
|
||||||
*/
|
*/
|
||||||
fun requireBackgroundSync()
|
fun requireBackgroundSync()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launches infinite self rescheduling background syncs via the WorkManager
|
* Launches infinite self rescheduling background syncs via the WorkManager.
|
||||||
*
|
*
|
||||||
* While dozing, syncs will only occur during maintenance windows
|
* While dozing, syncs will only occur during maintenance windows.
|
||||||
* For reliability it's recommended to also start a long running foreground service
|
* For reliability it's recommended to also start a long running foreground service
|
||||||
* along with disabling battery optimizations
|
* along with disabling battery optimizations.
|
||||||
*/
|
*/
|
||||||
fun startAutomaticBackgroundSync(timeOutInSeconds: Long, repeatDelayInSeconds: Long)
|
fun startAutomaticBackgroundSync(timeOutInSeconds: Long, repeatDelayInSeconds: Long)
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ interface Session {
|
||||||
fun stopSync()
|
fun stopSync()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear cache of the session
|
* Clear cache of the session.
|
||||||
*/
|
*/
|
||||||
suspend fun clearCache()
|
suspend fun clearCache()
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ interface Session {
|
||||||
fun syncFlow(): SharedFlow<SyncResponse>
|
fun syncFlow(): SharedFlow<SyncResponse>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This methods return true if an initial sync has been processed
|
* This methods return true if an initial sync has been processed.
|
||||||
*/
|
*/
|
||||||
fun hasAlreadySynced(): Boolean
|
fun hasAlreadySynced(): Boolean
|
||||||
|
|
||||||
|
@ -162,187 +162,187 @@ interface Session {
|
||||||
fun contentUrlResolver(): ContentUrlResolver
|
fun contentUrlResolver(): ContentUrlResolver
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ContentUploadProgressTracker associated with the session
|
* Returns the ContentUploadProgressTracker associated with the session.
|
||||||
*/
|
*/
|
||||||
fun contentUploadProgressTracker(): ContentUploadStateTracker
|
fun contentUploadProgressTracker(): ContentUploadStateTracker
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the TypingUsersTracker associated with the session
|
* Returns the TypingUsersTracker associated with the session.
|
||||||
*/
|
*/
|
||||||
fun typingUsersTracker(): TypingUsersTracker
|
fun typingUsersTracker(): TypingUsersTracker
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ContentDownloadStateTracker associated with the session
|
* Returns the ContentDownloadStateTracker associated with the session.
|
||||||
*/
|
*/
|
||||||
fun contentDownloadProgressTracker(): ContentDownloadStateTracker
|
fun contentDownloadProgressTracker(): ContentDownloadStateTracker
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the cryptoService associated with the session
|
* Returns the cryptoService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun cryptoService(): CryptoService
|
fun cryptoService(): CryptoService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ContentScannerService associated with the session
|
* Returns the ContentScannerService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun contentScannerService(): ContentScannerService
|
fun contentScannerService(): ContentScannerService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the identity service associated with the session
|
* Returns the identity service associated with the session.
|
||||||
*/
|
*/
|
||||||
fun identityService(): IdentityService
|
fun identityService(): IdentityService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the HomeServerCapabilities service associated with the session
|
* Returns the HomeServerCapabilities service associated with the session.
|
||||||
*/
|
*/
|
||||||
fun homeServerCapabilitiesService(): HomeServerCapabilitiesService
|
fun homeServerCapabilitiesService(): HomeServerCapabilitiesService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the RoomService associated with the session
|
* Returns the RoomService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun roomService(): RoomService
|
fun roomService(): RoomService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the RoomDirectoryService associated with the session
|
* Returns the RoomDirectoryService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun roomDirectoryService(): RoomDirectoryService
|
fun roomDirectoryService(): RoomDirectoryService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the GroupService associated with the session
|
* Returns the GroupService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun groupService(): GroupService
|
fun groupService(): GroupService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the UserService associated with the session
|
* Returns the UserService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun userService(): UserService
|
fun userService(): UserService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the SignOutService associated with the session
|
* Returns the SignOutService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun signOutService(): SignOutService
|
fun signOutService(): SignOutService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the FilterService associated with the session
|
* Returns the FilterService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun filterService(): FilterService
|
fun filterService(): FilterService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the PushRuleService associated with the session
|
* Returns the PushRuleService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun pushRuleService(): PushRuleService
|
fun pushRuleService(): PushRuleService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the PushersService associated with the session
|
* Returns the PushersService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun pushersService(): PushersService
|
fun pushersService(): PushersService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the EventService associated with the session
|
* Returns the EventService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun eventService(): EventService
|
fun eventService(): EventService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the TermsService associated with the session
|
* Returns the TermsService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun termsService(): TermsService
|
fun termsService(): TermsService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the SyncStatusService associated with the session
|
* Returns the SyncStatusService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun syncStatusService(): SyncStatusService
|
fun syncStatusService(): SyncStatusService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the SecureStorageService associated with the session
|
* Returns the SecureStorageService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun secureStorageService(): SecureStorageService
|
fun secureStorageService(): SecureStorageService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ProfileService associated with the session
|
* Returns the ProfileService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun profileService(): ProfileService
|
fun profileService(): ProfileService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the PresenceService associated with the session
|
* Returns the PresenceService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun presenceService(): PresenceService
|
fun presenceService(): PresenceService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the AccountService associated with the session
|
* Returns the AccountService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun accountService(): AccountService
|
fun accountService(): AccountService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ToDeviceService associated with the session
|
* Returns the ToDeviceService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun toDeviceService(): ToDeviceService
|
fun toDeviceService(): ToDeviceService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the EventStreamService associated with the session
|
* Returns the EventStreamService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun eventStreamService(): EventStreamService
|
fun eventStreamService(): EventStreamService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the widget service associated with the session
|
* Returns the widget service associated with the session.
|
||||||
*/
|
*/
|
||||||
fun widgetService(): WidgetService
|
fun widgetService(): WidgetService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the media service associated with the session
|
* Returns the media service associated with the session.
|
||||||
*/
|
*/
|
||||||
fun mediaService(): MediaService
|
fun mediaService(): MediaService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the integration manager service associated with the session
|
* Returns the integration manager service associated with the session.
|
||||||
*/
|
*/
|
||||||
fun integrationManagerService(): IntegrationManagerService
|
fun integrationManagerService(): IntegrationManagerService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the call signaling service associated with the session
|
* Returns the call signaling service associated with the session.
|
||||||
*/
|
*/
|
||||||
fun callSignalingService(): CallSignalingService
|
fun callSignalingService(): CallSignalingService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the file download service associated with the session
|
* Returns the file download service associated with the session.
|
||||||
*/
|
*/
|
||||||
fun fileService(): FileService
|
fun fileService(): FileService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the permalink service associated with the session
|
* Returns the permalink service associated with the session.
|
||||||
*/
|
*/
|
||||||
fun permalinkService(): PermalinkService
|
fun permalinkService(): PermalinkService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the search service associated with the session
|
* Returns the search service associated with the session.
|
||||||
*/
|
*/
|
||||||
fun searchService(): SearchService
|
fun searchService(): SearchService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the federation service associated with the session
|
* Returns the federation service associated with the session.
|
||||||
*/
|
*/
|
||||||
fun federationService(): FederationService
|
fun federationService(): FederationService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the third party service associated with the session
|
* Returns the third party service associated with the session.
|
||||||
*/
|
*/
|
||||||
fun thirdPartyService(): ThirdPartyService
|
fun thirdPartyService(): ThirdPartyService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the space service associated with the session
|
* Returns the space service associated with the session.
|
||||||
*/
|
*/
|
||||||
fun spaceService(): SpaceService
|
fun spaceService(): SpaceService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the open id service associated with the session
|
* Returns the open id service associated with the session.
|
||||||
*/
|
*/
|
||||||
fun openIdService(): OpenIdService
|
fun openIdService(): OpenIdService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the account data service associated with the session
|
* Returns the account data service associated with the session.
|
||||||
*/
|
*/
|
||||||
fun accountDataService(): SessionAccountDataService
|
fun accountDataService(): SessionAccountDataService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the SharedSecretStorageService associated with the session
|
* Returns the SharedSecretStorageService associated with the session.
|
||||||
*/
|
*/
|
||||||
fun sharedSecretStorageService(): SharedSecretStorageService
|
fun sharedSecretStorageService(): SharedSecretStorageService
|
||||||
|
|
||||||
|
@ -377,8 +377,8 @@ interface Session {
|
||||||
/**
|
/**
|
||||||
* Possible cases:
|
* Possible cases:
|
||||||
* - The access token is not valid anymore,
|
* - The access token is not valid anymore,
|
||||||
* - a M_CONSENT_NOT_GIVEN error has been received from the homeserver
|
* - a M_CONSENT_NOT_GIVEN error has been received from the homeserver;
|
||||||
* See [GlobalError] for all the possible cases
|
* See [GlobalError] for all the possible cases.
|
||||||
*/
|
*/
|
||||||
fun onGlobalError(session: Session, globalError: GlobalError) = Unit
|
fun onGlobalError(session: Session, globalError: GlobalError) = Unit
|
||||||
}
|
}
|
||||||
|
@ -386,7 +386,7 @@ interface Session {
|
||||||
fun getUiaSsoFallbackUrl(authenticationSessionId: String): String
|
fun getUiaSsoFallbackUrl(authenticationSessionId: String): String
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maintenance API, allows to print outs info on DB size to logcat
|
* Maintenance API, allows to print outs info on DB size to logcat.
|
||||||
*/
|
*/
|
||||||
fun logDbUsageInfo()
|
fun logDbUsageInfo()
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,16 +21,16 @@ import org.matrix.android.sdk.api.session.room.model.RoomSummary
|
||||||
import org.matrix.android.sdk.api.session.user.model.User
|
import org.matrix.android.sdk.api.session.user.model.User
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a room using the RoomService of a Session
|
* Get a room using the RoomService of a Session.
|
||||||
*/
|
*/
|
||||||
fun Session.getRoom(roomId: String): Room? = roomService().getRoom(roomId)
|
fun Session.getRoom(roomId: String): Room? = roomService().getRoom(roomId)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a room summary using the RoomService of a Session
|
* Get a room summary using the RoomService of a Session.
|
||||||
*/
|
*/
|
||||||
fun Session.getRoomSummary(roomIdOrAlias: String): RoomSummary? = roomService().getRoomSummary(roomIdOrAlias)
|
fun Session.getRoomSummary(roomIdOrAlias: String): RoomSummary? = roomService().getRoomSummary(roomIdOrAlias)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a user using the UserService of a Session
|
* Get a user using the UserService of a Session.
|
||||||
*/
|
*/
|
||||||
fun Session.getUser(userId: String): User? = userService().getUser(userId)
|
fun Session.getUser(userId: String): User? = userService().getUser(userId)
|
||||||
|
|
|
@ -21,9 +21,8 @@ import org.matrix.android.sdk.api.session.events.model.Content
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
interface ToDeviceService {
|
interface ToDeviceService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send an event to a specific list of devices
|
* Send an event to a specific list of devices.
|
||||||
*/
|
*/
|
||||||
suspend fun sendToDevice(eventType: String, contentMap: MXUsersDevicesMap<Any>, txnId: String? = UUID.randomUUID().toString())
|
suspend fun sendToDevice(eventType: String, contentMap: MXUsersDevicesMap<Any>, txnId: String? = UUID.randomUUID().toString())
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,12 @@ import org.matrix.android.sdk.api.util.Optional
|
||||||
*/
|
*/
|
||||||
interface SessionAccountDataService {
|
interface SessionAccountDataService {
|
||||||
/**
|
/**
|
||||||
* Retrieve the account data with the provided type or null if not found
|
* Retrieve the account data with the provided type or null if not found.
|
||||||
*/
|
*/
|
||||||
fun getUserAccountDataEvent(type: String): UserAccountDataEvent?
|
fun getUserAccountDataEvent(type: String): UserAccountDataEvent?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Observe the account data with the provided type
|
* Observe the account data with the provided type.
|
||||||
*/
|
*/
|
||||||
fun getLiveUserAccountDataEvent(type: String): LiveData<Optional<UserAccountDataEvent>>
|
fun getLiveUserAccountDataEvent(type: String): LiveData<Optional<UserAccountDataEvent>>
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ interface SessionAccountDataService {
|
||||||
fun getLiveRoomAccountDataEvents(types: Set<String>): LiveData<List<RoomAccountDataEvent>>
|
fun getLiveRoomAccountDataEvents(types: Set<String>): LiveData<List<RoomAccountDataEvent>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the account data with the provided type and the provided account data content
|
* Update the account data with the provided type and the provided account data content.
|
||||||
*/
|
*/
|
||||||
suspend fun updateUserAccountData(type: String, content: Content)
|
suspend fun updateUserAccountData(type: String, content: Content)
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,32 +39,32 @@ interface CallListener {
|
||||||
fun onCallAnswerReceived(callAnswerContent: CallAnswerContent)
|
fun onCallAnswerReceived(callAnswerContent: CallAnswerContent)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a called has been hung up
|
* Called when a called has been hung up.
|
||||||
*/
|
*/
|
||||||
fun onCallHangupReceived(callHangupContent: CallHangupContent)
|
fun onCallHangupReceived(callHangupContent: CallHangupContent)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a called has been rejected
|
* Called when a called has been rejected.
|
||||||
*/
|
*/
|
||||||
fun onCallRejectReceived(callRejectContent: CallRejectContent)
|
fun onCallRejectReceived(callRejectContent: CallRejectContent)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when an answer has been selected
|
* Called when an answer has been selected.
|
||||||
*/
|
*/
|
||||||
fun onCallSelectAnswerReceived(callSelectAnswerContent: CallSelectAnswerContent)
|
fun onCallSelectAnswerReceived(callSelectAnswerContent: CallSelectAnswerContent)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a negotiation is sent
|
* Called when a negotiation is sent.
|
||||||
*/
|
*/
|
||||||
fun onCallNegotiateReceived(callNegotiateContent: CallNegotiateContent)
|
fun onCallNegotiateReceived(callNegotiateContent: CallNegotiateContent)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the call has been managed by an other session
|
* Called when the call has been managed by an other session.
|
||||||
*/
|
*/
|
||||||
fun onCallManagedByOtherSession(callId: String)
|
fun onCallManagedByOtherSession(callId: String)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when an asserted identity event is received
|
* Called when an asserted identity event is received.
|
||||||
*/
|
*/
|
||||||
fun onCallAssertedIdentityReceived(callAssertedIdentityContent: CallAssertedIdentityContent)
|
fun onCallAssertedIdentityReceived(callAssertedIdentityContent: CallAssertedIdentityContent)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ interface CallSignalingService {
|
||||||
suspend fun getTurnServer(): TurnServerResponse
|
suspend fun getTurnServer(): TurnServerResponse
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an outgoing call
|
* Create an outgoing call.
|
||||||
*/
|
*/
|
||||||
fun createOutgoingCall(roomId: String, otherUserId: String, isVideoCall: Boolean): MxCall
|
fun createOutgoingCall(roomId: String, otherUserId: String, isVideoCall: Boolean): MxCall
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.matrix.android.sdk.api.session.room.model.call.EndCallReason
|
||||||
|
|
||||||
sealed class CallState {
|
sealed class CallState {
|
||||||
|
|
||||||
/** Idle, setting up objects */
|
/** Idle, setting up objects. */
|
||||||
object Idle : CallState()
|
object Idle : CallState()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -35,7 +35,7 @@ interface MxCallDetail {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define both an incoming call and on outgoing call
|
* Define both an incoming call and on outgoing call.
|
||||||
*/
|
*/
|
||||||
interface MxCall : MxCallDetail {
|
interface MxCall : MxCallDetail {
|
||||||
|
|
||||||
|
@ -46,13 +46,13 @@ interface MxCall : MxCallDetail {
|
||||||
var state: CallState
|
var state: CallState
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pick Up the incoming call
|
* Pick Up the incoming call.
|
||||||
* It has no effect on outgoing call
|
* It has no effect on outgoing call.
|
||||||
*/
|
*/
|
||||||
fun accept(sdpString: String)
|
fun accept(sdpString: String)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SDP negotiation for media pause, hold/resume, ICE restarts and voice/video call up/downgrading
|
* SDP negotiation for media pause, hold/resume, ICE restarts and voice/video call up/downgrading.
|
||||||
*/
|
*/
|
||||||
fun negotiate(sdpString: String, type: SdpType)
|
fun negotiate(sdpString: String, type: SdpType)
|
||||||
|
|
||||||
|
@ -62,17 +62,17 @@ interface MxCall : MxCallDetail {
|
||||||
fun selectAnswer()
|
fun selectAnswer()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reject an incoming call
|
* Reject an incoming call.
|
||||||
*/
|
*/
|
||||||
fun reject()
|
fun reject()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End the call
|
* End the call.
|
||||||
*/
|
*/
|
||||||
fun hangUp(reason: EndCallReason? = null)
|
fun hangUp(reason: EndCallReason? = null)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a call
|
* Start a call.
|
||||||
* Send offer SDP to the other participant.
|
* Send offer SDP to the other participant.
|
||||||
*/
|
*/
|
||||||
fun offerSdp(sdpString: String)
|
fun offerSdp(sdpString: String)
|
||||||
|
|
|
@ -29,7 +29,7 @@ interface ContentUrlResolver {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL to use to upload content
|
* URL to use to upload content.
|
||||||
*/
|
*/
|
||||||
val uploadUrl: String
|
val uploadUrl: String
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ interface ContentUrlResolver {
|
||||||
fun resolveFullSize(contentUrl: String?): String?
|
fun resolveFullSize(contentUrl: String?): String?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the ResolvedMethod to download a URL
|
* Get the ResolvedMethod to download a URL.
|
||||||
*
|
*
|
||||||
* @param contentUrl the Matrix media content URI (in the form of "mxc://...").
|
* @param contentUrl the Matrix media content URI (in the form of "mxc://...").
|
||||||
* @param elementToDecrypt Encryption data may be required if you use a content scanner
|
* @param elementToDecrypt Encryption data may be required if you use a content scanner
|
||||||
|
|
|
@ -155,8 +155,8 @@ interface CryptoService {
|
||||||
fun getIncomingRoomKeyRequestsPaged(): LiveData<PagedList<IncomingRoomKeyRequest>>
|
fun getIncomingRoomKeyRequestsPaged(): LiveData<PagedList<IncomingRoomKeyRequest>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can be called by the app layer to accept a request manually
|
* Can be called by the app layer to accept a request manually.
|
||||||
* Use carefully as it is prone to social attacks
|
* Use carefully as it is prone to social attacks.
|
||||||
*/
|
*/
|
||||||
suspend fun manuallyAcceptRoomKeyRequest(request: IncomingRoomKeyRequest)
|
suspend fun manuallyAcceptRoomKeyRequest(request: IncomingRoomKeyRequest)
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ sealed class MXCryptoError : Throwable() {
|
||||||
data class Base(val errorType: ErrorType,
|
data class Base(val errorType: ErrorType,
|
||||||
val technicalMessage: String,
|
val technicalMessage: String,
|
||||||
/**
|
/**
|
||||||
* Describe the error with more details
|
* Describe the error with more details.
|
||||||
*/
|
*/
|
||||||
val detailedErrorDescription: String? = null) : MXCryptoError()
|
val detailedErrorDescription: String? = null) : MXCryptoError()
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ sealed class MXCryptoError : Throwable() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
/**
|
/**
|
||||||
* Resource for technicalMessage
|
* Resource for technicalMessage.
|
||||||
*/
|
*/
|
||||||
const val UNABLE_TO_ENCRYPT_REASON = "Unable to encrypt %s"
|
const val UNABLE_TO_ENCRYPT_REASON = "Unable to encrypt %s"
|
||||||
const val UNABLE_TO_DECRYPT_REASON = "Unable to decrypt %1\$s. Algorithm: %2\$s"
|
const val UNABLE_TO_DECRYPT_REASON = "Unable to decrypt %1\$s. Algorithm: %2\$s"
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package org.matrix.android.sdk.api.session.crypto
|
package org.matrix.android.sdk.api.session.crypto
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This listener notifies on new Megolm sessions being created
|
* This listener notifies on new Megolm sessions being created.
|
||||||
*/
|
*/
|
||||||
interface NewSessionListener {
|
interface NewSessionListener {
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ fun EncryptedFileInfo.toElementToDecrypt(): ElementToDecrypt? {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represent data to decode an attachment
|
* Represent data to decode an attachment.
|
||||||
*/
|
*/
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data class ElementToDecrypt(
|
data class ElementToDecrypt(
|
||||||
|
|
|
@ -66,7 +66,7 @@ interface CrossSigningService {
|
||||||
fun markMyMasterKeyAsTrusted()
|
fun markMyMasterKeyAsTrusted()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sign one of your devices and upload the signature
|
* Sign one of your devices and upload the signature.
|
||||||
*/
|
*/
|
||||||
fun trustDevice(deviceId: String,
|
fun trustDevice(deviceId: String,
|
||||||
callback: MatrixCallback<Unit>)
|
callback: MatrixCallback<Unit>)
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.matrix.android.sdk.api.session.crypto.model.ImportRoomKeysResult
|
||||||
|
|
||||||
interface KeysBackupService {
|
interface KeysBackupService {
|
||||||
/**
|
/**
|
||||||
* Retrieve the current version of the backup from the homeserver
|
* Retrieve the current version of the backup from the homeserver.
|
||||||
*
|
*
|
||||||
* It can be different than keysBackupVersion.
|
* It can be different than keysBackupVersion.
|
||||||
* @param callback Asynchronous callback
|
* @param callback Asynchronous callback
|
||||||
|
@ -40,12 +40,12 @@ interface KeysBackupService {
|
||||||
callback: MatrixCallback<KeysVersion>)
|
callback: MatrixCallback<KeysVersion>)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Facility method to get the total number of locally stored keys
|
* Facility method to get the total number of locally stored keys.
|
||||||
*/
|
*/
|
||||||
fun getTotalNumbersOfKeys(): Int
|
fun getTotalNumbersOfKeys(): Int
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Facility method to get the number of backed up keys
|
* Facility method to get the number of backed up keys.
|
||||||
*/
|
*/
|
||||||
fun getTotalNumbersOfBackedUpKeys(): Int
|
fun getTotalNumbersOfBackedUpKeys(): Int
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ interface KeysBackupService {
|
||||||
callback: MatrixCallback<KeysBackupVersionTrust>)
|
callback: MatrixCallback<KeysBackupVersionTrust>)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the current progress of the backup
|
* Return the current progress of the backup.
|
||||||
*/
|
*/
|
||||||
fun getBackupProgress(progressListener: ProgressListener)
|
fun getBackupProgress(progressListener: ProgressListener)
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.matrix.android.sdk.api.session.crypto.keysbackup
|
||||||
interface KeysBackupStateListener {
|
interface KeysBackupStateListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The keys backup state has changed
|
* The keys backup state has changed.
|
||||||
* @param newState the new state
|
* @param newState the new state
|
||||||
*/
|
*/
|
||||||
fun onStateChange(newState: KeysBackupState)
|
fun onStateChange(newState: KeysBackupState)
|
||||||
|
|
|
@ -30,8 +30,8 @@ data class KeysVersionResult(
|
||||||
override val algorithm: String,
|
override val algorithm: String,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* algorithm-dependent data, for "m.megolm_backup.v1.curve25519-aes-sha2"
|
* algorithm-dependent data, for "m.megolm_backup.v1.curve25519-aes-sha2".
|
||||||
* see [org.matrix.android.sdk.internal.crypto.keysbackup.MegolmBackupAuthData]
|
* @see [org.matrix.android.sdk.internal.crypto.keysbackup.MegolmBackupAuthData]
|
||||||
*/
|
*/
|
||||||
@Json(name = "auth_data")
|
@Json(name = "auth_data")
|
||||||
override val authData: JsonDict,
|
override val authData: JsonDict,
|
||||||
|
|
|
@ -30,7 +30,7 @@ private const val CHAR_1 = 0x01.toByte()
|
||||||
private const val RECOVERY_KEY_LENGTH = 2 + 32 + 1
|
private const val RECOVERY_KEY_LENGTH = 2 + 32 + 1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tell if the format of the recovery key is correct
|
* Tell if the format of the recovery key is correct.
|
||||||
*
|
*
|
||||||
* @param recoveryKey
|
* @param recoveryKey
|
||||||
* @return true if the format of the recovery key is correct
|
* @return true if the format of the recovery key is correct
|
||||||
|
@ -40,7 +40,7 @@ fun isValidRecoveryKey(recoveryKey: String?): Boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute recovery key from curve25519 key
|
* Compute recovery key from curve25519 key.
|
||||||
*
|
*
|
||||||
* @param curve25519Key
|
* @param curve25519Key
|
||||||
* @return the recovery key
|
* @return the recovery key
|
||||||
|
@ -69,7 +69,7 @@ fun computeRecoveryKey(curve25519Key: ByteArray): String {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Please call [.isValidRecoveryKey] and ensure it returns true before calling this method
|
* Please call [.isValidRecoveryKey] and ensure it returns true before calling this method.
|
||||||
*
|
*
|
||||||
* @param recoveryKey the recovery key
|
* @param recoveryKey the recovery key
|
||||||
* @return curveKey, or null in case of error
|
* @return curveKey, or null in case of error
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.matrix.android.sdk.api.session.crypto.model.IncomingRoomKeyRequest
|
||||||
import org.matrix.android.sdk.api.session.crypto.model.SecretShareRequest
|
import org.matrix.android.sdk.api.session.crypto.model.SecretShareRequest
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Room keys events listener
|
* Room keys events listener.
|
||||||
*/
|
*/
|
||||||
interface GossipingRequestListener {
|
interface GossipingRequestListener {
|
||||||
/**
|
/**
|
||||||
|
@ -31,7 +31,7 @@ interface GossipingRequestListener {
|
||||||
fun onRoomKeyRequest(request: IncomingRoomKeyRequest)
|
fun onRoomKeyRequest(request: IncomingRoomKeyRequest)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the secret value to be shared
|
* Returns the secret value to be shared.
|
||||||
* @return true if is handled
|
* @return true if is handled
|
||||||
*/
|
*/
|
||||||
fun onSecretShareRequest(request: SecretShareRequest): Boolean
|
fun onSecretShareRequest(request: SecretShareRequest): Boolean
|
||||||
|
|
|
@ -20,24 +20,24 @@ import com.squareup.moshi.JsonClass
|
||||||
import org.matrix.android.sdk.api.interfaces.DatedObject
|
import org.matrix.android.sdk.api.interfaces.DatedObject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class describes the device information
|
* This class describes the device information.
|
||||||
*/
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class DeviceInfo(
|
data class DeviceInfo(
|
||||||
/**
|
/**
|
||||||
* The owner user id (not documented and useless but the homeserver sent it. You should not need it)
|
* The owner user id (not documented and useless but the homeserver sent it. You should not need it).
|
||||||
*/
|
*/
|
||||||
@Json(name = "user_id")
|
@Json(name = "user_id")
|
||||||
val userId: String? = null,
|
val userId: String? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The device id
|
* The device id.
|
||||||
*/
|
*/
|
||||||
@Json(name = "device_id")
|
@Json(name = "device_id")
|
||||||
val deviceId: String? = null,
|
val deviceId: String? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The device display name
|
* The device display name.
|
||||||
*/
|
*/
|
||||||
@Json(name = "display_name")
|
@Json(name = "display_name")
|
||||||
val displayName: String? = null,
|
val displayName: String? = null,
|
||||||
|
@ -49,7 +49,7 @@ data class DeviceInfo(
|
||||||
val lastSeenTs: Long? = null,
|
val lastSeenTs: Long? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The last ip address
|
* The last ip address.
|
||||||
*/
|
*/
|
||||||
@Json(name = "last_seen_ip")
|
@Json(name = "last_seen_ip")
|
||||||
val lastSeenIp: String? = null
|
val lastSeenIp: String? = null
|
||||||
|
|
|
@ -20,7 +20,7 @@ import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In Matrix specs: EncryptedFile
|
* In Matrix specs: EncryptedFile.
|
||||||
*/
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class EncryptedFileInfo(
|
data class EncryptedFileInfo(
|
||||||
|
@ -56,7 +56,7 @@ data class EncryptedFileInfo(
|
||||||
val v: String? = null
|
val v: String? = null
|
||||||
) {
|
) {
|
||||||
/**
|
/**
|
||||||
* Check what the spec tells us
|
* Check what the spec tells us.
|
||||||
*/
|
*/
|
||||||
fun isValid(): Boolean {
|
fun isValid(): Boolean {
|
||||||
if (url.isNullOrBlank()) {
|
if (url.isNullOrBlank()) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ data class EncryptedFileKey(
|
||||||
val k: String? = null
|
val k: String? = null
|
||||||
) {
|
) {
|
||||||
/**
|
/**
|
||||||
* Check what the spec tells us
|
* Check what the spec tells us.
|
||||||
*/
|
*/
|
||||||
fun isValid(): Boolean {
|
fun isValid(): Boolean {
|
||||||
if (alg != "A256CTR") {
|
if (alg != "A256CTR") {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package org.matrix.android.sdk.api.session.crypto.model
|
package org.matrix.android.sdk.api.session.crypto.model
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface representing an room key action request
|
* Interface representing an room key action request.
|
||||||
* Note: this class cannot be abstract because of [org.matrix.androidsdk.core.JsonUtils.toRoomKeyShare]
|
* Note: this class cannot be abstract because of [org.matrix.androidsdk.core.JsonUtils.toRoomKeyShare]
|
||||||
*/
|
*/
|
||||||
interface GossipingToDeviceObject : SendToDeviceObject {
|
interface GossipingToDeviceObject : SendToDeviceObject {
|
||||||
|
|
|
@ -23,22 +23,22 @@ import org.matrix.android.sdk.internal.util.time.Clock
|
||||||
*/
|
*/
|
||||||
data class IncomingRoomKeyRequest(
|
data class IncomingRoomKeyRequest(
|
||||||
/**
|
/**
|
||||||
* The user id
|
* The user id.
|
||||||
*/
|
*/
|
||||||
val userId: String? = null,
|
val userId: String? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The device id
|
* The device id.
|
||||||
*/
|
*/
|
||||||
val deviceId: String? = null,
|
val deviceId: String? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The request id
|
* The request id.
|
||||||
*/
|
*/
|
||||||
val requestId: String? = null,
|
val requestId: String? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The request body
|
* The request body.
|
||||||
*/
|
*/
|
||||||
val requestBody: RoomKeyRequestBody? = null,
|
val requestBody: RoomKeyRequestBody? = null,
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ data class IncomingRoomKeyRequest(
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
/**
|
/**
|
||||||
* Factory
|
* Factory.
|
||||||
*
|
*
|
||||||
* @param event the event
|
* @param event the event
|
||||||
* @param currentTimeMillis the current time in milliseconds
|
* @param currentTimeMillis the current time in milliseconds
|
||||||
|
|
|
@ -30,7 +30,7 @@ data class MXDeviceInfo(
|
||||||
val deviceId: String,
|
val deviceId: String,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the user id
|
* the user id.
|
||||||
*/
|
*/
|
||||||
@Json(name = "user_id")
|
@Json(name = "user_id")
|
||||||
val userId: String,
|
val userId: String,
|
||||||
|
@ -66,7 +66,7 @@ data class MXDeviceInfo(
|
||||||
val verified: Int = DEVICE_VERIFICATION_UNKNOWN
|
val verified: Int = DEVICE_VERIFICATION_UNKNOWN
|
||||||
) : Serializable {
|
) : Serializable {
|
||||||
/**
|
/**
|
||||||
* Tells if the device is unknown
|
* Tells if the device is unknown.
|
||||||
*
|
*
|
||||||
* @return true if the device is unknown
|
* @return true if the device is unknown
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -20,11 +20,11 @@ import org.matrix.android.sdk.api.session.events.model.Content
|
||||||
|
|
||||||
data class MXEncryptEventContentResult(
|
data class MXEncryptEventContentResult(
|
||||||
/**
|
/**
|
||||||
* The encrypted event content
|
* The encrypted event content.
|
||||||
*/
|
*/
|
||||||
val eventContent: Content,
|
val eventContent: Content,
|
||||||
/**
|
/**
|
||||||
* the event type
|
* The event type.
|
||||||
*/
|
*/
|
||||||
val eventType: String
|
val eventType: String
|
||||||
)
|
)
|
||||||
|
|
|
@ -31,7 +31,7 @@ class MXUsersDevicesMap<E> {
|
||||||
get() = map.isEmpty()
|
get() = map.isEmpty()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the device ids list for a user id
|
* Provides the device ids list for a user id.
|
||||||
* FIXME Should maybe return emptyList and not null, to avoid many !! in the code
|
* FIXME Should maybe return emptyList and not null, to avoid many !! in the code
|
||||||
*
|
*
|
||||||
* @param userId the user id
|
* @param userId the user id
|
||||||
|
@ -44,7 +44,7 @@ class MXUsersDevicesMap<E> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides the object for a device id and a user Id
|
* Provides the object for a device id and a user Id.
|
||||||
*
|
*
|
||||||
* @param deviceId the device id
|
* @param deviceId the device id
|
||||||
* @param userId the object id
|
* @param userId the object id
|
||||||
|
@ -57,7 +57,7 @@ class MXUsersDevicesMap<E> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set an object for a dedicated user Id and device Id
|
* Set an object for a dedicated user Id and device Id.
|
||||||
*
|
*
|
||||||
* @param userId the user Id
|
* @param userId the user Id
|
||||||
* @param deviceId the device id
|
* @param deviceId the device id
|
||||||
|
@ -71,7 +71,7 @@ class MXUsersDevicesMap<E> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines the objects map for a user Id
|
* Defines the objects map for a user Id.
|
||||||
*
|
*
|
||||||
* @param objectsPerDevices the objects maps
|
* @param objectsPerDevices the objects maps
|
||||||
* @param userId the user id
|
* @param userId the user id
|
||||||
|
@ -87,7 +87,7 @@ class MXUsersDevicesMap<E> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes objects for a dedicated user
|
* Removes objects for a dedicated user.
|
||||||
*
|
*
|
||||||
* @param userId the user id.
|
* @param userId the user id.
|
||||||
*/
|
*/
|
||||||
|
@ -98,14 +98,14 @@ class MXUsersDevicesMap<E> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the internal dictionary
|
* Clear the internal dictionary.
|
||||||
*/
|
*/
|
||||||
fun removeAllObjects() {
|
fun removeAllObjects() {
|
||||||
map.clear()
|
map.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add entries from another MXUsersDevicesMap
|
* Add entries from another MXUsersDevicesMap.
|
||||||
*
|
*
|
||||||
* @param other the other one
|
* @param other the other one
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.matrix.android.sdk.api.util.JsonDict
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class OlmDecryptionResult(
|
data class OlmDecryptionResult(
|
||||||
/**
|
/**
|
||||||
* The decrypted payload (with properties 'type', 'content')
|
* The decrypted payload (with properties 'type', 'content').
|
||||||
*/
|
*/
|
||||||
@Json(name = "payload") val payload: JsonDict? = null,
|
@Json(name = "payload") val payload: JsonDict? = null,
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import com.squareup.moshi.JsonClass
|
||||||
import org.matrix.android.sdk.internal.di.MoshiProvider
|
import org.matrix.android.sdk.internal.di.MoshiProvider
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing an room key request body content
|
* Class representing an room key request body content.
|
||||||
*/
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class RoomKeyRequestBody(
|
data class RoomKeyRequestBody(
|
||||||
|
|
|
@ -20,7 +20,7 @@ import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing a room key request content
|
* Class representing a room key request content.
|
||||||
*/
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class RoomKeyShareRequest(
|
data class RoomKeyShareRequest(
|
||||||
|
|
|
@ -20,7 +20,7 @@ import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing a room key request content
|
* Class representing a room key request content.
|
||||||
*/
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class SecretShareRequest(
|
data class SecretShareRequest(
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.matrix.android.sdk.internal.crypto.model.rest.VERIFICATION_METHOD_SAS
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores current pending verification requests
|
* Stores current pending verification requests.
|
||||||
*/
|
*/
|
||||||
data class PendingVerificationRequest(
|
data class PendingVerificationRequest(
|
||||||
val ageLocalTs: Long,
|
val ageLocalTs: Long,
|
||||||
|
@ -45,7 +45,7 @@ data class PendingVerificationRequest(
|
||||||
val isFinished: Boolean = isSuccessful || cancelConclusion != null
|
val isFinished: Boolean = isSuccessful || cancelConclusion != null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SAS is supported if I support it and the other party support it
|
* SAS is supported if I support it and the other party support it.
|
||||||
*/
|
*/
|
||||||
fun isSasSupported(): Boolean {
|
fun isSasSupported(): Boolean {
|
||||||
return requestInfo?.methods?.contains(VERIFICATION_METHOD_SAS).orFalse() &&
|
return requestInfo?.methods?.contains(VERIFICATION_METHOD_SAS).orFalse() &&
|
||||||
|
@ -53,7 +53,7 @@ data class PendingVerificationRequest(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Other can show QR code if I can scan QR code and other can show QR code
|
* Other can show QR code if I can scan QR code and other can show QR code.
|
||||||
*/
|
*/
|
||||||
fun otherCanShowQrCode(): Boolean {
|
fun otherCanShowQrCode(): Boolean {
|
||||||
return if (isIncoming) {
|
return if (isIncoming) {
|
||||||
|
@ -66,7 +66,7 @@ data class PendingVerificationRequest(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Other can scan QR code if I can show QR code and other can scan QR code
|
* Other can scan QR code if I can show QR code and other can scan QR code.
|
||||||
*/
|
*/
|
||||||
fun otherCanScanQrCode(): Boolean {
|
fun otherCanScanQrCode(): Boolean {
|
||||||
return if (isIncoming) {
|
return if (isIncoming) {
|
||||||
|
|
|
@ -19,22 +19,22 @@ package org.matrix.android.sdk.api.session.crypto.verification
|
||||||
interface QrCodeVerificationTransaction : VerificationTransaction {
|
interface QrCodeVerificationTransaction : VerificationTransaction {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To use to display a qr code, for the other user to scan it
|
* To use to display a qr code, for the other user to scan it.
|
||||||
*/
|
*/
|
||||||
val qrCodeText: String?
|
val qrCodeText: String?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call when you have scan the other user QR code
|
* Call when you have scan the other user QR code.
|
||||||
*/
|
*/
|
||||||
fun userHasScannedOtherQrCode(otherQrCodeText: String)
|
fun userHasScannedOtherQrCode(otherQrCodeText: String)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call when you confirm that other user has scanned your QR code
|
* Call when you confirm that other user has scanned your QR code.
|
||||||
*/
|
*/
|
||||||
fun otherUserScannedMyQrCode()
|
fun otherUserScannedMyQrCode()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call when you do not confirm that other user has scanned your QR code
|
* Call when you do not confirm that other user has scanned your QR code.
|
||||||
*/
|
*/
|
||||||
fun otherUserDidNotScannedMyQrCode()
|
fun otherUserDidNotScannedMyQrCode()
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ interface SasVerificationTransaction : VerificationTransaction {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To be called by the client when the user has verified that
|
* To be called by the client when the user has verified that
|
||||||
* both short codes do match
|
* both short codes do match.
|
||||||
*/
|
*/
|
||||||
fun userHasVerifiedShortCode()
|
fun userHasVerifiedShortCode()
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package org.matrix.android.sdk.api.session.crypto.verification
|
package org.matrix.android.sdk.api.session.crypto.verification
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verification methods
|
* Verification methods.
|
||||||
*/
|
*/
|
||||||
enum class VerificationMethod {
|
enum class VerificationMethod {
|
||||||
// Use it when your application supports the SAS verification method
|
// Use it when your application supports the SAS verification method
|
||||||
|
|
|
@ -34,7 +34,7 @@ interface VerificationService {
|
||||||
fun removeListener(listener: Listener)
|
fun removeListener(listener: Listener)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark this device as verified manually
|
* Mark this device as verified manually.
|
||||||
*/
|
*/
|
||||||
fun markedLocallyAsManuallyVerified(userId: String, deviceID: String)
|
fun markedLocallyAsManuallyVerified(userId: String, deviceID: String)
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ interface VerificationService {
|
||||||
transactionId: String?): String?
|
transactionId: String?): String?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request key verification with another user via room events (instead of the to-device API)
|
* Request key verification with another user via room events (instead of the to-device API).
|
||||||
*/
|
*/
|
||||||
fun requestKeyVerificationInDMs(methods: List<VerificationMethod>,
|
fun requestKeyVerificationInDMs(methods: List<VerificationMethod>,
|
||||||
otherUserId: String,
|
otherUserId: String,
|
||||||
|
@ -81,7 +81,7 @@ interface VerificationService {
|
||||||
otherDeviceId: String): String
|
otherDeviceId: String): String
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns false if the request is unknown
|
* Returns false if the request is unknown.
|
||||||
*/
|
*/
|
||||||
fun readyPendingVerificationInDMs(methods: List<VerificationMethod>,
|
fun readyPendingVerificationInDMs(methods: List<VerificationMethod>,
|
||||||
otherUserId: String,
|
otherUserId: String,
|
||||||
|
@ -89,7 +89,7 @@ interface VerificationService {
|
||||||
transactionId: String): Boolean
|
transactionId: String): Boolean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns false if the request is unknown
|
* Returns false if the request is unknown.
|
||||||
*/
|
*/
|
||||||
fun readyPendingVerification(methods: List<VerificationMethod>,
|
fun readyPendingVerification(methods: List<VerificationMethod>,
|
||||||
otherUserId: String,
|
otherUserId: String,
|
||||||
|
|
|
@ -28,7 +28,7 @@ interface VerificationTransaction {
|
||||||
val isIncoming: Boolean
|
val isIncoming: Boolean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User wants to cancel the transaction
|
* User wants to cancel the transaction.
|
||||||
*/
|
*/
|
||||||
fun cancel()
|
fun cancel()
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ inline fun <reified T> Content?.toModel(catchError: Boolean = true): T? {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This methods is a facility method to map a model to a json Content
|
* This methods is a facility method to map a model to a json Content.
|
||||||
*/
|
*/
|
||||||
@Suppress("UNCHECKED_CAST")
|
@Suppress("UNCHECKED_CAST")
|
||||||
inline fun <reified T> T.toContent(): Content {
|
inline fun <reified T> T.toContent(): Content {
|
||||||
|
@ -123,7 +123,7 @@ data class Event(
|
||||||
var ageLocalTs: Long? = null
|
var ageLocalTs: Long? = null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy all fields, including transient fields
|
* Copy all fields, including transient fields.
|
||||||
*/
|
*/
|
||||||
fun copyAll(): Event {
|
fun copyAll(): Event {
|
||||||
return copy().also {
|
return copy().also {
|
||||||
|
@ -227,14 +227,14 @@ data class Event(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether or not current event has mentioned the user
|
* Determines whether or not current event has mentioned the user.
|
||||||
*/
|
*/
|
||||||
fun isUserMentioned(userId: String): Boolean {
|
fun isUserMentioned(userId: String): Boolean {
|
||||||
return getDecryptedValue("formatted_body")?.contains(userId) ?: false
|
return getDecryptedValue("formatted_body")?.contains(userId) ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decrypt the message, or return the pure payload value if there is no encryption
|
* Decrypt the message, or return the pure payload value if there is no encryption.
|
||||||
*/
|
*/
|
||||||
private fun getDecryptedValue(key: String = "body"): String? {
|
private fun getDecryptedValue(key: String = "body"): String? {
|
||||||
return if (isEncrypted()) {
|
return if (isEncrypted()) {
|
||||||
|
@ -247,7 +247,7 @@ data class Event(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells if the event is redacted
|
* Tells if the event is redacted.
|
||||||
*/
|
*/
|
||||||
fun isRedacted() = unsignedData?.redactedEvent != null
|
fun isRedacted() = unsignedData?.redactedEvent != null
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ data class Event(
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the value of "content.msgtype", if the Event type is "m.room.message"
|
* Return the value of "content.msgtype", if the Event type is "m.room.message"
|
||||||
* and if the content has it, and if it is a String
|
* and if the content has it, and if it is a String.
|
||||||
*/
|
*/
|
||||||
fun Event.getMsgType(): String? {
|
fun Event.getMsgType(): String? {
|
||||||
if (getClearType() != EventType.MESSAGE) return null
|
if (getClearType() != EventType.MESSAGE) return null
|
||||||
|
@ -386,13 +386,13 @@ fun Event.getRelationContent(): RelationDefaultContent? {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the poll question or null otherwise
|
* Returns the poll question or null otherwise.
|
||||||
*/
|
*/
|
||||||
fun Event.getPollQuestion(): String? =
|
fun Event.getPollQuestion(): String? =
|
||||||
getPollContent()?.getBestPollCreationInfo()?.question?.getBestQuestion()
|
getPollContent()?.getBestPollCreationInfo()?.question?.getBestQuestion()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the relation content for a specific type or null otherwise
|
* Returns the relation content for a specific type or null otherwise.
|
||||||
*/
|
*/
|
||||||
fun Event.getRelationContentForType(type: String): RelationDefaultContent? =
|
fun Event.getRelationContentForType(type: String): RelationDefaultContent? =
|
||||||
getRelationContent()?.takeIf { it.type == type }
|
getRelationContent()?.takeIf { it.type == type }
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
package org.matrix.android.sdk.api.session.events.model
|
package org.matrix.android.sdk.api.session.events.model
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants defining known event relation types from Matrix specifications
|
* Constants defining known event relation types from Matrix specifications.
|
||||||
*/
|
*/
|
||||||
object RelationType {
|
object RelationType {
|
||||||
/** Lets you define an event which annotates an existing event.*/
|
/** Lets you define an event which annotates an existing event.*/
|
||||||
|
|
|
@ -20,37 +20,37 @@ import com.squareup.moshi.JsonClass
|
||||||
import org.matrix.android.sdk.api.session.room.model.relation.RelationDefaultContent
|
import org.matrix.android.sdk.api.session.room.model.relation.RelationDefaultContent
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing an encrypted event content
|
* Class representing an encrypted event content.
|
||||||
*/
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class EncryptedEventContent(
|
data class EncryptedEventContent(
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the used algorithm
|
* The used algorithm.
|
||||||
*/
|
*/
|
||||||
@Json(name = "algorithm")
|
@Json(name = "algorithm")
|
||||||
val algorithm: String? = null,
|
val algorithm: String? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The encrypted event
|
* The encrypted event.
|
||||||
*/
|
*/
|
||||||
@Json(name = "ciphertext")
|
@Json(name = "ciphertext")
|
||||||
val ciphertext: String? = null,
|
val ciphertext: String? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The device id
|
* The device id.
|
||||||
*/
|
*/
|
||||||
@Json(name = "device_id")
|
@Json(name = "device_id")
|
||||||
val deviceId: String? = null,
|
val deviceId: String? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the sender key
|
* The sender key.
|
||||||
*/
|
*/
|
||||||
@Json(name = "sender_key")
|
@Json(name = "sender_key")
|
||||||
val senderKey: String? = null,
|
val senderKey: String? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The session id
|
* The session id.
|
||||||
*/
|
*/
|
||||||
@Json(name = "session_id")
|
@Json(name = "session_id")
|
||||||
val sessionId: String? = null,
|
val sessionId: String? = null,
|
||||||
|
|
|
@ -19,7 +19,7 @@ import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing an encrypted event content
|
* Class representing an encrypted event content.
|
||||||
*/
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class EncryptionEventContent(
|
data class EncryptionEventContent(
|
||||||
|
|
|
@ -19,7 +19,7 @@ import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing an encrypted event content
|
* Class representing an encrypted event content.
|
||||||
*/
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class OlmEventContent(
|
data class OlmEventContent(
|
||||||
|
@ -30,7 +30,7 @@ data class OlmEventContent(
|
||||||
val ciphertext: Map<String, Any>? = null,
|
val ciphertext: Map<String, Any>? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the sender key
|
* the sender key.
|
||||||
*/
|
*/
|
||||||
@Json(name = "sender_key")
|
@Json(name = "sender_key")
|
||||||
val senderKey: String? = null
|
val senderKey: String? = null
|
||||||
|
|
|
@ -20,36 +20,36 @@ import com.squareup.moshi.JsonClass
|
||||||
import org.matrix.android.sdk.internal.di.MoshiProvider
|
import org.matrix.android.sdk.internal.di.MoshiProvider
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing the OLM payload content
|
* Class representing the OLM payload content.
|
||||||
*/
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class OlmPayloadContent(
|
data class OlmPayloadContent(
|
||||||
/**
|
/**
|
||||||
* The room id
|
* The room id.
|
||||||
*/
|
*/
|
||||||
@Json(name = "room_id")
|
@Json(name = "room_id")
|
||||||
val roomId: String? = null,
|
val roomId: String? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The sender
|
* The sender.
|
||||||
*/
|
*/
|
||||||
@Json(name = "sender")
|
@Json(name = "sender")
|
||||||
val sender: String? = null,
|
val sender: String? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The recipient
|
* The recipient.
|
||||||
*/
|
*/
|
||||||
@Json(name = "recipient")
|
@Json(name = "recipient")
|
||||||
val recipient: String? = null,
|
val recipient: String? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the recipient keys
|
* The recipient keys.
|
||||||
*/
|
*/
|
||||||
@Json(name = "recipient_keys")
|
@Json(name = "recipient_keys")
|
||||||
val recipientKeys: Map<String, String>? = null,
|
val recipientKeys: Map<String, String>? = null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The keys
|
* The keys.
|
||||||
*/
|
*/
|
||||||
@Json(name = "keys")
|
@Json(name = "keys")
|
||||||
val keys: Map<String, String>? = null
|
val keys: Map<String, String>? = null
|
||||||
|
|
|
@ -19,7 +19,7 @@ import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing an sharekey content
|
* Class representing an sharekey content.
|
||||||
*/
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class RoomKeyContent(
|
data class RoomKeyContent(
|
||||||
|
|
|
@ -19,7 +19,7 @@ import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing an sharekey content
|
* Class representing an sharekey content.
|
||||||
*/
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class RoomKeyWithHeldContent(
|
data class RoomKeyWithHeldContent(
|
||||||
|
@ -56,7 +56,7 @@ data class RoomKeyWithHeldContent(
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the device ID of the device sending the m.room_key.withheld message
|
* the device ID of the device sending the m.room_key.withheld message
|
||||||
* MSC3735
|
* MSC3735.
|
||||||
*/
|
*/
|
||||||
@Json(name = "from_device") val fromDevice: String? = null
|
@Json(name = "from_device") val fromDevice: String? = null
|
||||||
|
|
||||||
|
@ -69,23 +69,23 @@ data class RoomKeyWithHeldContent(
|
||||||
|
|
||||||
enum class WithHeldCode(val value: String) {
|
enum class WithHeldCode(val value: String) {
|
||||||
/**
|
/**
|
||||||
* the user/device was blacklisted
|
* the user/device was blacklisted.
|
||||||
*/
|
*/
|
||||||
BLACKLISTED("m.blacklisted"),
|
BLACKLISTED("m.blacklisted"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the user/devices is unverified
|
* the user/devices is unverified.
|
||||||
*/
|
*/
|
||||||
UNVERIFIED("m.unverified"),
|
UNVERIFIED("m.unverified"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the user/device is not allowed have the key. For example, this would usually be sent in response
|
* the user/device is not allowed have the key. For example, this would usually be sent in response
|
||||||
* to a key request if the user was not in the room when the message was sent
|
* to a key request if the user was not in the room when the message was sent.
|
||||||
*/
|
*/
|
||||||
UNAUTHORISED("m.unauthorised"),
|
UNAUTHORISED("m.unauthorised"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sent in reply to a key request if the device that the key is requested from does not have the requested key
|
* Sent in reply to a key request if the device that the key is requested from does not have the requested key.
|
||||||
*/
|
*/
|
||||||
UNAVAILABLE("m.unavailable"),
|
UNAVAILABLE("m.unavailable"),
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ import com.squareup.moshi.Json
|
||||||
import com.squareup.moshi.JsonClass
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class representing an encrypted event content
|
* Class representing an encrypted event content.
|
||||||
*/
|
*/
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class SecretSendEventContent(
|
data class SecretSendEventContent(
|
||||||
|
|
|
@ -73,7 +73,7 @@ interface FileService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use this URI and pass it to intent using flag Intent.FLAG_GRANT_READ_URI_PERMISSION
|
* Use this URI and pass it to intent using flag Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||||
* (if not other app won't be able to access it)
|
* (if not other app won't be able to access it).
|
||||||
*/
|
*/
|
||||||
fun getTemporarySharableURI(mxcUrl: String?,
|
fun getTemporarySharableURI(mxcUrl: String?,
|
||||||
fileName: String,
|
fileName: String,
|
||||||
|
@ -106,17 +106,17 @@ interface FileService {
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears all the files downloaded by the service, including decrypted files
|
* Clears all the files downloaded by the service, including decrypted files.
|
||||||
*/
|
*/
|
||||||
fun clearCache()
|
fun clearCache()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears all the decrypted files by the service
|
* Clears all the decrypted files by the service.
|
||||||
*/
|
*/
|
||||||
fun clearDecryptedCache()
|
fun clearDecryptedCache()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get size of cached files
|
* Get size of cached files.
|
||||||
*/
|
*/
|
||||||
fun getCacheSize(): Long
|
fun getCacheSize(): Long
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import androidx.core.content.FileProvider
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We have to declare our own file provider to avoid collision with apps using the sdk
|
* We have to declare our own file provider to avoid collision with apps using the sdk
|
||||||
* and having their own
|
* and having their own.
|
||||||
*/
|
*/
|
||||||
class MatrixSDKFileProvider : FileProvider() {
|
class MatrixSDKFileProvider : FileProvider() {
|
||||||
override fun getType(uri: Uri): String? {
|
override fun getType(uri: Uri): String? {
|
||||||
|
|
|
@ -23,16 +23,15 @@ import org.matrix.android.sdk.api.session.group.model.GroupSummary
|
||||||
* This interface defines methods to get groups. It's implemented at the session level.
|
* This interface defines methods to get groups. It's implemented at the session level.
|
||||||
*/
|
*/
|
||||||
interface GroupService {
|
interface GroupService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a group from a groupId
|
* Get a group from a groupId.
|
||||||
* @param groupId the groupId to look for.
|
* @param groupId the groupId to look for.
|
||||||
* @return the group with groupId or null
|
* @return the group with groupId or null
|
||||||
*/
|
*/
|
||||||
fun getGroup(groupId: String): Group?
|
fun getGroup(groupId: String): Group?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a groupSummary from a groupId
|
* Get a groupSummary from a groupId.
|
||||||
* @param groupId the groupId to look for.
|
* @param groupId the groupId to look for.
|
||||||
* @return the groupSummary with groupId or null
|
* @return the groupSummary with groupId or null
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,7 +24,7 @@ fun groupSummaryQueryParams(init: (GroupSummaryQueryParams.Builder.() -> Unit) =
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class can be used to filter group summaries
|
* This class can be used to filter group summaries.
|
||||||
*/
|
*/
|
||||||
data class GroupSummaryQueryParams(
|
data class GroupSummaryQueryParams(
|
||||||
val displayName: QueryStringValue,
|
val displayName: QueryStringValue,
|
||||||
|
|
|
@ -34,25 +34,25 @@ data class HomeServerCapabilities(
|
||||||
*/
|
*/
|
||||||
val canChange3pid: Boolean = true,
|
val canChange3pid: Boolean = true,
|
||||||
/**
|
/**
|
||||||
* Max size of file which can be uploaded to the homeserver in bytes. [MAX_UPLOAD_FILE_SIZE_UNKNOWN] if unknown or not retrieved yet
|
* Max size of file which can be uploaded to the homeserver in bytes. [MAX_UPLOAD_FILE_SIZE_UNKNOWN] if unknown or not retrieved yet.
|
||||||
*/
|
*/
|
||||||
val maxUploadFileSize: Long = MAX_UPLOAD_FILE_SIZE_UNKNOWN,
|
val maxUploadFileSize: Long = MAX_UPLOAD_FILE_SIZE_UNKNOWN,
|
||||||
/**
|
/**
|
||||||
* Last version identity server and binding supported
|
* Last version identity server and binding supported.
|
||||||
*/
|
*/
|
||||||
val lastVersionIdentityServerSupported: Boolean = false,
|
val lastVersionIdentityServerSupported: Boolean = false,
|
||||||
/**
|
/**
|
||||||
* Default identity server url, provided in Wellknown
|
* Default identity server url, provided in Wellknown.
|
||||||
*/
|
*/
|
||||||
val defaultIdentityServerUrl: String? = null,
|
val defaultIdentityServerUrl: String? = null,
|
||||||
/**
|
/**
|
||||||
* Room versions supported by the server
|
* Room versions supported by the server.
|
||||||
* This capability describes the default and available room versions a server supports, and at what level of stability.
|
* This capability describes the default and available room versions a server supports, and at what level of stability.
|
||||||
* Clients should make use of this capability to determine if users need to be encouraged to upgrade their rooms.
|
* Clients should make use of this capability to determine if users need to be encouraged to upgrade their rooms.
|
||||||
*/
|
*/
|
||||||
val roomVersions: RoomVersionCapabilities? = null,
|
val roomVersions: RoomVersionCapabilities? = null,
|
||||||
/**
|
/**
|
||||||
* True if the home server support threading
|
* True if the home server support threading.
|
||||||
*/
|
*/
|
||||||
val canUseThreading: Boolean = false
|
val canUseThreading: Boolean = false
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -22,12 +22,12 @@ package org.matrix.android.sdk.api.session.homeserver
|
||||||
interface HomeServerCapabilitiesService {
|
interface HomeServerCapabilitiesService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force a refresh of the stored data
|
* Force a refresh of the stored data.
|
||||||
*/
|
*/
|
||||||
suspend fun refreshHomeServerCapabilities()
|
suspend fun refreshHomeServerCapabilities()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the HomeServer capabilities
|
* Get the HomeServer capabilities.
|
||||||
*/
|
*/
|
||||||
fun getHomeServerCapabilities(): HomeServerCapabilities
|
fun getHomeServerCapabilities(): HomeServerCapabilities
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,13 @@ package org.matrix.android.sdk.api.session.identity
|
||||||
import org.matrix.android.sdk.api.session.identity.model.SignInvitationResult
|
import org.matrix.android.sdk.api.session.identity.model.SignInvitationResult
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to the identity server configuration and services identity server can provide
|
* Provides access to the identity server configuration and services identity server can provide.
|
||||||
*/
|
*/
|
||||||
interface IdentityService {
|
interface IdentityService {
|
||||||
/**
|
/**
|
||||||
* Return the default identity server of the user, which may have been provided at login time by the homeserver,
|
* Return the default identity server of the user, which may have been provided at login time by the homeserver,
|
||||||
* or by the Well-known setup of the homeserver
|
* or by the Well-known setup of the homeserver.
|
||||||
* It may be different from the current configured identity server
|
* It may be different from the current configured identity server.
|
||||||
*/
|
*/
|
||||||
fun getDefaultIdentityServer(): String?
|
fun getDefaultIdentityServer(): String?
|
||||||
|
|
||||||
|
@ -35,9 +35,9 @@ interface IdentityService {
|
||||||
fun getCurrentIdentityServerUrl(): String?
|
fun getCurrentIdentityServerUrl(): String?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the identity server is valid
|
* Check if the identity server is valid.
|
||||||
* See https://matrix.org/docs/spec/identity_service/latest#status-check
|
* See https://matrix.org/docs/spec/identity_service/latest#status-check.
|
||||||
* Matrix Android SDK2 only supports identity server API v2
|
* Matrix Android SDK2 only supports identity server API v2.
|
||||||
*/
|
*/
|
||||||
suspend fun isValidIdentityServer(url: String)
|
suspend fun isValidIdentityServer(url: String)
|
||||||
|
|
||||||
|
@ -52,12 +52,12 @@ interface IdentityService {
|
||||||
suspend fun setNewIdentityServer(url: String): String
|
suspend fun setNewIdentityServer(url: String): String
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disconnect (logout) from the current identity server
|
* Disconnect (logout) from the current identity server.
|
||||||
*/
|
*/
|
||||||
suspend fun disconnect()
|
suspend fun disconnect()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will ask the identity server to send an email or an SMS to let the user confirm he owns the ThreePid
|
* This will ask the identity server to send an email or an SMS to let the user confirm he owns the ThreePid.
|
||||||
*/
|
*/
|
||||||
suspend fun startBindThreePid(threePid: ThreePid)
|
suspend fun startBindThreePid(threePid: ThreePid)
|
||||||
|
|
||||||
|
@ -67,32 +67,32 @@ interface IdentityService {
|
||||||
suspend fun cancelBindThreePid(threePid: ThreePid)
|
suspend fun cancelBindThreePid(threePid: ThreePid)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will ask the identity server to send an new email or a new SMS to let the user confirm he owns the ThreePid
|
* This will ask the identity server to send an new email or a new SMS to let the user confirm he owns the ThreePid.
|
||||||
*/
|
*/
|
||||||
suspend fun sendAgainValidationCode(threePid: ThreePid)
|
suspend fun sendAgainValidationCode(threePid: ThreePid)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submit the code that the identity server has sent to the user (in email or SMS)
|
* Submit the code that the identity server has sent to the user (in email or SMS).
|
||||||
* Once successful, you will have to call [finalizeBindThreePid]
|
* Once successful, you will have to call [finalizeBindThreePid]
|
||||||
* @param code the code sent to the user
|
* @param code the code sent to the user
|
||||||
*/
|
*/
|
||||||
suspend fun submitValidationToken(threePid: ThreePid, code: String)
|
suspend fun submitValidationToken(threePid: ThreePid, code: String)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will perform the actual association of ThreePid and Matrix account
|
* This will perform the actual association of ThreePid and Matrix account.
|
||||||
*/
|
*/
|
||||||
suspend fun finalizeBindThreePid(threePid: ThreePid)
|
suspend fun finalizeBindThreePid(threePid: ThreePid)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unbind a threePid
|
* Unbind a threePid.
|
||||||
* The request will actually be done on the homeserver
|
* The request will actually be done on the homeserver.
|
||||||
*/
|
*/
|
||||||
suspend fun unbindThreePid(threePid: ThreePid)
|
suspend fun unbindThreePid(threePid: ThreePid)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search MatrixId of users providing email and phone numbers
|
* Search MatrixId of users providing email and phone numbers.
|
||||||
* Note the the user consent has to be set to true, or it will throw a UserConsentNotProvided failure
|
* Note the the user consent has to be set to true, or it will throw a UserConsentNotProvided failure.
|
||||||
* Application has to explicitly ask for the user consent, and the answer can be stored using [setUserConsent]
|
* Application has to explicitly ask for the user consent, and the answer can be stored using [setUserConsent].
|
||||||
* Please see https://support.google.com/googleplay/android-developer/answer/9888076?hl=en for more details.
|
* Please see https://support.google.com/googleplay/android-developer/answer/9888076?hl=en for more details.
|
||||||
*/
|
*/
|
||||||
suspend fun lookUp(threePids: List<ThreePid>): List<FoundThreePid>
|
suspend fun lookUp(threePids: List<ThreePid>): List<FoundThreePid>
|
||||||
|
@ -115,8 +115,8 @@ interface IdentityService {
|
||||||
fun setUserConsent(newValue: Boolean)
|
fun setUserConsent(newValue: Boolean)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the status of the current user's threePid
|
* Get the status of the current user's threePid.
|
||||||
* A lookup will be performed, but also pending binding state will be restored
|
* A lookup will be performed, but also pending binding state will be restored.
|
||||||
*
|
*
|
||||||
* @param threePids the list of threePid the user owns (retrieved form the homeserver)
|
* @param threePids the list of threePid the user owns (retrieved form the homeserver)
|
||||||
* @return a map of ThreePid -> SharedState
|
* @return a map of ThreePid -> SharedState
|
||||||
|
@ -126,7 +126,7 @@ interface IdentityService {
|
||||||
/**
|
/**
|
||||||
* When one performs a 3pid invite and the third party identifier is unknown, the home server
|
* When one performs a 3pid invite and the third party identifier is unknown, the home server
|
||||||
* will store the invitation in the Identity server and store some information in the room state membership event.
|
* will store the invitation in the Identity server and store some information in the room state membership event.
|
||||||
* The email invite will contains the token and secret that can be used to claim the stored invitation
|
* The email invite will contains the token and secret that can be used to claim the stored invitation.
|
||||||
*
|
*
|
||||||
* To aid clients who may not be able to perform crypto themselves,
|
* To aid clients who may not be able to perform crypto themselves,
|
||||||
* the identity server offers some crypto functionality to help in accepting invitations.
|
* the identity server offers some crypto functionality to help in accepting invitations.
|
||||||
|
|
|
@ -33,7 +33,7 @@ data class SignInvitationResult(
|
||||||
*/
|
*/
|
||||||
val signatures: Map<String, *>,
|
val signatures: Map<String, *>,
|
||||||
/**
|
/**
|
||||||
* The token for the invitation
|
* The token for the invitation.
|
||||||
*/
|
*/
|
||||||
val token: String
|
val token: String
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,7 +23,7 @@ interface SyncStatusService {
|
||||||
|
|
||||||
sealed class Status {
|
sealed class Status {
|
||||||
/**
|
/**
|
||||||
* For initial sync
|
* For initial sync.
|
||||||
*/
|
*/
|
||||||
abstract class InitialSyncStatus : Status()
|
abstract class InitialSyncStatus : Status()
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ interface SyncStatusService {
|
||||||
) : InitialSyncStatus()
|
) : InitialSyncStatus()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For incremental sync
|
* For incremental sync.
|
||||||
*/
|
*/
|
||||||
abstract class IncrementalSyncStatus : Status()
|
abstract class IncrementalSyncStatus : Status()
|
||||||
|
|
||||||
|
|
|
@ -30,17 +30,17 @@ data class IntegrationManagerConfig(
|
||||||
*/
|
*/
|
||||||
enum class Kind {
|
enum class Kind {
|
||||||
/**
|
/**
|
||||||
* Defined in UserAccountData
|
* Defined in UserAccountData.
|
||||||
*/
|
*/
|
||||||
ACCOUNT,
|
ACCOUNT,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defined in Wellknown
|
* Defined in Wellknown.
|
||||||
*/
|
*/
|
||||||
HOMESERVER,
|
HOMESERVER,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fallback value, hardcoded by the SDK
|
* Fallback value, hardcoded by the SDK.
|
||||||
*/
|
*/
|
||||||
DEFAULT
|
DEFAULT
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ interface MediaService {
|
||||||
suspend fun getRawPreviewUrl(url: String, timestamp: Long?): JsonDict
|
suspend fun getRawPreviewUrl(url: String, timestamp: Long?): JsonDict
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Url Preview data from the homeserver, or from cache, depending on the cache strategy
|
* Get Url Preview data from the homeserver, or from cache, depending on the cache strategy.
|
||||||
* @param url The url to get the preview data from
|
* @param url The url to get the preview data from
|
||||||
* @param timestamp The optional timestamp. Note that this parameter is not taken into account
|
* @param timestamp The optional timestamp. Note that this parameter is not taken into account
|
||||||
* if the data is already in cache and the cache strategy allow to use it
|
* if the data is already in cache and the cache strategy allow to use it
|
||||||
|
@ -45,7 +45,7 @@ interface MediaService {
|
||||||
suspend fun getPreviewUrl(url: String, timestamp: Long?, cacheStrategy: CacheStrategy): PreviewUrlData
|
suspend fun getPreviewUrl(url: String, timestamp: Long?, cacheStrategy: CacheStrategy): PreviewUrlData
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the cache of all retrieved UrlPreview data
|
* Clear the cache of all retrieved UrlPreview data.
|
||||||
*/
|
*/
|
||||||
suspend fun clearCache()
|
suspend fun clearCache()
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package org.matrix.android.sdk.api.session.media
|
package org.matrix.android.sdk.api.session.media
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Facility data class to get the common field of a PreviewUrl response form the server
|
* Facility data class to get the common field of a PreviewUrl response form the server.
|
||||||
*
|
*
|
||||||
* Example of return data for the url `https://matrix.org`:
|
* Example of return data for the url `https://matrix.org`:
|
||||||
* <pre>
|
* <pre>
|
||||||
|
|
|
@ -33,10 +33,10 @@ sealed class PermalinkData {
|
||||||
val viaParameters: List<String>
|
val viaParameters: List<String>
|
||||||
) : PermalinkData()
|
) : PermalinkData()
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* &room_name=Team2
|
* &room_name=Team2
|
||||||
&room_avatar_url=mxc:
|
* &room_avatar_url=mxc:
|
||||||
&inviter_name=bob
|
* &inviter_name=bob
|
||||||
*/
|
*/
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data class RoomEmailInviteLink(
|
data class RoomEmailInviteLink(
|
||||||
|
|
|
@ -23,7 +23,7 @@ import timber.log.Timber
|
||||||
import java.net.URLDecoder
|
import java.net.URLDecoder
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class turns a uri to a [PermalinkData]
|
* This class turns a uri to a [PermalinkData].
|
||||||
* element-based domains (e.g. https://app.element.io/#/user/@chagai95:matrix.org) permalinks
|
* element-based domains (e.g. https://app.element.io/#/user/@chagai95:matrix.org) permalinks
|
||||||
* or matrix.to permalinks (e.g. https://matrix.to/#/@chagai95:matrix.org)
|
* or matrix.to permalinks (e.g. https://matrix.to/#/@chagai95:matrix.org)
|
||||||
* or client permalinks (e.g. <clientPermalinkBaseUrl>user/@chagai95:matrix.org)
|
* or client permalinks (e.g. <clientPermalinkBaseUrl>user/@chagai95:matrix.org)
|
||||||
|
@ -31,7 +31,7 @@ import java.net.URLDecoder
|
||||||
object PermalinkParser {
|
object PermalinkParser {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns a uri string to a [PermalinkData]
|
* Turns a uri string to a [PermalinkData].
|
||||||
*/
|
*/
|
||||||
fun parse(uriString: String): PermalinkData {
|
fun parse(uriString: String): PermalinkData {
|
||||||
val uri = Uri.parse(uriString)
|
val uri = Uri.parse(uriString)
|
||||||
|
@ -39,7 +39,7 @@ object PermalinkParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turns a uri to a [PermalinkData]
|
* Turns a uri to a [PermalinkData].
|
||||||
* https://github.com/matrix-org/matrix-doc/blob/master/proposals/1704-matrix.to-permalinks.md
|
* https://github.com/matrix-org/matrix-doc/blob/master/proposals/1704-matrix.to-permalinks.md
|
||||||
*/
|
*/
|
||||||
fun parse(uri: Uri): PermalinkData {
|
fun parse(uri: Uri): PermalinkData {
|
||||||
|
|
|
@ -57,7 +57,7 @@ interface PermalinkService {
|
||||||
fun createPermalink(id: String, forceMatrixTo: Boolean = false): String?
|
fun createPermalink(id: String, forceMatrixTo: Boolean = false): String?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a permalink for a roomId, including the via parameters
|
* Creates a permalink for a roomId, including the via parameters.
|
||||||
*
|
*
|
||||||
* @param roomId the room id
|
* @param roomId the room id
|
||||||
* @param forceMatrixTo whether we should force using matrix.to base URL
|
* @param forceMatrixTo whether we should force using matrix.to base URL
|
||||||
|
@ -79,7 +79,7 @@ interface PermalinkService {
|
||||||
fun createPermalink(roomId: String, eventId: String, forceMatrixTo: Boolean = false): String
|
fun createPermalink(roomId: String, eventId: String, forceMatrixTo: Boolean = false): String
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract the linked id from the universal link
|
* Extract the linked id from the universal link.
|
||||||
*
|
*
|
||||||
* @param url the universal link, Ex: "https://matrix.to/#/@benoit:matrix.org"
|
* @param url the universal link, Ex: "https://matrix.to/#/@benoit:matrix.org"
|
||||||
* @return the id from the url, ex: "@benoit:matrix.org", or null if the url is not a permalink
|
* @return the id from the url, ex: "@benoit:matrix.org", or null if the url is not a permalink
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.matrix.android.sdk.api.session.presence.model.UserPresence
|
||||||
*/
|
*/
|
||||||
interface PresenceService {
|
interface PresenceService {
|
||||||
/**
|
/**
|
||||||
* Update the presence status for the current user
|
* Update the presence status for the current user.
|
||||||
* @param presence the new presence state
|
* @param presence the new presence state
|
||||||
* @param statusMsg the status message to attach to this state
|
* @param statusMsg the status message to attach to this state
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -36,21 +36,21 @@ interface ProfileService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the current display name for this user
|
* Return the current display name for this user.
|
||||||
* @param userId the userId param to look for
|
* @param userId the userId param to look for
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
suspend fun getDisplayName(userId: String): Optional<String>
|
suspend fun getDisplayName(userId: String): Optional<String>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the display name for this user
|
* Update the display name for this user.
|
||||||
* @param userId the userId to update the display name of
|
* @param userId the userId to update the display name of
|
||||||
* @param newDisplayName the new display name of the user
|
* @param newDisplayName the new display name of the user
|
||||||
*/
|
*/
|
||||||
suspend fun setDisplayName(userId: String, newDisplayName: String)
|
suspend fun setDisplayName(userId: String, newDisplayName: String)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the avatar for this user
|
* Update the avatar for this user.
|
||||||
* @param userId the userId to update the avatar of
|
* @param userId the userId to update the avatar of
|
||||||
* @param newAvatarUri the new avatar uri of the user
|
* @param newAvatarUri the new avatar uri of the user
|
||||||
* @param fileName the fileName of selected image
|
* @param fileName the fileName of selected image
|
||||||
|
@ -74,12 +74,12 @@ interface ProfileService {
|
||||||
suspend fun getProfile(userId: String): JsonDict
|
suspend fun getProfile(userId: String): JsonDict
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current user 3Pids
|
* Get the current user 3Pids.
|
||||||
*/
|
*/
|
||||||
fun getThreePids(): List<ThreePid>
|
fun getThreePids(): List<ThreePid>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current user 3Pids Live
|
* Get the current user 3Pids Live.
|
||||||
* @param refreshData set to true to fetch data from the homeserver
|
* @param refreshData set to true to fetch data from the homeserver
|
||||||
*/
|
*/
|
||||||
fun getThreePidsLive(refreshData: Boolean): LiveData<List<ThreePid>>
|
fun getThreePidsLive(refreshData: Boolean): LiveData<List<ThreePid>>
|
||||||
|
@ -90,7 +90,7 @@ interface ProfileService {
|
||||||
fun getPendingThreePids(): List<ThreePid>
|
fun getPendingThreePids(): List<ThreePid>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the pending 3Pids Live
|
* Get the pending 3Pids Live.
|
||||||
*/
|
*/
|
||||||
fun getPendingThreePidsLive(): LiveData<List<ThreePid>>
|
fun getPendingThreePidsLive(): LiveData<List<ThreePid>>
|
||||||
|
|
||||||
|
@ -100,18 +100,18 @@ interface ProfileService {
|
||||||
suspend fun addThreePid(threePid: ThreePid)
|
suspend fun addThreePid(threePid: ThreePid)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate a code received by text message
|
* Validate a code received by text message.
|
||||||
*/
|
*/
|
||||||
suspend fun submitSmsCode(threePid: ThreePid.Msisdn, code: String)
|
suspend fun submitSmsCode(threePid: ThreePid.Msisdn, code: String)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finalize adding a 3Pids. Call this method once the user has validated that he owns the ThreePid
|
* Finalize adding a 3Pids. Call this method once the user has validated that he owns the ThreePid.
|
||||||
*/
|
*/
|
||||||
suspend fun finalizeAddingThreePid(threePid: ThreePid,
|
suspend fun finalizeAddingThreePid(threePid: ThreePid,
|
||||||
userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor)
|
userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancel adding a threepid. It will remove locally stored data about this ThreePid
|
* Cancel adding a threepid. It will remove locally stored data about this ThreePid.
|
||||||
*/
|
*/
|
||||||
suspend fun cancelAddingThreePid(threePid: ThreePid)
|
suspend fun cancelAddingThreePid(threePid: ThreePid)
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ interface ProfileService {
|
||||||
suspend fun deleteThreePid(threePid: ThreePid)
|
suspend fun deleteThreePid(threePid: ThreePid)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a User object from a userId
|
* Return a User object from a userId.
|
||||||
*/
|
*/
|
||||||
suspend fun getProfileAsUser(userId: String): User {
|
suspend fun getProfileAsUser(userId: String): User {
|
||||||
return getProfile(userId).let { dict ->
|
return getProfile(userId).let { dict ->
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.util.UUID
|
||||||
interface PushersService {
|
interface PushersService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh pushers from server state
|
* Refresh pushers from server state.
|
||||||
*/
|
*/
|
||||||
fun refreshPushers()
|
fun refreshPushers()
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ interface PushersService {
|
||||||
append: Boolean = true)
|
append: Boolean = true)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Directly ask the push gateway to send a push to this device
|
* Directly ask the push gateway to send a push to this device.
|
||||||
* If successful, the push gateway has accepted the request. In this case, the app should receive a Push with the provided eventId.
|
* If successful, the push gateway has accepted the request. In this case, the app should receive a Push with the provided eventId.
|
||||||
* In case of error, PusherRejected will be thrown. In this case it means that the pushkey is not valid.
|
* In case of error, PusherRejected will be thrown. In this case it means that the pushkey is not valid.
|
||||||
*
|
*
|
||||||
|
@ -81,30 +81,30 @@ interface PushersService {
|
||||||
eventId: String)
|
eventId: String)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a registered pusher
|
* Remove a registered pusher.
|
||||||
* @param pusher the pusher to remove, can be http or email
|
* @param pusher the pusher to remove, can be http or email
|
||||||
*/
|
*/
|
||||||
suspend fun removePusher(pusher: Pusher)
|
suspend fun removePusher(pusher: Pusher)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a Http pusher by its pushkey and appId
|
* Remove a Http pusher by its pushkey and appId.
|
||||||
* @see addHttpPusher
|
* @see addHttpPusher
|
||||||
*/
|
*/
|
||||||
suspend fun removeHttpPusher(pushkey: String, appId: String)
|
suspend fun removeHttpPusher(pushkey: String, appId: String)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an Email pusher
|
* Remove an Email pusher.
|
||||||
* @see addEmailPusher
|
* @see addEmailPusher
|
||||||
*/
|
*/
|
||||||
suspend fun removeEmailPusher(email: String)
|
suspend fun removeEmailPusher(email: String)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current pushers, as a LiveData
|
* Get the current pushers, as a LiveData.
|
||||||
*/
|
*/
|
||||||
fun getPushersLive(): LiveData<List<Pusher>>
|
fun getPushersLive(): LiveData<List<Pusher>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current pushers
|
* Get the current pushers.
|
||||||
*/
|
*/
|
||||||
fun getPushers(): List<Pusher>
|
fun getPushers(): List<Pusher>
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue