Skip to content

Commit 780f1ff

Browse files
Merge branch 'develop' into feature/aris/fix_account_deactivation_issue
# Conflicts: # vector/src/main/java/im/vector/app/features/settings/account/deactivation/DeactivateAccountViewModel.kt
2 parents ba99d5c + f5973fa commit 780f1ff

File tree

182 files changed

+729
-480
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+729
-480
lines changed

.github/workflows/triage-labelled.yml

+27
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,30 @@ jobs:
251251
env:
252252
PROJECT_ID: "PN_kwDOAM0swc4AArk0"
253253
GITHUB_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
254+
255+
move_element_x_issues:
256+
name: ElementX issues to ElementX project board
257+
runs-on: ubuntu-latest
258+
# Skip in forks
259+
if: >
260+
github.repository == 'vector-im/element-android' &&
261+
(contains(github.event.issue.labels.*.name, 'Z-ElementX-Alpha') ||
262+
contains(github.event.issue.labels.*.name, 'Z-ElementX-Beta') ||
263+
contains(github.event.issue.labels.*.name, 'Z-ElementX'))
264+
steps:
265+
- uses: octokit/[email protected]
266+
with:
267+
headers: '{"GraphQL-Features": "projects_next_graphql"}'
268+
query: |
269+
mutation add_to_project($projectid:ID!,$contentid:ID!) {
270+
addProjectNextItem(input:{projectId:$projectid contentId:$contentid}) {
271+
projectNextItem {
272+
id
273+
}
274+
}
275+
}
276+
projectid: ${{ env.PROJECT_ID }}
277+
contentid: ${{ github.event.issue.node_id }}
278+
env:
279+
PROJECT_ID: "PN_kwDOAM0swc4ABTXY"
280+
GITHUB_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}

.github/workflows/update-gradle-wrapper.yml

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313

1414
- name: Update Gradle Wrapper
1515
uses: gradle-update/update-gradle-wrapper-action@v1
16+
# Skip in forks
17+
if: github.repository == 'vector-im/element-android'
1618
with:
1719
repo-token: ${{ secrets.GITHUB_TOKEN }}
1820
target-branch: develop

CHANGES.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
Changes in Element 1.4.13 (2022-04-26)
2+
======================================
3+
4+
Bugfixes 🐛
5+
----------
6+
- Fix UI freeze observed after each incremental sync ([#5835](https://github.com./vector-im/element-android/issues/5835))
7+
8+
19
Changes in Element v1.4.12 (2022-04-20)
210
=======================================
311

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ buildscript {
2121
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3'
2222
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.5'
2323
classpath "com.likethesalad.android:stem-plugin:2.0.0"
24-
classpath 'org.owasp:dependency-check-gradle:7.0.4.1'
25-
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.6.20"
24+
classpath 'org.owasp:dependency-check-gradle:7.1.0.1'
25+
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.6.21"
2626
// NOTE: Do not place your application dependencies here; they belong
2727
// in the individual module build.gradle files
2828
}

changelog.d/5816.sdk

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Some `Session` apis are now available by requesting the service first. For instance `Session.updateAvatar(...)` is now `Session.profileService().updateAvatar(...)`
2+
The shortcut `Room.search()` has been removed, you have to use `Session.searchService().search()`

changelog.d/5832.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add a GH workflow to push ElementX issues to the global board.

changelog.d/5836.doc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update the PR process doc with 2 reviewers and a new reviewer team.

changelog.d/5847.bugfix

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixes missing call icons when threads are enabled

docs/pull_request.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,15 @@ Also, draft PR should not stay indefinitely in this state. It may be removed if
3232

3333
##### PR Review Assignment
3434

35-
We use automatic assignment for PR reviews. A PR is automatically routed by GitHub to a team member using the round robin algorithm. The process is the following:
35+
We use automatic assignment for PR reviews. A PR is automatically routed by GitHub to 2 team members using the round robin algorithm. The process is the following:
3636

37-
- The PR creator assigns the [element-android](https://github.com./orgs/vector-im/teams/element-android) team as a reviewer. They can skip this process and assign directly a specific member if they think they should take a look at it.
38-
- GitHub automatically assigns one reviewer. If the chosen reviewer is not available (holiday, etc.), remove them and set again the team, GitHub will select another reviewer.
39-
- The reviewer gets a notification to make the review: they review the code following the good practice (see the rest of this document).
37+
- The PR creator can assign specific people if they have another Android developer in their team or they think a specific reviewer should take a look at the PR.
38+
- If there are missing reviewers, the PR creator assigns the [element-android-reviewers](https://github.com./orgs/vector-im/teams/element-android-reviewers) team as a reviewer.
39+
- GitHub automatically assigns other reviewers. If one of the chosen reviewers is not available (holiday, etc.), remove them and set again the team, GitHub will select another reviewer.
40+
- Reviewers get a notification to make the review: they review the code following the good practice (see the rest of this document).
4041
- After making their own review, if they feel not confident enough, they can ask another person for a full review, or they can tag someone within a PR comment to check specific lines.
4142

42-
For PRs coming from the community, the issue wrangler can assign either the team [element-android](https://github.com./orgs/vector-im/teams/element-android) or any member directly.
43+
For PRs coming from the community, the issue wrangler can assign either the team [element-android-reviewers](https://github.com./orgs/vector-im/teams/element-android-reviewers) or any members directly.
4344

4445
##### PR review time
4546

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Main changes in this version: Allows users to appear offline and adds an audio player for audio attachments
2+
Full changelog: https://github.com./vector-im/element-android/releases

matrix-sdk-android-flow/src/main/java/org/matrix/android/sdk/flow/FlowSession.kt

+23-19
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ import org.matrix.android.sdk.api.util.toOptional
4646
class FlowSession(private val session: Session) {
4747

4848
fun liveRoomSummaries(queryParams: RoomSummaryQueryParams, sortOrder: RoomSortOrder = RoomSortOrder.NONE): Flow<List<RoomSummary>> {
49-
return session.getRoomSummariesLive(queryParams, sortOrder).asFlow()
49+
return session.roomService().getRoomSummariesLive(queryParams, sortOrder).asFlow()
5050
.startWith(session.coroutineDispatchers.io) {
51-
session.getRoomSummaries(queryParams, sortOrder)
51+
session.roomService().getRoomSummaries(queryParams, sortOrder)
5252
}
5353
}
5454

5555
fun liveGroupSummaries(queryParams: GroupSummaryQueryParams): Flow<List<GroupSummary>> {
56-
return session.getGroupSummariesLive(queryParams).asFlow()
56+
return session.groupService().getGroupSummariesLive(queryParams).asFlow()
5757
.startWith(session.coroutineDispatchers.io) {
58-
session.getGroupSummaries(queryParams)
58+
session.groupService().getGroupSummaries(queryParams)
5959
}
6060
}
6161

@@ -67,9 +67,9 @@ class FlowSession(private val session: Session) {
6767
}
6868

6969
fun liveBreadcrumbs(queryParams: RoomSummaryQueryParams): Flow<List<RoomSummary>> {
70-
return session.getBreadcrumbsLive(queryParams).asFlow()
70+
return session.roomService().getBreadcrumbsLive(queryParams).asFlow()
7171
.startWith(session.coroutineDispatchers.io) {
72-
session.getBreadcrumbs(queryParams)
72+
session.roomService().getBreadcrumbs(queryParams)
7373
}
7474
}
7575

@@ -85,43 +85,47 @@ class FlowSession(private val session: Session) {
8585
}
8686

8787
fun livePushers(): Flow<List<Pusher>> {
88-
return session.getPushersLive().asFlow()
88+
return session.pushersService().getPushersLive().asFlow()
8989
}
9090

9191
fun liveUser(userId: String): Flow<Optional<User>> {
92-
return session.getUserLive(userId).asFlow()
92+
return session.userService().getUserLive(userId).asFlow()
9393
.startWith(session.coroutineDispatchers.io) {
94-
session.getUser(userId).toOptional()
94+
session.userService().getUser(userId).toOptional()
9595
}
9696
}
9797

9898
fun liveRoomMember(userId: String, roomId: String): Flow<Optional<RoomMemberSummary>> {
99-
return session.getRoomMemberLive(userId, roomId).asFlow()
99+
return session.roomService().getRoomMemberLive(userId, roomId).asFlow()
100100
.startWith(session.coroutineDispatchers.io) {
101-
session.getRoomMember(userId, roomId).toOptional()
101+
session.roomService().getRoomMember(userId, roomId).toOptional()
102102
}
103103
}
104104

105105
fun liveUsers(): Flow<List<User>> {
106-
return session.getUsersLive().asFlow()
106+
return session.userService().getUsersLive().asFlow()
107107
}
108108

109109
fun liveIgnoredUsers(): Flow<List<User>> {
110-
return session.getIgnoredUsersLive().asFlow()
110+
return session.userService().getIgnoredUsersLive().asFlow()
111111
}
112112

113113
fun livePagedUsers(filter: String? = null, excludedUserIds: Set<String>? = null): Flow<PagedList<User>> {
114-
return session.getPagedUsersLive(filter, excludedUserIds).asFlow()
114+
return session.userService().getPagedUsersLive(filter, excludedUserIds).asFlow()
115115
}
116116

117117
fun liveThreePIds(refreshData: Boolean): Flow<List<ThreePid>> {
118-
return session.getThreePidsLive(refreshData).asFlow()
119-
.startWith(session.coroutineDispatchers.io) { session.getThreePids() }
118+
return session.profileService().getThreePidsLive(refreshData).asFlow()
119+
.startWith(session.coroutineDispatchers.io) {
120+
session.profileService().getThreePids()
121+
}
120122
}
121123

122124
fun livePendingThreePIds(): Flow<List<ThreePid>> {
123-
return session.getPendingThreePidsLive().asFlow()
124-
.startWith(session.coroutineDispatchers.io) { session.getPendingThreePids() }
125+
return session.profileService().getPendingThreePidsLive().asFlow()
126+
.startWith(session.coroutineDispatchers.io) {
127+
session.profileService().getPendingThreePids()
128+
}
125129
}
126130

127131
fun liveUserCryptoDevices(userId: String): Flow<List<CryptoDeviceInfo>> {
@@ -179,7 +183,7 @@ class FlowSession(private val session: Session) {
179183
}
180184

181185
fun liveRoomChangeMembershipState(): Flow<Map<String, ChangeMembershipState>> {
182-
return session.getChangeMembershipsLive().asFlow()
186+
return session.roomService().getChangeMembershipsLive().asFlow()
183187
}
184188
}
185189

matrix-sdk-android/build.gradle

+16
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@ buildscript {
1414
}
1515
}
1616

17+
dokkaHtml {
18+
dokkaSourceSets {
19+
configureEach {
20+
// Emit warnings about not documented members.
21+
reportUndocumented.set(true)
22+
// Suppress package legacy riot. Sadly this does not work
23+
/*
24+
perPackageOption {
25+
prefix.set("org.matrix.android.sdk.internal.legacy.riot")
26+
suppress.set(true)
27+
}
28+
*/
29+
}
30+
}
31+
}
32+
1733
android {
1834
testOptions.unitTests.includeAndroidResources = true
1935

matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/account/ChangePasswordTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ChangePasswordTest : InstrumentedTest {
4646

4747
// Change password
4848
commonTestHelper.runBlockingTest {
49-
session.changePassword(TestConstants.PASSWORD, NEW_PASSWORD)
49+
session.accountService().changePassword(TestConstants.PASSWORD, NEW_PASSWORD)
5050
}
5151

5252
// Try to login with the previous password, it will fail

matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/account/DeactivateAccountTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class DeactivateAccountTest : InstrumentedTest {
4747

4848
// Deactivate the account
4949
commonTestHelper.runBlockingTest {
50-
session.deactivateAccount(
50+
session.accountService().deactivateAccount(
5151
eraseAllData = false,
5252
userInteractiveAuthInterceptor = object : UserInteractiveAuthInterceptor {
5353
override fun performStage(flowResponse: RegistrationFlowResponse, errCode: String?, promise: Continuation<UIABaseAuth>) {

matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CommonTestHelper.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ class CommonTestHelper(context: Context) {
431431

432432
fun signOutAndClose(session: Session) {
433433
runBlockingTest(timeout = 60_000) {
434-
session.signOut(true)
434+
session.signOutService().signOut(true)
435435
}
436436
// no need signout will close
437437
// session.close()

matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CryptoTestHelper.kt

+12-11
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import org.matrix.android.sdk.api.session.crypto.verification.VerificationTxStat
4040
import org.matrix.android.sdk.api.session.events.model.Event
4141
import org.matrix.android.sdk.api.session.events.model.EventType
4242
import org.matrix.android.sdk.api.session.events.model.toContent
43+
import org.matrix.android.sdk.api.session.getRoom
4344
import org.matrix.android.sdk.api.session.room.Room
4445
import org.matrix.android.sdk.api.session.room.model.Membership
4546
import org.matrix.android.sdk.api.session.room.model.RoomSummary
@@ -64,7 +65,7 @@ class CryptoTestHelper(private val testHelper: CommonTestHelper) {
6465
val aliceSession = testHelper.createAccount(TestConstants.USER_ALICE, defaultSessionParams)
6566

6667
val roomId = testHelper.runBlockingTest {
67-
aliceSession.createRoom(CreateRoomParams().apply { name = "MyRoom" })
68+
aliceSession.roomService().createRoom(CreateRoomParams().apply { name = "MyRoom" })
6869
}
6970
if (encryptedRoom) {
7071
testHelper.waitWithLatch { latch ->
@@ -98,7 +99,7 @@ class CryptoTestHelper(private val testHelper: CommonTestHelper) {
9899
val bobSession = testHelper.createAccount(TestConstants.USER_BOB, defaultSessionParams)
99100

100101
testHelper.waitWithLatch { latch ->
101-
val bobRoomSummariesLive = bobSession.getRoomSummariesLive(roomSummaryQueryParams { })
102+
val bobRoomSummariesLive = bobSession.roomService().getRoomSummariesLive(roomSummaryQueryParams { })
102103
val newRoomObserver = object : Observer<List<RoomSummary>> {
103104
override fun onChanged(t: List<RoomSummary>?) {
104105
if (t?.isNotEmpty() == true) {
@@ -112,7 +113,7 @@ class CryptoTestHelper(private val testHelper: CommonTestHelper) {
112113
}
113114

114115
testHelper.waitWithLatch { latch ->
115-
val bobRoomSummariesLive = bobSession.getRoomSummariesLive(roomSummaryQueryParams { })
116+
val bobRoomSummariesLive = bobSession.roomService().getRoomSummariesLive(roomSummaryQueryParams { })
116117
val roomJoinedObserver = object : Observer<List<RoomSummary>> {
117118
override fun onChanged(t: List<RoomSummary>?) {
118119
if (bobSession.getRoom(aliceRoomId)
@@ -124,7 +125,7 @@ class CryptoTestHelper(private val testHelper: CommonTestHelper) {
124125
}
125126
}
126127
bobRoomSummariesLive.observeForever(roomJoinedObserver)
127-
bobSession.joinRoom(aliceRoomId)
128+
bobSession.roomService().joinRoom(aliceRoomId)
128129
}
129130
// Ensure bob can send messages to the room
130131
// val roomFromBobPOV = bobSession.getRoom(aliceRoomId)!!
@@ -164,7 +165,7 @@ class CryptoTestHelper(private val testHelper: CommonTestHelper) {
164165
}
165166

166167
testHelper.runBlockingTest {
167-
samSession.joinRoom(room.roomId, null, emptyList())
168+
samSession.roomService().joinRoom(room.roomId, null, emptyList())
168169
}
169170

170171
return samSession
@@ -242,8 +243,8 @@ class CryptoTestHelper(private val testHelper: CommonTestHelper) {
242243
fun createDM(alice: Session, bob: Session): String {
243244
var roomId: String = ""
244245
testHelper.waitWithLatch { latch ->
245-
roomId = alice.createDirectRoom(bob.myUserId)
246-
val bobRoomSummariesLive = bob.getRoomSummariesLive(roomSummaryQueryParams { })
246+
roomId = alice.roomService().createDirectRoom(bob.myUserId)
247+
val bobRoomSummariesLive = bob.roomService().getRoomSummariesLive(roomSummaryQueryParams { })
247248
val newRoomObserver = object : Observer<List<RoomSummary>> {
248249
override fun onChanged(t: List<RoomSummary>?) {
249250
if (t?.any { it.roomId == roomId }.orFalse()) {
@@ -256,7 +257,7 @@ class CryptoTestHelper(private val testHelper: CommonTestHelper) {
256257
}
257258

258259
testHelper.waitWithLatch { latch ->
259-
val bobRoomSummariesLive = bob.getRoomSummariesLive(roomSummaryQueryParams { })
260+
val bobRoomSummariesLive = bob.roomService().getRoomSummariesLive(roomSummaryQueryParams { })
260261
val newRoomObserver = object : Observer<List<RoomSummary>> {
261262
override fun onChanged(t: List<RoomSummary>?) {
262263
if (bob.getRoom(roomId)
@@ -268,7 +269,7 @@ class CryptoTestHelper(private val testHelper: CommonTestHelper) {
268269
}
269270
}
270271
bobRoomSummariesLive.observeForever(newRoomObserver)
271-
bob.joinRoom(roomId)
272+
bob.roomService().joinRoom(roomId)
272273
}
273274

274275
return roomId
@@ -367,7 +368,7 @@ class CryptoTestHelper(private val testHelper: CommonTestHelper) {
367368
aliceSession.cryptoService().setWarnOnUnknownDevices(false)
368369

369370
val roomId = testHelper.runBlockingTest {
370-
aliceSession.createRoom(CreateRoomParams().apply { name = "MyRoom" })
371+
aliceSession.roomService().createRoom(CreateRoomParams().apply { name = "MyRoom" })
371372
}
372373
val room = aliceSession.getRoom(roomId)!!
373374

@@ -380,7 +381,7 @@ class CryptoTestHelper(private val testHelper: CommonTestHelper) {
380381
val session = testHelper.createAccount("User_$index", defaultSessionParams)
381382
testHelper.runBlockingTest(timeout = 600_000) { room.invite(session.myUserId, null) }
382383
println("TEST -> " + session.myUserId + " invited")
383-
testHelper.runBlockingTest { session.joinRoom(room.roomId, null, emptyList()) }
384+
testHelper.runBlockingTest { session.roomService().joinRoom(room.roomId, null, emptyList()) }
384385
println("TEST -> " + session.myUserId + " joined")
385386
sessions.add(session)
386387
}

matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/E2eeSanityTests.kt

+4-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ import org.matrix.android.sdk.api.session.crypto.model.OlmDecryptionResult
3838
import org.matrix.android.sdk.api.session.events.model.EventType
3939
import org.matrix.android.sdk.api.session.events.model.content.EncryptedEventContent
4040
import org.matrix.android.sdk.api.session.events.model.toModel
41+
import org.matrix.android.sdk.api.session.getRoom
42+
import org.matrix.android.sdk.api.session.getRoomSummary
4143
import org.matrix.android.sdk.api.session.room.Room
4244
import org.matrix.android.sdk.api.session.room.failure.JoinRoomFailure
4345
import org.matrix.android.sdk.api.session.room.model.Membership
@@ -551,7 +553,7 @@ class E2eeSanityTests : InstrumentedTest {
551553
testHelper.waitWithLatch { latch ->
552554
testHelper.retryPeriodicallyWithLatch(latch) {
553555
otherAccounts.map {
554-
aliceSession.getRoomMember(it.myUserId, e2eRoomID)?.membership
556+
aliceSession.roomService().getRoomMember(it.myUserId, e2eRoomID)?.membership
555557
}.all {
556558
it == Membership.JOIN
557559
}
@@ -574,7 +576,7 @@ class E2eeSanityTests : InstrumentedTest {
574576
testHelper.runBlockingTest(60_000) {
575577
Log.v("#E2E TEST", "${otherSession.myUserId} tries to join room $e2eRoomID")
576578
try {
577-
otherSession.joinRoom(e2eRoomID)
579+
otherSession.roomService().joinRoom(e2eRoomID)
578580
} catch (ex: JoinRoomFailure.JoinedWithTimeout) {
579581
// it's ok we will wait after
580582
}

matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/PreShareKeysTest.kt

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import org.matrix.android.sdk.api.session.events.model.EventType
2929
import org.matrix.android.sdk.api.session.events.model.content.EncryptedEventContent
3030
import org.matrix.android.sdk.api.session.events.model.content.RoomKeyContent
3131
import org.matrix.android.sdk.api.session.events.model.toModel
32+
import org.matrix.android.sdk.api.session.getRoom
3233
import org.matrix.android.sdk.common.CommonTestHelper
3334
import org.matrix.android.sdk.common.CryptoTestHelper
3435

matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/UnwedgingTest.kt

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import org.matrix.android.sdk.api.session.crypto.MXCryptoError
3434
import org.matrix.android.sdk.api.session.events.model.EventType
3535
import org.matrix.android.sdk.api.session.events.model.content.EncryptedEventContent
3636
import org.matrix.android.sdk.api.session.events.model.toModel
37+
import org.matrix.android.sdk.api.session.getRoom
3738
import org.matrix.android.sdk.api.session.room.timeline.Timeline
3839
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
3940
import org.matrix.android.sdk.api.session.room.timeline.TimelineSettings

0 commit comments

Comments
 (0)