Improve documentation

This commit is contained in:
Benoit Marty 2022-05-06 00:04:44 +02:00 committed by Benoit Marty
parent d92875e3c2
commit dc1eba2847
3 changed files with 31 additions and 11 deletions

View File

@ -17,13 +17,19 @@
package org.matrix.android.sdk.api.cache
sealed class CacheStrategy {
// Data is always fetched from the server
/**
* Data is always fetched from the server
*/
object NoCache : CacheStrategy()
// Once data is retrieved, it is stored for the provided amount of time.
// In case of error, and if strict is set to false, the cache can be returned if available
/**
* Once data is retrieved, it is stored for the provided amount of time.
* In case of error, and if strict is set to false, the cache can be returned if available
*/
data class TtlCache(val validityDurationInMillis: Long, val strict: Boolean) : CacheStrategy()
// Once retrieved, the data is stored in cache and will be always get from the cache
/**
* Once retrieved, the data is stored in cache and will be always get from the cache
*/
object InfiniteCache : CacheStrategy()
}

View File

@ -37,7 +37,9 @@ sealed class Failure(cause: Throwable? = null) : Throwable(cause = cause) {
data class ServerError(val error: MatrixError, val httpCode: Int) : Failure(RuntimeException(error.toString()))
object SuccessError : Failure(RuntimeException(RuntimeException("SuccessResult is false")))
// When server send an error, but it cannot be interpreted as a MatrixError
/**
* When server send an error, but it cannot be interpreted as a MatrixError
*/
data class OtherServerError(val errorBody: String, val httpCode: Int) : Failure(RuntimeException("HTTP $httpCode: $errorBody"))
data class RegistrationFlowError(val registrationFlowResponse: RegistrationFlowResponse) : Failure(RuntimeException(registrationFlowResponse.toString()))

View File

@ -17,10 +17,14 @@
package org.matrix.android.sdk.api.session.crypto.verification
sealed class VerificationTxState {
// Uninitialized state
/**
* Uninitialized state
*/
object None : VerificationTxState()
// Specific for SAS
/**
* Specific for SAS
*/
abstract class VerificationSasTxState : VerificationTxState()
object SendingStart : VerificationSasTxState()
@ -38,18 +42,26 @@ sealed class VerificationTxState {
object MacSent : VerificationSasTxState()
object Verifying : VerificationSasTxState()
// Specific for QR code
/**
* Specific for QR code
*/
abstract class VerificationQrTxState : VerificationTxState()
// Will be used to ask the user if the other user has correctly scanned
/**
* Will be used to ask the user if the other user has correctly scanned
*/
object QrScannedByOther : VerificationQrTxState()
object WaitingOtherReciprocateConfirm : VerificationQrTxState()
// Terminal states
/**
* Terminal states
*/
abstract class TerminalTxState : VerificationTxState()
object Verified : TerminalTxState()
// Cancelled by me or by other
/**
* Cancelled by me or by other
*/
data class Cancelled(val cancelCode: CancelCode, val byMe: Boolean) : TerminalTxState()
}