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

Commit

Permalink
Merge branch 'release/0.9.13'
Browse files Browse the repository at this point in the history
  • Loading branch information
bmarty committed Nov 6, 2018
2 parents b558c49 + a6b71ec commit 9a7d90a
Show file tree
Hide file tree
Showing 18 changed files with 295 additions and 38 deletions.
17 changes: 17 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
Changes to Matrix Android SDK in 0.9.13 (2018-11-06)
=======================================================

Improvements:
- Add RTL support
- PermalinkUtils is now able to parse a permalink

Bugfix:
- Fix crash when change visibility room (vector-im/riot-android#2679)
- Move `invite_room_state` to the UnsignedData object (vector-im/riot-android#2555)

API Change:
- MXSession.initUserAgent() takes a second parameter for flavor description.

Build:
- Treat some Lint warnings as errors

Changes to Matrix Android SDK in 0.9.12 (2018-10-18)
=======================================================

Expand Down
14 changes: 11 additions & 3 deletions matrix-sdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 26
versionCode 912
versionName "0.9.12"
resValue "string", "flavor_description", "SDKApp"
versionCode 913
versionName "0.9.13"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand Down Expand Up @@ -84,6 +83,15 @@ android {
disable 'InvalidPackage'
disable 'MissingTranslation'
disable 'RestrictedApi'

// Treat some warnings as errors
error 'StringFormatCount'
error 'HardcodedText'
error 'SpUsage'

// RTL
error 'RtlEnabled'
error 'RtlHardcoded'
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.matrix.androidsdk.MXSession;
import org.matrix.androidsdk.RestClient;
import org.matrix.androidsdk.common.CommonTestHelper;
import org.matrix.androidsdk.common.TestApiCallback;
Expand All @@ -39,7 +40,7 @@ public class RoomMembersTest {

@BeforeClass
public static void init() {
RestClient.initUserAgent(InstrumentationRegistry.getContext());
MXSession.initUserAgent(InstrumentationRegistry.getContext(), null);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class RoomNameTest {

@BeforeClass
public static void init() {
RestClient.initUserAgent(InstrumentationRegistry.getContext());
MXSession.initUserAgent(InstrumentationRegistry.getContext(), null);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.matrix.androidsdk.MXSession;
import org.matrix.androidsdk.RestClient;
import org.matrix.androidsdk.common.CommonTestHelper;
import org.matrix.androidsdk.data.Room;
Expand All @@ -44,7 +45,7 @@ public class RoomStateTest {

@BeforeClass
public static void init() {
RestClient.initUserAgent(InstrumentationRegistry.getContext());
MXSession.initUserAgent(InstrumentationRegistry.getContext(), null);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.matrix.androidsdk.MXSession;
import org.matrix.androidsdk.RestClient;
import org.matrix.androidsdk.common.CommonTestHelper;
import org.matrix.androidsdk.common.TestApiCallback;
Expand All @@ -40,7 +41,7 @@ public class RoomSummaryTest {

@BeforeClass
public static void init() {
RestClient.initUserAgent(InstrumentationRegistry.getContext());
MXSession.initUserAgent(InstrumentationRegistry.getContext(), null);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.matrix.androidsdk.MXSession;
import org.matrix.androidsdk.RestClient;
import org.matrix.androidsdk.common.CommonTestHelper;
import org.matrix.androidsdk.common.TestApiCallback;
Expand All @@ -24,7 +25,7 @@ public class SearchTest {

@BeforeClass
public static void init() {
RestClient.initUserAgent(InstrumentationRegistry.getContext());
MXSession.initUserAgent(InstrumentationRegistry.getContext(), null);
}

@Test
Expand Down
4 changes: 2 additions & 2 deletions matrix-sdk/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<!-- libjingle is designed for API >= 15 but the app should work from API >= 11 -->
<!--uses-sdk tools:overrideLibrary="io.pristine.libjingle"/-->

<application>
<receiver android:name="org.matrix.androidsdk.sync.EventsThread$SyncDelayReceiver" />
<application android:supportsRtl="true">
<receiver android:name=".sync.EventsThread$SyncDelayReceiver" />
</application>
</manifest>
9 changes: 5 additions & 4 deletions matrix-sdk/src/main/java/org/matrix/androidsdk/MXSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;

/**
* Class that represents one user's session with a particular home server.
Expand Down Expand Up @@ -344,10 +343,12 @@ private void checkIfAlive() {
/**
* Init the user-agent used by the REST requests.
*
* @param context the application context
* @param appContext the application context
* @param flavorDescription the flavor description, or null if not defined
*/
public static void initUserAgent(Context context) {
RestClient.initUserAgent(context);
public static void initUserAgent(@Nullable Context appContext,
@Nullable String flavorDescription) {
RestClient.initUserAgent(appContext, flavorDescription == null ? "SDKApp" : flavorDescription);
}

/**
Expand Down
13 changes: 7 additions & 6 deletions matrix-sdk/src/main/java/org/matrix/androidsdk/RestClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import android.content.pm.PackageManager;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import android.util.Pair;

Expand Down Expand Up @@ -262,9 +261,11 @@ private String sanitizeDynamicPath(String dynamicPath) {
* Create an user agent with the application version.
* Ex: Riot/0.8.12 (Linux; U; Android 6.0.1; SM-A510F Build/MMB29; Flavour FDroid; MatrixAndroidSDK 0.9.6)
*
* @param appContext the application context
* @param appContext the application context
* @param flavorDescription the flavor description
*/
public static void initUserAgent(Context appContext) {
public static void initUserAgent(@Nullable Context appContext,
@NonNull String flavorDescription) {
String appName = "";
String appVersion = "";

Expand Down Expand Up @@ -292,14 +293,14 @@ public static void initUserAgent(Context appContext) {
}

// if there is no user agent or cannot parse it
if ((null == sUserAgent) || (sUserAgent.lastIndexOf(")") == -1) || (sUserAgent.indexOf("(") == -1)) {
sUserAgent = appName + "/" + appVersion + " ( Flavour " + appContext.getString(R.string.flavor_description)
if ((null == sUserAgent) || (sUserAgent.lastIndexOf(")") == -1) || !sUserAgent.contains("(")) {
sUserAgent = appName + "/" + appVersion + " ( Flavour " + flavorDescription
+ "; MatrixAndroidSDK " + BuildConfig.VERSION_NAME + ")";
} else {
// update
sUserAgent = appName + "/" + appVersion + " " +
sUserAgent.substring(sUserAgent.indexOf("("), sUserAgent.lastIndexOf(")") - 1) +
"; Flavour " + appContext.getString(R.string.flavor_description) +
"; Flavour " + flavorDescription +
"; MatrixAndroidSDK " + BuildConfig.VERSION_NAME + ")";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ Call<Void> updateAccountData(@Path("userId") String userId,
* @param roomDirectoryVisibility the put params containing the new "visibility" field
*/
@PUT("directory/list/room/{roomId}")
Call<Void> setRoomDirectoryVisibility(@Path("roomId") String roomId, RoomDirectoryVisibility roomDirectoryVisibility);
Call<Void> setRoomDirectoryVisibility(@Path("roomId") String roomId, @Body RoomDirectoryVisibility roomDirectoryVisibility);

/**
* Get the visibility of the given room in the list directory.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,6 @@ public enum SentState {
// Specific to redaction
public String redacts;

// A subset of the state of the room at the time of the invite, if membership is invite
public List<Event> invite_room_state;

// store the exception triggered when unsent
public Exception unsentException = null;
public MatrixError unsentMatrixError = null;
Expand Down Expand Up @@ -583,7 +580,6 @@ public Event deepCopy() {
copy.prev_content_as_string = prev_content_as_string;

copy.unsigned = unsigned;
copy.invite_room_state = invite_room_state;
copy.redacts = redacts;

copy.mSentState = mSentState;
Expand Down Expand Up @@ -914,10 +910,6 @@ public void readExternal(ObjectInput input) throws IOException, ClassNotFoundExc
redacts = input.readUTF();
}

if (input.readBoolean()) {
invite_room_state = (List<Event>) input.readObject();
}

if (input.readBoolean()) {
unsentException = (Exception) input.readObject();
}
Expand Down Expand Up @@ -1002,11 +994,6 @@ public void writeExternal(ObjectOutput output) throws IOException {
output.writeUTF(redacts);
}

output.writeBoolean(null != invite_room_state);
if (null != invite_room_state) {
output.writeObject(invite_room_state);
}

output.writeBoolean(null != unsentException);
if (null != unsentException) {
output.writeObject(unsentException);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright 2014 OpenMarket Ltd
* Copyright 2018 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,6 +17,9 @@
package org.matrix.androidsdk.rest.model;

import com.google.gson.JsonElement;
import com.google.gson.annotations.SerializedName;

import java.util.List;

/**
* Contains optional extra information about the event.
Expand All @@ -37,6 +41,10 @@ public class UnsignedData implements java.io.Serializable {
*/
public String transaction_id;

// A subset of the state of the room at the time of the invite, if membership is invite
@SerializedName("invite_room_state")
public List<Event> inviteRoomState;

/**
* The previous event content (room member information only)
*/
Expand Down
Loading

0 comments on commit 9a7d90a

Please sign in to comment.