Commit graph

29 commits

Author SHA1 Message Date
Benoit Marty
aadc6d68d8 Merge branch 'develop' into feature/bma/removeOldResources 2023-06-27 16:09:30 +02:00
Benoit Marty
c33a08b602 Merge pull request #684 from vector-im/feature/bma/stringR
Quick PR to introduce `CommonStrings` type alias
2023-06-27 16:00:31 +02:00
Marco Romano
316d57d1b6 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.
2023-06-27 13:37:23 +02:00
Benoit Marty
659b9d3d9c Now that the composer as been removed, we do not need element resource module anymore. 2023-06-27 13:34:55 +02:00
Benoit Marty
dfa1adb9c1 More cleanup 2023-06-27 09:51:33 +02:00
Benoit Marty
798da50454 Use CommonStrings everywhere 2023-06-27 09:45:00 +02:00
Benoit Marty
36910abca4 Move FileSizeFormatter to module :libraries:androidutils 2023-06-26 11:14:53 +02:00
Benoit Marty
b6920afb7f Move cache management to a dedicated class and in the setting module, for clarity. 2023-06-26 11:07:53 +02:00
Benoit Marty
145cd410c7 Idx -> Index 2023-06-26 11:07:53 +02:00
Benoit Marty
5b4069d9f4 Use operator invoke. 2023-06-26 11:07:53 +02:00
Benoit Marty
8f0834afd5 Fix compilation issue in Fake class. 2023-06-26 11:07:53 +02:00
Benoit Marty
fb9568258f Clear cache: clear Coil and OkHttpClient cache. 2023-06-26 11:07:53 +02:00
Benoit Marty
979ebe4adb Close the client before deleting data, and ensure the app is restarted, using a cache Index. 2023-06-26 11:07:22 +02:00
Benoit Marty
573de1c168 Improve rendering of cache size (and fix compilation issue) 2023-06-26 11:07:22 +02:00
Benoit Marty
2a7d252a4e Display cache size in the developer settings (#643) 2023-06-26 11:06:36 +02:00
Benoit Marty
f014f0a3ae Add clear cache action in the developer settings (#643) 2023-06-26 11:06:36 +02:00
Yoan Pintas
f534ecda96 Init analytics modules (#350) 2023-06-05 13:11:34 +00:00
Florian Renaud
719dd20555 Remove useless OptIn in tests 2023-05-12 10:05:39 +02:00
Benoit Marty
4d7ec3916b Re-order parameters. 2023-05-05 11:49:27 +02:00
Benoit Marty
e89fcdcc94 Avoid using hard-coded key, use ShowkaseBrowserActivity.getIntent() instead. 2023-05-04 17:31:08 +02:00
Benoit Marty
6b77313fd6 Move the button to open the Showkase browser to the developer settings screen. (#389) 2023-05-04 17:29:03 +02:00
Chris Smith
581c5ab2d2 Move and refactor MatrixUser (#381)
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").
2023-05-03 16:30:19 +00:00
Jorge Martin Espinosa
9a45e48d9e Group design components in Showkase for the Compound team (#375)
* Screenshot tests changes:

    - Group components for Showkase.
    - Set special Paparazzi config for scrolling screens using non null `Preview.heightDp`.
    - Add merged theme preview with `ElementThemedPreview` component.
2023-05-02 16:13:35 +00:00
ganfra
638b45930e Merge pull request #334 from vector-im/feature/fga/feature_flag
Feature/fga/feature flag
2023-04-18 15:24:04 +02:00
ganfra
991c7ff7f0 [FeatureFlag] add more tests 2023-04-18 12:05:29 +02:00
ganfra
a11b407038 FeatureFlag: first implementation 2023-04-17 19:44:29 +02:00
Jorge Martin Espinosa
de010545fb Update Gradle to 8.1 and AGP to v8.0 (#329)
* Update AGP to 8.0.0.

* Set JAVA_HOME to JDK17

* Update lint version.

* Use right JDK for dependency analysis, replace deprecated env var.

* Upgrade to Gradle 8.1.

* Remove `@Supress(DSL_SCOPE_VIOLATION)` as it's no longer needed.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-04-17 08:49:52 +00:00
Benoit Marty
998178b70f [Strings] Use strings from localazy. 2023-03-27 14:44:24 +02:00
ganfra
bc9f3b69cc [Architecture] split all feature modules to api/impl 2023-03-08 16:13:45 +01:00