Skip to content
This repository was archived by the owner on Apr 12, 2022. It is now read-only.

Commit 353034e

Browse files
committed
Merge branch 'release/0.9.34'
2 parents c1a911a + f9f1a3a commit 353034e

File tree

55 files changed

+809
-885
lines changed

Some content is hidden

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

55 files changed

+809
-885
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
* [ ] Pull request is based on the develop branch
66
* [ ] Pull request updates [CHANGES.rst](https://github.com/matrix-org/matrix-android-sdk/blob/develop/CHANGES.rst)
7-
* [ ] Pull request includes a [sign off](https://github.com/matrix-org/synapse/blob/master/CONTRIBUTING.rst#sign-off)
7+
* [ ] Pull request includes a [sign off](https://github.com/matrix-org/synapse/blob/master/CONTRIBUTING.md#sign-off)

CHANGES.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
Changes to Matrix Android SDK in 0.9.34 (2020-05-13)
2+
=======================================================
3+
4+
Features:
5+
- MSC2437: Store tagged events in Room Account Data
6+
7+
Improvements:
8+
- Enhance the room account data API naming.
9+
- MXSession: Do not refresh TURN servers when VoIP is not supported
10+
11+
Bugfix:
12+
- Fix issue with identity server (missing access token) (vector-im/riot-android#3404)
13+
- Fix crash in MXCryptoImpl (vector-im/riot-android#3396)
14+
15+
API Change:
16+
- RoomAccountdata.hasTags() has been deprecated. Use .hasRoomTags() instead.
17+
- RoomAccountdata.getKeys() has been deprecated. Use .getRoomTagsKeys() instead.
18+
- RoomAccountdata.handleTagEvent() has been removed. Use .handleEvent() instead.
19+
- IMXStore.setRoomsWithoutURLPreview() has been removed.
20+
- IMXStore.getRoomsWithoutURLPreviews() has been removed. Use RoomAccountdata.isURLPreviewAllowedByUser() instead.
21+
22+
Others:
23+
- Provided support for implementation of reading "im.vector.riot.jitsi" from /.well-known/matrix/client
24+
125
Changes to Matrix Android SDK in 0.9.33 (2020-02-10)
226
=======================================================
327

CONTRIBUTING.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Contributing code to Matrix
22
===========================
33

4-
Please see https://github.com/matrix-org/synapse/blob/master/CONTRIBUTING.rst
4+
Please see https://github.com/matrix-org/synapse/blob/master/CONTRIBUTING.md
55
for details on how to contribute code to Matrix.org projects!

matrix-sdk-core/src/main/java/org/matrix/androidsdk/HomeServerConnectionConfig.java

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ public class HomeServerConnectionConfig {
4545

4646
// the home server URI
4747
private Uri mHomeServerUri;
48+
// the jitsi server URI. Can be null
49+
@Nullable
50+
private Uri mJitsiServerUri;
4851
// the identity server URI. Can be null
4952
@Nullable
5053
private Uri mIdentityServerUri;
@@ -93,6 +96,13 @@ public Uri getHomeserverUri() {
9396
return mHomeServerUri;
9497
}
9598

99+
/**
100+
* @return the jitsi server uri
101+
*/
102+
public Uri getJitsiServerUri() {
103+
return mJitsiServerUri;
104+
}
105+
96106
/**
97107
* @return the identity server uri, or null if not defined
98108
*/
@@ -163,6 +173,20 @@ public void setCredentials(Credentials credentials) {
163173
mIdentityServerUri = Uri.parse(identityServerUrl);
164174
}
165175
}
176+
177+
if (credentials.wellKnown.jitsiServer != null) {
178+
String jitsiServerUrl = credentials.wellKnown.jitsiServer.preferredDomain;
179+
180+
if (!TextUtils.isEmpty(jitsiServerUrl)) {
181+
// add trailing "/"
182+
if (!jitsiServerUrl.endsWith("/")) {
183+
jitsiServerUrl =jitsiServerUrl + "/";
184+
}
185+
186+
Log.d("setCredentials", "Overriding jitsi server url to " + jitsiServerUrl);
187+
mJitsiServerUri = Uri.parse(jitsiServerUrl);
188+
}
189+
}
166190
}
167191
}
168192

@@ -223,6 +247,7 @@ public Proxy getProxyConfig() {
223247
public String toString() {
224248
return "HomeserverConnectionConfig{" +
225249
"mHomeServerUri=" + mHomeServerUri +
250+
", mJitsiServerUri=" + mJitsiServerUri +
226251
", mIdentityServerUri=" + mIdentityServerUri +
227252
", mAntiVirusServerUri=" + mAntiVirusServerUri +
228253
", mAllowedFingerprints size=" + mAllowedFingerprints.size() +
@@ -246,6 +271,10 @@ public JSONObject toJson() throws JSONException {
246271
JSONObject json = new JSONObject();
247272

248273
json.put("home_server_url", mHomeServerUri.toString());
274+
Uri jitsiServerUri = getJitsiServerUri();
275+
if (jitsiServerUri != null) {
276+
json.put("jitsi_server_url", jitsiServerUri.toString());
277+
}
249278
Uri identityServerUri = getIdentityServerUri();
250279
if (identityServerUri != null) {
251280
json.put("identity_server_url", identityServerUri.toString());
@@ -316,6 +345,7 @@ public static HomeServerConnectionConfig fromJson(JSONObject jsonObject) throws
316345

317346
Builder builder = new Builder()
318347
.withHomeServerUri(Uri.parse(jsonObject.getString("home_server_url")))
348+
.withJitsiServerUri(jsonObject.has("jitsi_server_url") ? Uri.parse(jsonObject.getString("jitsi_server_url")) : null)
319349
.withIdentityServerUri(jsonObject.has("identity_server_url") ? Uri.parse(jsonObject.getString("identity_server_url")) : null)
320350
.withCredentials(creds)
321351
.withPin(jsonObject.optBoolean("pin", false));
@@ -413,6 +443,37 @@ public Builder withHomeServerUri(final Uri homeServerUri) {
413443
return this;
414444
}
415445

446+
/**
447+
* @param jitsiServerUri The URI to use to manage identity. Can be null
448+
* @return this builder
449+
*/
450+
public Builder withJitsiServerUri(@Nullable final Uri jitsiServerUri) {
451+
if (jitsiServerUri != null
452+
&& !jitsiServerUri.toString().isEmpty()
453+
&& !"http".equals(jitsiServerUri.getScheme())
454+
&& !"https".equals(jitsiServerUri.getScheme())) {
455+
throw new RuntimeException("Invalid jitsi server URI: " + jitsiServerUri);
456+
}
457+
458+
// add trailing /
459+
if ((null != jitsiServerUri) && !jitsiServerUri.toString().endsWith("/")) {
460+
try {
461+
String url = jitsiServerUri.toString();
462+
mHomeServerConnectionConfig.mJitsiServerUri = Uri.parse(url + "/");
463+
} catch (Exception e) {
464+
throw new RuntimeException("Invalid jitsi server URI: " + jitsiServerUri);
465+
}
466+
} else {
467+
if (jitsiServerUri != null && jitsiServerUri.toString().isEmpty()) {
468+
mHomeServerConnectionConfig.mJitsiServerUri = null;
469+
} else {
470+
mHomeServerConnectionConfig.mJitsiServerUri = jitsiServerUri;
471+
}
472+
}
473+
474+
return this;
475+
}
476+
416477
/**
417478
* @param identityServerUri The URI to use to manage identity. Can be null
418479
* @return this builder

matrix-sdk-core/src/main/java/org/matrix/androidsdk/rest/model/WellKnown.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ import com.google.gson.annotations.SerializedName
3838
* }
3939
* ]
4040
* }
41+
* "im.vector.riot.jitsi": {
42+
* "preferredDomain": "https://jitsi.riot.im/"
43+
* }
4144
* }
4245
* </pre>
4346
*/
@@ -81,4 +84,8 @@ class WellKnown {
8184
}
8285
return managers
8386
}
87+
88+
@JvmField
89+
@SerializedName("im.vector.riot.jitsi")
90+
var jitsiServer: WellKnownPreferredConfig? = null
8491
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2019 New Vector Ltd
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.matrix.androidsdk.rest.model
17+
18+
import com.google.gson.annotations.SerializedName
19+
20+
/**
21+
* https://matrix.org/docs/spec/client_server/r0.4.0.html#server-discovery
22+
* <pre>
23+
* {
24+
* "preferredDomain": "https://jitsi.riot.im/"
25+
* }
26+
* </pre>
27+
*/
28+
class WellKnownPreferredConfig {
29+
30+
@JvmField
31+
@SerializedName("preferredDomain")
32+
var preferredDomain: String? = null
33+
}
34+

matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/internal/MXCryptoImpl.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
import android.os.Handler;
2222
import android.os.HandlerThread;
2323
import android.os.Looper;
24+
import android.text.TextUtils;
25+
2426
import androidx.annotation.NonNull;
2527
import androidx.annotation.Nullable;
26-
import android.text.TextUtils;
2728

2829
import com.google.gson.JsonElement;
2930
import com.google.gson.JsonObject;
@@ -297,6 +298,10 @@ public MXCryptoImpl(@NonNull CryptoSession matrixSession,
297298
myDevices.put(mMyDevice.deviceId, mMyDevice);
298299

299300
mCryptoStore.storeUserDevices(mSession.getMyUserId(), myDevices);
301+
302+
// Create the VerificationManager before setting the CryptoEventsListener, to avoid crash (vector-im/riot-android#3396)
303+
mShortCodeVerificationManager = new VerificationManager(mSession);
304+
300305
mSession.getDataHandler().setCryptoEventsListener(mEventListener);
301306

302307
mEncryptingHandlerThread = new HandlerThread("MXCrypto_encrypting_" + mSession.getMyUserId(), Thread.MIN_PRIORITY);
@@ -318,7 +323,6 @@ public MXCryptoImpl(@NonNull CryptoSession matrixSession,
318323
mReceivedRoomKeyRequests.addAll(mCryptoStore.getPendingIncomingRoomKeyRequests());
319324

320325
mKeysBackup = new KeysBackup(this, homeServerConnectionConfig);
321-
mShortCodeVerificationManager = new VerificationManager(mSession);
322326
}
323327

324328
/**
@@ -1610,7 +1614,10 @@ public Map<String, Map<String, String>> signObject(String strToSign) {
16101614
* @param event the event
16111615
*/
16121616
private void onToDeviceEvent(final CryptoEvent event) {
1613-
mShortCodeVerificationManager.onToDeviceEvent(event);
1617+
// It should not happen anymore
1618+
if (mShortCodeVerificationManager != null) {
1619+
mShortCodeVerificationManager.onToDeviceEvent(event);
1620+
}
16141621

16151622
if (TextUtils.equals(event.getType(), CryptoEvent.EVENT_TYPE_ROOM_KEY)
16161623
|| TextUtils.equals(event.getType(), CryptoEvent.EVENT_TYPE_FORWARDED_ROOM_KEY)) {

matrix-sdk/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ android {
2727
defaultConfig {
2828
minSdkVersion 16
2929
targetSdkVersion 28
30-
versionCode 933
31-
versionName "0.9.33"
30+
versionCode 934
31+
versionName "0.9.34"
3232
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3333

3434
// Enable multi dex for test

matrix-sdk/src/main/java/org/matrix/androidsdk/MXDataHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2027,6 +2027,10 @@ public void onRoomTagEvent(final String roomId) {
20272027
mMxEventDispatcher.dispatchOnRoomTagEvent(roomId, ignoreEvent(roomId));
20282028
}
20292029

2030+
public void onTaggedEventsEvent(final String roomId) {
2031+
mMxEventDispatcher.dispatchOnTaggedEventsEvent(roomId, ignoreEvent(roomId));
2032+
}
2033+
20302034
public void onReadMarkerEvent(final String roomId) {
20312035
mMxEventDispatcher.dispatchOnReadMarkerEvent(roomId, ignoreEvent(roomId));
20322036
}

matrix-sdk/src/main/java/org/matrix/androidsdk/MXSession.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,7 @@ public void startEventStream(String initialToken) {
11781178
* Gracefully stop the event stream.
11791179
*/
11801180
public void stopEventStream() {
1181-
if (null != mCallsManager) {
1181+
if (isVoipCallSupported()) {
11821182
mCallsManager.stopTurnServerRefresh();
11831183
}
11841184

@@ -1198,7 +1198,7 @@ public void stopEventStream() {
11981198
public void pauseEventStream() {
11991199
checkIfAlive();
12001200

1201-
if (null != mCallsManager) {
1201+
if (isVoipCallSupported()) {
12021202
mCallsManager.pauseTurnServerRefresh();
12031203
}
12041204

@@ -1237,7 +1237,7 @@ public void resumeEventStream() {
12371237
mNetworkConnectivityReceiver.checkNetworkConnection(mContext);
12381238
}
12391239

1240-
if (null != mCallsManager) {
1240+
if (isVoipCallSupported()) {
12411241
mCallsManager.unpauseTurnServerRefresh();
12421242
}
12431243

@@ -1752,7 +1752,7 @@ public List<Room> roomsWithTag(final String tag) {
17521752
} else {
17531753
final Collection<Room> rooms = mDataHandler.getStore().getRooms();
17541754
for (Room room : rooms) {
1755-
if (!room.getAccountData().hasTags()) {
1755+
if (!room.getAccountData().hasRoomTags()) {
17561756
taggedRooms.add(room);
17571757
}
17581758
}

0 commit comments

Comments
 (0)