Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarty committed May 11, 2022
1 parent 2b651ce commit d09acce
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
}

0 comments on commit d09acce

Please sign in to comment.