Commit Graph

5468 Commits

Author SHA1 Message Date
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
ganfra f6a1db44a6 Fix some code quality/formatting 2023-06-27 14:43:05 +02:00
ganfra 812880a148 RoomList: fix tests and sample 2023-06-27 14:06:58 +02:00
Benoit Marty 9264dd891e More cleanup 2023-06-27 13:38:55 +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
ganfra d9559af2cf RoomList: branch invites 2023-06-27 12:52:06 +02:00
ganfra 34f5e0597a Merge branch 'develop' into feature/fga/room_list_api 2023-06-27 10:47:50 +02:00
ganfra 8f5fb64ba5 RoomList/Timeline: makes sure initial values are set before computing diff/update 2023-06-27 10:47:14 +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 4fa7d1a2d8 Introduce handy aliases to avoid writing this: import io.element.android.libraries.ui.strings.R as StringR 2023-06-27 09:45:00 +02:00
Marco Romano 4fe7bb6809 Add sendLocation API to Rust Room (#681)
Will be used by the location sharing feature.
2023-06-27 09:12:17 +02:00
renovate[bot] 32332deaf4 Update dependency org.matrix.rustcomponents:sdk-android to v0.1.24 (#675)
* Update dependency org.matrix.rustcomponents:sdk-android to v0.1.24

* Add new `filterByPushRules`.
Only existing usage of this API will set this param to `true` in order to not change the current behavior.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Marco Romano <marcor@element.io>
2023-06-27 08:29:36 +02:00
ganfra eb00ef3c06 RoomList: fix small error in update processing 2023-06-26 22:58:54 +02:00
ganfra 7c76a74a30 RoomList/Timeline : Add Buffer(Unlimited) to avoid blocking rust listener thread 2023-06-26 22:32:59 +02:00
ganfra 19e2c104af RoomList: update LoadingState and fix a crash 2023-06-26 22:30:12 +02:00
ganfra 8c66924be9 Timeline: refactor a bit 2023-06-26 18:18:48 +02:00
ganfra fa48c29486 RoomList: more rework on RoomSummaryDataSource 2023-06-26 18:02:53 +02:00
Marco Romano c5c9cd33da Refine handleSnackbarMessage API (#676)
As per our offline convos during a PR review.
2023-06-26 16:29:50 +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 baf117e8fa Move content to to File.kt. Also remove deleteAllFiles, we have deleteRecursively now. 2023-06-26 11:07:53 +02:00
Benoit Marty 145cd410c7 Idx -> Index 2023-06-26 11:07:53 +02:00
Benoit Marty 4297cfac24 Fix typo in comment. 2023-06-26 11:07:53 +02:00
Benoit Marty 35dc9eebfc Ensure all file about sqlite are deleted. 2023-06-26 11:07:53 +02:00
Benoit Marty ffa7154e43 Implement missing methods in Fake class. 2023-06-26 11:07:53 +02:00
Benoit Marty 3652059a52 Lazy usage of OkHttpClient 2023-06-26 11:07:53 +02:00
Benoit Marty e298670b68 var -> val 2023-06-26 11:07:53 +02:00
Benoit Marty f9423fc15e Close the client before removing its data. Probably safer. 2023-06-26 11:07:22 +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 c847ac3a98 Improve FileSizeFormatter.format API. 2023-06-26 11:06:36 +02:00
Benoit Marty 529720079a Move FileSizeFormatter to a new module for injectable Android utilities. 2023-06-26 11:06:36 +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
Benoit Marty 4f269d37dd Improve PreferenceText rendering, in particular center the test on the right vertically, add padding in add more previews. 2023-06-26 11:06:36 +02:00
bmarty 874739ece9 Sync Strings from Localazy 2023-06-26 00:10:53 +00:00
ganfra 7ee3c1bf42 Merge branch 'develop' into feature/fga/room_list_api 2023-06-23 18:14:09 +02:00
ganfra 3e074cd49a Merge pull request #667 from vector-im/update-rust-sdk-0.1.23
Update rust sdk 0.1.23
2023-06-23 17:40:23 +02:00
ganfra db55644fb8 Rust sdk update: make the project compiling 2023-06-23 17:22:08 +02:00
ganfra f3e072bdb0 RoomList: try syncing when network is back and inError state 2023-06-23 17:07:27 +02:00
Jorge Martin Espinosa cf2723ac7f [Message Actions] Copy events to clipboard (#665)
* Add `Copy` action for text events

* Remove 'Copy' action from the list for non-text events

* Use `@ContributesBinding` to inject `AndroidClipboardHelper`.
2023-06-23 14:39:07 +00:00
Jorge Martin Espinosa 9251cbf536 [Message Actions] Report messages (#642)
* Add report messages feature

* Try to improve how snackbars are delivered

---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
2023-06-23 10:44:47 +02:00
Marco Romano e1bb5684cd Expose new windowInsets param from ModalBottomSheet (#662)
Part of new public API in compose.material3:1.1.1
2023-06-23 09:57:21 +02:00
ganfra ca080fd6af RoomList: introduces a SyncService 2023-06-22 16:50:53 +02:00
Jorge Martin Espinosa 42827206b3 [Message Actions] Forward messages (#635)
* Add forwarding messages base

* Make forwarding single-selection

---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
2023-06-22 13:27:59 +02:00
ganfra ef8dc6ea7a RoomList: change a bit the api of RoomSummaryDataSource 2023-06-22 12:34:07 +02:00
ganfra 4656af6ce8 RoomList: start/stop sync in resume/pause callbacks 2023-06-22 12:21:10 +02:00
ganfra 01f1f73b96 Merge branch 'develop' into feature/fga/room_list_api 2023-06-22 11:31:49 +02:00