Commit graph

59 commits

Author SHA1 Message Date
Benoit Marty
f61df38e55 Migrate license to AGPL.
Run script `uv run license-editor --repository ../element-x-android`
2024-09-06 17:19:19 +02:00
Benoit Marty
9d91cc6184 Add missing test for AppMigration06 2024-09-06 11:51:59 +02:00
Benoit Marty
56fd455d44 Add missing test for AppMigration05 2024-09-06 11:41:13 +02:00
Benoit Marty
951dff8951 Fix test compilation issue. 2024-09-03 10:01:45 +02:00
Benoit Marty
c41cb33410 Provide distinct cache directory to the Rust SDK. 2024-08-30 18:36:20 +02:00
Benoit Marty
4227b42dfa Add unit test on DefaultImageLoaderHolder 2024-06-24 14:42:04 +02:00
ganfra
38329ab1ba Session : fix sessionPath missing 2024-06-12 15:42:30 +02:00
Jorge Martín
67f6bf0d2d Add session path migration to SessionData 2024-06-06 17:06:57 +02:00
Benoit Marty
ec8cb2e32f Change Test class suffix. 2024-05-30 10:11:18 +02:00
Benoit Marty
b38c144f46 Add test on DefaultFirebaseNewTokenHandler 2024-05-22 18:42:39 +02:00
Jorge Martin Espinosa
69d5b564da
Fix crash when creating an EncryptedFile in Android 6 (#2853) 2024-05-15 16:10:16 +00:00
Jorge Martin Espinosa
5c59f6c20f
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
Jorge Martin Espinosa
1de6797673
Remove SessionData.needsVerification as the source of truth for session verification status (#2748)
* Remove `SessionData.needsVerification` as the source of truth for session verification status.

- Use the Rust SDK `EncryptionService.verificationState()` instead, but always waiting for the first 'known' result (either verified or not, discarding 'unknown').
- Add a workaround in the super rare case when reading this value gets stuck somehow. We'll assume the user is not verified in that case.
- Make `DefaultFtueService.getNextStep` and dependent checks `suspend`.
- Make the `skip` button use a value in the session preferences instead.

* Log exception when the verification status can't be loaded

Co-authored-by: Benoit Marty <benoit@matrix.org>

* Fix review comments

---------

Co-authored-by: Benoit Marty <benoit@matrix.org>
2024-04-24 13:55:25 +00:00
Jorge Martin Espinosa
1045f99d18
Add SessionData.needsVerification field (#2672)
* Add `SessionData.needsVerification`:
  - Allows us to add a skip button for debug builds.
  - We can have the verification state almost instantly.
  - It doesn't depend on network availability to know the verification state and display the UI.
* Add DB migration.
- Make the skip button in the verification flow skip the whole flow including the completed screen.
- Save the session as verified in `RustEncryptionService.recover(recoveryKey)`.
* Enforce session verification for existing users too.
* Fix verification confirmed screen subtitle (typo in id, was using the wrong string)
* Update screenshots

---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
2024-04-09 17:28:12 +02:00
Benoit Marty
0df33bf3e6 An interface is enough. 2024-02-27 14:42:43 +01:00
Benoit Marty
b634fb43e2 Add test for DatabaseSessionStore.getAllSessions(), and update data when session is not found. 2024-02-27 12:04:59 +01:00
Benoit Marty
eacb515e14 Add test on DefaultSessionObserver. 2024-02-27 11:39:17 +01:00
Benoit Marty
38bb166298 Remove useless log. 2024-02-27 10:41:14 +01:00
Benoit Marty
b4773d541f
Merge pull request #2244 from element-hq/feature/bma/encryptedDb2
Encrypted db
2024-01-19 17:40:23 +01:00
Jorge Martin Espinosa
6ecce81f45
Try mitigating unexpected logouts (#2251)
* Try mitigating unexpected logouts.

Try making getting/storing session data use a Mutex for synchronization.

Also added some more logs so we can understand exactly where it's failing.
2024-01-18 16:22:25 +01:00
Benoit Marty
877ed3c7ac Fix test. 2024-01-18 12:44:20 +01:00
Benoit Marty
f9c1892f2f SessionData: add the passphrase. 2024-01-18 11:50:05 +01:00
Benoit Marty
5d086ad82d Fix moar ktlint issues 2024-01-11 10:02:10 +01:00
renovate[bot]
c8bd362397
Update plugin ktlint to v12.1.0 (#2200)
* Update plugin ktlint to v12.1.0

* Run `./gradlew ktlintFormat` and fix some issues manually.

* Fix other issues reproted by Ktlint

* Limit false positives, KtLint removes unnecessary curly brace in String templates.

* Remove useless Unit

* Minor improvements over ktlint changes

* Restore `AlertDialogContent` behaviour

* Update screenshots

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Benoit Marty <benoit@matrix.org>
Co-authored-by: Jorge Martín <jorgem@element.io>
Co-authored-by: ElementBot <benoitm+elementbot@element.io>
2024-01-10 16:22:24 +01:00
Marco Romano
79d2941fe4
Include desugaring lib also in library modules (#1604)
## Type of change

- [ ] Feature
- [ ] Bugfix
- [x] Technical
- [ ] Other :

## Content

Includes the `coreLibraryDesugaring(libs.android.desugar)` dependency in all modules which use one of our gradle plugins.

## Motivation and context

Right now desugaring is enabled also in library modules but the desugar dependency is not included in those.
This causes some unwanted side effects such as being unable to run compose previews in an emu.

This change will also include the desugar dependency in those libraries.
2023-10-19 09:00:32 +00:00
Marco Romano
57ccafca42 Other fixes as per https://cashapp.github.io/sqldelight/2.0.0/upgrading-2.0/ 2023-10-13 15:17:12 +02:00
Marco Romano
2d3d007e60 Find and replace 2023-10-13 14:55:12 +02:00
Benoit Marty
12996e8253 Improve comment. 2023-10-12 15:48:13 +02:00
Benoit Marty
30b509456c Add some comment in the files manipulating the session DB 2023-10-12 14:59:06 +02:00
Benoit Marty
9bacf9df8e Add DB versions to test all migrations 2023-10-12 14:53:14 +02:00
Benoit Marty
1938525201 Fix DB migration test. Does not require a migration apparently. 2023-10-12 14:53:00 +02:00
Benoit Marty
8bbcb973c4 Fix test. 2023-10-10 10:20:49 +02:00
Benoit Marty
96867bccf2 Database version 4: add isTokenValid and loginType fields
Generate database with model version 4
2023-10-10 10:20:49 +02:00
Benoit Marty
6761a5e2fb Fix test compilation 2023-10-10 10:20:49 +02:00
Benoit Marty
c3a0deb201 Code quality. 2023-10-10 10:20:49 +02:00
Benoit Marty
266f93cc28 Add SignedOutNode, to handle session behind deleted from outside (no support for soft-logout) 2023-10-10 10:20:31 +02:00
Benoit Marty
124d6bf95f SignedOut mode - WIP 2023-10-10 10:20:31 +02:00
Benoit Marty
8305912b14 Map the new fields of SessionData. 2023-10-10 10:20:31 +02:00
Benoit Marty
a424bc26ed Need this now. 2023-10-10 10:20:31 +02:00
Benoit Marty
a1afdeb6d3 Generate database with model version 3, to unit test database migration.
https://cashapp.github.io/sqldelight/1.5.4/multiplatform_sqlite/migrations/
2023-10-10 10:20:31 +02:00
Benoit Marty
d293cae47f Implement didRefreshTokens(): update database with updated SessionData. 2023-08-23 14:42:46 +02:00
Benoit Marty
6928dc6e44 Restore OIDC support. 2023-08-23 12:18:42 +02:00
Benoit Marty
a2975ec094 Add a test to cover fix of #950 2023-07-24 15:28:36 +02:00
Jorge Martin Espinosa
2488432805
Hide encryption history + FTUE flow (#839)
* First attempt at implementing encrypted history banner and removing old UTDs

* Get the right behavior in the timeline

* Implement the designs

* Extract post-processing logic, add tests

* Add encryption banner to timeline screenshots

* Create FTUE feature to handle welcome screen and analytics

* Move classes to their own packages, add tests for `DefaultFtueState`.

* Remove unnecessary private MutableStateFlow

* Move some FTUE related methods and classes back to the `impl` module

* Handle back press at each FTUE step

* Remove unneeded `TestScope` receiver for `createState` in tests.

* Use light & dark previews for the banner view.

* Move color customization from `TextStyle` to `Text` component.

* Rename `InfoList` design components, use them in `AnalyticsOptInView` too.

* Cleanup MatrixClient.

* Fix copy&paste error

Co-authored-by: Benoit Marty <benoit@matrix.org>

* Fix typo

* Fix Maestro tests

---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
Co-authored-by: Benoit Marty <benoit@matrix.org>
2023-07-17 18:34:36 +02:00
Benoit Marty
becbc6607d Fix detected forbidden pattern. 2023-05-31 15:31:05 +02:00
Florian Renaud
719dd20555 Remove useless OptIn in tests 2023-05-12 10:05:39 +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
00c23618ab Persist notification data. Note that it will break the key storage for the session database. 2023-04-05 16:59:17 +02:00
Benoit Marty
dfb9106fb1 Bad copy/paste 2023-04-05 16:59:17 +02:00
Benoit Marty
35c7bffc45 Observe session database to be able to detect new user and removed user. 2023-04-05 16:59:17 +02:00