Android Matrix messenger application using the Matrix Rust Sdk and Jetpack Compose
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
574 B

/*
* Copyright 2023, 2024 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only
* Please see LICENSE in the repository root for full details.
*/
plugins {
id("io.element.android-compose-library")
id("kotlin-parcelize")
}
android {
namespace = "io.element.android.libraries.architecture"
}
dependencies {
api(projects.libraries.di)
api(libs.dagger)
api(libs.appyx.core)
api(libs.androidx.lifecycle.runtime)
Async API improvements "v2" (#672) * Async API improvements "v2" **NB: This PR actually changes only 3 files in `libraries/architecture/`. All the other changes are automated refactors to fix the calling code.** This is a proposal for improvements to our `Async` type as discussed in: https://github.com/vector-im/element-x-android/pull/598/files#r1230664392 and in other chats. Please bear in mind it is just a proposal, I'd love to hear your feedback about it, especially when it comes to naming: I've tried to make parameter and function names use a terminology similar to what we find in the Kotlin stdlib and its `Result` type. I'm inclined to like more the non-extension flavours of the new `run*` APIs, though I'd also like your feedback about what API shape you prefer. ### Summary of the changes: #### Functional - Adds `exceptionOrNull()` API to complement the existing `dataOrNull()` API. - Adds `isFailure()`, `isLoading()`, `isSuccess()` and `isUninitialized()` courtesy APIs. - Renames `executeResult()` to `runUpdatingState()`: - Becomes the base API to which all the other similarly named APIs call into. - Makes it inline. - Adds contract. - Passes over any `prevData` to newre Async states. - Passes through the `block`s return value. - Adds unit tests. - Renames `execute` to `runCatchingUpdatingState()` and makes it just call into `runUpdatingState()` - Adds extension function overloads to the `run*` functions to accept `MutableState` as receiver #### Cosmetics - Reorders classes and methods in alphabetic order. - Reorder parameter names to mimic conventions in Kotlin stdlib. - Adds docstrings where useful. * Use `fold()` * rename pop to popFirst * Add docstrings * Please Detekt * Rename exception to error. * Please detekt * Update existing usages.
1 year ago
testImplementation(libs.test.junit)
testImplementation(libs.coroutines.test)
testImplementation(libs.test.truth)
}