Commit Graph

43 Commits

Author SHA1 Message Date
Benoit Marty
b748fcc631 Copyright: Add final period 2025-11-10 10:13:41 +01:00
Benoit Marty
0a0224b586 Copyright: run command uv run license-editor --repository ../element-x-android 2025-11-10 10:09:26 +01:00
Benoit Marty
826cacf209 Remove @Inject, not necessary anymore when class is annotated with @ContributesBinding 2025-10-22 18:52:37 +02:00
Benoit Marty
a786f6a5e9 Improve AnnouncementService. 2025-10-08 10:13:02 +02:00
Benoit Marty
4475ed0d37 Show new notification sound banner logic 2025-10-07 15:53:59 +02:00
Benoit Marty
71d2c1d9df Add isFreshInstall Boolean to allow the miration to behave in a different way for an application upgrade or a fresh install.
We cannot restore the previous code which existed because of https://github.com/element-hq/element-x-android/pull/3535
2025-10-07 15:53:57 +02:00
Benoit Marty
629fc552e5 Use DependencyHandlerScope.testCommonDependencies() 2025-09-16 14:38:31 +02:00
Jorge Martín
e06bacbff3 Redo DI gradle setup code 2025-09-04 16:49:20 +02:00
Jorge Martín
fc3153bd26 Fix lint issues and restore commented out code 2025-09-04 16:49:18 +02:00
Jorge Martín
92a4b8b66b Start migrating Anvil KSP to Metro 2025-09-04 16:48:34 +02:00
Benoit Marty
a00623e490 Cleanup tests. 2025-09-01 15:03:41 +02:00
Benoit Marty
5f223f3c89 Refactor: Move InMemorySessionStore to test module
- Delete `libraries/session-storage/impl-memory` module
- Move `InMemorySessionStore.kt` to `libraries/session-storage/test`
2025-09-01 14:47:42 +02:00
Jorge Martin Espinosa
2f2e886e9f Handle preference stores corruption by clearing them (#5086)
* Handle preference stores corruption by clearing them:
    - Use the centralised `PreferenceDataStoreFactory` instead of `preferences by`.
    - Add `DefaultPreferencesCorruptionHandlerFactory.replaceWithEmpty` to its `create(name)` method so all preference stores are cleared if they're corrupted.

* Add detekt rule to make sure we use `PreferenceDataStoreFactory` instead of `by preferencesDataStore`

* Remove `@SingleIn` annotations as the annotated class no longer have to be singletons
2025-08-22 06:59:06 +00:00
Jorge Martin Espinosa
58a3ea8b1f Add catchingExceptions method to replace runCatching (#4797)
- Add `runCatchingExceptions` and `mapCatchingExceptions` to replace `runCatching` and `mapCatching`.
- Make `tryOrNull { ... }` catch only exceptions too.
- Apply the changes to the whole project.
- Add new Rust fakes for tests to handle the code that's now unblocked - previously it just threw an `UnsatisfiedLinkError` which we ignored.
- Add a new `detekt-rules` project with a `RunCatchingRule` to prevent `runCatching` and `mapCatching` usages.
2025-06-04 09:02:26 +02:00
Benoit Marty
77a7c0b2e5 Remember flows (#4533)
* Add Konsist test to ensure that the result of a function returning a flow is remembered.

* Remember flows before they are collected by state.

* Fix compilation issue

* Make isOnline a val.

* Make selectedUsers() a val.

* Make flow() a val.

* Make getUserConsent(), didAskUserConsent() and getAnalyticsId() some val.

* Remove Timeline.paginationStatus() and replace by direct access to the underlined flow.

* Simplify test

* userConsentFlow must be initialized before because it's used in observeUserConsent

* Fix test compilation
2025-04-04 16:50:43 +02:00
Benoit Marty
05fc76822a Apply dual licenses: AGPL + Element Commercial to file headers.
2 replace all actions have been performed:
- "SPDX-License-Identifier: AGPL-3.0-only" to "SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial"
- "Please see LICENSE in the repository root for full details." to "Please see LICENSE files in the repository root for full details."
2025-01-07 10:05:04 +01:00
Jorge Martin Espinosa
e44b5ad98d Upgrade Kotlin to v2.0 (#3594)
* Bump Kotlin to v2.0

* Fix lots of issues due to the upgrade: lint issues, function signature incompatibilities, broken tests, etc.

---------

Co-authored-by: Benoit Marty <benoit@matrix.org>
2024-10-10 08:32:00 +00:00
ganfra
6b1f3b9e4a migration : fix presenter test for fresh/old install 2024-09-25 14:12:11 +02:00
Benoit Marty
ddc15bd81a Remove useless and obsolete comment. 2024-09-25 11:58:04 +02:00
Benoit Marty
cb0fa05e66 Perform the migration, even if the current version is not known. 2024-09-25 11:54:31 +02:00
Benoit Marty
a1515a62a0 Cleanup 2024-09-18 18:08:11 +02:00
Benoit Marty
2b016227e9 Migrate license to AGPL.
Run script `uv run license-editor --repository ../element-x-android`
2024-09-06 17:19:19 +02:00
Benoit Marty
8ce1687bf5 var -> val for lambda 2024-09-06 14:46:28 +02:00
Benoit Marty
e4a2bfa9f0 Use the local val instead. 2024-09-06 13:54:15 +02:00
Benoit Marty
9693a248f7 Add missing test for AppMigration06 2024-09-06 11:51:59 +02:00
Benoit Marty
c51d098679 Add missing test for AppMigration05 2024-09-06 11:41:13 +02:00
Benoit Marty
b00061263a Do not perform any migration on fresh application installation. 2024-09-06 10:52:39 +02:00
Benoit Marty
76e34ae798 Add an application migration to delete the old log files. 2024-09-06 09:31:14 +02:00
Benoit Marty
06f0fd1f64 App migration: also move the cache files. 2024-09-02 11:26:59 +02:00
Benoit Marty
93cace6954 Provide distinct cache directory to the Rust SDK. 2024-08-30 18:36:20 +02:00
Jorge Martin Espinosa
950e502ca6 Improve screenshot testing with ComposablePreviewScanner (#3125)
* Use ComposablePreviewScanner to rework how screenshot testing works
* Add test sharding
* Update screenshots
* Fixes for Element Gallery

---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
Co-authored-by: Benoit Marty <benoit@matrix.org>
2024-07-03 13:05:06 +02:00
Jorge Martin Espinosa
feef0f6976 Add full screen intent permissions banner (#3024)
* Add full screen intent permissions banner, creating `:libraries:fullscreenintent` modules.
* Add it to notification settings too:
    - Create `libraries:fullscreenintent` modules for the permission presenter and associated data.
    - Add the presenter and states to `NotificationSettingsPresenter` and `NotificationSettingsView`.
* Use the right API to check for full screen intent permissions.
- Use the right package name for `:libraries:permission` contents.
* Fix broken tests (flaky?)
* Ignore coverage verification for fake and small presenters

---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
2024-06-18 07:41:10 +00:00
Jorge Martín
841558c3b4 Add session path migration to SessionData 2024-06-06 17:06:57 +02:00
Benoit Marty
7dac89202a Fix existing tests. 2024-06-05 14:59:51 +02:00
Jorge Martin Espinosa
801f0b955d Notifications: simplify the flow by removing persistence (#2924)
* Notifications: simplify the flow by removing persistence. 
* Bump of minSdk to `24` (Android 7).
* Add migration to remove `notification.bin` file
2024-05-29 08:03:23 +00:00
Benoit Marty
ab2e620e39 Rename class (code quality) 2024-05-23 14:38:50 +02:00
Benoit Marty
55fda265d9 Rename class (code quality) 2024-05-23 14:38:49 +02:00
Jorge Martin Espinosa
6257425344 Bump Rust SDK to v0.2.18 and bump app version (#2836)
* Adapt to changes in SDK:
    - Remove name from MatrixRoom, we should use displayName instead.
    - Remove separate invites room list.
    - Added runBlocking to get the now async NotificationClient from the Rust SDK.
    - Made some other functions suspend.
    - Client.resolveRoomAlias now returns a roomId and via parameters, we pass the roomId.

* Add logs removal migration again as `AppMigration03` to make sure we don't leak private data in existing logs.

* Bump app version to `0.4.12`
2024-05-13 16:48:23 +02:00
Jorge Martin Espinosa
9aadec8435 Enforce mandatory session verification only for new logins (#2811)
* Enforce mandatory session verification only for new logins

- Creates `AppMigration` base interface as a way to isolate migration logic, app migrations must implement this interface.
- Creates `AppMigration01` with the existing logs removal migration and `AppMigration02` with the logic to allow existing sessions to skip verification.
- Add `DefaultSessionPreferencesStoreFactory.remove(sessionId)` to allow a ephemeral session store access to exist outside the `SessionScope` for this new migration.

* Fix tests

* Add more tests.

This also includes creating several abstractions.

* Review changes.

- Make `orderedMigrations` a class property, `migrations` just a constructor parameter to avoid incorrect usages.
- Create `lastMigration` property too, use it instead of `MIGRATION_VERSION`.
2024-05-07 14:06:34 +00:00
Benoit Marty
1db515ee17 Please KtLint 2024-04-24 13:28:52 +02:00
Benoit Marty
8d0aa68f9a Add KDoc. 2024-04-24 13:26:27 +02:00
Benoit Marty
46544b1b45 Code quality. 2024-04-24 11:40:09 +02:00
Benoit Marty
f6b5b8419b Implement a migration mechanism to handle internal stuff which need to occur during application upgrade.
Remove VectorFileLogger, it was dead code.
2024-04-24 11:17:23 +02:00