* Make `InternalButton` internal instead of private so it can be customised.
Also, change the `ButtonColors.contentColor` for text buttons to `LocalContentColor.current` by default.
* Add temporary color for Snackbar action label
* Implement `Snackbar` component based on Compound
* Propagate changes to all other components
* Use right Preview annotation config
* Move `ButtonVisuals` to their own file
* Update screenshots
* Make previews internal
* Update screenshots
* Set a custom token for contentColor in AppBars
* Change 'Label' to 'Action' in the previews
* Add changelog
* Update screenshots
---------
Co-authored-by: ElementBot <benoitm+elementbot@element.io>
With this change, composable previews and screenshots should be created with just:
```
@ElementPreviews@Composable
fun MyViewPreview() {
ElementPreview {
MyView()
}
}
```
- Adds `@ElementPreviews` which is a shorthand for:
```
@Preview(name = "D")
@Preview(name = "N", uiMode = Configuration.UI_MODE_NIGHT_YES)
```
Should be used in connection with the now public `fun ElementPreview()` composable.
- Adds ElementPreviews to previewAnnotations in dangerfile
- Screenshots of night mode previews are now rendered with night mode
- Replaces `ElementPreviewLight` and `ElementThemedPreview` with `ElementPreview`
- Deprecates `ElementPreviewDark` which should be removed.
- Remaining usages of `ElementPreviewDark` are now ignored during screenshot tests
* 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.
Move and refactor MatrixUser
Instead of living in matrixui and having an AvatarData, this can
reside in the matrix module and just have the URL. An extension
method in matrixui can then provide the AvatarData when required.
This removes some small duplication, and pushes the UI-specific
information (i.e., what size of avatar is going to be rendered)
further down the stack. It also aligns the field names with those
used by the rust SDK (e.g. "displayName" instead of "userName").