Skip to content

Instantly share code, notes, and snippets.

View quentin41500's full-sized avatar

Quentin Colle quentin41500

View GitHub Profile
/**
* Execute [block] and operate [predicate] on returned value. Each retries can be separated by
* [delay] if necessary.
*
* @param count Number of tries before failing.
* @param delay Delay between retries
* @param block Code to execute
* @param predicate Predicate to execute.
*/
suspend fun <T> retryWithPredicate(
@quentin41500
quentin41500 / CartManager.kt
Last active June 8, 2021 12:28
Using Sealed class and LiveData to handle network request through the repository layer.
/**
* Observable manager for saving the [Cart]'s resource information.
*/
class CartManager : LiveData<Resource<Cart?>>() {
init {
value = Success(null)
}
/**