Commit Graph

2138 Commits

Author SHA1 Message Date
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
fd1352de5f Merge pull request #680 from vector-im/renovate/org.matrix.rustcomponents
Update dependency org.matrix.rustcomponents:sdk-android to v0.1.25
2023-06-27 10:37:05 +02:00
Marco Romano
3eb6a4bc5a Set up SDK & reusable map view component (#476)
Adds `libraries/map` which contains some initial building blocks that will be used by the location sharing feature.

Ref: https://github.com/vector-im/element-meta/issues/1684
2023-06-27 07:23:00 +00:00
Marco Romano
8101f42979 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]
8bd291ecd7 Update dependency app.cash.molecule:molecule-runtime to v0.10.0 (#679)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-06-27 08:36:25 +02:00
renovate[bot]
b0c468ec8d Update dependency org.matrix.rustcomponents:sdk-android to v0.1.25 2023-06-27 06:30:11 +00:00
renovate[bot]
ff135352d8 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
2bd671656e Merge pull request #674 from vector-im/renovate/appyx
Update appyx to v1.3.0
2023-06-26 21:31:06 +02:00
Marco Romano
ffc9d1e82e Refine handleSnackbarMessage API (#676)
As per our offline convos during a PR review.
2023-06-26 16:29:50 +02:00
renovate[bot]
a42b8caab3 Update appyx to v1.3.0 2023-06-26 10:07:03 +00:00
Benoit Marty
52fd72d24b Merge pull request #648 from vector-im/feature/bma/clearCache
Developer option to clear cache
2023-06-26 12:06:26 +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
963c4a5f40 Improve readability 2023-06-26 11:07:53 +02:00
Benoit Marty
375ac17e14 Move content to to File.kt. Also remove deleteAllFiles, we have deleteRecursively now. 2023-06-26 11:07:53 +02:00
Benoit Marty
b563b1ec95 Idx -> Index 2023-06-26 11:07:53 +02:00
Benoit Marty
fc61d452c6 Fix typo in comment. 2023-06-26 11:07:53 +02:00
Benoit Marty
6591fbec17 Use operator invoke. 2023-06-26 11:07:53 +02:00
Benoit Marty
cd3b653e1d Merge dict. 2023-06-26 11:07:53 +02:00
Benoit Marty
32ddc7e6f7 Ensure all file about sqlite are deleted. 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
89d4969833 Implement missing methods 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
12e54ac080 Lazy usage of OkHttpClient 2023-06-26 11:07:53 +02:00
Benoit Marty
5fe186f9de var -> val 2023-06-26 11:07:53 +02:00
Benoit Marty
1c06943530 Close the client before removing its data. Probably safer. 2023-06-26 11:07:22 +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
4b8d11b7e4 Ignore typo 2023-06-26 11:07:22 +02:00
ElementBot
001e724a04 Update screenshots 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
2809d6fc2f Improve FileSizeFormatter.format API. 2023-06-26 11:06:36 +02:00
Benoit Marty
ac60ef0cbe Move FileSizeFormatter to a new module for injectable Android utilities. 2023-06-26 11:06:36 +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
Benoit Marty
67c4df3b88 Add logs. 2023-06-26 11:06:36 +02:00
Benoit Marty
ee033a2aa4 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
Benoit Marty
a2615a6408 Merge pull request #659 from vector-im/renovate/dependencycheck
Update dependency org.owasp.dependencycheck to v8.3.1
2023-06-26 09:54:46 +02:00
Benoit Marty
24ebbd6c01 Merge pull request #670 from vector-im/sync-localazy
Sync Strings
2023-06-26 09:54:22 +02:00
bmarty
9c5c578c67 Sync Strings from Localazy 2023-06-26 00:10:53 +00:00
ganfra
6489d4bbfd 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
d85ef79f20 Rust sdk update: make the project compiling 2023-06-23 17:22:08 +02:00
Jorge Martin Espinosa
95f65e2031 [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
Yoan Pintas
1c1e65c70d Merge pull request #666 from vector-im/yostyle/enable_analytics 2023-06-23 16:35:58 +02:00
Chris Smith
d79d444563 Merge pull request #580 from vector-im/misc/cjs/invite-string-change
Fix strings and preview provider for creating rooms
2023-06-23 15:33:04 +01:00
yostyle
efb132c14f Consent thread safe 2023-06-23 16:11:45 +02:00
Chris Smith
e598a920eb Merge remote-tracking branch 'origin/develop' into misc/cjs/invite-string-change 2023-06-23 15:03:11 +01:00
yostyle
09c2c3dea1 Init or stop posthog based on user consent 2023-06-23 15:57:25 +02:00
ganfra
fb23350b62 Merge pull request #660 from vector-im/renovate/io.sentry
Update dependency io.sentry:sentry-android to v6.24.0
2023-06-23 15:11:00 +02:00
Chris Smith
8fe5a0fe27 Merge remote-tracking branch 'origin/develop' into misc/cjs/invite-string-change 2023-06-23 14:10:17 +01:00
Johannes Marbach
1c583ead1c Merge pull request #627 from vector-im/johannes/room-creation-analytics-events 2023-06-23 15:09:55 +02:00