Commit Graph

73 Commits

Author SHA1 Message Date
Benoit Marty
5f16297939 Merge branch 'develop' into feature/bma/removeOldResources 2023-06-27 16:09:30 +02:00
Benoit Marty
d782162f27 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
2a82e1b4e4 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
4cb9843415 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
287328f7df More cleanup 2023-06-27 09:51:33 +02:00
Benoit Marty
4a8c49fa28 Use CommonStrings everywhere 2023-06-27 09:45:00 +02:00
Benoit Marty
a226580c8c Move FileSizeFormatter to module :libraries:androidutils 2023-06-26 11:14:53 +02:00
Benoit Marty
f1019f3444 Move cache management to a dedicated class and in the setting module, for clarity. 2023-06-26 11:07:53 +02:00
Benoit Marty
b563b1ec95 Idx -> Index 2023-06-26 11:07:53 +02:00
Benoit Marty
6591fbec17 Use operator invoke. 2023-06-26 11:07:53 +02:00
Benoit Marty
231d4b1577 Fix compilation issue in Fake class. 2023-06-26 11:07:53 +02:00
Benoit Marty
0ee2861452 Clear cache: clear Coil and OkHttpClient cache. 2023-06-26 11:07:53 +02:00
Benoit Marty
58860a9440 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
df4bc3d7ce Improve rendering of cache size (and fix compilation issue) 2023-06-26 11:07:22 +02:00
Benoit Marty
5d8adb25ae Display cache size in the developer settings (#643) 2023-06-26 11:06:36 +02:00
Benoit Marty
bf80c251aa Add clear cache action in the developer settings (#643) 2023-06-26 11:06:36 +02:00
Yoan Pintas
d2263372d2 Init analytics modules (#350) 2023-06-05 13:11:34 +00:00
Florian Renaud
c22d181d8c Remove useless OptIn in tests 2023-05-12 10:05:39 +02:00
Benoit Marty
f881bd849d Re-order parameters. 2023-05-05 11:49:27 +02:00
Benoit Marty
232ae32051 Avoid using hard-coded key, use ShowkaseBrowserActivity.getIntent() instead. 2023-05-04 17:31:08 +02:00
Benoit Marty
e8049f81a4 Move the button to open the Showkase browser to the developer settings screen. (#389) 2023-05-04 17:29:03 +02:00
Chris Smith
5c935818c6 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
921fb55220 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
f98fe8e52c Merge pull request #334 from vector-im/feature/fga/feature_flag
Feature/fga/feature flag
2023-04-18 15:24:04 +02:00
ganfra
82c9ee9982 [FeatureFlag] add more tests 2023-04-18 12:05:29 +02:00
ganfra
279185b175 FeatureFlag: first implementation 2023-04-17 19:44:29 +02:00
Jorge Martin Espinosa
afd58f1634 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
c774f7529e [Strings] Use strings from localazy. 2023-03-27 14:44:24 +02:00
ganfra
7051bfc14e [Architecture] split all feature modules to api/impl 2023-03-08 16:13:45 +01:00
ganfra
b2c68d555a [Architecture] introduce nodeBuilder concept 2023-03-07 20:31:16 +01:00
ganfra
9d91fb06cc Merge branch 'develop' into feature/fga/improve_node_architecture 2023-03-07 12:10:20 +01:00
ganfra
c581f0b383 [Architecture] introduce BackstackNode 2023-03-02 17:55:26 +01:00
Benoit Marty
0b5abc7a73 Move module matrixtest to matrix.test 2023-03-02 17:19:58 +01:00
ganfra
15ed58b756 [Architecture] use FeatureEntryPoint on Preferences 2023-03-02 15:59:25 +01:00
ganfra
da92113e43 [Architecture] Introduce EntryPoint and use createNode for ParentNode too 2023-03-02 12:33:18 +01:00
Benoit Marty
0959f652a8 Add some previews. 2023-02-14 17:03:02 +01:00
Benoit Marty
ec687edc2d Extract Provider (and rename them) to their own file and move fixture(s) there. 2023-02-14 17:03:02 +01:00
Benoit Marty
f04f2dad9e Give the id to AvatarData to be able to compute initial properly. 2023-02-14 17:03:02 +01:00
Benoit Marty
23c4b9041a Enforce no default value in state. 2023-02-14 17:03:02 +01:00
Benoit Marty
af5277f5cc Add test for PreferencesRootPresenter 2023-02-09 12:19:04 +01:00
Benoit Marty
2cfa921a70 Rework Preview for a better rendering in the IDE. 2023-02-03 12:56:53 +01:00
ganfra
6bbd5bdc3d Merge branch 'develop' into feature/fga/fix_restoration 2023-02-01 16:05:05 +01:00
ganfra
bfb508ba1d Remove PresenterConnector and molecule runtime in feature modules, directly call Presenter.present method 2023-02-01 15:56:07 +01:00
Benoit Marty
b4fbe77581 Optimize import 2023-01-30 16:36:51 +01:00
Benoit Marty
7662eb114a Merge pull request #58 from vector-im/feature/bma/investigation
Add animation between screens
2023-01-25 11:49:01 +01:00
Benoit Marty
15700062c7 Rename function (code review) 2023-01-25 11:14:50 +01:00
ganfra
27bf42c5f2 Change/move some gradle modules to be better separated. Let core module be a kotlin lib. 2023-01-24 17:38:57 +01:00
Benoit Marty
7e2fd638e4 Animation between screens 2023-01-24 17:24:40 +01:00
Benoit Marty
908b31af81 Naming convention and no need for a val for presenter 2023-01-24 09:48:35 +01:00
Benoit Marty
1319be177a Use the modifier parameter. 2023-01-24 09:45:11 +01:00