1
0
mirror of https://github.com/vector-im/riotX-android synced 2025-10-06 00:02:48 +02:00

Compare commits

...

129 Commits

Author SHA1 Message Date
ericdecanini
92322aa4c6 Adds conditional transition logic on opening images 2022-06-09 15:05:34 +02:00
Onuray Sahin
3f491018b4 Merge pull request #6244 from vector-im/feature/ons/organize_location_settings_flags
Re-organize location settings flags [PSF-1062]
2022-06-08 13:03:10 +03:00
Benoit Marty
3b2f9d9404 Merge pull request #6029 from vector-im/feature/bma/sdk_sync_service
Feature/bma/sdk sync service
2022-06-08 11:58:38 +02:00
Adam Brown
6ad672e04b Merge pull request #6250 from vector-im/dependabot/gradle/com.autonomousapps.dependency-analysis-1.5.0
Bump com.autonomousapps.dependency-analysis from 1.4.0 to 1.5.0
2022-06-08 10:27:11 +01:00
Benoit Marty
9bc70399f1 Merge pull request #6259 from vector-im/feature/bma/release_store_status
Release recipe: stores live status and update of F-Droid flow.
2022-06-08 11:11:40 +02:00
Adam Brown
a4721033c8 Merge pull request #6229 from vector-im/dependabot/gradle/org.matrix.android-olm-sdk-3.2.12
Bump olm-sdk from 3.2.11 to 3.2.12
2022-06-08 10:04:08 +01:00
Benoit Marty
0b3dfab951 "beta" -> "open testing" PlayStore terminology and move step to update the topic once production is live to a dedicated section. Also update the diary only when production is live. 2022-06-08 10:45:26 +02:00
Benoit Marty
78da5017a9 Update about the F-Droid release flow. 2022-06-08 10:27:46 +02:00
Benoit Marty
b35a09906c Add checks to give the status of the PlayStore submission. 2022-06-08 10:23:19 +02:00
Benoit Marty
ac61aeea29 Fix compilation issue after rebase. 2022-06-08 10:00:48 +02:00
Benoit Marty
1bad8f7741 Introduce SessionState to be able to check the Session state from several places. 2022-06-08 09:55:28 +02:00
Benoit Marty
d3784c8019 Add changelog 2022-06-08 09:55:28 +02:00
Benoit Marty
de960116b3 Rename internal fun. 2022-06-08 09:55:28 +02:00
Benoit Marty
dd22cdf7f2 Rename existing SyncService to SyncAndroidService to avoid confusion 2022-06-08 09:55:28 +02:00
Benoit Marty
f62d598b79 Create a SyncService and move some methods from Session there.
Merge SyncStatusService to SyncService, and rename some classes
2022-06-08 09:53:33 +02:00
Maxime NATUREL
73568dbc86 Merge pull request #6212 from vector-im/fix/mna/6209-wrong-live-status
Fix wrong status of live location sharing in timeline (PSF-1073)
2022-06-08 09:40:33 +02:00
dependabot[bot]
8030a8ceaf Bump com.autonomousapps.dependency-analysis from 1.4.0 to 1.5.0
Bumps com.autonomousapps.dependency-analysis from 1.4.0 to 1.5.0.

---
updated-dependencies:
- dependency-name: com.autonomousapps.dependency-analysis
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-07 23:10:08 +00:00
Benoit Marty
733c2848a7 Merge pull request #6226 from vector-im/dependabot/gradle/androidx.core-core-ktx-1.8.0
Bump core-ktx from 1.7.0 to 1.8.0
2022-06-07 23:43:21 +02:00
Benoit Marty
7274924977 Merge pull request #6239 from vector-im/sync-analytics-plan
Sync analytics plan
2022-06-07 23:40:58 +02:00
Adam Brown
462d3071de Merge pull request #6171 from vector-im/feature/adm/sdk-new-password-on-confirmation
[SDK] Allow passwords to be set at the point of reset confirmation
2022-06-07 16:43:28 +01:00
Michael Kaye
93bacc98fe Revert "Ignore tests."
This reverts commit 17d85840a7.
2022-06-07 16:02:53 +01:00
Michael Kaye
49d1c1baee Revert "Remove UI tests from connected android test run via @Ignore"
This reverts commit 5eac30d283.
2022-06-07 16:02:52 +01:00
Michael Kaye
2946f2ec59 Revert "Include vector connected android tests in coverage run."
This reverts commit d43cff9d2f.
2022-06-07 16:02:49 +01:00
Michael Kaye
17d85840a7 Ignore tests.
All failing with
```
im.vector.app.SecurityBootstrapTest > testBasicBootstrap[Nexus_5X_API_28(AVD) - 9] FAILED
        java.lang.IllegalStateException: Method addObserver must be called on the main thread
        at androidx.lifecycle.LifecycleRegistry.enforceMainThreadIfNeeded(LifecycleRegistry.java:317)

im.vector.app.VerifySessionInteractiveTest > checkVerifyPopup[Nexus_5X_API_28(AVD) - 9] FAILED
        java.lang.IllegalStateException: Method addObserver must be called on the main thread
        at androidx.lifecycle.LifecycleRegistry.enforceMainThreadIfNeeded(LifecycleRegistry.java:317)

im.vector.app.VerifySessionPassphraseTest > checkVerifyWithPassphrase[Nexus_5X_API_28(AVD) - 9] FAILED
        java.lang.IllegalStateException: Method addObserver must be called on the main thread
        at androidx.lifecycle.LifecycleRegistry.enforceMainThreadIfNeeded(LifecycleRegistry.java:317)

```
2022-06-07 15:44:27 +01:00
Michael Kaye
5eac30d283 Remove UI tests from connected android test run via @Ignore 2022-06-07 15:42:58 +01:00
Michael Kaye
d43cff9d2f Include vector connected android tests in coverage run. 2022-06-07 15:42:42 +01:00
Benoit Marty
c2bf6ab7e3 Merge branch 'hotfix/v1.4.19' into develop 2022-06-07 15:14:47 +02:00
Benoit Marty
26dcc9bc52 Merge hotfix 1.4.19 into develop 2022-06-07 15:14:29 +02:00
Benoit Marty
b2f67f971b Prepare v1.4.19 2022-06-07 15:11:46 +02:00
ericdecanini
6513210904 Changes space subtitle in explore rooms from joined string to direct space parent 2022-06-07 15:02:15 +02:00
Valere
a6113526d0 code review 2022-06-07 15:01:57 +02:00
Valere
2fa25f8b5e Fix param name 2022-06-07 15:01:29 +02:00
Valere
d67f86a1e0 fix slow paged room list 2022-06-07 15:00:54 +02:00
Onuray Sahin
ea714bbdaa Fix lint errors - unused string resources. 2022-06-07 13:06:09 +03:00
Adam Brown
4ffce89ef2 adding fallback locale for when the configuration locale is missing 2022-06-07 10:37:18 +01:00
ClaireG
0602f58074 Merge pull request #6234 from vector-im/cgizard/ISSUE-6232
Text cropped: "Secure backup"
2022-06-07 11:19:10 +02:00
Michael Kaye
10125f4738 Merge pull request #6111 from vector-im/michaelk/sonarqube_fixes
Sonarqube including coverage on each PR.
2022-06-07 09:44:00 +01:00
Onuray Sahin
4b862be9df Changelog added. 2022-06-07 01:05:10 +03:00
Michael Kaye
c2ac07b1c9 Fix ktlint error 2022-06-06 18:56:05 +01:00
Michael Kaye
23324990c0 Fix and/&& mixup 2022-06-06 17:55:12 +01:00
Michael Kaye
e9cb417cef We still might be flaky; retry entire test run if so. 2022-06-06 17:43:30 +01:00
Onuray Sahin
e506337522 Remove labs flag for rendering location events. 2022-06-06 19:32:48 +03:00
Michael Kaye
56608d564e Retry ALL THE THINGS, and always send sonarqube 2022-06-06 17:08:02 +01:00
Adam Brown
0ef67b6b64 Merge pull request #6214 from vector-im/feature/adm/homeserver-version-parsing
Homeserver version without patch number parsing
2022-06-06 14:54:32 +01:00
Adam Brown
fa21b6d224 creating generic extension for converting empty strings to null and making use for finding option regex match 2022-06-06 14:16:01 +01:00
Onuray Sahin
d75bd140d9 Remove location sharing flag from preferences. 2022-06-06 15:59:46 +03:00
Adam Brown
edfabb0f26 adding missing loading state when confirming password reset
- adds reset test cases to the onboarding view model
2022-06-06 13:59:34 +01:00
Adam Brown
fa5b7c66ca adding dedicated fail event in the legacy onboarding flow when the reset password new password is not set 2022-06-06 13:59:34 +01:00
Adam Brown
32389a9b33 removing impossible case 2022-06-06 13:59:33 +01:00
Adam Brown
93a247e0ce converting if/else and try/catch to when and runCatching 2022-06-06 13:58:55 +01:00
Adam Brown
cc8f17b786 moving the reset password new password to the reset confirmation step
- the new password is moved to the in memory view model state
2022-06-06 13:57:59 +01:00
Adam Brown
35163f77ba allow passing the new password when resetting passwords either upfront or as part of the confirmation step 2022-06-06 13:57:59 +01:00
Adam Brown
e3d46cfd15 introducing a reset state for holding onto the reset inputs 2022-06-06 13:57:58 +01:00
Adam Brown
a5f404f247 Merge pull request #6042 from vector-im/feature/adm/ftue-analytics
FTUE - Sign up analytics
2022-06-06 13:52:01 +01:00
Adam Brown
db3cb42cc3 renaming getter to imply the function does more than simply get a value 2022-06-06 11:41:36 +01:00
Adam Brown
06e67a313b correctly casing github/gitlab 2022-06-06 11:39:59 +01:00
Adam Brown
49930773e7 handling the legacy onboarding complete navigation by inferring the auth description from the sign mode
- the type is set to other as the legacy viewmodel doesn't support tracking the sso provider
2022-06-06 11:38:29 +01:00
Onuray Sahin
bae830dd03 Merge pull request #6222 from vector-im/feature/ons/fix_voice_message_stackoverflow
Fix StackOverflowError while recording voice message [PSF-1065]
2022-06-06 12:58:15 +03:00
Adam Brown
6fcbd24ce1 reverting instance check, no longer needed as the event no longer contains any data
- it's part of the initialstate instead
2022-06-06 10:23:06 +01:00
Adam Brown
5d0d177a7a including null case in the authentication when 2022-06-06 10:22:22 +01:00
Onuray Sahin
0b9db0ee6b Code review fix. 2022-06-06 12:19:09 +03:00
bmarty
0104fe70ab Sync analytics plan 2022-06-06 00:03:15 +00:00
Jorge Martin Espinosa
166d2a3ba0 Merge pull request #6151 from vector-im/feature/jorgem/outbound_presharing_keys_mode
Allow .well-known configuration to override key sharing mode.
2022-06-03 15:33:59 +02:00
Claire G
6ed6b49d7f fix text cropped 2022-06-03 14:41:43 +02:00
dependabot[bot]
941d5844b5 Bump olm-sdk from 3.2.11 to 3.2.12
Bumps olm-sdk from 3.2.11 to 3.2.12.

---
updated-dependencies:
- dependency-name: org.matrix.android:olm-sdk
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-03 01:03:37 +00:00
Benoit Marty
b6b487dfa0 Merge pull request #6094 from vector-im/feature/adm/ftue-avoid-resetting-login-state
SDK - Avoid resetting login state when calling `AuthenticationService.getLoginFlow`
2022-06-02 23:11:52 +02:00
dependabot[bot]
524dcbb3d1 Bump core-ktx from 1.7.0 to 1.8.0
Bumps core-ktx from 1.7.0 to 1.8.0.

---
updated-dependencies:
- dependency-name: androidx.core:core-ktx
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-02 10:50:27 +00:00
Benoit Marty
e53c0909dc Merge pull request #6227 from vector-im/dependabot/gradle/androidx.appcompat-appcompat-1.4.2
Bump appcompat from 1.4.1 to 1.4.2
2022-06-02 12:49:13 +02:00
dependabot[bot]
7c50720b76 Bump appcompat from 1.4.1 to 1.4.2
Bumps appcompat from 1.4.1 to 1.4.2.

---
updated-dependencies:
- dependency-name: androidx.appcompat:appcompat
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-01 23:19:50 +00:00
Adam Brown
8e8d38c3bb adding changelog entry 2022-06-01 16:48:10 +01:00
Adam Brown
4f8aedb038 moving and updating duplicated service function doc 2022-06-01 16:48:10 +01:00
Adam Brown
b0c294b41b avoiding resetting pending state when starting a new login flow
- fixes selecting a incorrect homeserver and returning to the previous login page also failing
2022-06-01 16:48:10 +01:00
Eric Decanini
e18146a006 Merge pull request #6219 from gsouquet/gsouquet/delight-automation
Remove spaces issues to delight board automation
2022-06-01 16:39:32 +02:00
Onuray Sahin
807e89521f Changelog added. 2022-06-01 17:02:17 +03:00
Onuray Sahin
966b3ce54a Create a new list for sublist to fix stackoverflowerror. 2022-06-01 16:55:42 +03:00
Adam Brown
033b877269 Merge pull request #6216 from vector-im/dependabot/gradle/com.google.android.material-material-1.6.1
Bump material from 1.6.0 to 1.6.1
2022-06-01 13:48:09 +01:00
Adam Brown
10016fcb15 using correct license for matrix sdk class 2022-06-01 13:45:59 +01:00
Germain Souquet
3b680e27e8 Fix label name 2022-06-01 11:46:51 +01:00
Germain Souquet
de3e0acb56 move issues with the team delight label 2022-06-01 11:37:33 +01:00
Adam Brown
3756b2d240 adding trailing commas to lists 2022-06-01 10:44:23 +01:00
Adam Brown
4501c7cf45 adding test case for trailing . on the version 2022-06-01 10:44:10 +01:00
Adam Brown
b3841c9006 adding changelog entry 2022-06-01 10:41:37 +01:00
Adam Brown
289ce7419d supporting homeserver versions without a patch value 2022-06-01 10:41:37 +01:00
Adam Brown
ea151b37f0 adding test cases around parsing homeserver versions 2022-06-01 10:41:37 +01:00
Germain Souquet
0287153e56 Remove spaces issues to delight board automation 2022-06-01 10:04:47 +01:00
Adam Brown
d002ab6a6b removing unused imports 2022-06-01 09:11:05 +01:00
Adam Brown
8d3c70f522 removing unused imports 2022-06-01 09:11:05 +01:00
Adam Brown
70c35304ce aligning the with develop to use the initial state for reading the activity arguments 2022-06-01 09:11:05 +01:00
Adam Brown
15765166fb adding changelog entry 2022-06-01 09:11:05 +01:00
Adam Brown
28050488ba passing the authentication state from the onboarding and tracking sign up after the user has consented to tracking 2022-06-01 09:11:04 +01:00
Adam Brown
ac89495348 chaining the current authentication type into the onboarding state 2022-06-01 09:09:56 +01:00
Adam Brown
e89f9eae1a providing the full SSOProvider instead of selection instead of just the id 2022-06-01 09:09:56 +01:00
Adam Brown
9110fe8a6a lifting unavailable homeserver rendering to the activity/ftuevariant
- the viewmodel is now responsible for inferring connectivity errors and providing a retry action
2022-06-01 09:09:56 +01:00
dependabot[bot]
5934043d17 Bump material from 1.6.0 to 1.6.1
Bumps [material](https://github.com/material-components/material-components-android) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/material-components/material-components-android/releases)
- [Commits](https://github.com/material-components/material-components-android/compare/1.6.0...1.6.1)

---
updated-dependencies:
- dependency-name: com.google.android.material:material
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-31 23:06:50 +00:00
Benoit Marty
e6beb73e3d Merge pull request #5970 from ofalvai/feature/ofa/read-receipts-design
Make read receipt avatar list more compact
2022-05-31 18:26:57 +02:00
Benoit Marty
8e709dbbdb Merge pull request #5528 from SpiritCroc/chunk-modification-issue
Fix missing/swapped/duplicated messages due to wrong TimelineChunk modifications or insertions
2022-05-31 18:24:08 +02:00
Benoit Marty
1fe4ecee99 Merge pull request #5888 from vector-im/feature/bma/issue_tmpl
Add a final question to know if the issue submitter will provide a PR
2022-05-31 18:18:59 +02:00
Benoit Marty
884525bef0 Merge pull request #6125 from vector-im/task/eric/code-style-parenthesis
Code Style - New line before and after method parentheses
2022-05-31 18:17:07 +02:00
Benoit Marty
1c73e28226 Version++ 2022-05-31 17:58:09 +02:00
Benoit Marty
e3c72876df Merge branch 'release/1.4.18' into develop 2022-05-31 17:56:42 +02:00
Olivér Falvai
b5168f27dd Merge remote-tracking branch 'origin/develop' into feature/ofa/read-receipts-design 2022-05-31 17:50:02 +02:00
Olivér Falvai
3146920c04 Add changelog entry 2022-05-31 17:49:47 +02:00
Maxime NATUREL
b1750c1c21 Adding log in worker 2022-05-31 15:56:36 +02:00
Maxime NATUREL
102684ed88 Fixing aggregation process 2022-05-31 15:56:23 +02:00
Maxime NATUREL
9874bdeeab Adding changelog entry 2022-05-31 15:56:16 +02:00
ericdecanini
8af49891ff Post merge conflict reformatting 2022-05-31 14:23:02 +02:00
ericdecanini
e6e05317e1 Merge remote-tracking branch 'origin/develop' into task/eric/code-style-parenthesis
# Conflicts:
#	matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/verification/qrcode/VerificationTest.kt
#	matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/keysbackup/DefaultKeysBackupService.kt
#	matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/DefaultRoomService.kt
#	matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/room/summary/RoomSummaryDataSource.kt
#	vector/src/main/java/im/vector/app/features/home/room/list/RoomSummaryItemFactory.kt
#	vector/src/main/java/im/vector/app/features/media/ImageContentRenderer.kt
2022-05-31 14:21:16 +02:00
Jorge Martín
2271df9907 Add support for setting pre sharing keys mode from .well-known 2022-05-31 11:32:39 +02:00
Adam Brown
d18e7ad001 Merge branch 'develop' of github.com:vector-im/element-android into michaelk/sonarqube_fixes 2022-05-30 10:07:43 +01:00
Adam Brown
ead189a9c7 temporarily ignoring flaky test when ran on the CI 2022-05-30 09:37:39 +01:00
Adam Brown
b0f4c87d6b triggering actions 2022-05-27 11:41:43 +01:00
ericdecanini
d5432cd0e7 Merge remote-tracking branch 'origin/develop' into task/eric/code-style-parenthesis
# Conflicts:
#	vector/src/main/java/im/vector/app/features/onboarding/DirectLoginUseCase.kt
2022-05-26 10:37:19 +02:00
ericdecanini
927f526c6c Post merge conflict reformatting 2022-05-25 17:35:54 +02:00
ericdecanini
8647400dda Merge remote-tracking branch 'origin/develop' into task/eric/code-style-parenthesis
# Conflicts:
#	matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/MXOlmDevice.kt
2022-05-25 17:35:31 +02:00
Michael Kaye
9f4f3f482c Merge branch 'develop' into michaelk/sonarqube_fixes 2022-05-25 14:22:10 +01:00
Michael Kaye
fd5b7099af Add commented out version of building integration tests for reference. 2022-05-25 14:10:50 +01:00
Michael Kaye
40e4c4ce1e Update README.md with latest links generated from sonarcloud site. 2022-05-25 14:03:08 +01:00
Michael Kaye
ba109a486f Update to build scripts to enable sonarqube reporting including coverage. 2022-05-25 13:35:40 +01:00
Michael Kaye
c59c5cfb4a Ignore all tests that have failed during testing. 2022-05-25 12:36:21 +01:00
ericdecanini
c3209d7049 Manually fixes more formatting issues 2022-05-24 15:31:20 +02:00
ericdecanini
6c21a6b48d Separates some method parameters 2022-05-24 15:26:24 +02:00
ericdecanini
3f3662e605 Changes code style method parameters new line around parentheses to true 2022-05-23 12:30:42 +02:00
Olivér Falvai
ed1179b155 Ignore lint warning about negative margin 2022-05-07 20:44:58 +02:00
Olivér Falvai
87e740973c Make read receipt avatar list compact 2022-05-07 20:06:03 +02:00
Benoit Marty
7881f7f9ea Add a final question to know if the issue submitter will provide a PR 2022-05-02 14:41:58 +02:00
SpiritCroc
7c0cd1dc52 Fix ktLint / op-spacing 2022-04-12 19:17:07 +02:00
SpiritCroc
6a8230239b Avoid inconsistent timelines by db insertions before fully loaded chunk 2022-03-21 10:50:55 +01:00
SpiritCroc
626395304d Fix crash on Android 6 2022-03-19 12:01:01 +01:00
SpiritCroc
cd45248f40 Fix modifying the wrong events in TimelineChunk
I was observing cases where builtEvents[modificationIndex] was not
having the same eventId as the udpatedEntity in handleDatabaseChangeSet.

In particular, I observed both cases that
- there was no item in the list yet with the same eventId as the updated
  one
- there was an item with the same eventId already in the list, but at a
  different position.

Whenever this happened, the timeline would render missing, duplicated,
or swapped messages in the timeline.

Instead of relying on the modificationIndex to be the same for both the
change set and builtEvents, look up the proper index by eventId.
2022-03-13 08:19:47 +01:00
657 changed files with 7043 additions and 5159 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -73,3 +73,14 @@ body:
- 'No'
validations:
required: true
- type: dropdown
id: pr
attributes:
label: Are you willing to provide a PR?
description: |
Providing a PR can drastically speed up the process of fixing this bug. Don't worry, it's still OK to answer 'No' :).
options:
- 'Yes'
- 'No'
validations:
required: true

View File

@@ -34,3 +34,14 @@ body:
placeholder: Is there anything else you'd like to add?
validations:
required: false
- type: dropdown
id: pr
attributes:
label: Are you willing to provide a PR?
description: |
Don't worry, it's still OK to answer 'No' :).
options:
- 'Yes'
- 'No'
validations:
required: true

View File

@@ -49,24 +49,34 @@ body:
### Once tested and validated internally
- [ ] Create a new beta release on the GooglePlay console and upload the 4 signed Apks.
- [ ] Create a new open testing release on the GooglePlay console and upload the 4 signed Apks.
- [ ] Check that the version codes are correct
- [ ] Copy the fastlane change to the GooglePlay console in the section en-GB.
- [ ] Push to beta release to 100% of the users
- [ ] Notify the F-Droid team so that they can schedule the publication on F-Droid
- [ ] Push the open testing release to 100% of the users
- [ ] Notify the F-Droid team [here](https://matrix.to/#/!LAAuJLQXYHjMNWKrCK:matrix.org?via=matrix.org&via=bubu1.eu&via=lant.uk) so that they can schedule the publication on F-Droid
- [ ] The application is available to the PlayStore testers (live). Google can take between 1 hour and up to 7 days to approve the release.
- [ ] The application is available to the F-Droid users.
### Once Live on PlayStore
### Once open testing is live on PlayStore
- [ ] Ping the Android public room and update its topic
- [ ] Add an entry in the internal diary
### After at least 2 days
### Once Live on F-Droid
- [ ] Update the Android public room topic
### After at least 2 days (generally next Monday)
- [ ] Check the [rageshakes](https://github.com/matrix-org/element-android-rageshakes/issues)
- [ ] Check the crash reports on the GooglePlay console
- [ ] Check the Android Element room for any reported issues on the new version
- [ ] If all is OK, push to production and notify Markus (Bubu) to release the F-Droid version
- [ ] Ping the Android public room and update its topic with the new available version
- [ ] If all is OK, promote the open testing release to production. Generally using a 100% roll out, but can be a smaller value depending on the release content.
- [ ] The application is available to the PlayStore users (live). Google can take (again!) between 1 hour and up to 7 days to approve the release.
### Once production is live on PlayStore
- [ ] Ping the Android public room and update its topic
- [ ] Add an entry in the internal diary
### Android SDK2

View File

@@ -29,200 +29,6 @@ jobs:
steps:
- run: echo "Run those tests!" # no-op success
# Run Android Tests
integration-tests:
name: Matrix SDK - Running Integration Tests
needs: should-i-run
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
api-level: [ 28 ]
steps:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: 3.8
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Start synapse server
uses: michaelkaye/setup-matrix-synapse@v1.0.3
with:
uploadLogs: true
httpPort: 8080
disableRateLimiting: true
public_baseurl: "http://10.0.2.2:8080/"
# package: org.matrix.android.sdk.session
- name: Run integration tests for Matrix SDK [org.matrix.android.sdk.session] API[${{ matrix.api-level }}]
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86
profile: Nexus 5X
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
emulator-build: 7425822
script: |
adb root
adb logcat -c
touch emulator-session.log
chmod 777 emulator-session.log
adb logcat >> emulator-session.log &
./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.session' matrix-sdk-android:connectedDebugAndroidTest
- name: Read Results [org.matrix.android.sdk.session]
if: always()
id: get-comment-body-session
run: python3 ./tools/ci/render_test_output.py session ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml
- name: Remove adb logcat
if: always()
run: pkill -9 adb
- name: Run integration tests for Matrix SDK [org.matrix.android.sdk.account] API[${{ matrix.api-level }}]
if: always()
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86
profile: Nexus 5X
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
emulator-build: 7425822
script: |
adb root
adb logcat -c
touch emulator-account.log
chmod 777 emulator-account.log
adb logcat >> emulator-account.log &
./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.account' matrix-sdk-android:connectedDebugAndroidTest
- name: Read Results [org.matrix.android.sdk.account]
if: always()
id: get-comment-body-account
run: python3 ./tools/ci/render_test_output.py account ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml
- name: Remove adb logcat
if: always()
run: pkill -9 adb
# package: org.matrix.android.sdk.internal
- name: Run integration tests for Matrix SDK [org.matrix.android.sdk.internal] API[${{ matrix.api-level }}]
if: always()
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86
profile: Nexus 5X
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
emulator-build: 7425822
script: |
adb root
adb logcat -c
touch emulator-internal.log
chmod 777 emulator-internal.log
adb logcat >> emulator-internal.log &
./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.internal' matrix-sdk-android:connectedDebugAndroidTest
- name: Read Results [org.matrix.android.sdk.internal]
if: always()
id: get-comment-body-internal
run: python3 ./tools/ci/render_test_output.py internal ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml
- name: Remove adb logcat
if: always()
run: pkill -9 adb
# package: org.matrix.android.sdk.ordering
- name: Run integration tests for Matrix SDK [org.matrix.android.sdk.ordering] API[${{ matrix.api-level }}]
if: always()
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86
profile: Nexus 5X
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
emulator-build: 7425822
script: |
adb root
adb logcat -c
touch emulator-ordering.log
chmod 777 emulator-ordering.log
adb logcat >> emulator-ordering.log &
./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.package='org.matrix.android.sdk.ordering' matrix-sdk-android:connectedDebugAndroidTest
- name: Read Results [org.matrix.android.sdk.ordering]
if: always()
id: get-comment-body-ordering
run: python3 ./tools/ci/render_test_output.py ordering ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml
- name: Remove adb logcat
if: always()
run: pkill -9 adb
# package: class PermalinkParserTest
- name: Run integration tests for Matrix SDK class [org.matrix.android.sdk.PermalinkParserTest] API[${{ matrix.api-level }}]
if: always()
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86
profile: Nexus 5X
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
emulator-build: 7425822
script: |
adb root
adb logcat -c
touch emulator-permalink.log
chmod 777 emulator-permalink.log
adb logcat >> emulator-permalink.log &
./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.class='org.matrix.android.sdk.PermalinkParserTest' matrix-sdk-android:connectedDebugAndroidTest
- name: Read Results [org.matrix.android.sdk.PermalinkParserTest]
if: always()
id: get-comment-body-permalink
run: python3 ./tools/ci/render_test_output.py permalink ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml
- name: Remove adb logcat
if: always()
run: pkill -9 adb
# package: class PermalinkParserTest
- name: Find Comment
if: always() && github.event_name == 'pull_request'
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Integration Tests Results
- name: Publish results to PR
if: always() && github.event_name == 'pull_request'
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
### Matrix SDK
## Integration Tests Results:
- `[org.matrix.android.sdk.session]`<br>${{ steps.get-comment-body-session.outputs.session }}
- `[org.matrix.android.sdk.account]`<br>${{ steps.get-comment-body-account.outputs.account }}
- `[org.matrix.android.sdk.internal]`<br>${{ steps.get-comment-body-internal.outputs.internal }}
- `[org.matrix.android.sdk.ordering]`<br>${{ steps.get-comment-body-ordering.outputs.ordering }}
- `[org.matrix.android.sdk.PermalinkParserTest]`<br>${{ steps.get-comment-body-permalink.outputs.permalink }}
edit-mode: replace
- name: Upload Test Report Log
uses: actions/upload-artifact@v3
if: always()
with:
name: integrationtest-error-results
path: |
emulator-permalink.log
emulator-internal.log
emulator-ordering.log
emulator-account.log
emulator-session.log
ui-tests:
name: UI Tests (Synapse)
needs: should-i-run
@@ -282,42 +88,13 @@ jobs:
emulator.log
failure_screenshots/
codecov-units:
name: Unit tests with code coverage
needs: should-i-run
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- run: ./gradlew allCodeCoverageReport $CI_GRADLE_ARG_PROPERTIES
- name: Upload Codecov data
uses: actions/upload-artifact@v3
if: always()
with:
name: codecov-xml
path: |
build/reports/jacoco/allCodeCoverageReport/allCodeCoverageReport.xml
# Notify the channel about delayed failures
notify:
name: Notify matrix
runs-on: ubuntu-latest
needs:
- should-i-run
- integration-tests
- ui-tests
- codecov-units
if: always() && (needs.should-i-run.result == 'success' ) && ((needs.codecov-units.result != 'success' ) || (needs.ui-tests.result != 'success') || (needs.integration-tests.result != 'success'))
# No concurrency required, runs every time on a schedule.
steps:

View File

@@ -1,81 +0,0 @@
name: Sonarqube nightly
on:
schedule:
- cron: '0 20 * * *'
# Enrich gradle.properties for CI/CD
env:
CI_GRADLE_ARG_PROPERTIES: >
-Porg.gradle.jvmargs=-Xmx4g
-Porg.gradle.parallel=false
jobs:
codecov-units:
name: Unit tests with code coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- run: ./gradlew allCodeCoverageReport $CI_GRADLE_ARG_PROPERTIES
- name: Upload Codecov data
uses: actions/upload-artifact@v3
if: always()
with:
name: codecov-xml
path: |
build/reports/jacoco/allCodeCoverageReport/allCodeCoverageReport.xml
sonarqube:
name: Sonarqube upload
runs-on: ubuntu-latest
needs:
- codecov-units
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/download-artifact@v3
with:
name: codecov-xml # will restore to allCodeCoverageReport.xml by default; we restore to the same location in following tasks
- run: mkdir -p build/reports/jacoco/allCodeCoverageReport/
- run: mv allCodeCoverageReport.xml build/reports/jacoco/allCodeCoverageReport/
- run: ./gradlew sonarqube $CI_GRADLE_ARG_PROPERTIES
env:
ORG_GRADLE_PROJECT_SONAR_LOGIN: ${{ secrets.SONAR_TOKEN }}
# Notify the channel about sonarqube failures
notify:
name: Notify matrix
runs-on: ubuntu-latest
needs:
- sonarqube
- codecov-units
if: always() && (needs.sonarqube.result != 'success' || needs.codecov-units.result != 'success')
steps:
- uses: michaelkaye/matrix-hookshot-action@v1.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
hookshot_url: ${{ secrets.ELEMENT_ANDROID_HOOKSHOT_URL }}
text_template: "Sonarqube run (on ${{ github.ref }}): {{#each job_statuses }}{{#with this }}{{#if completed }} {{name}} {{conclusion}} at {{completed_at}}, {{/if}}{{/with}}{{/each}}"
html_template: "Sonarqube run (on ${{ github.ref }}): {{#each job_statuses }}{{#with this }}{{#if completed }}<br />{{icon conclusion}} {{name}} <font color='{{color conclusion}}'>{{conclusion}} at {{completed_at}} <a href=\"{{html_url}}\">[details]</a></font>{{/if}}{{/with}}{{/each}}"

View File

@@ -12,73 +12,98 @@ env:
-Porg.gradle.parallel=false
jobs:
# Build Android Tests
build-android-tests:
name: Build Android Tests
runs-on: ubuntu-latest
concurrency:
group: ${{ github.ref == 'refs/heads/main' && format('unit-tests-main-{0}', github.sha) || github.ref == 'refs/heads/develop' && format('unit-tests-develop-{0}', github.sha) || format('build-android-tests-{0}', github.ref) }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build Android Tests
run: ./gradlew clean assembleAndroidTest $CI_GRADLE_ARG_PROPERTIES --stacktrace
unit-tests:
name: Run Unit Tests
runs-on: ubuntu-latest
tests:
name: Runs all tests
runs-on: macos-latest # for the emulator
# Allow all jobs on main and develop. Just one per PR.
concurrency:
group: ${{ github.ref == 'refs/heads/main' && format('unit-tests-main-{0}', github.sha) || github.ref == 'refs/heads/develop' && format('unit-tests-develop-{0}', github.sha) || format('unit-tests-{0}', github.ref) }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run unit tests
run: ./gradlew clean test $CI_GRADLE_ARG_PROPERTIES --stacktrace
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
- uses: gradle/gradle-build-action@v2
- uses: actions/setup-python@v3
with:
python-version: 3.8
- uses: michaelkaye/setup-matrix-synapse@v1.0.3
with:
uploadLogs: true
httpPort: 8080
disableRateLimiting: true
public_baseurl: "http://10.0.2.2:8080/"
- name: Run all the codecoverage tests at once
id: tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 28
arch: x86
profile: Nexus 5X
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
emulator-build: 7425822
script: ./gradlew theCodeCoverageReport --stacktrace $CI_GRADLE_ARG_PROPERTIES
- name: Run all the codecoverage tests at once (retry if emulator failed)
uses: reactivecircus/android-emulator-runner@v2
if: always() && steps.tests.outcome == 'failure' # don't run if previous step succeeded.
with:
api-level: 28
arch: x86
profile: Nexus 5X
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
emulator-build: 7425822
script: ./gradlew theCodeCoverageReport --stacktrace $CI_GRADLE_ARG_PROPERTIES
- run: ./gradlew sonarqube $CI_GRADLE_ARG_PROPERTIES
if: always() # we may have failed a previous step and retried, that's OK
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
ORG_GRADLE_PROJECT_SONAR_LOGIN: ${{ secrets.SONAR_TOKEN }}
- name: Format unit test results
if: always()
run: python3 ./tools/ci/render_test_output.py unit ./**/build/test-results/**/*.xml
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always() &&
github.event.sender.login != 'dependabot[bot]' &&
( github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository )
with:
files: ./**/build/test-results/**/*.xml
# Notify the channel about runs against develop or main that have failures, as PRs should have caught these first.
notify:
runs-on: ubuntu-latest
needs:
- unit-tests
- build-android-tests
if: ${{ (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/main' ) && failure() }}
steps:
- uses: michaelkaye/matrix-hookshot-action@v0.3.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
matrix_access_token: ${{ secrets.ELEMENT_ANDROID_NOTIFICATION_ACCESS_TOKEN }}
matrix_room_id: ${{ secrets.ELEMENT_ANDROID_INTERNAL_ROOM_ID }}
text_template: "Build is broken for ${{ github.ref }}: {{#each job_statuses }}{{#with this }}{{#if completed }}{{name}} {{conclusion}} at {{completed_at}}, {{/if}}{{/with}}{{/each}}"
html_template: "Build is broken for ${{ github.ref }}: {{#each job_statuses }}{{#with this }}{{#if completed }}<br />{{icon conclusion }} {{name}} <font color='{{color conclusion }}'>{{conclusion}} at {{completed_at}} <a href=\"{{html_url}}\">[details]</a></font>{{/if}}{{/with}}{{/each}}"
# can't be run on macos due to containers.
# - name: Publish Unit Test Results
# uses: EnricoMi/publish-unit-test-result-action@v1
# if: always() &&
# github.event.sender.login != 'dependabot[bot]' &&
# ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository )
# with:
# files: ./**/build/test-results/**/*.xml
# Unneeded as part of the test suite above, kept around in case we want to re-enable them.
#
# # Build Android Tests
# build-android-tests:
# name: Build Android Tests
# runs-on: ubuntu-latest
# concurrency:
# group: ${{ github.ref == 'refs/heads/main' && format('unit-tests-main-{0}', github.sha) || github.ref == 'refs/heads/develop' && format('unit-tests-develop-{0}', github.sha) || format('build-android-tests-{0}', github.ref) }}
# cancel-in-progress: true
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-java@v3
# with:
# distribution: 'adopt'
# java-version: 11
# - uses: actions/cache@v3
# with:
# path: |
# ~/.gradle/caches
# ~/.gradle/wrapper
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
# restore-keys: |
# ${{ runner.os }}-gradle-
# - name: Build Android Tests
# run: ./gradlew clean assembleAndroidTest $CI_GRADLE_ARG_PROPERTIES --stacktrace

View File

@@ -9,15 +9,15 @@ jobs:
name: Add Z-Labs label for features behind labs flags
runs-on: ubuntu-latest
if: >
contains(github.event.issue.labels.*.name, 'A-Maths') ||
contains(github.event.issue.labels.*.name, 'A-Message-Pinning') ||
contains(github.event.issue.labels.*.name, 'A-Polls') ||
contains(github.event.issue.labels.*.name, 'A-Location-Sharing') ||
contains(github.event.issue.labels.*.name, 'A-Message-Bubbles') ||
contains(github.event.issue.labels.*.name, 'Z-IA') ||
contains(github.event.issue.labels.*.name, 'A-Themes-Custom') ||
contains(github.event.issue.labels.*.name, 'A-E2EE-Dehydration') ||
contains(github.event.issue.labels.*.name, 'A-Tags')
contains(github.event.issue.labels.*.name, 'A-Maths') ||
contains(github.event.issue.labels.*.name, 'A-Message-Pinning') ||
contains(github.event.issue.labels.*.name, 'A-Polls') ||
contains(github.event.issue.labels.*.name, 'A-Location-Sharing') ||
contains(github.event.issue.labels.*.name, 'A-Message-Bubbles') ||
contains(github.event.issue.labels.*.name, 'Z-IA') ||
contains(github.event.issue.labels.*.name, 'A-Themes-Custom') ||
contains(github.event.issue.labels.*.name, 'A-E2EE-Dehydration') ||
contains(github.event.issue.labels.*.name, 'A-Tags')
steps:
- uses: actions/github-script@v5
with:
@@ -79,7 +79,7 @@ jobs:
name: X-Needs-Product to Design project board
runs-on: ubuntu-latest
if: >
contains(github.event.issue.labels.*.name, 'X-Needs-Product')
contains(github.event.issue.labels.*.name, 'X-Needs-Product')
steps:
- uses: octokit/graphql-action@v2.x
id: add_to_project
@@ -105,10 +105,7 @@ jobs:
# Skip in forks
if: >
github.repository == 'vector-im/element-android' &&
(contains(github.event.issue.labels.*.name, 'A-Spaces') ||
contains(github.event.issue.labels.*.name, 'A-Space-Settings') ||
contains(github.event.issue.labels.*.name, 'A-Subspaces') ||
contains(github.event.issue.labels.*.name, 'Z-IA'))
(contains(github.event.issue.labels.*.name, 'Team: Delight'))
steps:
- uses: octokit/graphql-action@v2.x
with:
@@ -201,7 +198,7 @@ jobs:
env:
PROJECT_ID: "PN_kwDOAM0swc3m-g"
GITHUB_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
move_ftue_issues:
name: Z-FTUE to Mobile FTUE board
runs-on: ubuntu-latest

View File

@@ -15,9 +15,6 @@ jobs:
!contains(github.event.issue.labels.*.name, 'A-E2EE-Dehydration') &&
!contains(github.event.issue.labels.*.name, 'A-E2EE-Key-Backup') &&
!contains(github.event.issue.labels.*.name, 'A-E2EE-SAS-Verification') &&
!contains(github.event.issue.labels.*.name, 'A-Spaces') &&
!contains(github.event.issue.labels.*.name, 'A-Spaces-Settings') &&
!contains(github.event.issue.labels.*.name, 'A-Subspaces')) &&
(contains(github.event.issue.labels.*.name, 'T-Defect') &&
contains(github.event.issue.labels.*.name, 'S-Critical') &&
(contains(github.event.issue.labels.*.name, 'O-Frequent') ||

View File

@@ -1,3 +1,11 @@
Changes in Element 1.4.19 (2022-06-07)
======================================
Bugfixes 🐛
----------
- Fix | performance regression on roomlist + proper display of space parents in explore rooms. ([#6233](https://github.com/vector-im/element-android/issues/6233))
Changes in Element v1.4.18 (2022-05-31)
=======================================

View File

@@ -1,9 +1,9 @@
[![Buildkite](https://badge.buildkite.com/ad0065c1b70f557cd3b1d3d68f9c2154010f83c4d6f71706a9.svg?branch=develop)](https://buildkite.com/matrix-dot-org/element-android/builds?branch=develop)
[![Weblate](https://translate.element.io/widgets/element-android/-/svg-badge.svg)](https://translate.element.io/engage/element-android/?utm_source=widget)
[![Element Android Matrix room #element-android:matrix.org](https://img.shields.io/matrix/element-android:matrix.org.svg?label=%23element-android:matrix.org&logo=matrix&server_fqdn=matrix.org)](https://matrix.to/#/#element-android:matrix.org)
[![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=im.vector.app.android&metric=alert_status)](https://sonarcloud.io/dashboard?id=im.vector.app.android)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=im.vector.app.android&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=im.vector.app.android)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=im.vector.app.android&metric=bugs)](https://sonarcloud.io/dashboard?id=im.vector.app.android)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=vector-im_element-android&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=vector-im_element-android)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=vector-im_element-android&metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=vector-im_element-android)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=vector-im_element-android&metric=bugs)](https://sonarcloud.io/summary/new_code?id=vector-im_element-android)
# Element Android

View File

@@ -43,7 +43,7 @@ plugins {
id "io.gitlab.arturbosch.detekt" version "1.20.0"
// Dependency Analysis
id 'com.autonomousapps.dependency-analysis' version "1.4.0"
id 'com.autonomousapps.dependency-analysis' version "1.5.0"
}
// https://github.com/jeremylong/DependencyCheck
@@ -180,8 +180,8 @@ apply plugin: 'org.sonarqube'
sonarqube {
properties {
property "sonar.projectName", "Element-Android"
property "sonar.projectKey", "im.vector.app.android"
property "sonar.projectName", "element-android"
property "sonar.projectKey", "vector-im_element-android"
property "sonar.host.url", "https://sonarcloud.io"
property "sonar.projectVersion", project(":vector").android.defaultConfig.versionName
property "sonar.sourceEncoding", "UTF-8"
@@ -191,7 +191,7 @@ sonarqube {
property "sonar.links.issue", "https://github.com/vector-im/element-android/issues"
property "sonar.organization", "new_vector_ltd_organization"
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/allCodeCoverageReport/allCodeCoverageReport.xml"
property "sonar.coverage.jacoco.xmlReportPaths", "${project.buildDir}/reports/jacoco/theCodeCoverageReport/theCodeCoverageReport.xml"
property "sonar.login", project.hasProperty("SONAR_LOGIN") ? SONAR_LOGIN : "invalid"
}
}

1
changelog.d/5285.wip Normal file
View File

@@ -0,0 +1 @@
FTUE - Adds Sign Up tracking

1
changelog.d/5528.bugfix Normal file
View File

@@ -0,0 +1 @@
Fix cases of missing, swapped, or duplicated messages

1
changelog.d/5970.feature Normal file
View File

@@ -0,0 +1 @@
Make read receipt avatar list more compact

1
changelog.d/6017.misc Normal file
View File

@@ -0,0 +1 @@
Adds support for parsing homeserver versions without a patch number

5
changelog.d/6029.sdk Normal file
View File

@@ -0,0 +1,5 @@
Some methods from `Session` have been moved to a new `SyncService`, that you can retrieve from a `Session`.
- `SyncStatusService` method has been moved to the new `SyncService`
- `InitSyncStep` have been moved and renamed to `InitialSyncStep`
- `SyncStatusService.Status` has been renamed to `SyncRequestState`
- The existing `SyncService` has been renamed to `SyncAndroidService` because of name clash with the new SDK Service

1
changelog.d/6093.sdk Normal file
View File

@@ -0,0 +1 @@
Allowing AuthenticationService.getLoginFlow to fail without resetting state from previously successful calls

1
changelog.d/6146.feature Normal file
View File

@@ -0,0 +1 @@
Allow .well-known configuration to override key sharing mode

1
changelog.d/6169.sdk Normal file
View File

@@ -0,0 +1 @@
Allows new passwords to be passed at the point of confirmation when resetting a password

1
changelog.d/6209.bugfix Normal file
View File

@@ -0,0 +1 @@
Fix wrong status of live location sharing in timeline

1
changelog.d/6222.bugfix Normal file
View File

@@ -0,0 +1 @@
Fix StackOverflowError while recording voice message

1
changelog.d/6232.bugfix Normal file
View File

@@ -0,0 +1 @@
Text cropped: "Secure backup"

1
changelog.d/6244.feature Normal file
View File

@@ -0,0 +1 @@
Re-organize location settings flags

View File

@@ -2,7 +2,10 @@ def excludes = [ ]
def initializeReport(report, projects, classExcludes) {
projects.each { project -> project.apply plugin: 'jacoco' }
report.executionData { fileTree(rootProject.rootDir.absolutePath).include("**/build/jacoco/*.exec") }
report.executionData { fileTree(rootProject.rootDir.absolutePath).include(
"**/build/outputs/unit_test_code_coverage/**/*.exec",
"**/build/outputs/code_coverage/**/coverage.ec"
) }
report.reports {
xml.enabled true
@@ -18,11 +21,13 @@ def initializeReport(report, projects, classExcludes) {
switch (project) {
case { project.plugins.hasPlugin("com.android.application") }:
androidClassDirs.add("${project.buildDir}/tmp/kotlin-classes/gplayDebug")
androidSourceDirs.add("${project.buildDir}/generated/source/kapt/gplayDebug")
androidSourceDirs.add("${project.projectDir}/src/main/kotlin")
androidSourceDirs.add("${project.projectDir}/src/main/java")
break
case { project.plugins.hasPlugin("com.android.library") }:
androidClassDirs.add("${project.buildDir}/tmp/kotlin-classes/debug")
androidSourceDirs.add("${project.buildDir}/generated/source/kapt/debug")
androidSourceDirs.add("${project.projectDir}/src/main/kotlin")
androidSourceDirs.add("${project.projectDir}/src/main/java")
break
@@ -43,13 +48,17 @@ def collectProjects(predicate) {
return subprojects.findAll { it.buildFile.isFile() && predicate(it) }
}
task allCodeCoverageReport(type: JacocoReport) {
task theCodeCoverageReport(type: JacocoReport) {
outputs.upToDateWhen { false }
rootProject.apply plugin: 'jacoco'
// to limit projects in a specific report, add
// def excludedProjects = [ ... ]
// def projects = collectProjects { !excludedProjects.contains(it.name) }
def projects = collectProjects { true }
dependsOn { projects*.test }
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}
def projects = collectProjects { ['vector','matrix-sdk-android'].contains(it.name) }
dependsOn {
[':matrix-sdk-android:testDebugUnitTest'] +
[':vector:testGplayDebugUnitTest'] +
[':matrix-sdk-android:connectedDebugAndroidTest']
}
initializeReport(it, projects, excludes)
}

View File

@@ -49,8 +49,8 @@ ext.libs = [
],
androidx : [
'activity' : "androidx.activity:activity:1.4.0",
'appCompat' : "androidx.appcompat:appcompat:1.4.1",
'core' : "androidx.core:core-ktx:1.7.0",
'appCompat' : "androidx.appcompat:appcompat:1.4.2",
'core' : "androidx.core:core-ktx:1.8.0",
'recyclerview' : "androidx.recyclerview:recyclerview:1.2.1",
'exifinterface' : "androidx.exifinterface:exifinterface:1.3.3",
'fragmentKtx' : "androidx.fragment:fragment-ktx:1.4.1",
@@ -78,7 +78,7 @@ ext.libs = [
'transition' : "androidx.transition:transition:1.2.0",
],
google : [
'material' : "com.google.android.material:material:1.6.0"
'material' : "com.google.android.material:material:1.6.1"
],
dagger : [
'dagger' : "com.google.dagger:dagger:$dagger",

View File

@@ -0,0 +1,2 @@
Main changes in this version: Various bug fixes and stability improvements.
Full changelog: https://github.com/vector-im/element-android/releases

View File

@@ -44,7 +44,7 @@ class SwipeToDismissHandler(
@SuppressLint("ClickableViewAccessibility")
override fun onTouch(v: View, event: MotionEvent): Boolean {
when (event.action) {
MotionEvent.ACTION_DOWN -> {
MotionEvent.ACTION_DOWN -> {
if (swipeView.hitRect.contains(event.x.toInt(), event.y.toInt())) {
isTracking = true
}
@@ -58,7 +58,7 @@ class SwipeToDismissHandler(
}
return true
}
MotionEvent.ACTION_MOVE -> {
MotionEvent.ACTION_MOVE -> {
if (isTracking) {
val translationY = event.y - startY
swipeView.translationY = translationY
@@ -66,7 +66,7 @@ class SwipeToDismissHandler(
}
return true
}
else -> {
else -> {
return false
}
}

View File

@@ -88,7 +88,7 @@ class FlowSession(private val session: Session) {
}
fun liveSyncState(): Flow<SyncState> {
return session.getSyncStateLive().asFlow()
return session.syncService().getSyncStateLive().asFlow()
}
fun livePushers(): Flow<List<Pusher>> {

View File

@@ -56,7 +56,7 @@ android {
// that the app's state is completely cleared between tests.
testInstrumentationRunnerArguments clearPackageData: 'true'
buildConfigField "String", "SDK_VERSION", "\"1.4.18\""
buildConfigField "String", "SDK_VERSION", "\"1.4.20\""
buildConfigField "String", "GIT_SDK_REVISION", "\"${gitRevision()}\""
buildConfigField "String", "GIT_SDK_REVISION_UNIX_DATE", "\"${gitRevisionUnixDate()}\""
@@ -74,6 +74,7 @@ android {
buildTypes {
debug {
testCoverageEnabled true
// Set to true to log privacy or sensible data, such as token
buildConfigField "boolean", "LOG_PRIVATE_DATA", project.property("vector.debugPrivateData")
// Set to BODY instead of NONE to enable logging
@@ -175,7 +176,7 @@ dependencies {
implementation libs.androidx.work
// olm lib is now hosted in MavenCentral
implementation 'org.matrix.android:olm-sdk:3.2.11'
implementation 'org.matrix.android:olm-sdk:3.2.12'
// DI
implementation libs.dagger.dagger

View File

@@ -19,10 +19,14 @@ package org.matrix.android.sdk
import android.content.Context
import androidx.test.core.app.ApplicationProvider
import org.junit.Rule
import org.matrix.android.sdk.common.RetryTestRule
import org.matrix.android.sdk.test.shared.createTimberTestRule
interface InstrumentedTest {
@Rule
fun retryTestRule() = RetryTestRule(3)
@Rule
fun timberTestRule() = createTimberTestRule()

View File

@@ -137,11 +137,11 @@ class CommonTestHelper private constructor(context: Context) {
fun syncSession(session: Session, timeout: Long = TestConstants.timeOutMillis * 10) {
val lock = CountDownLatch(1)
coroutineScope.launch {
session.startSync(true)
val syncLiveData = session.getSyncStateLive()
session.syncService().startSync(true)
val syncLiveData = session.syncService().getSyncStateLive()
val syncObserver = object : Observer<SyncState> {
override fun onChanged(t: SyncState?) {
if (session.hasAlreadySynced()) {
if (session.syncService().hasAlreadySynced()) {
lock.countDown()
syncLiveData.removeObserver(this)
}
@@ -160,10 +160,10 @@ class CommonTestHelper private constructor(context: Context) {
fun clearCacheAndSync(session: Session, timeout: Long = TestConstants.timeOutMillis) {
waitWithLatch(timeout) { latch ->
session.clearCache()
val syncLiveData = session.getSyncStateLive()
val syncLiveData = session.syncService().getSyncStateLive()
val syncObserver = object : Observer<SyncState> {
override fun onChanged(t: SyncState?) {
if (session.hasAlreadySynced()) {
if (session.syncService().hasAlreadySynced()) {
Timber.v("Clear cache and synced")
syncLiveData.removeObserver(this)
latch.countDown()
@@ -171,7 +171,7 @@ class CommonTestHelper private constructor(context: Context) {
}
}
syncLiveData.observeForever(syncObserver)
session.startSync(true)
session.syncService().startSync(true)
}
}
@@ -252,7 +252,8 @@ class CommonTestHelper private constructor(context: Context) {
message: String,
numberOfMessages: Int,
rootThreadEventId: String,
timeout: Long = TestConstants.timeOutMillis): List<TimelineEvent> {
timeout: Long = TestConstants.timeOutMillis
): List<TimelineEvent> {
val timeline = room.timelineService().createTimeline(null, TimelineSettings(10))
timeline.start()
val sentEvents = sendTextMessagesBatched(timeline, room, message, numberOfMessages, timeout, rootThreadEventId)
@@ -272,9 +273,11 @@ class CommonTestHelper private constructor(context: Context) {
* @param testParams test params about the session
* @return the session associated with the newly created account
*/
private fun createAccount(userNamePrefix: String,
password: String,
testParams: SessionTestParams): Session {
private fun createAccount(
userNamePrefix: String,
password: String,
testParams: SessionTestParams
): Session {
val session = createAccountAndSync(
userNamePrefix + "_" + accountNumber++ + "_" + UUID.randomUUID(),
password,
@@ -294,9 +297,11 @@ class CommonTestHelper private constructor(context: Context) {
* @param testParams test params about the session
* @return the session associated with the existing account
*/
fun logIntoAccount(userId: String,
password: String,
testParams: SessionTestParams): Session {
fun logIntoAccount(
userId: String,
password: String,
testParams: SessionTestParams
): Session {
val session = logAccountAndSync(userId, password, testParams)
assertNotNull(session)
return session.also {
@@ -311,9 +316,11 @@ class CommonTestHelper private constructor(context: Context) {
* @param password the password
* @param sessionTestParams parameters for the test
*/
private fun createAccountAndSync(userName: String,
password: String,
sessionTestParams: SessionTestParams): Session {
private fun createAccountAndSync(
userName: String,
password: String,
sessionTestParams: SessionTestParams
): Session {
val hs = createHomeServerConfig()
runBlockingTest {
@@ -349,9 +356,11 @@ class CommonTestHelper private constructor(context: Context) {
* @param password the password
* @param sessionTestParams session test params
*/
private fun logAccountAndSync(userName: String,
password: String,
sessionTestParams: SessionTestParams): Session {
private fun logAccountAndSync(
userName: String,
password: String,
sessionTestParams: SessionTestParams
): Session {
val hs = createHomeServerConfig()
runBlockingTest {
@@ -377,8 +386,10 @@ class CommonTestHelper private constructor(context: Context) {
* @param userName the account username
* @param password the password
*/
fun logAccountWithError(userName: String,
password: String): Throwable {
fun logAccountWithError(
userName: String,
password: String
): Throwable {
val hs = createHomeServerConfig()
runBlockingTest {

View File

@@ -18,8 +18,10 @@ package org.matrix.android.sdk.common
import org.matrix.android.sdk.api.session.Session
data class CryptoTestData(val roomId: String,
val sessions: List<Session>) {
data class CryptoTestData(
val roomId: String,
val sessions: List<Session>
) {
val firstSession: Session
get() = sessions.first()

View File

@@ -73,9 +73,11 @@ class MockOkHttpInterceptor : TestInterceptor {
/**
* Simple rule that reply with the given body for any request that matches the match param
*/
class SimpleRule(match: String,
private val code: Int = HttpsURLConnection.HTTP_OK,
private val body: String = "{}") : Rule(match) {
class SimpleRule(
match: String,
private val code: Int = HttpsURLConnection.HTTP_OK,
private val body: String = "{}"
) : Rule(match) {
override fun process(originalRequest: Request): Response? {
return Response.Builder()

View File

@@ -27,8 +27,10 @@ import java.util.concurrent.CountDownLatch
* @param onlySuccessful true to fail if an error occurs. This is the default behavior
* @param <T>
*/
open class TestMatrixCallback<T>(private val countDownLatch: CountDownLatch,
private val onlySuccessful: Boolean = true) : MatrixCallback<T> {
open class TestMatrixCallback<T>(
private val countDownLatch: CountDownLatch,
private val onlySuccessful: Boolean = true
) : MatrixCallback<T> {
@CallSuper
override fun onSuccess(data: T) {

View File

@@ -47,7 +47,9 @@ internal interface TestMatrixComponent : MatrixComponent {
@Component.Factory
interface Factory {
fun create(@BindsInstance context: Context,
@BindsInstance matrixConfiguration: MatrixConfiguration): TestMatrixComponent
fun create(
@BindsInstance context: Context,
@BindsInstance matrixConfiguration: MatrixConfiguration
): TestMatrixComponent
}
}

View File

@@ -22,6 +22,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotEquals
import org.junit.FixMethodOrder
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
@@ -40,6 +41,7 @@ import java.util.UUID
@Suppress("SpellCheckingInspection")
@RunWith(AndroidJUnit4::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Ignore
class AttachmentEncryptionTest {
private fun checkDecryption(input: String, encryptedFileInfo: EncryptedFileInfo): String {

View File

@@ -22,6 +22,7 @@ import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotEquals
import org.junit.Assert.assertNull
import org.junit.Before
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -37,6 +38,7 @@ import org.matrix.olm.OlmSession
private const val DUMMY_DEVICE_KEY = "DeviceKey"
@RunWith(AndroidJUnit4::class)
@Ignore
class CryptoStoreTest : InstrumentedTest {
@get:Rule val rule = RetryTestRule(3)

View File

@@ -21,6 +21,7 @@ import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Assert.fail
import org.junit.FixMethodOrder
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
@@ -30,6 +31,7 @@ import org.junit.runners.MethodSorters
*/
@RunWith(AndroidJUnit4::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Ignore
class ExportEncryptionTest {
@Test
@@ -83,7 +85,8 @@ class ExportEncryptionTest {
@Test
fun checkExportDecrypt1() {
val password = "password"
val input = "-----BEGIN MEGOLM SESSION DATA-----\nAXNhbHRzYWx0c2FsdHNhbHSIiIiIiIiIiIiIiIiIiIiIAAAACmIRUW2OjZ3L2l6j9h0lHlV3M2dx\n" + "cissyYBxjsfsAndErh065A8=\n-----END MEGOLM SESSION DATA-----"
val input = "-----BEGIN MEGOLM SESSION DATA-----\nAXNhbHRzYWx0c2FsdHNhbHSIiIiIiIiIiIiIiIiIiIiIAAAACmIRUW2OjZ3L2l6j9h0lHlV3M2dx\n" +
"cissyYBxjsfsAndErh065A8=\n-----END MEGOLM SESSION DATA-----"
val expectedString = "plain"
var decodedString: String? = null
@@ -103,7 +106,8 @@ class ExportEncryptionTest {
@Test
fun checkExportDecrypt2() {
val password = "betterpassword"
val input = "-----BEGIN MEGOLM SESSION DATA-----\nAW1vcmVzYWx0bW9yZXNhbHT//////////wAAAAAAAAAAAAAD6KyBpe1Niv5M5NPm4ZATsJo5nghk\n" + "KYu63a0YQ5DRhUWEKk7CcMkrKnAUiZny\n-----END MEGOLM SESSION DATA-----"
val input = "-----BEGIN MEGOLM SESSION DATA-----\nAW1vcmVzYWx0bW9yZXNhbHT//////////wAAAAAAAAAAAAAD6KyBpe1Niv5M5NPm4ZATsJo5nghk\n" +
"KYu63a0YQ5DRhUWEKk7CcMkrKnAUiZny\n-----END MEGOLM SESSION DATA-----"
val expectedString = "Hello, World"
var decodedString: String? = null
@@ -123,7 +127,8 @@ class ExportEncryptionTest {
@Test
fun checkExportDecrypt3() {
val password = "SWORDFISH"
val input = "-----BEGIN MEGOLM SESSION DATA-----\nAXllc3NhbHR5Z29vZG5lc3P//////////wAAAAAAAAAAAAAD6OIW+Je7gwvjd4kYrb+49gKCfExw\n" + "MgJBMD4mrhLkmgAngwR1pHjbWXaoGybtiAYr0moQ93GrBQsCzPbvl82rZhaXO3iH5uHo/RCEpOqp\nPgg29363BGR+/Ripq/VCLKGNbw==\n-----END MEGOLM SESSION DATA-----"
val input = "-----BEGIN MEGOLM SESSION DATA-----\nAXllc3NhbHR5Z29vZG5lc3P//////////wAAAAAAAAAAAAAD6OIW+Je7gwvjd4kYrb+49gKCfExw\n" +
"MgJBMD4mrhLkmgAngwR1pHjbWXaoGybtiAYr0moQ93GrBQsCzPbvl82rZhaXO3iH5uHo/RCEpOqp\nPgg29363BGR+/Ripq/VCLKGNbw==\n-----END MEGOLM SESSION DATA-----"
val expectedString = "alphanumericallyalphanumericallyalphanumericallyalphanumerically"
var decodedString: String? = null
@@ -202,7 +207,8 @@ class ExportEncryptionTest {
@Test
fun checkExportEncrypt4() {
val password = "passwordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpassword" + "passwordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpassword"
val password = "passwordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpassword" +
"passwordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpasswordpassword"
val expectedString = "alphanumericallyalphanumericallyalphanumericallyalphanumerically"
var decodedString: String? = null

View File

@@ -21,6 +21,7 @@ import org.amshove.kluent.shouldBe
import org.junit.Assert
import org.junit.Before
import org.junit.FixMethodOrder
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
@@ -59,6 +60,7 @@ import kotlin.coroutines.resume
*/
@RunWith(AndroidJUnit4::class)
@FixMethodOrder(MethodSorters.JVM)
@Ignore
class UnwedgingTest : InstrumentedTest {
private lateinit var messagesReceivedByBob: List<TimelineEvent>

View File

@@ -25,6 +25,7 @@ import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Assert.fail
import org.junit.FixMethodOrder
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
@@ -47,6 +48,7 @@ import kotlin.coroutines.resume
@RunWith(AndroidJUnit4::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@LargeTest
@Ignore
class XSigningTest : InstrumentedTest {
@Test

View File

@@ -25,6 +25,7 @@ import org.amshove.kluent.internal.assertEquals
import org.junit.Assert
import org.junit.Assert.assertNull
import org.junit.FixMethodOrder
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -50,6 +51,7 @@ import org.matrix.android.sdk.mustFail
@RunWith(AndroidJUnit4::class)
@FixMethodOrder(MethodSorters.JVM)
@LargeTest
@Ignore
class KeyShareTests : InstrumentedTest {
@get:Rule val rule = RetryTestRule(3)
@@ -422,7 +424,7 @@ class KeyShareTests : InstrumentedTest {
// /!\ Stop initial alice session syncing so that it can't reply
aliceSession.cryptoService().enableKeyGossiping(false)
aliceSession.stopSync()
aliceSession.syncService().stopSync()
// Let's now try to request
aliceNewSession.cryptoService().reRequestRoomKeyForEvent(sentEvents.first().root)
@@ -445,7 +447,7 @@ class KeyShareTests : InstrumentedTest {
// let's wake up alice
aliceSession.cryptoService().enableKeyGossiping(true)
aliceSession.startSync(true)
aliceSession.syncService().startSync(true)
// We should now get a reply from first session
commonTestHelper.waitWithLatch { latch ->

View File

@@ -21,6 +21,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import org.junit.Assert
import org.junit.FixMethodOrder
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -46,6 +47,7 @@ import org.matrix.android.sdk.mustFail
@RunWith(AndroidJUnit4::class)
@FixMethodOrder(MethodSorters.JVM)
@LargeTest
@Ignore
class WithHeldTests : InstrumentedTest {
@get:Rule val rule = RetryTestRule(3)

View File

@@ -24,6 +24,7 @@ import org.junit.Assert.assertNotNull
import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.FixMethodOrder
import org.junit.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -55,6 +56,7 @@ import java.util.concurrent.CountDownLatch
@RunWith(AndroidJUnit4::class)
@FixMethodOrder(MethodSorters.JVM)
@LargeTest
@Ignore
class KeysBackupTest : InstrumentedTest {
@get:Rule val rule = RetryTestRule(3)

View File

@@ -33,7 +33,8 @@ import java.util.concurrent.CountDownLatch
internal class KeysBackupTestHelper(
private val testHelper: CommonTestHelper,
private val cryptoTestHelper: CryptoTestHelper) {
private val cryptoTestHelper: CryptoTestHelper
) {
fun waitForKeybackUpBatching() {
Thread.sleep(400)
@@ -96,8 +97,10 @@ internal class KeysBackupTestHelper(
)
}
fun prepareAndCreateKeysBackupData(keysBackup: KeysBackupService,
password: String? = null): PrepareKeysBackupDataResult {
fun prepareAndCreateKeysBackupData(
keysBackup: KeysBackupService,
password: String? = null
): PrepareKeysBackupDataResult {
val stateObserver = StateObserver(keysBackup)
val megolmBackupCreationInfo = testHelper.doSync<MegolmBackupCreationInfo> {
@@ -169,9 +172,11 @@ internal class KeysBackupTestHelper(
* - The new device must have the same count of megolm keys
* - Alice must have the same keys on both devices
*/
fun checkRestoreSuccess(testData: KeysBackupScenarioData,
total: Int,
imported: Int) {
fun checkRestoreSuccess(
testData: KeysBackupScenarioData,
total: Int,
imported: Int
) {
// - Imported keys number must be correct
Assert.assertEquals(testData.aliceKeys.size, total)
Assert.assertEquals(total, imported)

View File

@@ -18,5 +18,7 @@ package org.matrix.android.sdk.internal.crypto.keysbackup
import org.matrix.android.sdk.api.session.crypto.keysbackup.MegolmBackupCreationInfo
data class PrepareKeysBackupDataResult(val megolmBackupCreationInfo: MegolmBackupCreationInfo,
val version: String)
data class PrepareKeysBackupDataResult(
val megolmBackupCreationInfo: MegolmBackupCreationInfo,
val version: String
)

View File

@@ -27,9 +27,11 @@ import java.util.concurrent.CountDownLatch
* This class observe the state change of a KeysBackup object and provide a method to check the several state change
* It checks all state transitions and detected forbidden transition
*/
internal class StateObserver(private val keysBackup: KeysBackupService,
private val latch: CountDownLatch? = null,
private val expectedStateChange: Int = -1) : KeysBackupStateListener {
internal class StateObserver(
private val keysBackup: KeysBackupService,
private val latch: CountDownLatch? = null,
private val expectedStateChange: Int = -1
) : KeysBackupStateListener {
private val allowedStateTransitions = listOf(
KeysBackupState.BackingUp to KeysBackupState.ReadyToBackUp,

View File

@@ -52,6 +52,7 @@ import java.util.concurrent.CountDownLatch
@RunWith(AndroidJUnit4::class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Ignore
class SASTest : InstrumentedTest {
@Test
@@ -264,14 +265,16 @@ class SASTest : InstrumentedTest {
assertEquals("Request should be cancelled with m.unknown_method", CancelCode.UnknownMethod.value, cancelReq.code)
}
private fun fakeBobStart(bobSession: Session,
aliceUserID: String?,
aliceDevice: String?,
tid: String,
protocols: List<String> = SASDefaultVerificationTransaction.KNOWN_AGREEMENT_PROTOCOLS,
hashes: List<String> = SASDefaultVerificationTransaction.KNOWN_HASHES,
mac: List<String> = SASDefaultVerificationTransaction.KNOWN_MACS,
codes: List<String> = SASDefaultVerificationTransaction.KNOWN_SHORT_CODES) {
private fun fakeBobStart(
bobSession: Session,
aliceUserID: String?,
aliceDevice: String?,
tid: String,
protocols: List<String> = SASDefaultVerificationTransaction.KNOWN_AGREEMENT_PROTOCOLS,
hashes: List<String> = SASDefaultVerificationTransaction.KNOWN_HASHES,
mac: List<String> = SASDefaultVerificationTransaction.KNOWN_MACS,
codes: List<String> = SASDefaultVerificationTransaction.KNOWN_SHORT_CODES
) {
val startMessage = KeyVerificationStart(
fromDevice = bobSession.cryptoService().getMyDevice().deviceId,
method = VerificationMethod.SAS.toValue(),

View File

@@ -19,6 +19,7 @@ package org.matrix.android.sdk.internal.crypto.verification.qrcode
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.amshove.kluent.shouldBe
import org.junit.FixMethodOrder
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.MethodSorters
@@ -41,6 +42,7 @@ import kotlin.coroutines.resume
@RunWith(AndroidJUnit4::class)
@FixMethodOrder(MethodSorters.JVM)
@Ignore
class VerificationTest : InstrumentedTest {
data class ExpectedResult(
@@ -151,10 +153,12 @@ class VerificationTest : InstrumentedTest {
// TODO Add tests without SAS
private fun doTest(aliceSupportedMethods: List<VerificationMethod>,
bobSupportedMethods: List<VerificationMethod>,
expectedResultForAlice: ExpectedResult,
expectedResultForBob: ExpectedResult) = runCryptoTest(context()) { cryptoTestHelper, testHelper ->
private fun doTest(
aliceSupportedMethods: List<VerificationMethod>,
bobSupportedMethods: List<VerificationMethod>,
expectedResultForAlice: ExpectedResult,
expectedResultForBob: ExpectedResult
) = runCryptoTest(context()) { cryptoTestHelper, testHelper ->
val cryptoTestData = cryptoTestHelper.doE2ETestWithAliceAndBobInARoom()
val aliceSession = cryptoTestData.firstSession

View File

@@ -289,9 +289,11 @@ class MarkdownParserTest : InstrumentedTest {
markdownParser.parse(text).expect(text, null)
}
private fun testType(name: String,
markdownPattern: String,
htmlExpectedTag: String) {
private fun testType(
name: String,
markdownPattern: String,
htmlExpectedTag: String
) {
// Test simple case
"$markdownPattern$name$markdownPattern"
.let {
@@ -376,10 +378,12 @@ class MarkdownParserTest : InstrumentedTest {
}
}
private fun testTypeNewLines(name: String,
markdownPattern: String,
htmlExpectedTag: String,
softBreak: String = "<br />") {
private fun testTypeNewLines(
name: String,
markdownPattern: String,
htmlExpectedTag: String,
softBreak: String = "<br />"
) {
// With new line inside the block
"$markdownPattern$name\n$name$markdownPattern"
.let {

View File

@@ -83,7 +83,7 @@ class ThreadMessagingTest : InstrumentedTest {
val timeline = aliceRoom.timelineService().createTimeline(null, TimelineSettings(30))
timeline.start()
aliceSession.startSync(true)
aliceSession.syncService().startSync(true)
run {
val lock = CountDownLatch(1)
val eventsListener = commonTestHelper.createEventListener(lock) { snapshot ->
@@ -97,7 +97,7 @@ class ThreadMessagingTest : InstrumentedTest {
timeline.addListener(eventsListener)
commonTestHelper.await(lock, 600_000)
}
aliceSession.stopSync()
aliceSession.syncService().stopSync()
}
@Test
@@ -144,7 +144,7 @@ class ThreadMessagingTest : InstrumentedTest {
val timeline = aliceRoom.timelineService().createTimeline(null, TimelineSettings(30))
timeline.start()
aliceSession.startSync(true)
aliceSession.syncService().startSync(true)
run {
val lock = CountDownLatch(1)
val eventsListener = commonTestHelper.createEventListener(lock) { snapshot ->
@@ -156,9 +156,9 @@ class ThreadMessagingTest : InstrumentedTest {
timeline.addListener(eventsListener)
commonTestHelper.await(lock, 600_000)
}
aliceSession.stopSync()
aliceSession.syncService().stopSync()
bobSession.startSync(true)
bobSession.syncService().startSync(true)
run {
val lock = CountDownLatch(1)
val eventsListener = commonTestHelper.createEventListener(lock) { snapshot ->
@@ -170,7 +170,7 @@ class ThreadMessagingTest : InstrumentedTest {
timeline.addListener(eventsListener)
commonTestHelper.await(lock, 600_000)
}
bobSession.stopSync()
bobSession.syncService().stopSync()
}
@Test
@@ -217,7 +217,7 @@ class ThreadMessagingTest : InstrumentedTest {
val timeline = aliceRoom.timelineService().createTimeline(null, TimelineSettings(30))
timeline.start()
aliceSession.startSync(true)
aliceSession.syncService().startSync(true)
run {
val lock = CountDownLatch(1)
val eventsListener = commonTestHelper.createEventListener(lock) { snapshot ->
@@ -233,7 +233,7 @@ class ThreadMessagingTest : InstrumentedTest {
timeline.addListener(eventsListener)
commonTestHelper.await(lock, 600_000)
}
aliceSession.stopSync()
aliceSession.syncService().stopSync()
}
@Test
@@ -314,7 +314,7 @@ class ThreadMessagingTest : InstrumentedTest {
val timeline = aliceRoom.timelineService().createTimeline(null, TimelineSettings(30))
timeline.start()
aliceSession.startSync(true)
aliceSession.syncService().startSync(true)
run {
val lock = CountDownLatch(1)
val eventsListener = commonTestHelper.createEventListener(lock) { snapshot ->
@@ -338,6 +338,6 @@ class ThreadMessagingTest : InstrumentedTest {
timeline.addListener(eventsListener)
commonTestHelper.await(lock, 600_000)
}
aliceSession.stopSync()
aliceSession.syncService().stopSync()
}
}

View File

@@ -154,9 +154,11 @@ internal class ChunkEntityTest : InstrumentedTest {
}
}
private fun ChunkEntity.addAll(roomId: String,
events: List<Event>,
direction: PaginationDirection) {
private fun ChunkEntity.addAll(
roomId: String,
events: List<Event>,
direction: PaginationDirection
) {
events.forEach { event ->
val fakeEvent = event.toEntity(roomId, SendState.SYNCED, clock.epochMillis()).let {
realm.copyToRealm(it)

View File

@@ -19,8 +19,9 @@ package org.matrix.android.sdk.session.room.timeline
import org.matrix.android.sdk.api.session.events.model.Event
import org.matrix.android.sdk.internal.session.room.timeline.TokenChunkEvent
internal data class FakeTokenChunkEvent(override val start: String?,
override val end: String?,
override val events: List<Event> = emptyList(),
override val stateEvents: List<Event> = emptyList()
internal data class FakeTokenChunkEvent(
override val start: String?,
override val end: String?,
override val events: List<Event> = emptyList(),
override val stateEvents: List<Event> = emptyList()
) : TokenChunkEvent

View File

@@ -57,7 +57,7 @@ class PollAggregationTest : InstrumentedTest {
// Bob creates a poll
roomFromBobPOV.sendService().sendPoll(PollType.DISCLOSED, pollQuestion, pollOptions)
aliceSession.startSync(true)
aliceSession.syncService().startSync(true)
val aliceTimeline = roomFromAlicePOV.timelineService().createTimeline(null, TimelineSettings(30))
aliceTimeline.start()
@@ -133,7 +133,7 @@ class PollAggregationTest : InstrumentedTest {
aliceTimeline.removeAllListeners()
aliceSession.stopSync()
aliceSession.syncService().stopSync()
aliceTimeline.dispose()
}

View File

@@ -41,11 +41,12 @@ object RoomDataHelper {
}
}
private fun createFakeEvent(type: String,
content: Content? = null,
prevContent: Content? = null,
sender: String = FAKE_TEST_SENDER,
stateKey: String? = null
private fun createFakeEvent(
type: String,
content: Content? = null,
prevContent: Content? = null,
sender: String = FAKE_TEST_SENDER,
stateKey: String? = null
): Event {
return Event(
type = type,

View File

@@ -88,7 +88,7 @@ class TimelinePreviousLastForwardTest : InstrumentedTest {
}
// Bob stop to sync
bobSession.stopSync()
bobSession.syncService().stopSync()
val firstMessage = "First messages from Alice"
// Alice sends 30 messages
@@ -101,7 +101,7 @@ class TimelinePreviousLastForwardTest : InstrumentedTest {
.eventId
// Bob start to sync
bobSession.startSync(true)
bobSession.syncService().startSync(true)
run {
val lock = CountDownLatch(1)
@@ -125,7 +125,7 @@ class TimelinePreviousLastForwardTest : InstrumentedTest {
}
// Bob stop to sync
bobSession.stopSync()
bobSession.syncService().stopSync()
val secondMessage = "Second messages from Alice"
// Alice sends again 30 messages
@@ -136,7 +136,7 @@ class TimelinePreviousLastForwardTest : InstrumentedTest {
)
// Bob start to sync
bobSession.startSync(true)
bobSession.syncService().startSync(true)
run {
val lock = CountDownLatch(1)

View File

@@ -20,6 +20,7 @@ import androidx.test.filters.LargeTest
import kotlinx.coroutines.runBlocking
import org.amshove.kluent.internal.assertEquals
import org.junit.FixMethodOrder
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
@@ -38,6 +39,7 @@ import org.matrix.android.sdk.common.TestConstants
@RunWith(JUnit4::class)
@FixMethodOrder(MethodSorters.JVM)
@LargeTest
@Ignore
class TimelineSimpleBackPaginationTest : InstrumentedTest {
@Test

View File

@@ -71,7 +71,7 @@ class TimelineWithManyMembersTest : InstrumentedTest {
val timelineForCurrentMember = roomForCurrentMember.timelineService().createTimeline(null, TimelineSettings(30))
timelineForCurrentMember.start()
session.startSync(true)
session.syncService().startSync(true)
run {
val lock = CountDownLatch(1)
@@ -92,7 +92,7 @@ class TimelineWithManyMembersTest : InstrumentedTest {
timelineForCurrentMember.addListener(eventsListener)
commonTestHelper.await(lock, 600_000)
}
session.stopSync()
session.syncService().stopSync()
}
}
}

View File

@@ -22,6 +22,7 @@ import kotlinx.coroutines.runBlocking
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNotNull
import org.junit.FixMethodOrder
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
@@ -98,6 +99,7 @@ class SpaceCreationTest : InstrumentedTest {
}
@Test
@Ignore
fun testJoinSimplePublicSpace() = runSessionTest(context()) { commonTestHelper ->
val aliceSession = commonTestHelper.createAccount("alice", SessionTestParams(true))

View File

@@ -387,9 +387,10 @@ class SpaceHierarchyTest : InstrumentedTest {
val roomIds: List<String>
)
private fun createPublicSpace(session: Session,
spaceName: String,
childInfo: List<Triple<String, Boolean, Boolean?>>
private fun createPublicSpace(
session: Session,
spaceName: String,
childInfo: List<Triple<String, Boolean, Boolean?>>
/** Name, auto-join, canonical*/
): TestSpaceCreationResult {
var spaceId = ""
@@ -416,9 +417,10 @@ class SpaceHierarchyTest : InstrumentedTest {
return TestSpaceCreationResult(spaceId, roomIds)
}
private fun createPrivateSpace(session: Session,
spaceName: String,
childInfo: List<Triple<String, Boolean, Boolean?>>
private fun createPrivateSpace(
session: Session,
spaceName: String,
childInfo: List<Triple<String, Boolean, Boolean?>>
/** Name, auto-join, canonical*/
): TestSpaceCreationResult {
var spaceId = ""

View File

@@ -28,9 +28,11 @@ import org.matrix.android.sdk.api.session.Session
* This interface defines methods to authenticate or to create an account to a matrix server.
*/
interface AuthenticationService {
/**
* Request the supported login flows for this homeserver.
* This is the first method to call to be able to get a wizard to login or to create an account
* This is the first method to call to be able to get a wizard to login or to create an account.
* @param homeServerConnectionConfig contains the homeserver URL to login to, a wellKnown lookup will be attempted.
*/
suspend fun getLoginFlow(homeServerConnectionConfig: HomeServerConnectionConfig): LoginFlowResult
@@ -93,14 +95,18 @@ interface AuthenticationService {
/**
* Create a session after a SSO successful login.
*/
suspend fun createSessionFromSso(homeServerConnectionConfig: HomeServerConnectionConfig,
credentials: Credentials): Session
suspend fun createSessionFromSso(
homeServerConnectionConfig: HomeServerConnectionConfig,
credentials: Credentials
): Session
/**
* Perform a wellknown request, using the domain from the matrixId.
*/
suspend fun getWellKnownData(matrixId: String,
homeServerConnectionConfig: HomeServerConnectionConfig?): WellknownResult
suspend fun getWellKnownData(
matrixId: String,
homeServerConnectionConfig: HomeServerConnectionConfig?
): WellknownResult
/**
* Authenticate with a matrixId and a password.
@@ -111,9 +117,11 @@ interface AuthenticationService {
* @param initialDeviceName the initial device name
* @param deviceId the device id, optional. If not provided or null, the server will generate one.
*/
suspend fun directAuthentication(homeServerConnectionConfig: HomeServerConnectionConfig,
matrixId: String,
password: String,
initialDeviceName: String,
deviceId: String? = null): Session
suspend fun directAuthentication(
homeServerConnectionConfig: HomeServerConnectionConfig,
matrixId: String,
password: String,
initialDeviceName: String,
deviceId: String? = null
): Session
}

View File

@@ -41,8 +41,10 @@ import org.matrix.android.sdk.api.auth.registration.TermPolicies
* @param userLanguage the user language
* @param defaultLanguage the default language to use if the user language is not found for a policy in registrationFlowResponse
*/
fun TermPolicies.toLocalizedLoginTerms(userLanguage: String,
defaultLanguage: String = "en"): List<LocalizedFlowDataLoginTerms> {
fun TermPolicies.toLocalizedLoginTerms(
userLanguage: String,
defaultLanguage: String = "en"
): List<LocalizedFlowDataLoginTerms> {
val result = ArrayList<LocalizedFlowDataLoginTerms>()
val policies = get("policies")

View File

@@ -39,10 +39,12 @@ interface LoginWizard {
* @param deviceId the device id, optional. If not provided or null, the server will generate one.
* @return a [Session] if the login is successful
*/
suspend fun login(login: String,
password: String,
initialDeviceName: String,
deviceId: String? = null): Session
suspend fun login(
login: String,
password: String,
initialDeviceName: String,
deviceId: String? = null
): Session
/**
* Exchange a login token to an access token.
@@ -63,14 +65,14 @@ interface LoginWizard {
* [resetPasswordMailConfirmed] is successfully called.
*
* @param email an email previously associated to the account the user wants the password to be reset.
* @param newPassword the desired new password
*/
suspend fun resetPassword(email: String,
newPassword: String)
suspend fun resetPassword(email: String)
/**
* Confirm the new password, once the user has checked their email
* When this method succeed, tha account password will be effectively modified.
*
* @param newPassword the desired new password
*/
suspend fun resetPasswordMailConfirmed()
suspend fun resetPasswordMailConfirmed(newPassword: String)
}

View File

@@ -54,9 +54,11 @@ interface RegistrationWizard {
* @param password the desired password
* @param initialDeviceDisplayName the device display name
*/
suspend fun createAccount(userName: String?,
password: String?,
initialDeviceDisplayName: String?): RegistrationResult
suspend fun createAccount(
userName: String?,
password: String?,
initialDeviceDisplayName: String?
): RegistrationResult
/**
* Perform the "m.login.recaptcha" stage.

View File

@@ -26,9 +26,11 @@ sealed class WellknownResult {
* Retrieve the specific piece of information from the user in a way which fits within the existing client user experience,
* if the client is inclined to do so. Failure can take place instead if no good user experience for this is possible at this point.
*/
data class Prompt(val homeServerUrl: String,
val identityServerUrl: String?,
val wellKnown: WellKnown) : WellknownResult()
data class Prompt(
val homeServerUrl: String,
val identityServerUrl: String?,
val wellKnown: WellKnown
) : WellknownResult()
/**
* Stop the current auto-discovery mechanism. If no more auto-discovery mechanisms are available,

View File

@@ -27,3 +27,8 @@ fun CharSequence.ensurePrefix(prefix: CharSequence): CharSequence {
* Append a new line and then the provided string.
*/
fun StringBuilder.appendNl(str: String) = append("\n").append(str)
/**
* Returns null if the string is empty.
*/
fun String.ensureNotEmpty() = ifEmpty { null }

View File

@@ -17,8 +17,6 @@
package org.matrix.android.sdk.api.session
import androidx.annotation.MainThread
import androidx.lifecycle.LiveData
import kotlinx.coroutines.flow.SharedFlow
import okhttp3.OkHttpClient
import org.matrix.android.sdk.api.MatrixCoroutineDispatchers
import org.matrix.android.sdk.api.auth.data.SessionParams
@@ -37,7 +35,6 @@ import org.matrix.android.sdk.api.session.file.FileService
import org.matrix.android.sdk.api.session.group.GroupService
import org.matrix.android.sdk.api.session.homeserver.HomeServerCapabilitiesService
import org.matrix.android.sdk.api.session.identity.IdentityService
import org.matrix.android.sdk.api.session.initsync.SyncStatusService
import org.matrix.android.sdk.api.session.integrationmanager.IntegrationManagerService
import org.matrix.android.sdk.api.session.media.MediaService
import org.matrix.android.sdk.api.session.openid.OpenIdService
@@ -55,8 +52,7 @@ import org.matrix.android.sdk.api.session.signout.SignOutService
import org.matrix.android.sdk.api.session.space.SpaceService
import org.matrix.android.sdk.api.session.statistics.StatisticsListener
import org.matrix.android.sdk.api.session.sync.FilterService
import org.matrix.android.sdk.api.session.sync.SyncState
import org.matrix.android.sdk.api.session.sync.model.SyncResponse
import org.matrix.android.sdk.api.session.sync.SyncService
import org.matrix.android.sdk.api.session.terms.TermsService
import org.matrix.android.sdk.api.session.thirdparty.ThirdPartyService
import org.matrix.android.sdk.api.session.typing.TypingUsersTracker
@@ -98,59 +94,11 @@ interface Session {
@MainThread
fun open()
/**
* Requires a one time background sync.
*/
fun requireBackgroundSync()
/**
* Launches infinite self rescheduling background syncs via the WorkManager.
*
* While dozing, syncs will only occur during maintenance windows.
* For reliability it's recommended to also start a long running foreground service
* along with disabling battery optimizations.
*/
fun startAutomaticBackgroundSync(timeOutInSeconds: Long, repeatDelayInSeconds: Long)
fun stopAnyBackgroundSync()
/**
* This method start the sync thread.
*/
fun startSync(fromForeground: Boolean)
/**
* This method stop the sync thread.
*/
fun stopSync()
/**
* Clear cache of the session.
*/
suspend fun clearCache()
/**
* This method allows to listen the sync state.
* @return a [LiveData] of [SyncState].
*/
fun getSyncStateLive(): LiveData<SyncState>
/**
* This method returns the current sync state.
* @return the current [SyncState].
*/
fun getSyncState(): SyncState
/**
* This method returns a flow of SyncResponse. New value will be pushed through the sync thread.
*/
fun syncFlow(): SharedFlow<SyncResponse>
/**
* This methods return true if an initial sync has been processed.
*/
fun hasAlreadySynced(): Boolean
/**
* This method allow to close a session. It does stop some services.
*/
@@ -247,9 +195,9 @@ interface Session {
fun termsService(): TermsService
/**
* Returns the SyncStatusService associated with the session.
* Returns the SyncService associated with the session.
*/
fun syncStatusService(): SyncStatusService
fun syncService(): SyncService
/**
* Returns the SecureStorageService associated with the session.

View File

@@ -27,8 +27,10 @@ interface AccountService {
* @param password Current password.
* @param newPassword New password
*/
suspend fun changePassword(password: String,
newPassword: String)
suspend fun changePassword(
password: String,
newPassword: String
)
/**
* Deactivate the account.
@@ -46,6 +48,8 @@ interface AccountService {
* an incomplete view of conversations
* @param userInteractiveAuthInterceptor see [UserInteractiveAuthInterceptor]
*/
suspend fun deactivateAccount(eraseAllData: Boolean,
userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor)
suspend fun deactivateAccount(
eraseAllData: Boolean,
userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor
)
}

View File

@@ -91,10 +91,12 @@ interface MxCall : MxCallDetail {
* Send a m.call.replaces event to initiate call transfer.
* See [org.matrix.android.sdk.api.session.room.model.call.CallReplacesContent] for documentation about the parameters
*/
suspend fun transfer(targetUserId: String,
targetRoomId: String?,
createCallId: String?,
awaitCallId: String?)
suspend fun transfer(
targetUserId: String,
targetRoomId: String?,
createCallId: String?,
awaitCallId: String?
)
fun addListener(listener: StateListener)
fun removeListener(listener: StateListener)

View File

@@ -88,9 +88,11 @@ interface CryptoService {
fun getDeviceTrackingStatus(userId: String): Int
suspend fun importRoomKeys(roomKeysAsArray: ByteArray,
password: String,
progressListener: ProgressListener?): ImportRoomKeysResult
suspend fun importRoomKeys(
roomKeysAsArray: ByteArray,
password: String,
progressListener: ProgressListener?
): ImportRoomKeysResult
suspend fun exportRoomKeys(password: String): ByteArray
@@ -119,10 +121,12 @@ interface CryptoService {
fun isRoomEncrypted(roomId: String): Boolean
// TODO This could be removed from this interface
fun encryptEventContent(eventContent: Content,
eventType: String,
roomId: String,
callback: MatrixCallback<MXEncryptEventContentResult>)
fun encryptEventContent(
eventContent: Content,
eventType: String,
roomId: String,
callback: MatrixCallback<MXEncryptEventContentResult>
)
fun discardOutboundSession(roomId: String)

View File

@@ -25,12 +25,14 @@ import org.matrix.olm.OlmException
*/
sealed class MXCryptoError : Throwable() {
data class Base(val errorType: ErrorType,
val technicalMessage: String,
/**
* Describe the error with more details.
*/
val detailedErrorDescription: String? = null) : MXCryptoError()
data class Base(
val errorType: ErrorType,
val technicalMessage: String,
/**
* Describe the error with more details.
*/
val detailedErrorDescription: String? = null
) : MXCryptoError()
data class OlmError(val olmException: OlmException) : MXCryptoError()

View File

@@ -26,7 +26,7 @@ data class RequestReply(
)
sealed class RequestResult {
data class Success(val chainIndex: Int) : RequestResult()
data class Success(val chainIndex: Int) : RequestResult()
data class Failure(val code: WithHeldCode) : RequestResult()
}

View File

@@ -37,14 +37,18 @@ interface CrossSigningService {
* Initialize cross signing for this user.
* Users needs to enter credentials
*/
fun initializeCrossSigning(uiaInterceptor: UserInteractiveAuthInterceptor?,
callback: MatrixCallback<Unit>)
fun initializeCrossSigning(
uiaInterceptor: UserInteractiveAuthInterceptor?,
callback: MatrixCallback<Unit>
)
fun isCrossSigningInitialized(): Boolean = getMyCrossSigningKeys() != null
fun checkTrustFromPrivateKeys(masterKeyPrivateKey: String?,
uskKeyPrivateKey: String?,
sskPrivateKey: String?): UserTrustResult
fun checkTrustFromPrivateKeys(
masterKeyPrivateKey: String?,
uskKeyPrivateKey: String?,
sskPrivateKey: String?
): UserTrustResult
fun getUserCrossSigningKeys(otherUserId: String): MXCrossSigningInfo?
@@ -60,20 +64,26 @@ interface CrossSigningService {
fun allPrivateKeysKnown(): Boolean
fun trustUser(otherUserId: String,
callback: MatrixCallback<Unit>)
fun trustUser(
otherUserId: String,
callback: MatrixCallback<Unit>
)
fun markMyMasterKeyAsTrusted()
/**
* Sign one of your devices and upload the signature.
*/
fun trustDevice(deviceId: String,
callback: MatrixCallback<Unit>)
fun trustDevice(
deviceId: String,
callback: MatrixCallback<Unit>
)
fun checkDeviceTrust(otherUserId: String,
otherDeviceId: String,
locallyTrusted: Boolean?): DeviceTrustResult
fun checkDeviceTrust(
otherUserId: String,
otherDeviceId: String,
locallyTrusted: Boolean?
): DeviceTrustResult
// FIXME Those method do not have to be in the service
fun onSecretMSKGossip(mskPrivateKey: String)

View File

@@ -36,8 +36,10 @@ interface KeysBackupService {
* @param keysBackupCreationInfo the info object from [prepareKeysBackupVersion].
* @param callback Asynchronous callback
*/
fun createKeysBackupVersion(keysBackupCreationInfo: MegolmBackupCreationInfo,
callback: MatrixCallback<KeysVersion>)
fun createKeysBackupVersion(
keysBackupCreationInfo: MegolmBackupCreationInfo,
callback: MatrixCallback<KeysVersion>
)
/**
* Facility method to get the total number of locally stored keys.
@@ -55,8 +57,10 @@ interface KeysBackupService {
* @param progressListener the callback to follow the progress
* @param callback the main callback
*/
fun backupAllGroupSessions(progressListener: ProgressListener?,
callback: MatrixCallback<Unit>?)
fun backupAllGroupSessions(
progressListener: ProgressListener?,
callback: MatrixCallback<Unit>?
)
/**
* Check trust on a key backup version.
@@ -64,8 +68,10 @@ interface KeysBackupService {
* @param keysBackupVersion the backup version to check.
* @param callback block called when the operations completes.
*/
fun getKeysBackupTrust(keysBackupVersion: KeysVersionResult,
callback: MatrixCallback<KeysBackupVersionTrust>)
fun getKeysBackupTrust(
keysBackupVersion: KeysVersionResult,
callback: MatrixCallback<KeysBackupVersionTrust>
)
/**
* Return the current progress of the backup.
@@ -79,8 +85,10 @@ interface KeysBackupService {
* @param version the backup version
* @param callback
*/
fun getVersion(version: String,
callback: MatrixCallback<KeysVersionResult?>)
fun getVersion(
version: String,
callback: MatrixCallback<KeysVersionResult?>
)
/**
* This method fetches the last backup version on the server, then compare to the currently backup version use.
@@ -114,9 +122,11 @@ interface KeysBackupService {
* @param progressListener a progress listener, as generating private key from password may take a while
* @param callback Asynchronous callback
*/
fun prepareKeysBackupVersion(password: String?,
progressListener: ProgressListener?,
callback: MatrixCallback<MegolmBackupCreationInfo>)
fun prepareKeysBackupVersion(
password: String?,
progressListener: ProgressListener?,
callback: MatrixCallback<MegolmBackupCreationInfo>
)
/**
* Delete a keys backup version. It will delete all backed up keys on the server, and the backup itself.
@@ -125,8 +135,10 @@ interface KeysBackupService {
* @param version the backup version to delete.
* @param callback Asynchronous callback
*/
fun deleteBackup(version: String,
callback: MatrixCallback<Unit>?)
fun deleteBackup(
version: String,
callback: MatrixCallback<Unit>?
)
/**
* Ask if the backup on the server contains keys that we may do not have locally.
@@ -142,9 +154,11 @@ interface KeysBackupService {
* @param trust the trust to set to the keys backup.
* @param callback block called when the operations completes.
*/
fun trustKeysBackupVersion(keysBackupVersion: KeysVersionResult,
trust: Boolean,
callback: MatrixCallback<Unit>)
fun trustKeysBackupVersion(
keysBackupVersion: KeysVersionResult,
trust: Boolean,
callback: MatrixCallback<Unit>
)
/**
* Set trust on a keys backup version.
@@ -153,9 +167,11 @@ interface KeysBackupService {
* @param recoveryKey the recovery key to challenge with the key backup public key.
* @param callback block called when the operations completes.
*/
fun trustKeysBackupVersionWithRecoveryKey(keysBackupVersion: KeysVersionResult,
recoveryKey: String,
callback: MatrixCallback<Unit>)
fun trustKeysBackupVersionWithRecoveryKey(
keysBackupVersion: KeysVersionResult,
recoveryKey: String,
callback: MatrixCallback<Unit>
)
/**
* Set trust on a keys backup version.
@@ -164,9 +180,11 @@ interface KeysBackupService {
* @param password the pass phrase to challenge with the keyBackupVersion public key.
* @param callback block called when the operations completes.
*/
fun trustKeysBackupVersionWithPassphrase(keysBackupVersion: KeysVersionResult,
password: String,
callback: MatrixCallback<Unit>)
fun trustKeysBackupVersionWithPassphrase(
keysBackupVersion: KeysVersionResult,
password: String,
callback: MatrixCallback<Unit>
)
/**
* Restore a backup with a recovery key from a given backup version stored on the homeserver.
@@ -178,11 +196,14 @@ interface KeysBackupService {
* @param stepProgressListener the step progress listener
* @param callback Callback. It provides the number of found keys and the number of successfully imported keys.
*/
fun restoreKeysWithRecoveryKey(keysVersionResult: KeysVersionResult,
recoveryKey: String, roomId: String?,
sessionId: String?,
stepProgressListener: StepProgressListener?,
callback: MatrixCallback<ImportRoomKeysResult>)
fun restoreKeysWithRecoveryKey(
keysVersionResult: KeysVersionResult,
recoveryKey: String,
roomId: String?,
sessionId: String?,
stepProgressListener: StepProgressListener?,
callback: MatrixCallback<ImportRoomKeysResult>
)
/**
* Restore a backup with a password from a given backup version stored on the homeserver.
@@ -194,12 +215,14 @@ interface KeysBackupService {
* @param stepProgressListener the step progress listener
* @param callback Callback. It provides the number of found keys and the number of successfully imported keys.
*/
fun restoreKeyBackupWithPassword(keysBackupVersion: KeysVersionResult,
password: String,
roomId: String?,
sessionId: String?,
stepProgressListener: StepProgressListener?,
callback: MatrixCallback<ImportRoomKeysResult>)
fun restoreKeyBackupWithPassword(
keysBackupVersion: KeysVersionResult,
password: String,
roomId: String?,
sessionId: String?,
stepProgressListener: StepProgressListener?,
callback: MatrixCallback<ImportRoomKeysResult>
)
val keysBackupVersion: KeysVersionResult?
@@ -216,8 +239,10 @@ interface KeysBackupService {
fun isValidRecoveryKeyForCurrentVersion(recoveryKey: String, callback: MatrixCallback<Boolean>)
fun computePrivateKey(passphrase: String,
privateKeySalt: String,
privateKeyIterations: Int,
progressListener: ProgressListener): ByteArray
fun computePrivateKey(
passphrase: String,
privateKeySalt: String,
privateKeyIterations: Int,
progressListener: ProgressListener
): ByteArray
}

View File

@@ -40,7 +40,8 @@ sealed class KeysBackupVersionTrustSignature {
/**
* Flag to indicate the signature from this device is valid.
*/
val valid: Boolean) : KeysBackupVersionTrustSignature()
val valid: Boolean
) : KeysBackupVersionTrustSignature()
data class UserSignature(
val keyId: String?,

View File

@@ -19,7 +19,8 @@ package org.matrix.android.sdk.api.session.crypto.verification
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
data class EmojiRepresentation(val emoji: String,
@StringRes val nameResId: Int,
@DrawableRes val drawableRes: Int? = null
data class EmojiRepresentation(
val emoji: String,
@StringRes val nameResId: Int,
@DrawableRes val drawableRes: Int? = null
)

View File

@@ -46,54 +46,68 @@ interface VerificationService {
fun getExistingVerificationRequestInRoom(roomId: String, tid: String?): PendingVerificationRequest?
fun beginKeyVerification(method: VerificationMethod,
otherUserId: String,
otherDeviceId: String,
transactionId: String?): String?
fun beginKeyVerification(
method: VerificationMethod,
otherUserId: String,
otherDeviceId: String,
transactionId: String?
): String?
/**
* Request key verification with another user via room events (instead of the to-device API).
*/
fun requestKeyVerificationInDMs(methods: List<VerificationMethod>,
otherUserId: String,
roomId: String,
localId: String? = LocalEcho.createLocalEchoId()): PendingVerificationRequest
fun requestKeyVerificationInDMs(
methods: List<VerificationMethod>,
otherUserId: String,
roomId: String,
localId: String? = LocalEcho.createLocalEchoId()
): PendingVerificationRequest
fun cancelVerificationRequest(request: PendingVerificationRequest)
/**
* Request a key verification from another user using toDevice events.
*/
fun requestKeyVerification(methods: List<VerificationMethod>,
otherUserId: String,
otherDevices: List<String>?): PendingVerificationRequest
fun requestKeyVerification(
methods: List<VerificationMethod>,
otherUserId: String,
otherDevices: List<String>?
): PendingVerificationRequest
fun declineVerificationRequestInDMs(otherUserId: String,
transactionId: String,
roomId: String)
fun declineVerificationRequestInDMs(
otherUserId: String,
transactionId: String,
roomId: String
)
// Only SAS method is supported for the moment
// TODO Parameter otherDeviceId should be removed in this case
fun beginKeyVerificationInDMs(method: VerificationMethod,
transactionId: String,
roomId: String,
otherUserId: String,
otherDeviceId: String): String
fun beginKeyVerificationInDMs(
method: VerificationMethod,
transactionId: String,
roomId: String,
otherUserId: String,
otherDeviceId: String
): String
/**
* Returns false if the request is unknown.
*/
fun readyPendingVerificationInDMs(methods: List<VerificationMethod>,
otherUserId: String,
roomId: String,
transactionId: String): Boolean
fun readyPendingVerificationInDMs(
methods: List<VerificationMethod>,
otherUserId: String,
roomId: String,
transactionId: String
): Boolean
/**
* Returns false if the request is unknown.
*/
fun readyPendingVerification(methods: List<VerificationMethod>,
otherUserId: String,
transactionId: String): Boolean
fun readyPendingVerification(
methods: List<VerificationMethod>,
otherUserId: String,
transactionId: String
): Boolean
interface Listener {
/**

View File

@@ -24,6 +24,8 @@ interface EventService {
* Ask the homeserver for an event content. The SDK will try to decrypt it if it is possible
* The result will not be stored into cache
*/
suspend fun getEvent(roomId: String,
eventId: String): Event
suspend fun getEvent(
roomId: String,
eventId: String
): Event
}

View File

@@ -44,10 +44,12 @@ interface FileService {
* Download a file if necessary and ensure that if the file is encrypted, the file is decrypted.
* Result will be a decrypted file, stored in the cache folder. url parameter will be used to create unique filename to avoid name collision.
*/
suspend fun downloadFile(fileName: String,
mimeType: String?,
url: String?,
elementToDecrypt: ElementToDecrypt?): File
suspend fun downloadFile(
fileName: String,
mimeType: String?,
url: String?,
elementToDecrypt: ElementToDecrypt?
): File
suspend fun downloadFile(messageContent: MessageWithAttachmentContent): File =
downloadFile(
@@ -57,10 +59,11 @@ interface FileService {
elementToDecrypt = messageContent.encryptedFileInfo?.toElementToDecrypt()
)
fun isFileInCache(mxcUrl: String?,
fileName: String,
mimeType: String?,
elementToDecrypt: ElementToDecrypt?
fun isFileInCache(
mxcUrl: String?,
fileName: String,
mimeType: String?,
elementToDecrypt: ElementToDecrypt?
): Boolean
fun isFileInCache(messageContent: MessageWithAttachmentContent) =
@@ -75,10 +78,12 @@ interface FileService {
* Use this URI and pass it to intent using flag Intent.FLAG_GRANT_READ_URI_PERMISSION
* (if not other app won't be able to access it).
*/
fun getTemporarySharableURI(mxcUrl: String?,
fileName: String,
mimeType: String?,
elementToDecrypt: ElementToDecrypt?): Uri?
fun getTemporarySharableURI(
mxcUrl: String?,
fileName: String,
mimeType: String?,
elementToDecrypt: ElementToDecrypt?
): Uri?
fun getTemporarySharableURI(messageContent: MessageWithAttachmentContent): Uri? =
getTemporarySharableURI(
@@ -92,10 +97,12 @@ interface FileService {
* Get information on the given file.
* Mimetype should be the same one as passed to downloadFile (limitation for now)
*/
fun fileState(mxcUrl: String?,
fileName: String,
mimeType: String?,
elementToDecrypt: ElementToDecrypt?): FileState
fun fileState(
mxcUrl: String?,
fileName: String,
mimeType: String?,
elementToDecrypt: ElementToDecrypt?
): FileState
fun fileState(messageContent: MessageWithAttachmentContent): FileState =
fileState(

View File

@@ -1,50 +0,0 @@
/*
* Copyright 2020 The Matrix.org Foundation C.I.C.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.matrix.android.sdk.api.session.initsync
import androidx.lifecycle.LiveData
interface SyncStatusService {
fun getSyncStatusLive(): LiveData<Status>
sealed class Status {
/**
* For initial sync.
*/
abstract class InitialSyncStatus : Status()
object Idle : InitialSyncStatus()
data class InitialSyncProgressing(
val initSyncStep: InitSyncStep,
val percentProgress: Int = 0
) : InitialSyncStatus()
/**
* For incremental sync.
*/
abstract class IncrementalSyncStatus : Status()
object IncrementalSyncIdle : IncrementalSyncStatus()
data class IncrementalSyncParsing(
val rooms: Int,
val toDevice: Int
) : IncrementalSyncStatus()
object IncrementalSyncError : IncrementalSyncStatus()
object IncrementalSyncDone : IncrementalSyncStatus()
}
}

View File

@@ -25,8 +25,10 @@ import org.matrix.android.sdk.api.session.permalinks.MatrixPermalinkSpan.Callbac
* @property url the permalink url tied to the span
* @property callback the callback to use.
*/
class MatrixPermalinkSpan(private val url: String,
private val callback: Callback? = null) : ClickableSpan() {
class MatrixPermalinkSpan(
private val url: String,
private val callback: Callback? = null
) : ClickableSpan() {
interface Callback {
fun onUrlClicked(url: String)

View File

@@ -107,8 +107,10 @@ interface ProfileService {
/**
* Finalize adding a 3Pids. Call this method once the user has validated that he owns the ThreePid.
*/
suspend fun finalizeAddingThreePid(threePid: ThreePid,
userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor)
suspend fun finalizeAddingThreePid(
threePid: ThreePid,
userInteractiveAuthInterceptor: UserInteractiveAuthInterceptor
)
/**
* Cancel adding a threepid. It will remove locally stored data about this ThreePid.

View File

@@ -58,12 +58,14 @@ interface PushersService {
* email pushers since we don't want to stop other accounts notifying to the same email address.
* @throws [InvalidParameterException] if a parameter is not correct
*/
suspend fun addEmailPusher(email: String,
lang: String,
emailBranding: String,
appDisplayName: String,
deviceDisplayName: String,
append: Boolean = true)
suspend fun addEmailPusher(
email: String,
lang: String,
emailBranding: String,
appDisplayName: String,
deviceDisplayName: String,
append: Boolean = true
)
/**
* Directly ask the push gateway to send a push to this device.
@@ -75,10 +77,12 @@ interface PushersService {
* @param pushkey the FCM token
* @param eventId the eventId which will be sent in the Push message. Use a fake eventId.
*/
suspend fun testPush(url: String,
appId: String,
pushkey: String,
eventId: String)
suspend fun testPush(
url: String,
appId: String,
pushkey: String,
eventId: String
)
/**
* Remove a registered pusher.

View File

@@ -22,15 +22,23 @@ import org.matrix.android.sdk.api.session.events.model.Event
* This class as all required context needed to evaluate rules
*/
interface ConditionResolver {
fun resolveEventMatchCondition(event: Event,
condition: EventMatchCondition): Boolean
fun resolveEventMatchCondition(
event: Event,
condition: EventMatchCondition
): Boolean
fun resolveRoomMemberCountCondition(event: Event,
condition: RoomMemberCountCondition): Boolean
fun resolveRoomMemberCountCondition(
event: Event,
condition: RoomMemberCountCondition
): Boolean
fun resolveSenderNotificationPermissionCondition(event: Event,
condition: SenderNotificationPermissionCondition): Boolean
fun resolveSenderNotificationPermissionCondition(
event: Event,
condition: SenderNotificationPermissionCondition
): Boolean
fun resolveContainsDisplayNameCondition(event: Event,
condition: ContainsDisplayNameCondition): Boolean
fun resolveContainsDisplayNameCondition(
event: Event,
condition: ContainsDisplayNameCondition
): Boolean
}

View File

@@ -51,8 +51,10 @@ interface PushRuleService {
// fun fulfilledBingRule(event: Event, rules: List<PushRule>): PushRule?
fun resolveSenderNotificationPermissionCondition(event: Event,
condition: SenderNotificationPermissionCondition): Boolean
fun resolveSenderNotificationPermissionCondition(
event: Event,
condition: SenderNotificationPermissionCondition
): Boolean
interface PushRuleListener {
fun onEvents(pushEvents: PushEvents)

View File

@@ -28,8 +28,10 @@ interface RoomDirectoryService {
/**
* Get rooms from directory.
*/
suspend fun getPublicRooms(server: String?,
publicRoomsParams: PublicRoomsParams): PublicRoomsResponse
suspend fun getPublicRooms(
server: String?,
publicRoomsParams: PublicRoomsParams
): PublicRoomsResponse
/**
* Get the visibility of a room in the directory.

View File

@@ -60,9 +60,11 @@ interface RoomService {
* @param reason optional reason for joining the room
* @param viaServers the servers to attempt to join the room through. One of the servers must be participating in the room.
*/
suspend fun joinRoom(roomIdOrAlias: String,
reason: String? = null,
viaServers: List<String> = emptyList())
suspend fun joinRoom(
roomIdOrAlias: String,
reason: String? = null,
viaServers: List<String> = emptyList()
)
/**
* @param roomId the roomId of the room to join
@@ -107,15 +109,19 @@ interface RoomService {
* Get a snapshot list of room summaries.
* @return the immutable list of [RoomSummary]
*/
fun getRoomSummaries(queryParams: RoomSummaryQueryParams,
sortOrder: RoomSortOrder = RoomSortOrder.NONE): List<RoomSummary>
fun getRoomSummaries(
queryParams: RoomSummaryQueryParams,
sortOrder: RoomSortOrder = RoomSortOrder.NONE
): List<RoomSummary>
/**
* Get a live list of room summaries. This list is refreshed as soon as the data changes.
* @return the [LiveData] of List[RoomSummary]
*/
fun getRoomSummariesLive(queryParams: RoomSummaryQueryParams,
sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY): LiveData<List<RoomSummary>>
fun getRoomSummariesLive(
queryParams: RoomSummaryQueryParams,
sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY
): LiveData<List<RoomSummary>>
/**
* Get a snapshot list of Breadcrumbs.
@@ -145,8 +151,10 @@ interface RoomService {
/**
* Resolve a room alias to a room ID.
*/
suspend fun getRoomIdByAlias(roomAlias: String,
searchOnServer: Boolean): Optional<RoomAliasDescription>
suspend fun getRoomIdByAlias(
roomAlias: String,
searchOnServer: Boolean
): Optional<RoomAliasDescription>
/**
* Delete a room alias.
@@ -211,16 +219,27 @@ interface RoomService {
/**
* TODO Doc.
*/
fun getPagedRoomSummariesLive(queryParams: RoomSummaryQueryParams,
pagedListConfig: PagedList.Config = defaultPagedListConfig,
sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY): LiveData<PagedList<RoomSummary>>
fun getPagedRoomSummariesLive(
queryParams: RoomSummaryQueryParams,
pagedListConfig: PagedList.Config = defaultPagedListConfig,
sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY
): LiveData<PagedList<RoomSummary>>
/**
* TODO Doc.
* Get's a live paged list from a filter that can be dynamically updated.
*
* @param queryParams The filter to use
* @param pagedListConfig The paged list configuration (page size, initial load, prefetch distance...)
* @param sortOrder defines how to sort the results
* @param getFlattenParents When true, the list of known parents and grand parents summaries will be resolved.
* This can have significant impact on performance, better be used only on manageable list (filtered by displayName, ..).
*/
fun getFilteredPagedRoomSummariesLive(queryParams: RoomSummaryQueryParams,
pagedListConfig: PagedList.Config = defaultPagedListConfig,
sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY): UpdatableLivePageResult
fun getFilteredPagedRoomSummariesLive(
queryParams: RoomSummaryQueryParams,
pagedListConfig: PagedList.Config = defaultPagedListConfig,
sortOrder: RoomSortOrder = RoomSortOrder.ACTIVITY,
getFlattenParents: Boolean = false,
): UpdatableLivePageResult
/**
* Return a LiveData on the number of rooms.
@@ -246,8 +265,10 @@ interface RoomService {
/**
* Returns all the children of this space, as LiveData.
*/
fun getFlattenRoomSummaryChildrenOfLive(spaceId: String?,
memberships: List<Membership> = Membership.activeMemberships()): LiveData<List<RoomSummary>>
fun getFlattenRoomSummaryChildrenOfLive(
spaceId: String?,
memberships: List<Membership> = Membership.activeMemberships()
): LiveData<List<RoomSummary>>
/**
* Refreshes the RoomSummary LatestPreviewContent for the given @param roomId.

View File

@@ -40,12 +40,14 @@ internal data class MessageVerificationAcceptContent(
companion object : VerificationInfoAcceptFactory {
override fun create(tid: String,
keyAgreementProtocol: String,
hash: String,
commitment: String,
messageAuthenticationCode: String,
shortAuthenticationStrings: List<String>): VerificationInfoAccept {
override fun create(
tid: String,
keyAgreementProtocol: String,
hash: String,
commitment: String,
messageAuthenticationCode: String,
shortAuthenticationStrings: List<String>
): VerificationInfoAccept {
return MessageVerificationAcceptContent(
hash,
keyAgreementProtocol,

View File

@@ -58,16 +58,20 @@ interface RelationService {
* @param targetEventId the id of the event being reacted
* @param reaction the reaction (preferably emoji)
*/
fun sendReaction(targetEventId: String,
reaction: String): Cancelable
fun sendReaction(
targetEventId: String,
reaction: String
): Cancelable
/**
* Undo a reaction (emoji) to the targetedEvent.
* @param targetEventId the id of the event being reacted
* @param reaction the reaction (preferably emoji)
*/
suspend fun undoReaction(targetEventId: String,
reaction: String): Cancelable
suspend fun undoReaction(
targetEventId: String,
reaction: String
): Cancelable
/**
* Edit a poll.
@@ -76,10 +80,12 @@ interface RelationService {
* @param question The edited question
* @param options The edited options
*/
fun editPoll(targetEvent: TimelineEvent,
pollType: PollType,
question: String,
options: List<String>): Cancelable
fun editPoll(
targetEvent: TimelineEvent,
pollType: PollType,
question: String,
options: List<String>
): Cancelable
/**
* Edit a text message body. Limited to "m.text" contentType.
@@ -89,11 +95,13 @@ interface RelationService {
* @param newBodyAutoMarkdown true to parse markdown on the new body
* @param compatibilityBodyText The text that will appear on clients that don't support yet edition
*/
fun editTextMessage(targetEvent: TimelineEvent,
msgType: String,
newBodyText: CharSequence,
newBodyAutoMarkdown: Boolean,
compatibilityBodyText: String = "* $newBodyText"): Cancelable
fun editTextMessage(
targetEvent: TimelineEvent,
msgType: String,
newBodyText: CharSequence,
newBodyAutoMarkdown: Boolean,
compatibilityBodyText: String = "* $newBodyText"
): Cancelable
/**
* Edit a reply. This is a special case because replies contains fallback text as a prefix.
@@ -103,10 +111,12 @@ interface RelationService {
* @param newBodyText The edited body (stripped from in reply to content)
* @param compatibilityBodyText The text that will appear on clients that don't support yet edition
*/
fun editReply(replyToEdit: TimelineEvent,
originalTimelineEvent: TimelineEvent,
newBodyText: String,
compatibilityBodyText: String = "* $newBodyText"): Cancelable
fun editReply(
replyToEdit: TimelineEvent,
originalTimelineEvent: TimelineEvent,
newBodyText: String,
compatibilityBodyText: String = "* $newBodyText"
): Cancelable
/**
* Get the edit history of the given event.
@@ -127,11 +137,12 @@ interface RelationService {
* @param showInThread If true, relation will be added to the reply in order to be visible from within threads
* @param rootThreadEventId If show in thread is true then we need the rootThreadEventId to generate the relation
*/
fun replyToMessage(eventReplied: TimelineEvent,
replyText: CharSequence,
autoMarkdown: Boolean = false,
showInThread: Boolean = false,
rootThreadEventId: String? = null
fun replyToMessage(
eventReplied: TimelineEvent,
replyText: CharSequence,
autoMarkdown: Boolean = false,
showInThread: Boolean = false,
rootThreadEventId: String? = null
): Cancelable?
/**
@@ -159,10 +170,12 @@ interface RelationService {
* @param formattedText The formatted body using MessageType#FORMAT_MATRIX_HTML
* @param eventReplied the event referenced by the reply within a thread
*/
fun replyInThread(rootThreadEventId: String,
replyInThreadText: CharSequence,
msgType: String = MessageType.MSGTYPE_TEXT,
autoMarkdown: Boolean = false,
formattedText: String? = null,
eventReplied: TimelineEvent? = null): Cancelable?
fun replyInThread(
rootThreadEventId: String,
replyInThreadText: CharSequence,
msgType: String = MessageType.MSGTYPE_TEXT,
autoMarkdown: Boolean = false,
formattedText: String? = null,
eventReplied: TimelineEvent? = null
): Cancelable?
}

View File

@@ -76,10 +76,12 @@ interface SendService {
* @param rootThreadEventId when this param is not null, the Media will be sent in this specific thread
* @return a [Cancelable]
*/
fun sendMedia(attachment: ContentAttachmentData,
compressBeforeSending: Boolean,
roomIds: Set<String>,
rootThreadEventId: String? = null): Cancelable
fun sendMedia(
attachment: ContentAttachmentData,
compressBeforeSending: Boolean,
roomIds: Set<String>,
rootThreadEventId: String? = null
): Cancelable
/**
* Method to send a list of media asynchronously.
@@ -90,10 +92,12 @@ interface SendService {
* @param rootThreadEventId when this param is not null, all the Media will be sent in this specific thread
* @return a [Cancelable]
*/
fun sendMedias(attachments: List<ContentAttachmentData>,
compressBeforeSending: Boolean,
roomIds: Set<String>,
rootThreadEventId: String? = null): Cancelable
fun sendMedias(
attachments: List<ContentAttachmentData>,
compressBeforeSending: Boolean,
roomIds: Set<String>,
rootThreadEventId: String? = null
): Cancelable
/**
* Send a poll to the room.

View File

@@ -16,5 +16,7 @@
package org.matrix.android.sdk.api.session.room.threads.model
data class ThreadEditions(var rootThreadEdition: String? = null,
var latestThreadEdition: String? = null)
data class ThreadEditions(
var rootThreadEdition: String? = null,
var latestThreadEdition: String? = null
)

View File

@@ -22,12 +22,14 @@ import org.matrix.android.sdk.api.session.room.sender.SenderInfo
/**
* The main thread Summary model, mainly used to display the thread list.
*/
data class ThreadSummary(val roomId: String,
val rootEvent: Event?,
val latestEvent: Event?,
val rootEventId: String,
val rootThreadSenderInfo: SenderInfo,
val latestThreadSenderInfo: SenderInfo,
val isUserParticipating: Boolean,
val numberOfThreads: Int,
val threadEditions: ThreadEditions = ThreadEditions())
data class ThreadSummary(
val roomId: String,
val rootEvent: Event?,
val latestEvent: Event?,
val rootEventId: String,
val rootThreadSenderInfo: SenderInfo,
val latestThreadSenderInfo: SenderInfo,
val isUserParticipating: Boolean,
val numberOfThreads: Int,
val threadEditions: ThreadEditions = ThreadEditions()
)

View File

@@ -33,12 +33,14 @@ interface SearchService {
* @param afterLimit how many events after the result are returned.
* @param includeProfile requests that the server returns the historic profile information for the users that sent the events that were returned.
*/
suspend fun search(searchTerm: String,
roomId: String,
nextBatch: String?,
orderByRecent: Boolean,
limit: Int,
beforeLimit: Int,
afterLimit: Int,
includeProfile: Boolean): SearchResult
suspend fun search(
searchTerm: String,
roomId: String,
nextBatch: String?,
orderByRecent: Boolean,
limit: Int,
beforeLimit: Int,
afterLimit: Int,
includeProfile: Boolean
): SearchResult
}

View File

@@ -44,10 +44,12 @@ interface SharedSecretStorageService {
*
* @return key creation info
*/
suspend fun generateKey(keyId: String,
key: SsssKeySpec?,
keyName: String,
keySigner: KeySigner?): SsssKeyCreationInfo
suspend fun generateKey(
keyId: String,
key: SsssKeySpec?,
keyName: String,
keySigner: KeySigner?
): SsssKeyCreationInfo
/**
* Generates a SSSS key using the given passphrase.
@@ -61,11 +63,13 @@ interface SharedSecretStorageService {
*
* @return key creation info
*/
suspend fun generateKeyWithPassphrase(keyId: String,
keyName: String,
passphrase: String,
keySigner: KeySigner,
progressListener: ProgressListener?): SsssKeyCreationInfo
suspend fun generateKeyWithPassphrase(
keyId: String,
keyName: String,
passphrase: String,
keySigner: KeySigner,
progressListener: ProgressListener?
): SsssKeyCreationInfo
fun getKey(keyId: String): KeyInfoResult

View File

@@ -31,11 +31,13 @@ interface Space {
*/
fun spaceSummary(): RoomSummary?
suspend fun addChildren(roomId: String,
viaServers: List<String>?,
order: String?,
suspend fun addChildren(
roomId: String,
viaServers: List<String>?,
order: String?,
// autoJoin: Boolean = false,
suggested: Boolean? = false)
suggested: Boolean? = false
)
fun getChildInfo(roomId: String): SpaceChildContent?

View File

@@ -37,11 +37,13 @@ interface SpaceService {
/**
* Just a shortcut for space creation for ease of use.
*/
suspend fun createSpace(name: String,
topic: String?,
avatarUri: Uri?,
isPublic: Boolean,
roomAliasLocalPart: String? = null): String
suspend fun createSpace(
name: String,
topic: String?,
avatarUri: Uri?,
isPublic: Boolean,
roomAliasLocalPart: String? = null
): String
/**
* Get a space from a spaceId.
@@ -68,25 +70,33 @@ interface SpaceService {
* then the parameters given for suggested_only and max_depth must be the same.
* @param knownStateList when paginating, pass back the m.space.child state events
*/
suspend fun querySpaceChildren(spaceId: String,
suggestedOnly: Boolean? = null,
limit: Int? = null,
from: String? = null,
knownStateList: List<Event>? = null): SpaceHierarchyData
suspend fun querySpaceChildren(
spaceId: String,
suggestedOnly: Boolean? = null,
limit: Int? = null,
from: String? = null,
knownStateList: List<Event>? = null
): SpaceHierarchyData
/**
* Get a live list of space summaries. This list is refreshed as soon as the data changes.
* @return the [LiveData] of List[SpaceSummary]
*/
fun getSpaceSummariesLive(queryParams: SpaceSummaryQueryParams,
sortOrder: RoomSortOrder = RoomSortOrder.NONE): LiveData<List<RoomSummary>>
fun getSpaceSummariesLive(
queryParams: SpaceSummaryQueryParams,
sortOrder: RoomSortOrder = RoomSortOrder.NONE
): LiveData<List<RoomSummary>>
fun getSpaceSummaries(spaceSummaryQueryParams: SpaceSummaryQueryParams,
sortOrder: RoomSortOrder = RoomSortOrder.NONE): List<RoomSummary>
fun getSpaceSummaries(
spaceSummaryQueryParams: SpaceSummaryQueryParams,
sortOrder: RoomSortOrder = RoomSortOrder.NONE
): List<RoomSummary>
suspend fun joinSpace(spaceIdOrAlias: String,
reason: String? = null,
viaServers: List<String> = emptyList()): JoinSpaceResult
suspend fun joinSpace(
spaceIdOrAlias: String,
reason: String? = null,
viaServers: List<String> = emptyList()
): JoinSpaceResult
suspend fun rejectInvite(spaceId: String, reason: String?)

View File

@@ -23,15 +23,19 @@ sealed interface StatisticEvent {
/**
* Initial sync request, response downloading, and treatment (parsing and storage) of response.
*/
data class InitialSyncRequest(val requestDurationMs: Int,
val downloadDurationMs: Int,
val treatmentDurationMs: Int,
val nbOfJoinedRooms: Int) : StatisticEvent
data class InitialSyncRequest(
val requestDurationMs: Int,
val downloadDurationMs: Int,
val treatmentDurationMs: Int,
val nbOfJoinedRooms: Int
) : StatisticEvent
/**
* Incremental sync event.
*/
data class SyncTreatment(val durationMs: Int,
val afterPause: Boolean,
val nbOfJoinedRooms: Int) : StatisticEvent
data class SyncTreatment(
val durationMs: Int,
val afterPause: Boolean,
val nbOfJoinedRooms: Int
) : StatisticEvent
}

View File

@@ -14,9 +14,9 @@
* limitations under the License.
*/
package org.matrix.android.sdk.api.session.initsync
package org.matrix.android.sdk.api.session.sync
enum class InitSyncStep {
enum class InitialSyncStep {
ServerComputing,
Downloading,
ImportingAccount,

View File

@@ -0,0 +1,44 @@
/*
* Copyright (c) 2022 The Matrix.org Foundation C.I.C.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.matrix.android.sdk.api.session.sync
sealed interface SyncRequestState {
/**
* For initial sync.
*/
interface InitialSyncRequestState : SyncRequestState
object Idle : InitialSyncRequestState
data class InitialSyncProgressing(
val initialSyncStep: InitialSyncStep,
val percentProgress: Int = 0
) : InitialSyncRequestState
/**
* For incremental sync.
*/
interface IncrementalSyncRequestState : SyncRequestState
object IncrementalSyncIdle : IncrementalSyncRequestState
data class IncrementalSyncParsing(
val rooms: Int,
val toDevice: Int
) : IncrementalSyncRequestState
object IncrementalSyncError : IncrementalSyncRequestState
object IncrementalSyncDone : IncrementalSyncRequestState
}

View File

@@ -0,0 +1,76 @@
/*
* Copyright 2022 The Matrix.org Foundation C.I.C.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.matrix.android.sdk.api.session.sync
import androidx.lifecycle.LiveData
import kotlinx.coroutines.flow.SharedFlow
import org.matrix.android.sdk.api.session.sync.model.SyncResponse
interface SyncService {
/**
* This method start the sync thread.
*/
fun startSync(fromForeground: Boolean)
/**
* This method stop the sync thread.
*/
fun stopSync()
/**
* Requires a one time background sync.
*/
fun requireBackgroundSync()
/**
* Launches infinite self rescheduling background syncs via the WorkManager.
*
* While dozing, syncs will only occur during maintenance windows.
* For reliability it's recommended to also start a long running foreground service
* along with disabling battery optimizations.
*/
fun startAutomaticBackgroundSync(timeOutInSeconds: Long, repeatDelayInSeconds: Long)
fun stopAnyBackgroundSync()
/**
* This method returns the current sync state.
* @return the current [SyncState].
*/
fun getSyncState(): SyncState
/**
* This method allows to listen the sync state.
* @return a [LiveData] of [SyncState].
*/
fun getSyncStateLive(): LiveData<SyncState>
/**
* Get the [SyncRequestState] as a LiveData.
*/
fun getSyncRequestStateLive(): LiveData<SyncRequestState>
/**
* This method returns a flow of SyncResponse. New value will be pushed through the sync thread.
*/
fun syncFlow(): SharedFlow<SyncResponse>
/**
* This methods return true if an initial sync has been processed.
*/
fun hasAlreadySynced(): Boolean
}

Some files were not shown because too many files have changed in this diff Show More