diff --git a/CHANGES.rst b/CHANGES.rst index 8356e57f6..1fa31e6c5 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,29 @@ +Changes to Matrix Android SDK in 0.9.27 (2018-08-28) +======================================================= + +/!\ Security: + - The homeserver access token was incorrectly included in requests sent to the Identity Server, a separate service. + The client should prompt the user to logout and login again to renew the token, unless the user is happy to trust the Identity Server provider with their access token (e.g. if the homeserver and identity server are operated by the same provider). + +Features: + - Allow Matrix SDK client to configure the filter used for pagination (vector-im/riot-android#3237) + +Improvements: + - Add a TermsManager (vector-im/riot-android#3225) + +Bugfix: + - Stop sending the access token of the homeserver to the identity server + - VoIP: Stop falling back to Google for STUN (vector-im/riot-android#3223). + - EventIDs: Add regex to match eventIDs for v4 and v5 rooms + - Failed to send a message in a new joined room (invited by email) + +Others: + - Remove useless log (vector-im/riot-android#3236) + +Build: + - Migrate to androidx (following https://developer.android.com/jetpack/androidx/migrate) + - WebRTC: upgrade webrtc library, using the one build along with Jitsi + Changes to Matrix Android SDK in 0.9.26 (2019-07-24) ======================================================= @@ -1558,4 +1584,4 @@ Build: - Test: - - \ No newline at end of file + - diff --git a/build.gradle b/build.gradle index aed030a07..8af3e422e 100644 --- a/build.gradle +++ b/build.gradle @@ -34,12 +34,13 @@ allprojects { includeGroupByRegex "org\\.matrix\\.gitlab\\.matrix-org" } } + // Jitsi repo + maven { + url "https://github.com/vector-im/jitsi_libre_maven/raw/master/releases" + } google() jcenter() mavenCentral() - maven { - url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases" - } } } diff --git a/gradle.properties b/gradle.properties index ead439d15..ad113e105 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,3 +21,5 @@ # SONAR_LOGIN=sonar_login org.gradle.configureondemand=false +android.useAndroidX=true +android.enableJetifier=true \ No newline at end of file diff --git a/matrix-sdk-core/build.gradle b/matrix-sdk-core/build.gradle index 41436417e..c985608f0 100644 --- a/matrix-sdk-core/build.gradle +++ b/matrix-sdk-core/build.gradle @@ -11,7 +11,7 @@ android { versionCode 1 versionName "1.0" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { @@ -42,13 +42,13 @@ dependencies { implementation "com.squareup.okhttp3:okhttp:$okhttp_version" implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0' - implementation 'com.squareup.retrofit2:retrofit:2.4.0' + implementation 'com.squareup.retrofit2:retrofit:2.6.0' implementation 'com.squareup.retrofit2:converter-gson:2.4.0' - implementation "com.android.support:appcompat-v7:$support_lib_version" - implementation "com.android.support:preference-v7:$support_lib_version" + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'androidx.preference:preference:1.0.0' testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + androidTestImplementation 'androidx.test:runner:1.2.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' } diff --git a/matrix-sdk-core/src/debug/java/org/matrix/androidsdk/core/interceptors/FormattedJsonHttpLogger.java b/matrix-sdk-core/src/debug/java/org/matrix/androidsdk/core/interceptors/FormattedJsonHttpLogger.java index e388b69a8..ae7704d05 100644 --- a/matrix-sdk-core/src/debug/java/org/matrix/androidsdk/core/interceptors/FormattedJsonHttpLogger.java +++ b/matrix-sdk-core/src/debug/java/org/matrix/androidsdk/core/interceptors/FormattedJsonHttpLogger.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.core.interceptors; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.json.JSONArray; import org.json.JSONException; diff --git a/matrix-sdk-core/src/main/java/org/matrix/androidsdk/core/CompatUtil.java b/matrix-sdk-core/src/main/java/org/matrix/androidsdk/core/CompatUtil.java index 1630b0501..2e6036f94 100644 --- a/matrix-sdk-core/src/main/java/org/matrix/androidsdk/core/CompatUtil.java +++ b/matrix-sdk-core/src/main/java/org/matrix/androidsdk/core/CompatUtil.java @@ -22,9 +22,9 @@ import android.security.KeyPairGeneratorSpec; import android.security.keystore.KeyGenParameterSpec; import android.security.keystore.KeyProperties; -import android.support.annotation.Nullable; -import android.support.annotation.RequiresApi; -import android.support.v7.preference.PreferenceManager; +import androidx.annotation.Nullable; +import androidx.annotation.RequiresApi; +import androidx.preference.PreferenceManager; import android.util.Base64; import org.matrix.androidsdk.core.model.SecretKeyAndVersion; diff --git a/matrix-sdk-core/src/main/java/org/matrix/androidsdk/core/MXPatterns.java b/matrix-sdk-core/src/main/java/org/matrix/androidsdk/core/MXPatterns.java index 23f2d09a0..66c9d9ab3 100644 --- a/matrix-sdk-core/src/main/java/org/matrix/androidsdk/core/MXPatterns.java +++ b/matrix-sdk-core/src/main/java/org/matrix/androidsdk/core/MXPatterns.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.core; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import java.util.Arrays; import java.util.List; @@ -55,6 +55,10 @@ private MXPatterns() { private static final String MATRIX_EVENT_IDENTIFIER_V3_REGEX = "\\$[A-Z0-9/+]+"; public static final Pattern PATTERN_CONTAIN_MATRIX_EVENT_IDENTIFIER_V3 = Pattern.compile(MATRIX_EVENT_IDENTIFIER_V3_REGEX, Pattern.CASE_INSENSITIVE); + // regex pattern to find message ids v4 in a string. + private static final String MATRIX_EVENT_IDENTIFIER_V4_REGEX = "\\$[A-Z0-9\\_\\-]+"; + public static final Pattern PATTERN_CONTAIN_MATRIX_EVENT_IDENTIFIER_V4 = Pattern.compile(MATRIX_EVENT_IDENTIFIER_V4_REGEX, Pattern.CASE_INSENSITIVE); + // regex pattern to find group ids in a string. private static final String MATRIX_GROUP_IDENTIFIER_REGEX = "\\+[A-Z0-9=_\\-./]+" + DOMAIN_REGEX; public static final Pattern PATTERN_CONTAIN_MATRIX_GROUP_IDENTIFIER = Pattern.compile(MATRIX_GROUP_IDENTIFIER_REGEX, Pattern.CASE_INSENSITIVE); @@ -128,7 +132,8 @@ public static boolean isRoomAlias(@Nullable final String str) { */ public static boolean isEventId(@Nullable final String str) { return str != null - && (PATTERN_CONTAIN_MATRIX_EVENT_IDENTIFIER.matcher(str).matches() || PATTERN_CONTAIN_MATRIX_EVENT_IDENTIFIER_V3.matcher(str).matches()); + && (PATTERN_CONTAIN_MATRIX_EVENT_IDENTIFIER.matcher(str).matches() || PATTERN_CONTAIN_MATRIX_EVENT_IDENTIFIER_V3.matcher(str).matches() + || PATTERN_CONTAIN_MATRIX_EVENT_IDENTIFIER_V4.matcher(str).matches()); } /** diff --git a/matrix-sdk-core/src/main/java/org/matrix/androidsdk/core/model/MatrixError.java b/matrix-sdk-core/src/main/java/org/matrix/androidsdk/core/model/MatrixError.java index e34720b9c..afa700fb3 100644 --- a/matrix-sdk-core/src/main/java/org/matrix/androidsdk/core/model/MatrixError.java +++ b/matrix-sdk-core/src/main/java/org/matrix/androidsdk/core/model/MatrixError.java @@ -16,7 +16,7 @@ */ package org.matrix.androidsdk.core.model; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import com.google.gson.annotations.SerializedName; @@ -55,6 +55,8 @@ public class MatrixError implements java.io.Serializable { public static final String RESOURCE_LIMIT_EXCEEDED = "M_RESOURCE_LIMIT_EXCEEDED"; public static final String WRONG_ROOM_KEYS_VERSION = "M_WRONG_ROOM_KEYS_VERSION"; + public static final String TERMS_NOT_SIGNED = "M_TERMS_NOT_SIGNED"; + // The error codes related to the password policy public static final String PASSWORD_TOO_SHORT = "M_PASSWORD_TOO_SHORT"; public static final String PASSWORD_NO_DIGIT = "M_PASSWORD_NO_DIGIT"; @@ -123,6 +125,8 @@ public String getLocalizedMessage() { localizedMessage = error; } else if (!TextUtils.isEmpty(errcode)) { localizedMessage = errcode; + } else if (!TextUtils.isEmpty(mErrorBodyAsString)) { + localizedMessage = mErrorBodyAsString; } return localizedMessage; diff --git a/matrix-sdk-core/src/release/java/org/matrix/androidsdk/core/interceptors/FormattedJsonHttpLogger.java b/matrix-sdk-core/src/release/java/org/matrix/androidsdk/core/interceptors/FormattedJsonHttpLogger.java index 2aba26168..9cc69901e 100644 --- a/matrix-sdk-core/src/release/java/org/matrix/androidsdk/core/interceptors/FormattedJsonHttpLogger.java +++ b/matrix-sdk-core/src/release/java/org/matrix/androidsdk/core/interceptors/FormattedJsonHttpLogger.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.core.interceptors; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import okhttp3.logging.HttpLoggingInterceptor; diff --git a/matrix-sdk-crypto/build.gradle b/matrix-sdk-crypto/build.gradle index 4b68b94fc..16e14fa62 100644 --- a/matrix-sdk-crypto/build.gradle +++ b/matrix-sdk-crypto/build.gradle @@ -9,7 +9,7 @@ buildscript { } dependencies { - classpath "io.realm:realm-gradle-plugin:5.8.0" + classpath "io.realm:realm-gradle-plugin:5.12.0" } } @@ -20,7 +20,7 @@ android { minSdkVersion 16 targetSdkVersion 28 - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } compileOptions { @@ -50,7 +50,7 @@ dependencies { // olm lib is now hosted by jitpack: https://jitpack.io/#org.matrix.gitlab.matrix-org/olm implementation 'org.matrix.gitlab.matrix-org:olm:3.1.2' - implementation 'com.squareup.retrofit2:retrofit:2.4.0' + implementation 'com.squareup.retrofit2:retrofit:2.6.0' implementation 'com.squareup.retrofit2:converter-gson:2.4.0' implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0' @@ -60,8 +60,8 @@ dependencies { // Database kapt 'dk.ilios:realmfieldnameshelper:1.1.1' - implementation "com.android.support:appcompat-v7:$support_lib_version" + implementation 'androidx.appcompat:appcompat:1.0.2' testImplementation 'junit:junit:4.12' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + androidTestImplementation 'androidx.test:runner:1.2.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' } diff --git a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/MXCrypto.kt b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/MXCrypto.kt index d89747166..05904f65b 100644 --- a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/MXCrypto.kt +++ b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/MXCrypto.kt @@ -17,7 +17,7 @@ package org.matrix.androidsdk.crypto import android.os.Handler -import android.support.annotation.VisibleForTesting +import androidx.annotation.VisibleForTesting import com.google.gson.JsonElement import org.matrix.androidsdk.core.callback.ApiCallback import org.matrix.androidsdk.core.listeners.ProgressListener diff --git a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/MXOlmDevice.java b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/MXOlmDevice.java index 657b738cb..b379c8eda 100755 --- a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/MXOlmDevice.java +++ b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/MXOlmDevice.java @@ -17,7 +17,7 @@ package org.matrix.androidsdk.crypto; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import com.google.gson.JsonParser; diff --git a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/algorithms/IMXDecrypting.java b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/algorithms/IMXDecrypting.java index e7cdc0c73..966ac3271 100644 --- a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/algorithms/IMXDecrypting.java +++ b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/algorithms/IMXDecrypting.java @@ -17,7 +17,7 @@ package org.matrix.androidsdk.crypto.algorithms; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.matrix.androidsdk.crypto.IncomingRoomKeyRequest; import org.matrix.androidsdk.crypto.MXDecryptionException; diff --git a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/algorithms/megolm/MXMegolmDecryption.java b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/algorithms/megolm/MXMegolmDecryption.java index 4fda341c8..c016fc102 100644 --- a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/algorithms/megolm/MXMegolmDecryption.java +++ b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/algorithms/megolm/MXMegolmDecryption.java @@ -17,7 +17,7 @@ package org.matrix.androidsdk.crypto.algorithms.megolm; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import org.matrix.androidsdk.core.Log; diff --git a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/cryptostore/IMXCryptoStore.java b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/cryptostore/IMXCryptoStore.java index ae5a4e97a..56160c783 100644 --- a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/cryptostore/IMXCryptoStore.java +++ b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/cryptostore/IMXCryptoStore.java @@ -18,7 +18,7 @@ package org.matrix.androidsdk.crypto.cryptostore; import android.content.Context; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.jetbrains.annotations.NotNull; import org.matrix.androidsdk.crypto.IncomingRoomKeyRequest; diff --git a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/cryptostore/MXFileCryptoStore.java b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/cryptostore/MXFileCryptoStore.java index cee3c91a5..806a48781 100644 --- a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/cryptostore/MXFileCryptoStore.java +++ b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/cryptostore/MXFileCryptoStore.java @@ -20,7 +20,7 @@ import android.content.Context; import android.os.Looper; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import org.jetbrains.annotations.NotNull; diff --git a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/data/MXOlmInboundGroupSession2.java b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/data/MXOlmInboundGroupSession2.java index 30898cb46..1a5dd64ae 100755 --- a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/data/MXOlmInboundGroupSession2.java +++ b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/data/MXOlmInboundGroupSession2.java @@ -17,7 +17,7 @@ package org.matrix.androidsdk.crypto.data; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import org.matrix.androidsdk.core.Log; diff --git a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/internal/MXCryptoImpl.java b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/internal/MXCryptoImpl.java index 425c9c0d4..ace3bd0d2 100755 --- a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/internal/MXCryptoImpl.java +++ b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/internal/MXCryptoImpl.java @@ -21,8 +21,8 @@ import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.TextUtils; import com.google.gson.JsonElement; diff --git a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/keysbackup/KeysBackup.kt b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/keysbackup/KeysBackup.kt index 6ff7ba3f3..9bf5d5186 100644 --- a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/keysbackup/KeysBackup.kt +++ b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/keysbackup/KeysBackup.kt @@ -16,9 +16,9 @@ package org.matrix.androidsdk.crypto.keysbackup -import android.support.annotation.UiThread -import android.support.annotation.VisibleForTesting -import android.support.annotation.WorkerThread +import androidx.annotation.UiThread +import androidx.annotation.VisibleForTesting +import androidx.annotation.WorkerThread import org.matrix.androidsdk.core.JsonUtility import org.matrix.androidsdk.core.Log import org.matrix.androidsdk.core.callback.ApiCallback diff --git a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/keysbackup/KeysBackupPassword.kt b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/keysbackup/KeysBackupPassword.kt index 7ccc36495..b0b82eb9e 100644 --- a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/keysbackup/KeysBackupPassword.kt +++ b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/keysbackup/KeysBackupPassword.kt @@ -19,7 +19,7 @@ */ package org.matrix.androidsdk.crypto.keysbackup -import android.support.annotation.WorkerThread +import androidx.annotation.WorkerThread import org.matrix.androidsdk.core.Log import org.matrix.androidsdk.core.listeners.ProgressListener import java.util.* diff --git a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/model/rest/DeviceInfo.java b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/model/rest/DeviceInfo.java index 34d0d20d0..a556389f2 100644 --- a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/model/rest/DeviceInfo.java +++ b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/model/rest/DeviceInfo.java @@ -17,7 +17,7 @@ */ package org.matrix.androidsdk.crypto.model.rest; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.matrix.androidsdk.core.interfaces.DatedObject; diff --git a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/rest/ParentRestClient.java b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/rest/ParentRestClient.java index ba4c61b87..863bf1033 100644 --- a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/rest/ParentRestClient.java +++ b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/rest/ParentRestClient.java @@ -15,7 +15,7 @@ */ package org.matrix.androidsdk.crypto.rest; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import com.google.gson.Gson; diff --git a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/verification/VerificationEmoji.kt b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/verification/VerificationEmoji.kt index 40aba91c7..0eb8c6478 100644 --- a/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/verification/VerificationEmoji.kt +++ b/matrix-sdk-crypto/src/main/java/org/matrix/androidsdk/crypto/verification/VerificationEmoji.kt @@ -15,7 +15,7 @@ */ package org.matrix.androidsdk.crypto.verification -import android.support.annotation.StringRes +import androidx.annotation.StringRes import org.matrix.androidsdk.crypto.R object VerificationEmoji { diff --git a/matrix-sdk/build.gradle b/matrix-sdk/build.gradle index 1893bb1e5..742bc1eef 100644 --- a/matrix-sdk/build.gradle +++ b/matrix-sdk/build.gradle @@ -10,7 +10,7 @@ buildscript { } dependencies { - classpath "io.realm:realm-gradle-plugin:5.9.0" + classpath "io.realm:realm-gradle-plugin:5.12.0" } } @@ -27,9 +27,9 @@ android { defaultConfig { minSdkVersion 16 targetSdkVersion 28 - versionCode 926 - versionName "0.9.26" - testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + versionCode 927 + versionName "0.9.27" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" // Enable multi dex for test multiDexEnabled true @@ -159,10 +159,10 @@ dependencies { // Kotlin implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "com.android.support:appcompat-v7:$support_lib_version" - implementation "com.android.support:preference-v7:$support_lib_version" + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'androidx.preference:preference:1.0.0' - implementation 'com.squareup.retrofit2:retrofit:2.4.0' + implementation 'com.squareup.retrofit2:retrofit:2.6.0' implementation 'com.squareup.retrofit2:converter-gson:2.4.0' implementation "com.google.code.gson:gson:$gson_version" implementation "com.squareup.okhttp3:okhttp:$okhttp_version" @@ -177,11 +177,11 @@ dependencies { kapt 'dk.ilios:realmfieldnameshelper:1.1.1' // WebRTC - implementation('com.facebook.react:react-native-webrtc:1.69.0-jitsi-799011@aar') + implementation('com.facebook.react:react-native-webrtc:1.69.2-jitsi-2062090@aar') // Test - testImplementation 'com.android.support.test:runner:1.0.2' - testImplementation 'com.android.support.test:rules:1.0.2' + testImplementation 'androidx.test:runner:1.2.0' + testImplementation 'androidx.test:rules:1.2.0' testImplementation 'org.mockito:mockito-core:2.23.0' testImplementation 'junit:junit:4.12' testImplementation 'org.hamcrest:hamcrest-library:1.3' @@ -190,10 +190,9 @@ dependencies { // Robolectric androidTestImplementation 'junit:junit:4.12' - androidTestImplementation "com.android.support:support-annotations:$support_lib_version" - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test:rules:1.0.2' + androidTestImplementation 'androidx.test:runner:1.2.0' + androidTestImplementation 'androidx.test:rules:1.2.0' // Enable multi dex for test - implementation 'com.android.support:multidex:1.0.3' + implementation 'androidx.multidex:multidex:2.0.1' } diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/common/CommonTestHelper.java b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/common/CommonTestHelper.java index 656c23929..33b334f06 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/common/CommonTestHelper.java +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/common/CommonTestHelper.java @@ -19,9 +19,9 @@ import android.content.Context; import android.net.Uri; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.test.InstrumentationRegistry; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.test.InstrumentationRegistry; import org.junit.Assert; import org.matrix.androidsdk.HomeServerConnectionConfig; diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/common/TestApiCallback.kt b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/common/TestApiCallback.kt index 293d797d3..bec1e2f8d 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/common/TestApiCallback.kt +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/common/TestApiCallback.kt @@ -16,7 +16,7 @@ package org.matrix.androidsdk.common -import android.support.annotation.CallSuper +import androidx.annotation.CallSuper import org.junit.Assert.fail import org.matrix.androidsdk.core.Log import org.matrix.androidsdk.core.callback.ApiCallback diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/core/EventDisplayTest.java b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/core/EventDisplayTest.java index 14acd2281..edf57cbc8 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/core/EventDisplayTest.java +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/core/EventDisplayTest.java @@ -17,7 +17,7 @@ package org.matrix.androidsdk.core; import android.content.Context; -import android.support.test.InstrumentationRegistry; +import androidx.test.InstrumentationRegistry; import android.text.SpannableStringBuilder; import com.google.gson.JsonObject; diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/AttachmentEncryptionTest.java b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/AttachmentEncryptionTest.java index 2ee7c77a4..5bc2c17f3 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/AttachmentEncryptionTest.java +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/AttachmentEncryptionTest.java @@ -1,7 +1,7 @@ package org.matrix.androidsdk.crypto; import android.os.MemoryFile; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.runner.AndroidJUnit4; import android.util.Base64; import org.junit.Assert; diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/CryptoRestTest.java b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/CryptoRestTest.java index d0eb5bae7..51f813aed 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/CryptoRestTest.java +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/CryptoRestTest.java @@ -18,8 +18,8 @@ package org.matrix.androidsdk.crypto; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; import org.junit.Assert; import org.junit.FixMethodOrder; diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/CryptoStoreHelper.kt b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/CryptoStoreHelper.kt index 441bd59af..e68f2c484 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/CryptoStoreHelper.kt +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/CryptoStoreHelper.kt @@ -18,7 +18,7 @@ package org.matrix.androidsdk.crypto -import android.support.test.InstrumentationRegistry +import androidx.test.InstrumentationRegistry import org.matrix.androidsdk.crypto.cryptostore.IMXCryptoStore import org.matrix.androidsdk.crypto.cryptostore.MXFileCryptoStore import org.matrix.androidsdk.crypto.cryptostore.db.RealmCryptoStore diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/CryptoStoreImportationTest.kt b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/CryptoStoreImportationTest.kt index 4f7397fa7..45b58bd28 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/CryptoStoreImportationTest.kt +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/CryptoStoreImportationTest.kt @@ -18,7 +18,7 @@ package org.matrix.androidsdk.crypto -import android.support.test.InstrumentationRegistry +import androidx.test.InstrumentationRegistry import android.text.TextUtils import org.junit.Assert.* import org.junit.Before diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/CryptoTest.java b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/CryptoTest.java index 9e3dced96..96afdeb5d 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/CryptoTest.java +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/CryptoTest.java @@ -21,8 +21,8 @@ import android.content.Context; import android.os.SystemClock; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; import android.text.TextUtils; import com.google.gson.JsonObject; diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/ExportEncryptionTest.java b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/ExportEncryptionTest.java index 98706998e..232f2c91d 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/ExportEncryptionTest.java +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/ExportEncryptionTest.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.crypto; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.runner.AndroidJUnit4; import org.junit.Assert; import org.junit.FixMethodOrder; diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/PartialSharedSessionTest.kt b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/PartialSharedSessionTest.kt index 85bbc1e10..212f08d1a 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/PartialSharedSessionTest.kt +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/PartialSharedSessionTest.kt @@ -15,8 +15,8 @@ */ package org.matrix.androidsdk.crypto -import android.support.test.InstrumentationRegistry -import android.support.test.runner.AndroidJUnit4 +import androidx.test.InstrumentationRegistry +import androidx.test.runner.AndroidJUnit4 import com.google.gson.JsonObject import com.google.gson.JsonPrimitive import okhttp3.Protocol diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/keysbackup/KeysBackupPasswordTest.kt b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/keysbackup/KeysBackupPasswordTest.kt index c5ac02989..7c9817aab 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/keysbackup/KeysBackupPasswordTest.kt +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/keysbackup/KeysBackupPasswordTest.kt @@ -16,7 +16,7 @@ package org.matrix.androidsdk.crypto.keysbackup -import android.support.test.runner.AndroidJUnit4 +import androidx.test.runner.AndroidJUnit4 import org.junit.Assert.* import org.junit.Before import org.junit.FixMethodOrder diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/keysbackup/KeysBackupTest.kt b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/keysbackup/KeysBackupTest.kt index 45b51e224..f0cf730f3 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/keysbackup/KeysBackupTest.kt +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/keysbackup/KeysBackupTest.kt @@ -16,8 +16,8 @@ package org.matrix.androidsdk.crypto.keysbackup -import android.support.test.InstrumentationRegistry -import android.support.test.runner.AndroidJUnit4 +import androidx.test.InstrumentationRegistry +import androidx.test.runner.AndroidJUnit4 import org.junit.Assert.* import org.junit.FixMethodOrder import org.junit.Test diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/verification/SASTest.kt b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/verification/SASTest.kt index 649b4154e..48efd2f4b 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/verification/SASTest.kt +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/crypto/verification/SASTest.kt @@ -17,8 +17,8 @@ package org.matrix.androidsdk.crypto.verification -import android.support.test.InstrumentationRegistry -import android.support.test.runner.AndroidJUnit4 +import androidx.test.InstrumentationRegistry +import androidx.test.runner.AndroidJUnit4 import org.junit.Assert.* import org.junit.FixMethodOrder import org.junit.Test diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/data/room/RoomAvatarResolverTest.java b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/data/room/RoomAvatarResolverTest.java index bb46034cf..1613d3ada 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/data/room/RoomAvatarResolverTest.java +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/data/room/RoomAvatarResolverTest.java @@ -17,7 +17,7 @@ package org.matrix.androidsdk.data.room; import android.content.Context; -import android.support.test.InstrumentationRegistry; +import androidx.test.InstrumentationRegistry; import junit.framework.Assert; diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/data/room/RoomDisplayNameResolverTest.java b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/data/room/RoomDisplayNameResolverTest.java index 5dc7aafb4..a00e11cec 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/data/room/RoomDisplayNameResolverTest.java +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/data/room/RoomDisplayNameResolverTest.java @@ -17,7 +17,7 @@ package org.matrix.androidsdk.data.room; import android.content.Context; -import android.support.test.InstrumentationRegistry; +import androidx.test.InstrumentationRegistry; import junit.framework.Assert; diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/LazyLoadingTestHelper.java b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/LazyLoadingTestHelper.java index 3e8219675..db73974fa 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/LazyLoadingTestHelper.java +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/LazyLoadingTestHelper.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.lazyloading; import android.content.Context; -import android.support.test.InstrumentationRegistry; +import androidx.test.InstrumentationRegistry; import junit.framework.Assert; diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/RoomMembersTest.java b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/RoomMembersTest.java index 3d4039480..9200f26b0 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/RoomMembersTest.java +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/RoomMembersTest.java @@ -15,7 +15,7 @@ */ package org.matrix.androidsdk.lazyloading; -import android.support.test.InstrumentationRegistry; +import androidx.test.InstrumentationRegistry; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/RoomNameTest.java b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/RoomNameTest.java index 7e3ce91fc..8062152c3 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/RoomNameTest.java +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/RoomNameTest.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.lazyloading; -import android.support.test.InstrumentationRegistry; +import androidx.test.InstrumentationRegistry; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/RoomStateTest.java b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/RoomStateTest.java index c08698bd3..3fa8355ab 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/RoomStateTest.java +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/RoomStateTest.java @@ -15,7 +15,7 @@ */ package org.matrix.androidsdk.lazyloading; -import android.support.test.InstrumentationRegistry; +import androidx.test.InstrumentationRegistry; import android.text.TextUtils; import org.junit.Assert; diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/RoomSummaryTest.java b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/RoomSummaryTest.java index 366a4abe9..a009ed610 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/RoomSummaryTest.java +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/RoomSummaryTest.java @@ -15,7 +15,7 @@ */ package org.matrix.androidsdk.lazyloading; -import android.support.test.InstrumentationRegistry; +import androidx.test.InstrumentationRegistry; import junit.framework.Assert; diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/SearchTest.java b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/SearchTest.java index 96ffc6a39..7d30788d5 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/SearchTest.java +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/lazyloading/SearchTest.java @@ -1,6 +1,6 @@ package org.matrix.androidsdk.lazyloading; -import android.support.test.InstrumentationRegistry; +import androidx.test.InstrumentationRegistry; import junit.framework.Assert; diff --git a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/roomkeys/RoomKeysRestClientTest.kt b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/roomkeys/RoomKeysRestClientTest.kt index ef88e016c..88d762e38 100644 --- a/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/roomkeys/RoomKeysRestClientTest.kt +++ b/matrix-sdk/src/androidTest/java/org/matrix/androidsdk/roomkeys/RoomKeysRestClientTest.kt @@ -16,8 +16,8 @@ package org.matrix.androidsdk.roomkeys -import android.support.test.InstrumentationRegistry -import android.support.test.runner.AndroidJUnit4 +import androidx.test.InstrumentationRegistry +import androidx.test.runner.AndroidJUnit4 import org.junit.Assert.* import org.junit.FixMethodOrder import org.junit.Test diff --git a/matrix-sdk/src/main/assets/www/call.js b/matrix-sdk/src/main/assets/www/call.js index bd1b98088..ace7a368f 100755 --- a/matrix-sdk/src/main/assets/www/call.js +++ b/matrix-sdk/src/main/assets/www/call.js @@ -55,7 +55,7 @@ function MatrixCall(opts) { /** The length of time a call can be ringing for. */ MatrixCall.CALL_TIMEOUT_MS = 120000; /** The fallback server to use for STUN. */ -MatrixCall.FALLBACK_STUN_SERVER = 'stun:stun.l.google.com:19302'; +MatrixCall.FALLBACK_STUN_SERVER = ''; /** * update the matrix call state diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/HomeServerConnectionConfig.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/HomeServerConnectionConfig.java index 97fb50b11..e7bfef5d8 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/HomeServerConnectionConfig.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/HomeServerConnectionConfig.java @@ -18,8 +18,8 @@ package org.matrix.androidsdk; import android.net.Uri; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.TextUtils; import org.json.JSONArray; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/MXDataHandler.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/MXDataHandler.java index f9e0c9af7..11ddf4be6 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/MXDataHandler.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/MXDataHandler.java @@ -20,7 +20,7 @@ import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import com.google.gson.Gson; @@ -180,6 +180,10 @@ public interface RequestNetworkErrorListener { // tell if the lazy loading is enabled private boolean mIsLazyLoadingEnabled; + // Filter for pagination + @Nullable + private RoomEventFilter mCustomPaginationFilter; + /** * Default constructor. * @@ -1029,6 +1033,9 @@ private void manageAccountData(List accountDataElements, boo } else if (AccountDataElement.ACCOUNT_DATA_TYPE_WIDGETS.equals(accountDataElement.type)) { // User widgets manageUserWidgets(accountDataElement); + } else if (AccountDataElement.ACCOUNT_DATA_ACCEPTED_TERMS.equals(accountDataElement.type)) { + // Accepted terms + manageAcceptedTerms(accountDataElement); } } } catch (Exception e) { @@ -1053,6 +1060,10 @@ private void managePushRulesUpdate(AccountDataElement accountDataElement) { onBingRulesUpdate(); } + private void manageAcceptedTerms(AccountDataElement accountDataElement) { + //TODO + } + /** * Check if the ignored users list is updated * @@ -1755,6 +1766,26 @@ private String getLeftRoomsFilter() { return filterBody.toJSONString(); } + /* package */ + void setPaginationFilter(@Nullable RoomEventFilter paginationFilter) { + mCustomPaginationFilter = paginationFilter; + } + + /** + * Get the pagination filter, which can be customized by the client. Lazy loading param is managed here. + * + * @return the RoomEventFilter to use for pagination + */ + public RoomEventFilter getPaginationFilter() { + if (mCustomPaginationFilter != null) { + // Ensure lazy loading param is correct + FilterUtil.enableLazyLoading(mCustomPaginationFilter, isLazyLoadingEnabled()); + return mCustomPaginationFilter; + } else { + return FilterUtil.createRoomEventFilter(isLazyLoadingEnabled()); + } + } + /* * Handle a 'toDevice' event * @param event the event diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/MXSession.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/MXSession.java index 71d647c8d..ce7043f67 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/MXSession.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/MXSession.java @@ -24,9 +24,9 @@ import android.os.AsyncTask; import android.os.Handler; import android.os.Looper; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; import android.text.TextUtils; import org.jetbrains.annotations.NotNull; @@ -67,6 +67,7 @@ import org.matrix.androidsdk.data.store.MXStoreListener; import org.matrix.androidsdk.db.MXLatestChatMessageCache; import org.matrix.androidsdk.db.MXMediaCache; +import org.matrix.androidsdk.features.terms.TermsManager; import org.matrix.androidsdk.groups.GroupsManager; import org.matrix.androidsdk.network.NetworkConnectivityReceiver; import org.matrix.androidsdk.rest.client.AccountDataRestClient; @@ -81,6 +82,7 @@ import org.matrix.androidsdk.rest.client.PushRulesRestClient; import org.matrix.androidsdk.rest.client.PushersRestClient; import org.matrix.androidsdk.rest.client.RoomsRestClient; +import org.matrix.androidsdk.rest.client.TermsRestClient; import org.matrix.androidsdk.rest.client.ThirdPidRestClient; import org.matrix.androidsdk.rest.model.CreateRoomParams; import org.matrix.androidsdk.rest.model.CreateRoomResponse; @@ -93,10 +95,12 @@ import org.matrix.androidsdk.rest.model.bingrules.BingRule; import org.matrix.androidsdk.rest.model.filter.FilterBody; import org.matrix.androidsdk.rest.model.filter.FilterResponse; +import org.matrix.androidsdk.rest.model.filter.RoomEventFilter; import org.matrix.androidsdk.rest.model.login.Credentials; import org.matrix.androidsdk.rest.model.login.LoginFlow; import org.matrix.androidsdk.rest.model.login.RegistrationFlowResponse; import org.matrix.androidsdk.rest.model.login.ThreePidCredentials; +import org.matrix.androidsdk.rest.model.login.TokenRefreshResponse; import org.matrix.androidsdk.rest.model.message.MediaMessage; import org.matrix.androidsdk.rest.model.message.Message; import org.matrix.androidsdk.rest.model.search.SearchResponse; @@ -165,6 +169,8 @@ public class MXSession implements CryptoSession { private BingRulesManager mBingRulesManager = null; + private TermsManager termsManager; + private boolean mIsAliveSession = true; // online status @@ -363,6 +369,8 @@ public void onReadReceiptsLoaded(final String roomId) { mGroupsManager = new GroupsManager(mDataHandler, mGroupsRestClient); mDataHandler.setGroupsManager(mGroupsManager); + + termsManager = new TermsManager(this); } private void checkIfAlive() { @@ -494,6 +502,16 @@ public RoomKeysRestClient getRoomKeysRestClient() { return mCrypto.getKeysBackup().getRoomKeysRestClient(); } + /** + * Get the TermsManager. + * + * @return the TermsManager + */ + public TermsManager getTermsManager() { + checkIfAlive(); + return termsManager; + } + /** * Refresh the presence info of a dedicated user. * @@ -956,9 +974,9 @@ public void startEventStream(final EventsThreadListener anEventsListener, public void refreshToken() { checkIfAlive(); - mProfileRestClient.refreshTokens(new ApiCallback() { + mProfileRestClient.refreshTokens(getCredentials().refreshToken, new ApiCallback() { @Override - public void onSuccess(Credentials info) { + public void onSuccess(TokenRefreshResponse info) { Log.d(LOG_TAG, "refreshToken : succeeds."); } @@ -1068,6 +1086,17 @@ public synchronized void setSyncFilter(FilterBody filter) { convertFilterToFilterId(); } + /** + * Allows setting the filter used for the pagination + * The lazyLoading attribute will be overidden by the Matrix SDK, you do not have to take care of it + * + * @param filter the content of the filter param on pagination requests. Null to reset the filter. + */ + public void setPaginationFilter(@Nullable RoomEventFilter filter) { + Log.d(LOG_TAG, "setPaginationFilter ## " + filter); + mDataHandler.setPaginationFilter(filter); + } + /** * Convert a filter to a filterId * Either it is already known to the server, or send the filter to the server to get a filterId diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/MxEventDispatcher.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/MxEventDispatcher.java index 9ffbe4932..0115c3f9f 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/MxEventDispatcher.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/MxEventDispatcher.java @@ -17,7 +17,7 @@ package org.matrix.androidsdk; import android.os.Looper; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.matrix.androidsdk.core.Log; import org.matrix.androidsdk.core.MXOsHandler; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/RestClient.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/RestClient.java index 627810a8d..631b574fb 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/RestClient.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/RestClient.java @@ -21,8 +21,8 @@ import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.TextUtils; import com.google.gson.Gson; @@ -62,8 +62,14 @@ public class RestClient { * Prefix used in path of identity server API requests. */ public static final String URI_IDENTITY_PATH = "_matrix/identity/api/v1"; + public static final String URI_IDENTITY_PATH_V2 = "_matrix/identity/v2/"; public static final String URI_API_PREFIX_IDENTITY = URI_IDENTITY_PATH + "/"; + /** + * Prefix used for integration manager + */ + public static final String URI_INTEGRATION_MANAGER_PATH = "_matrix/integrations/v1"; + /** * List the servers which should be used to define the base url. */ @@ -75,7 +81,7 @@ public enum EndPointServer { protected static final int CONNECTION_TIMEOUT_MS = 30000; - private Credentials mCredentials; + private String mAccessToken; protected T mApi; @@ -90,7 +96,7 @@ public enum EndPointServer { private static String sUserAgent = null; // http client - private OkHttpClient mOkHttpClient = new OkHttpClient(); + private OkHttpClient mOkHttpClient; public RestClient(HomeServerConnectionConfig hsConfig, Class type, String uriPrefix) { this(hsConfig, type, uriPrefix, JsonUtils.getKotlinGson(), EndPointServer.HOME_SERVER); @@ -129,7 +135,13 @@ public RestClient(HomeServerConnectionConfig hsConfig, Class type, String uri // Private constructor with Gson instance as a parameter private RestClient(HomeServerConnectionConfig hsConfig, Class type, String uriPrefix, Gson gson, EndPointServer endPointServer) { mHsConfig = hsConfig; - mCredentials = hsConfig.getCredentials(); + + if (endPointServer == EndPointServer.HOME_SERVER) { + Credentials credentials = hsConfig.getCredentials(); + if (credentials != null) { + mAccessToken = credentials.accessToken; + } + } Interceptor authenticationInterceptor = new Interceptor() { @@ -143,8 +155,8 @@ public Response intercept(Chain chain) throws IOException { } // Add the access token to all requests if it is set - if ((mCredentials != null) && (mCredentials.accessToken != null)) { - newRequestBuilder.addHeader("Authorization", "Bearer " + mCredentials.accessToken); + if (mAccessToken != null) { + newRequestBuilder.addHeader("Authorization", "Bearer " + mAccessToken); } request = newRequestBuilder.build(); @@ -346,21 +358,12 @@ public void onNetworkConnectionUpdate(boolean isConnected) { } /** - * Get the user's credentials. Typically for saving them somewhere persistent. - * - * @return the user credentials - */ - public Credentials getCredentials() { - return mCredentials; - } - - /** - * Provide the user's credentials. To be called after login or registration. + * Update the Access Token of the Rest Client. To be called after login or registration. * - * @param credentials the user credentials + * @param newAccessToken the new Access Token */ - public void setCredentials(Credentials credentials) { - mCredentials = credentials; + public void setAccessToken(String newAccessToken) { + mAccessToken = newAccessToken; } } diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/adapters/MessageRow.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/adapters/MessageRow.java index 0508293f7..f7fa4978c 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/adapters/MessageRow.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/adapters/MessageRow.java @@ -16,8 +16,8 @@ */ package org.matrix.androidsdk.adapters; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.Spannable; import android.text.SpannableString; import android.text.style.ParagraphStyle; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/call/CallSoundsManager.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/call/CallSoundsManager.java index db9067da8..95efb7856 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/call/CallSoundsManager.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/call/CallSoundsManager.java @@ -28,7 +28,7 @@ import android.os.Environment; import android.os.Vibrator; import android.provider.MediaStore; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.matrix.androidsdk.R; import org.matrix.androidsdk.core.Log; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/call/MXWebRtcCall.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/call/MXWebRtcCall.java index aaff39a34..96bcd2346 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/call/MXWebRtcCall.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/call/MXWebRtcCall.java @@ -20,12 +20,13 @@ import android.annotation.SuppressLint; import android.content.Context; -import android.support.v4.content.ContextCompat; import android.text.TextUtils; import android.util.DisplayMetrics; import android.view.View; import android.widget.RelativeLayout; +import androidx.core.content.ContextCompat; + import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -41,6 +42,8 @@ import org.webrtc.CameraEnumerator; import org.webrtc.CameraVideoCapturer; import org.webrtc.DataChannel; +import org.webrtc.DefaultVideoDecoderFactory; +import org.webrtc.DefaultVideoEncoderFactory; import org.webrtc.EglBase; import org.webrtc.IceCandidate; import org.webrtc.MediaConstraints; @@ -50,6 +53,7 @@ import org.webrtc.RtpReceiver; import org.webrtc.SdpObserver; import org.webrtc.SessionDescription; +import org.webrtc.SurfaceTextureHelper; import org.webrtc.VideoSource; import org.webrtc.VideoTrack; @@ -598,8 +602,7 @@ private void createLocalStream() { // define at least on server if (iceServers.isEmpty()) { - Log.d(LOG_TAG, "## createLocalStream(): use the default google server"); - iceServers.add(new PeerConnection.IceServer("stun:stun.l.google.com:19302")); + Log.d(LOG_TAG, "## createLocalStream(): No iceServers found "); } // define constraints @@ -985,7 +988,12 @@ private void createVideoTrack() { // permission crash Log.d(LOG_TAG, "createVideoTrack find a video capturer"); try { - mVideoSource = mPeerConnectionFactory.createVideoSource(mCameraVideoCapturer); + // Following instruction here: https://stackoverflow.com/questions/55085726/webrtc-create-peerconnectionfactory-object + EglBase rootEglBase = EglUtils.getRootEglBase(); + SurfaceTextureHelper surfaceTextureHelper = SurfaceTextureHelper.create("CaptureThread", rootEglBase.getEglBaseContext()); + mVideoSource = mPeerConnectionFactory.createVideoSource(mCameraVideoCapturer.isScreencast()); + mCameraVideoCapturer.initialize(surfaceTextureHelper, mContext, mVideoSource.getCapturerObserver()); + mCameraVideoCapturer.startCapture(DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_FPS); mLocalVideoTrack = mPeerConnectionFactory.createVideoTrack(VIDEO_TRACK_ID, mVideoSource); @@ -1083,13 +1091,30 @@ public void run() { if (null == mPeerConnectionFactory) { Log.d(LOG_TAG, "## initCallUI(): video call and no mPeerConnectionFactory"); - mPeerConnectionFactory = PeerConnectionFactory.builder().createPeerConnectionFactory(); + // Inspired from https://vivekc.xyz/getting-started-with-webrtc-part-4-de72b58ab31e + //Create a new PeerConnectionFactory instance - using Hardware encoder and decoder. + PeerConnectionFactory.Options options = new PeerConnectionFactory.Options(); + DefaultVideoEncoderFactory defaultVideoEncoderFactory = + new DefaultVideoEncoderFactory( + EglUtils.getRootEglBase().getEglBaseContext(), + /* enableIntelVp8Encoder */true, + /* enableH264HighProfile */true); + DefaultVideoDecoderFactory defaultVideoDecoderFactory = + new DefaultVideoDecoderFactory(EglUtils.getRootEglBase().getEglBaseContext()); + + mPeerConnectionFactory = PeerConnectionFactory.builder() + .setOptions(options) + .setVideoEncoderFactory(defaultVideoEncoderFactory) + .setVideoDecoderFactory(defaultVideoDecoderFactory) + .createPeerConnectionFactory(); // Initialize EGL contexts required for HW acceleration. + /* EglBase.Context eglContext = EglUtils.getRootEglBaseContext(); if (eglContext != null) { mPeerConnectionFactory.setVideoHwAccelerationOptions(eglContext, eglContext); } + */ createVideoTrack(); createAudioTrack(); diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/call/MXWebRtcView.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/call/MXWebRtcView.java index 6bd4177f3..a8809669b 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/call/MXWebRtcView.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/call/MXWebRtcView.java @@ -3,7 +3,7 @@ import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Point; -import android.support.v4.view.ViewCompat; +import androidx.core.view.ViewCompat; import android.util.Log; import android.view.View; import android.view.ViewGroup; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/core/ContentManager.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/core/ContentManager.java index 0fc9f6c70..0dfe30a4c 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/core/ContentManager.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/core/ContentManager.java @@ -17,7 +17,7 @@ package org.matrix.androidsdk.core; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.matrix.androidsdk.HomeServerConnectionConfig; import org.matrix.androidsdk.RestClient; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/core/EventDisplay.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/core/EventDisplay.java index 95f06cf7e..b81279476 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/core/EventDisplay.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/core/EventDisplay.java @@ -19,8 +19,8 @@ import android.content.Context; import android.graphics.Typeface; import android.os.Build; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.Html; import android.text.Spannable; import android.text.SpannableString; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/core/FilterUtil.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/core/FilterUtil.java index 9368e2103..299cff912 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/core/FilterUtil.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/core/FilterUtil.java @@ -16,8 +16,8 @@ package org.matrix.androidsdk.core; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import org.matrix.androidsdk.rest.model.Event; import org.matrix.androidsdk.rest.model.filter.Filter; @@ -133,6 +133,16 @@ public static void enableLazyLoading(FilterBody filterBody, boolean useLazyLoadi } } + /** + * Patch the roomEventFilter to enable or disable the lazy loading + * + * @param roomEventFilter the roomEventFilter to patch + * @param useLazyLoading true to enable lazy loading + */ + public static void enableLazyLoading(@NonNull RoomEventFilter roomEventFilter, boolean useLazyLoading) { + roomEventFilter.lazyLoadMembers = useLazyLoading; + } + /** * Create a RoomEventFilter * diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/core/JsonUtils.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/core/JsonUtils.java index eed565bd8..779f4a18a 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/core/JsonUtils.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/core/JsonUtils.java @@ -17,8 +17,8 @@ */ package org.matrix.androidsdk.core; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import com.google.gson.Gson; import com.google.gson.GsonBuilder; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/core/PermalinkUtils.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/core/PermalinkUtils.java index de8b8a9a3..1767d61d3 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/core/PermalinkUtils.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/core/PermalinkUtils.java @@ -17,8 +17,8 @@ package org.matrix.androidsdk.core; import android.net.Uri; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.TextUtils; import org.matrix.androidsdk.rest.model.Event; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/core/VersionsUtil.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/core/VersionsUtil.java index c6e5022b4..2b73dda6e 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/core/VersionsUtil.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/core/VersionsUtil.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.core; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.matrix.androidsdk.rest.model.Versions; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/DataRetriever.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/DataRetriever.java index 7fde21c9b..fa4f4d948 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/DataRetriever.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/DataRetriever.java @@ -19,7 +19,6 @@ import android.os.Looper; import android.text.TextUtils; -import org.matrix.androidsdk.core.FilterUtil; import org.matrix.androidsdk.core.Log; import org.matrix.androidsdk.core.callback.ApiCallback; import org.matrix.androidsdk.core.callback.SimpleApiCallback; @@ -29,6 +28,7 @@ import org.matrix.androidsdk.rest.client.RoomsRestClient; import org.matrix.androidsdk.rest.model.Event; import org.matrix.androidsdk.rest.model.TokensChunkEvents; +import org.matrix.androidsdk.rest.model.filter.RoomEventFilter; import java.util.Collection; import java.util.HashMap; @@ -113,14 +113,14 @@ public void getEvent(final IMXStore store, final String roomId, final String eve * @param roomId the room Id * @param token the start token. * @param limit the maximum number of messages to retrieve - * @param withLazyLoading true when lazy loading is enabled + * @param roomEventFilter the filter to use * @param callback the callback */ public void backPaginate(final IMXStore store, final String roomId, final String token, final int limit, - final boolean withLazyLoading, + final RoomEventFilter roomEventFilter, final ApiCallback callback) { // reach the marker end if (TextUtils.equals(token, Event.PAGINATE_BACK_TOKEN_END)) { @@ -183,7 +183,7 @@ public void run() { } else { Log.d(LOG_TAG, "## backPaginate() : trigger a remote request"); - mRestClient.getRoomMessagesFrom(roomId, token, EventTimeline.Direction.BACKWARDS, limit, FilterUtil.createRoomEventFilter(withLazyLoading), + mRestClient.getRoomMessagesFrom(roomId, token, EventTimeline.Direction.BACKWARDS, limit, roomEventFilter, new SimpleApiCallback(callback) { @Override public void onSuccess(TokensChunkEvents tokensChunkEvents) { @@ -275,18 +275,17 @@ public void onUnexpectedError(Exception e) { * @param store the store to use * @param roomId the room Id * @param token the start token. - * @param withLazyLoading true when lazy loading is enabled + * @param roomEventFilter the filter to use * @param callback the callback */ private void forwardPaginate(final IMXStore store, final String roomId, final String token, - final boolean withLazyLoading, + final RoomEventFilter roomEventFilter, final ApiCallback callback) { putPendingToken(mPendingForwardRequestTokenByRoomId, roomId, token); - mRestClient.getRoomMessagesFrom(roomId, token, EventTimeline.Direction.FORWARDS, RoomsRestClient.DEFAULT_MESSAGES_PAGINATION_LIMIT, - FilterUtil.createRoomEventFilter(withLazyLoading), + mRestClient.getRoomMessagesFrom(roomId, token, EventTimeline.Direction.FORWARDS, RoomsRestClient.DEFAULT_MESSAGES_PAGINATION_LIMIT, roomEventFilter, new SimpleApiCallback(callback) { @Override public void onSuccess(TokensChunkEvents tokensChunkEvents) { @@ -306,19 +305,19 @@ public void onSuccess(TokensChunkEvents tokensChunkEvents) { * @param roomId the room id * @param token the token to go back from. Null to start from live. * @param direction the pagination direction - * @param withLazyLoading true when lazy loading is enabled + * @param roomEventFilter the filter to use * @param callback the onComplete callback */ public void paginate(final IMXStore store, final String roomId, final String token, final EventTimeline.Direction direction, - final boolean withLazyLoading, + final RoomEventFilter roomEventFilter, final ApiCallback callback) { if (direction == EventTimeline.Direction.BACKWARDS) { - backPaginate(store, roomId, token, RoomsRestClient.DEFAULT_MESSAGES_PAGINATION_LIMIT, withLazyLoading, callback); + backPaginate(store, roomId, token, RoomsRestClient.DEFAULT_MESSAGES_PAGINATION_LIMIT, roomEventFilter, callback); } else { - forwardPaginate(store, roomId, token, withLazyLoading, callback); + forwardPaginate(store, roomId, token, roomEventFilter, callback); } } @@ -329,17 +328,17 @@ public void paginate(final IMXStore store, * @param roomId the room id * @param token the token to go back from. * @param paginationCount the number of events to retrieve. - * @param withLazyLoading true when lazy loading is enabled + * @param roomEventFilter the filter to use for pagination * @param callback the onComplete callback */ public void requestServerRoomHistory(final String roomId, final String token, final int paginationCount, - final boolean withLazyLoading, + final RoomEventFilter roomEventFilter, final ApiCallback callback) { putPendingToken(mPendingRemoteRequestTokenByRoomId, roomId, token); - mRestClient.getRoomMessagesFrom(roomId, token, EventTimeline.Direction.BACKWARDS, paginationCount, FilterUtil.createRoomEventFilter(withLazyLoading), + mRestClient.getRoomMessagesFrom(roomId, token, EventTimeline.Direction.BACKWARDS, paginationCount, roomEventFilter, new SimpleApiCallback(callback) { @Override public void onSuccess(TokensChunkEvents info) { diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/MyUser.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/MyUser.java index a99c224ec..9fdab29f0 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/MyUser.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/MyUser.java @@ -68,7 +68,7 @@ public MyUser(User user) { * @param callback the async callback */ public void updateDisplayName(final String displayName, final ApiCallback callback) { - mDataHandler.getProfileRestClient().updateDisplayname(displayName, new SimpleApiCallback(callback) { + mDataHandler.getProfileRestClient().updateDisplayname(user_id, displayName, new SimpleApiCallback(callback) { @Override public void onSuccess(Void info) { // Update the object member before calling the given callback @@ -87,7 +87,7 @@ public void onSuccess(Void info) { * @param callback the async callback */ public void updateAvatarUrl(final String avatarUrl, final ApiCallback callback) { - mDataHandler.getProfileRestClient().updateAvatarUrl(avatarUrl, new SimpleApiCallback(callback) { + mDataHandler.getProfileRestClient().updateAvatarUrl(user_id, avatarUrl, new SimpleApiCallback(callback) { @Override public void onSuccess(Void info) { // Update the object member before calling the given callback diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/Room.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/Room.java index 1b1e05680..00cf331bf 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/Room.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/Room.java @@ -28,8 +28,8 @@ import android.os.AsyncTask; import android.os.Handler; import android.os.Looper; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.TextUtils; import android.util.Pair; @@ -407,7 +407,7 @@ public void requestServerRoomHistory(final String token, final int paginationCount, final ApiCallback callback) { mDataHandler.getDataRetriever() - .requestServerRoomHistory(getRoomId(), token, paginationCount, mDataHandler.isLazyLoadingEnabled(), + .requestServerRoomHistory(getRoomId(), token, paginationCount, mDataHandler.getPaginationFilter(), new SimpleApiCallback(callback) { @Override public void onSuccess(TokensChunkEvents info) { @@ -2011,7 +2011,7 @@ private void handleRoomAccountDataEvents(List accountDataEvents) { private void addTag(String tag, Double order, final ApiCallback callback) { // sanity check if ((null != tag) && (null != order)) { - mDataHandler.getDataRetriever().getRoomsRestClient().addTag(getRoomId(), tag, order, callback); + mDataHandler.getDataRetriever().getRoomsRestClient().addTag(mMyUserId, getRoomId(), tag, order, callback); } else { if (null != callback) { callback.onSuccess(null); @@ -2028,7 +2028,7 @@ private void addTag(String tag, Double order, final ApiCallback callback) private void removeTag(String tag, final ApiCallback callback) { // sanity check if (null != tag) { - mDataHandler.getDataRetriever().getRoomsRestClient().removeTag(getRoomId(), tag, callback); + mDataHandler.getDataRetriever().getRoomsRestClient().removeTag(mMyUserId, getRoomId(), tag, callback); } else { if (null != callback) { callback.onSuccess(null); @@ -2082,7 +2082,7 @@ public boolean isURLPreviewAllowedByUser() { * @param callback the asynchronous callback */ public void setIsURLPreviewAllowedByUser(boolean status, ApiCallback callback) { - mDataHandler.getDataRetriever().getRoomsRestClient().updateURLPreviewStatus(getRoomId(), status, callback); + mDataHandler.getDataRetriever().getRoomsRestClient().updateURLPreviewStatus(mMyUserId, getRoomId(), status, callback); } //============================================================================================================== diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomAccountData.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomAccountData.java index 851e7644f..8005494f9 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomAccountData.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomAccountData.java @@ -18,7 +18,7 @@ package org.matrix.androidsdk.data; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.matrix.androidsdk.rest.model.Event; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomMediaMessage.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomMediaMessage.java index 2c9f47609..8bd0685aa 100755 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomMediaMessage.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomMediaMessage.java @@ -31,7 +31,7 @@ import android.os.Parcelable; import android.provider.MediaStore; import android.provider.OpenableColumns; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import android.util.Pair; import android.webkit.MimeTypeMap; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomPreviewData.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomPreviewData.java index 2e17449fd..2dd337774 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomPreviewData.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomPreviewData.java @@ -18,7 +18,7 @@ import android.os.AsyncTask; import android.os.Looper; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import org.matrix.androidsdk.MXSession; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomState.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomState.java index 8594c3ec0..28e64f036 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomState.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomState.java @@ -18,9 +18,9 @@ package org.matrix.androidsdk.data; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.VisibleForTesting; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; import android.text.TextUtils; import com.google.gson.JsonObject; @@ -565,8 +565,6 @@ public RoomMember getMember(String userId) { } if (member == null) { - Log.w(LOG_TAG, "## Null member '" + userId); - if (TextUtils.equals(getDataHandler().getUserId(), userId)) { // This should never happen Log.e(LOG_TAG, "## Null current user '" + userId); diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomSummary.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomSummary.java index 067db1d01..393fa0555 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomSummary.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/RoomSummary.java @@ -18,8 +18,8 @@ package org.matrix.androidsdk.data; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.TextUtils; import com.google.gson.JsonElement; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/room/RoomAvatarResolver.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/room/RoomAvatarResolver.java index 2e2816a6f..ca56b5798 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/room/RoomAvatarResolver.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/room/RoomAvatarResolver.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.data.room; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import org.matrix.androidsdk.data.Room; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/room/RoomDisplayNameResolver.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/room/RoomDisplayNameResolver.java index b44ba76b0..df4ca1843 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/room/RoomDisplayNameResolver.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/room/RoomDisplayNameResolver.java @@ -17,8 +17,8 @@ package org.matrix.androidsdk.data.room; import android.content.Context; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.TextUtils; import org.matrix.androidsdk.R; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/store/IMXStore.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/store/IMXStore.java index 2ff3f8185..91bc05ec0 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/store/IMXStore.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/store/IMXStore.java @@ -19,7 +19,7 @@ package org.matrix.androidsdk.data.store; import android.content.Context; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.matrix.androidsdk.core.callback.ApiCallback; import org.matrix.androidsdk.crypto.interfaces.CryptoStore; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/store/MXFileStore.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/store/MXFileStore.java index 539d2f624..cad73ccd3 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/store/MXFileStore.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/store/MXFileStore.java @@ -20,8 +20,8 @@ import android.content.Context; import android.os.HandlerThread; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.TextUtils; import org.matrix.androidsdk.HomeServerConnectionConfig; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/store/MXMemoryStore.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/store/MXMemoryStore.java index 3511c1b20..185f3ef3e 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/store/MXMemoryStore.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/store/MXMemoryStore.java @@ -21,7 +21,7 @@ import android.content.Context; import android.os.Handler; import android.os.Looper; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import org.matrix.androidsdk.core.Log; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/EventTimeline.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/EventTimeline.java index 27850d6c4..08722d50b 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/EventTimeline.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/EventTimeline.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.data.timeline; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.matrix.androidsdk.core.callback.ApiCallback; import org.matrix.androidsdk.data.Room; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/EventTimelineFactory.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/EventTimelineFactory.java index fc705d792..e8d196bb4 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/EventTimelineFactory.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/EventTimelineFactory.java @@ -16,8 +16,8 @@ package org.matrix.androidsdk.data.timeline; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import org.matrix.androidsdk.MXDataHandler; import org.matrix.androidsdk.data.Room; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/MXEventTimeline.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/MXEventTimeline.java index de8a60393..873fbefc7 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/MXEventTimeline.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/MXEventTimeline.java @@ -20,8 +20,8 @@ import android.os.AsyncTask; import android.os.Looper; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.TextUtils; import org.matrix.androidsdk.MXDataHandler; @@ -429,12 +429,14 @@ private void manageBackEvents(int maxEventCount, final ApiCallback call mEventListeners.onEvent(snapshotedEvent.mEvent, Direction.BACKWARDS, snapshotedEvent.mState); } - // https://github.com/vector-im/vector-android/pull/354 - // defines a new summary if the known is not supported - RoomSummary summary = mStore.getSummary(mRoomId); - - if (null != latestSupportedEvent && (null == summary || !RoomSummary.isSupportedEvent(summary.getLatestReceivedEvent()))) { - mStore.storeSummary(new RoomSummary(null, latestSupportedEvent, getState(), mDataHandler.getUserId())); + // Update potentially the summary last event + if (null != latestSupportedEvent) { + RoomSummary summary = mStore.getSummary(mRoomId); + if (summary == null) { + mStore.storeSummary(new RoomSummary(null, latestSupportedEvent, getState(), mDataHandler.getUserId())); + } else if (!RoomSummary.isSupportedEvent(summary.getLatestReceivedEvent())) { + summary.setLatestReceivedEvent(latestSupportedEvent, getState()); + } } Log.d(LOG_TAG, "manageEvents : commit"); @@ -685,7 +687,7 @@ public void run() { return true; } - mDataHandler.getDataRetriever().backPaginate(mStore, mRoomId, getBackState().getToken(), eventCount, mDataHandler.isLazyLoadingEnabled(), + mDataHandler.getDataRetriever().backPaginate(mStore, mRoomId, getBackState().getToken(), eventCount, mDataHandler.getPaginationFilter(), new SimpleApiCallback(callback) { @Override public void onSuccess(TokensChunkEvents response) { @@ -780,7 +782,7 @@ public boolean forwardPaginate(final ApiCallback callback) { mIsForwardPaginating = true; - mDataHandler.getDataRetriever().paginate(mStore, mRoomId, mForwardsPaginationToken, Direction.FORWARDS, mDataHandler.isLazyLoadingEnabled(), + mDataHandler.getDataRetriever().paginate(mStore, mRoomId, mForwardsPaginationToken, Direction.FORWARDS, mDataHandler.getPaginationFilter(), new SimpleApiCallback(callback) { @Override public void onSuccess(TokensChunkEvents response) { diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/StateEventRedactionChecker.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/StateEventRedactionChecker.java index 04f37c739..7f87bb980 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/StateEventRedactionChecker.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/StateEventRedactionChecker.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.data.timeline; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import org.matrix.androidsdk.MXDataHandler; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineEventListeners.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineEventListeners.java index c6740fad3..d835c8f61 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineEventListeners.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineEventListeners.java @@ -18,8 +18,8 @@ import android.os.Handler; import android.os.Looper; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import org.matrix.androidsdk.core.Log; import org.matrix.androidsdk.data.RoomState; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineEventSaver.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineEventSaver.java index 74ee1df1e..cbe8775ce 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineEventSaver.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineEventSaver.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.data.timeline; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.matrix.androidsdk.MXDataHandler; import org.matrix.androidsdk.data.Room; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineInvitedRoomSyncHandler.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineInvitedRoomSyncHandler.java index 65a781dec..07ba5b121 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineInvitedRoomSyncHandler.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineInvitedRoomSyncHandler.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.data.timeline; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.matrix.androidsdk.data.Room; import org.matrix.androidsdk.rest.model.Event; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineJoinRoomSyncHandler.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineJoinRoomSyncHandler.java index fdc2f32d8..931be03b4 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineJoinRoomSyncHandler.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineJoinRoomSyncHandler.java @@ -1,7 +1,7 @@ package org.matrix.androidsdk.data.timeline; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.TextUtils; import org.matrix.androidsdk.MXDataHandler; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineLiveEventHandler.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineLiveEventHandler.java index 5995119af..e0b14261c 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineLiveEventHandler.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineLiveEventHandler.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.data.timeline; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import org.matrix.androidsdk.MXDataHandler; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelinePushWorker.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelinePushWorker.java index ff19ac67c..fb73a805f 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelinePushWorker.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelinePushWorker.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.data.timeline; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import com.google.gson.JsonObject; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineStateHolder.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineStateHolder.java index 53bd0da39..6b574f5de 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineStateHolder.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/data/timeline/TimelineStateHolder.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.data.timeline; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.matrix.androidsdk.MXDataHandler; import org.matrix.androidsdk.data.RoomState; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/db/MXMediaCache.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/db/MXMediaCache.java index 9d23c08a7..c170f6c89 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/db/MXMediaCache.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/db/MXMediaCache.java @@ -26,7 +26,7 @@ import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import android.webkit.MimeTypeMap; import android.widget.ImageView; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/db/MXMediaDownloadWorkerTask.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/db/MXMediaDownloadWorkerTask.java index f79bdd0e6..0717ca6ac 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/db/MXMediaDownloadWorkerTask.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/db/MXMediaDownloadWorkerTask.java @@ -22,8 +22,8 @@ import android.graphics.BitmapFactory; import android.net.Uri; import android.os.AsyncTask; -import android.support.annotation.Nullable; -import android.support.v4.util.LruCache; +import androidx.annotation.Nullable; +import androidx.collection.LruCache; import android.text.TextUtils; import android.util.Pair; import android.webkit.MimeTypeMap; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/features/terms/GetTermsResponse.kt b/matrix-sdk/src/main/java/org/matrix/androidsdk/features/terms/GetTermsResponse.kt new file mode 100644 index 000000000..2c9f9d3af --- /dev/null +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/features/terms/GetTermsResponse.kt @@ -0,0 +1,24 @@ +/* + * Copyright 2019 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. + * 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.androidsdk.features.terms + +import org.matrix.androidsdk.rest.model.terms.TermsResponse + +data class GetTermsResponse( + val serverResponse: TermsResponse, + val alreadyAcceptedTermUrls: Set +) diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/features/terms/TermsManager.kt b/matrix-sdk/src/main/java/org/matrix/androidsdk/features/terms/TermsManager.kt new file mode 100644 index 000000000..b330aa39a --- /dev/null +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/features/terms/TermsManager.kt @@ -0,0 +1,94 @@ +/* + * Copyright 2019 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. + * 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.androidsdk.features.terms + +import org.matrix.androidsdk.MXSession +import org.matrix.androidsdk.RestClient +import org.matrix.androidsdk.core.Log +import org.matrix.androidsdk.core.callback.ApiCallback +import org.matrix.androidsdk.core.callback.SimpleApiCallback +import org.matrix.androidsdk.rest.client.TermsRestClient +import org.matrix.androidsdk.rest.model.sync.AccountDataElement +import org.matrix.androidsdk.rest.model.terms.TermsResponse + +class TermsManager(private val mxSession: MXSession) { + private val termsRestClient = TermsRestClient() + + enum class ServiceType { + IntegrationManager, + IdentityService + } + + fun get(serviceType: ServiceType, baseUrl: String, callback: ApiCallback) { + val url = when (serviceType) { + ServiceType.IntegrationManager -> "$baseUrl${RestClient.URI_INTEGRATION_MANAGER_PATH}" + ServiceType.IdentityService -> "$baseUrl${RestClient.URI_IDENTITY_PATH_V2}" + } + + termsRestClient.get(url, object : SimpleApiCallback(callback) { + override fun onSuccess(info: TermsResponse) { + callback.onSuccess(GetTermsResponse(info, getAlreadyAcceptedTermUrlsFromAccountData())) + } + }) + } + + fun agreeToTerms(serviceType: ServiceType, baseUrl: String, agreedUrls: List, token: String?, callback: ApiCallback) { + termsRestClient.setAccessToken(token) + + val url = when (serviceType) { + ServiceType.IntegrationManager -> "$baseUrl${RestClient.URI_INTEGRATION_MANAGER_PATH}" + ServiceType.IdentityService -> "$baseUrl${RestClient.URI_IDENTITY_PATH_V2}" + } + + termsRestClient.agreeToTerms(url, agreedUrls, object : SimpleApiCallback(callback) { + override fun onSuccess(info: Unit) { + //client SHOULD update this account data section adding any the URLs + // of any additional documents that the user agreed to this list. + //Get current m.accepted_terms append new ones and update account data + val listOfAcceptedTerms = getAlreadyAcceptedTermUrlsFromAccountData() + + val newList = listOfAcceptedTerms.toMutableSet().apply { addAll(agreedUrls) }.toList() + + mxSession.myUserId.let { userId -> + mxSession.accountDataRestClient?.setAccountData( + userId, + AccountDataElement.ACCOUNT_DATA_ACCEPTED_TERMS, + mapOf(AccountDataElement.ACCOUNT_DATA_KEY_ACCEPTED_TERMS to newList), + object : SimpleApiCallback(callback) { + override fun onSuccess(info: Void?) { + Log.d(LOG_TAG, "Account data accepted terms updated") + callback.onSuccess(Unit) + } + } + ) + } + } + }) + } + + private fun getAlreadyAcceptedTermUrlsFromAccountData(): Set { + val accountDataCurrentAcceptedTerms = + mxSession.dataHandler.store.getAccountDataElement(AccountDataElement.ACCOUNT_DATA_ACCEPTED_TERMS) + + return accountDataCurrentAcceptedTerms?.content + ?.get(AccountDataElement.ACCOUNT_DATA_KEY_ACCEPTED_TERMS) as? Set ?: emptySet() + } + + companion object { + private const val LOG_TAG = "TermsManager" + } +} \ No newline at end of file diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/features/terms/TermsNotSignedException.kt b/matrix-sdk/src/main/java/org/matrix/androidsdk/features/terms/TermsNotSignedException.kt new file mode 100644 index 000000000..d74e6c6f8 --- /dev/null +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/features/terms/TermsNotSignedException.kt @@ -0,0 +1,19 @@ +/* + * Copyright 2019 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. + * 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.androidsdk.features.terms + +class TermsNotSignedException(val token: String?) : Exception() \ No newline at end of file diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/fragments/MatrixMessageListFragment.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/fragments/MatrixMessageListFragment.java index dc3bb78a8..a66a6ac1a 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/fragments/MatrixMessageListFragment.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/fragments/MatrixMessageListFragment.java @@ -23,11 +23,11 @@ import android.os.Bundle; import android.os.Handler; import android.os.Looper; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v7.app.AlertDialog; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentManager; +import androidx.appcompat.app.AlertDialog; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.MotionEvent; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/fragments/MatrixMessagesFragment.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/fragments/MatrixMessagesFragment.java index bb20cfa3b..c7ba6afb4 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/fragments/MatrixMessagesFragment.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/fragments/MatrixMessagesFragment.java @@ -21,7 +21,7 @@ import android.content.Context; import android.os.Bundle; import android.os.Looper; -import android.support.v4.app.Fragment; +import androidx.fragment.app.Fragment; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/groups/GroupsManager.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/groups/GroupsManager.java index 3ddc403af..63fef5e84 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/groups/GroupsManager.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/groups/GroupsManager.java @@ -18,7 +18,7 @@ import android.os.Handler; import android.os.Looper; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import org.matrix.androidsdk.MXDataHandler; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/interfaces/HtmlToolbox.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/interfaces/HtmlToolbox.java index 68d839a71..55413dd9c 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/interfaces/HtmlToolbox.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/interfaces/HtmlToolbox.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.interfaces; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.Html; public interface HtmlToolbox { diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/listeners/MXRoomEventListener.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/listeners/MXRoomEventListener.java index 6c7c553b5..510d9961b 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/listeners/MXRoomEventListener.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/listeners/MXRoomEventListener.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.listeners; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import org.matrix.androidsdk.core.Log; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/api/RoomsApi.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/api/RoomsApi.java index befe48022..e513e08a7 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/api/RoomsApi.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/api/RoomsApi.java @@ -17,7 +17,7 @@ */ package org.matrix.androidsdk.rest.api; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/api/TermsApi.kt b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/api/TermsApi.kt new file mode 100644 index 000000000..2ed46b7d5 --- /dev/null +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/api/TermsApi.kt @@ -0,0 +1,36 @@ +/* + * Copyright 2019 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. + * 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.androidsdk.rest.api + +import org.matrix.androidsdk.rest.model.terms.AcceptTermsBody +import org.matrix.androidsdk.rest.model.terms.TermsResponse +import retrofit2.Call +import retrofit2.http.Body +import retrofit2.http.GET +import retrofit2.http.POST +import retrofit2.http.Url + +interface TermsApi { + + @GET + fun getTerms(@Url url: String): Call + + @POST + fun agreeToTerms(@Url url: String, @Body params: AcceptTermsBody): Call + + +} \ No newline at end of file diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/LoginRestClient.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/LoginRestClient.java index 5b2e364c8..bc4bffc5a 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/LoginRestClient.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/LoginRestClient.java @@ -18,7 +18,7 @@ package org.matrix.androidsdk.rest.client; import android.os.Build; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import org.matrix.androidsdk.HomeServerConnectionConfig; @@ -131,7 +131,7 @@ public void register(final RegistrationParams params, final ApiCallback(description, mUnsentEventsManager, new SimpleApiCallback(callback) { @Override public void onSuccess(Credentials info) { - setCredentials(info); + setAccessToken(info.accessToken); callback.onSuccess(info); } }, new RestAdapterCallback.RequestRetryCallBack() { @@ -275,7 +275,7 @@ private void login(final LoginParams params, final ApiCallback call .enqueue(new RestAdapterCallback(description, mUnsentEventsManager, new SimpleApiCallback(callback) { @Override public void onSuccess(Credentials info) { - setCredentials(info); + setAccessToken(info.accessToken); callback.onSuccess(info); } }, new RestAdapterCallback.RequestRetryCallBack() { @@ -327,7 +327,7 @@ public void loginWithToken(final String user, final String token, final String t .enqueue(new RestAdapterCallback(description, mUnsentEventsManager, new SimpleApiCallback(callback) { @Override public void onSuccess(Credentials info) { - setCredentials(info); + setAccessToken(info.accessToken); callback.onSuccess(info); } }, new RestAdapterCallback.RequestRetryCallBack() { diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/MXRestExecutorService.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/MXRestExecutorService.java index cfcbe7562..56ac5989f 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/MXRestExecutorService.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/MXRestExecutorService.java @@ -17,7 +17,7 @@ package org.matrix.androidsdk.rest.client; import android.os.HandlerThread; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import org.matrix.androidsdk.core.MXOsHandler; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/MediaScanRestClient.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/MediaScanRestClient.java index 010aa4c45..29e05ce87 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/MediaScanRestClient.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/MediaScanRestClient.java @@ -15,7 +15,7 @@ */ package org.matrix.androidsdk.rest.client; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import org.matrix.androidsdk.HomeServerConnectionConfig; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/ProfileRestClient.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/ProfileRestClient.java index ff5874a82..b5747c4e7 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/ProfileRestClient.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/ProfileRestClient.java @@ -21,6 +21,7 @@ import org.matrix.androidsdk.HomeServerConnectionConfig; import org.matrix.androidsdk.RestClient; import org.matrix.androidsdk.core.callback.ApiCallback; +import org.matrix.androidsdk.core.callback.SimpleApiCallback; import org.matrix.androidsdk.rest.api.ProfileApi; import org.matrix.androidsdk.rest.callback.RestAdapterCallback; import org.matrix.androidsdk.rest.model.ChangePasswordParams; @@ -35,7 +36,6 @@ import org.matrix.androidsdk.rest.model.User; import org.matrix.androidsdk.rest.model.login.AuthParamsEmailIdentity; import org.matrix.androidsdk.rest.model.login.AuthParamsLoginPassword; -import org.matrix.androidsdk.rest.model.login.Credentials; import org.matrix.androidsdk.rest.model.login.ThreePidCredentials; import org.matrix.androidsdk.rest.model.login.TokenRefreshParams; import org.matrix.androidsdk.rest.model.login.TokenRefreshResponse; @@ -89,10 +89,11 @@ public void success(User user, Response response) { /** * Update this user's own display name. * + * @param userId the userId * @param newName the new name * @param callback the callback if the call succeeds */ - public void updateDisplayname(final String newName, final ApiCallback callback) { + public void updateDisplayname(final String userId, final String newName, final ApiCallback callback) { // privacy //final String description = "updateDisplayname newName : " + newName; final String description = "update display name"; @@ -103,11 +104,11 @@ public void updateDisplayname(final String newName, final ApiCallback call // don't retry if the network comes back // let the user chooses what he want to do - mApi.displayname(getCredentials().userId, user) + mApi.displayname(userId, user) .enqueue(new RestAdapterCallback(description, mUnsentEventsManager, callback, new RestAdapterCallback.RequestRetryCallBack() { @Override public void onRetry() { - updateDisplayname(newName, callback); + updateDisplayname(userId, newName, callback); } })); } @@ -139,10 +140,11 @@ public void success(User user, Response response) { /** * Update this user's own avatar URL. * + * @param userId the userId * @param newUrl the new name * @param callback the callback if the call succeeds */ - public void updateAvatarUrl(final String newUrl, final ApiCallback callback) { + public void updateAvatarUrl(final String userId, final String newUrl, final ApiCallback callback) { // privacy //final String description = "updateAvatarUrl newUrl : " + newUrl; final String description = "updateAvatarUrl"; @@ -151,11 +153,11 @@ public void updateAvatarUrl(final String newUrl, final ApiCallback callbac User user = new User(); user.setAvatarUrl(newUrl); - mApi.avatarUrl(getCredentials().userId, user) + mApi.avatarUrl(userId, user) .enqueue(new RestAdapterCallback(description, mUnsentEventsManager, callback, new RestAdapterCallback.RequestRetryCallBack() { @Override public void onRetry() { - updateAvatarUrl(newUrl, callback); + updateAvatarUrl(userId, newUrl, callback); } })); } @@ -291,25 +293,28 @@ public void onRetry() { /** * Refresh access/refresh tokens, using the current refresh token. * - * @param callback the callback success and failure callback + * @param refreshToken the refreshToken + * @param callback the callback success and failure callback */ - public void refreshTokens(final ApiCallback callback) { + public void refreshTokens(final String refreshToken, final ApiCallback callback) { final String description = "refreshTokens"; TokenRefreshParams params = new TokenRefreshParams(); - params.refresh_token = getCredentials().refreshToken; + params.refresh_token = refreshToken; mApi.tokenRefresh(params) - .enqueue(new RestAdapterCallback(description, mUnsentEventsManager, callback, null) { - @Override - public void success(TokenRefreshResponse tokenResponse, Response response) { - onEventSent(); - getCredentials().refreshToken = tokenResponse.refreshToken; - getCredentials().accessToken = tokenResponse.accessToken; - if (null != callback) { - callback.onSuccess(getCredentials()); - } - } + .enqueue(new RestAdapterCallback(description, + mUnsentEventsManager, + new SimpleApiCallback(callback) { + @Override + public void onSuccess(TokenRefreshResponse info) { + setAccessToken(info.accessToken); + if (null != callback) { + callback.onSuccess(info); + } + } + }, + null) { }); } diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/RoomsRestClient.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/RoomsRestClient.java index f756b72c1..548828d8c 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/RoomsRestClient.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/RoomsRestClient.java @@ -18,7 +18,7 @@ package org.matrix.androidsdk.rest.client; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import com.google.gson.JsonElement; @@ -841,22 +841,23 @@ public void onRetry() { * Add a tag to a room. * Use this method to update the order of an existing tag. * + * @param userId the userId * @param roomId the roomId * @param tag the new tag to add to the room. * @param order the order. * @param callback the operation callback */ - public void addTag(final String roomId, final String tag, final Double order, final ApiCallback callback) { + public void addTag(final String userId, final String roomId, final String tag, final Double order, final ApiCallback callback) { final String description = "addTag : roomId " + roomId + " - tag " + tag + " - order " + order; Map hashMap = new HashMap<>(); hashMap.put("order", order); - mApi.addTag(getCredentials().userId, roomId, tag, hashMap) + mApi.addTag(userId, roomId, tag, hashMap) .enqueue(new RestAdapterCallback(description, mUnsentEventsManager, callback, new RestAdapterCallback.RequestRetryCallBack() { @Override public void onRetry() { - addTag(roomId, tag, order, callback); + addTag(userId, roomId, tag, order, callback); } })); } @@ -864,18 +865,19 @@ public void onRetry() { /** * Remove a tag to a room. * + * @param userId the userId * @param roomId the roomId * @param tag the new tag to add to the room. * @param callback the operation callback */ - public void removeTag(final String roomId, final String tag, final ApiCallback callback) { + public void removeTag(final String userId, final String roomId, final String tag, final ApiCallback callback) { final String description = "removeTag : roomId " + roomId + " - tag " + tag; - mApi.removeTag(getCredentials().userId, roomId, tag) + mApi.removeTag(userId, roomId, tag) .enqueue(new RestAdapterCallback(description, mUnsentEventsManager, callback, new RestAdapterCallback.RequestRetryCallBack() { @Override public void onRetry() { - removeTag(roomId, tag, callback); + removeTag(userId, roomId, tag, callback); } })); } @@ -883,21 +885,22 @@ public void onRetry() { /** * Update the URL preview status * + * @param userId the userId * @param roomId the roomId * @param status the new status * @param callback the operation callback */ - public void updateURLPreviewStatus(final String roomId, final boolean status, final ApiCallback callback) { + public void updateURLPreviewStatus(final String userId, final String roomId, final boolean status, final ApiCallback callback) { final String description = "updateURLPreviewStatus : roomId " + roomId + " - status " + status; Map params = new HashMap<>(); params.put(AccountDataElement.ACCOUNT_DATA_KEY_URL_PREVIEW_DISABLE, !status); - mApi.updateAccountData(getCredentials().userId, roomId, Event.EVENT_TYPE_URL_PREVIEW, params) + mApi.updateAccountData(userId, roomId, Event.EVENT_TYPE_URL_PREVIEW, params) .enqueue(new RestAdapterCallback(description, mUnsentEventsManager, callback, new RestAdapterCallback.RequestRetryCallBack() { @Override public void onRetry() { - updateURLPreviewStatus(roomId, status, callback); + updateURLPreviewStatus(userId, roomId, status, callback); } })); } diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/TermsRestClient.kt b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/TermsRestClient.kt new file mode 100644 index 000000000..83295e415 --- /dev/null +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/client/TermsRestClient.kt @@ -0,0 +1,41 @@ +/* + * Copyright 2019 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. + * 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.androidsdk.rest.client + +import android.net.Uri +import org.matrix.androidsdk.HomeServerConnectionConfig +import org.matrix.androidsdk.RestClient +import org.matrix.androidsdk.core.callback.ApiCallback +import org.matrix.androidsdk.core.rest.DefaultRetrofit2CallbackWrapper +import org.matrix.androidsdk.rest.api.TermsApi +import org.matrix.androidsdk.rest.model.terms.AcceptTermsBody +import org.matrix.androidsdk.rest.model.terms.TermsResponse + +internal class TermsRestClient : + RestClient(HomeServerConnectionConfig.Builder() + .withHomeServerUri(Uri.parse("https://foo.bar")) + .build(), + TermsApi::class.java, "") { + + fun get(prefix: String, callback: ApiCallback) { + mApi.getTerms("$prefix/terms").enqueue(DefaultRetrofit2CallbackWrapper(callback)) + } + + fun agreeToTerms(prefix: String, agreedUrls: List, callback: ApiCallback) { + mApi.agreeToTerms("$prefix/terms", AcceptTermsBody(agreedUrls)).enqueue(DefaultRetrofit2CallbackWrapper(callback)) + } + +} \ No newline at end of file diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/CreateRoomParams.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/CreateRoomParams.java index 0cbace4c5..cf1874c90 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/CreateRoomParams.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/CreateRoomParams.java @@ -17,7 +17,7 @@ package org.matrix.androidsdk.rest.model; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import com.google.gson.annotations.SerializedName; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/Event.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/Event.java index c674b444f..cb40ccc7f 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/Event.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/Event.java @@ -17,7 +17,7 @@ */ package org.matrix.androidsdk.rest.model; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import com.google.gson.JsonElement; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/bingrules/PushRuleSet.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/bingrules/PushRuleSet.java index c292983b3..1f3c6f0d4 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/bingrules/PushRuleSet.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/bingrules/PushRuleSet.java @@ -16,8 +16,8 @@ */ package org.matrix.androidsdk.rest.model.bingrules; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import android.text.TextUtils; import java.util.ArrayList; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/login/PasswordLoginParams.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/login/PasswordLoginParams.java index 76314144a..820d17665 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/login/PasswordLoginParams.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/login/PasswordLoginParams.java @@ -18,7 +18,7 @@ package org.matrix.androidsdk.rest.model.login; import android.os.Build; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.text.TextUtils; import org.matrix.androidsdk.rest.client.LoginRestClient; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/message/FileMessage.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/message/FileMessage.java index 63eca2ba6..b4b78f337 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/message/FileMessage.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/message/FileMessage.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.rest.model.message; import android.content.ClipDescription; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import android.text.TextUtils; import android.webkit.MimeTypeMap; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/message/ImageMessage.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/message/ImageMessage.java index 6a7132a9c..b86e19899 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/message/ImageMessage.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/message/ImageMessage.java @@ -17,7 +17,7 @@ package org.matrix.androidsdk.rest.model.message; import android.media.ExifInterface; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.matrix.androidsdk.crypto.MXEncryptedAttachments; import org.matrix.androidsdk.crypto.model.crypto.EncryptedFileInfo; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/message/MediaMessage.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/message/MediaMessage.java index 087192d89..6a7b678fc 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/message/MediaMessage.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/message/MediaMessage.java @@ -16,7 +16,7 @@ package org.matrix.androidsdk.rest.model.message; import android.net.Uri; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.matrix.androidsdk.core.Log; import org.matrix.androidsdk.crypto.MXEncryptedAttachments; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/message/VideoMessage.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/message/VideoMessage.java index 2af3472b1..7e98403dd 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/message/VideoMessage.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/message/VideoMessage.java @@ -15,7 +15,7 @@ */ package org.matrix.androidsdk.rest.model.message; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import org.matrix.androidsdk.crypto.MXEncryptedAttachments; import org.matrix.androidsdk.crypto.model.crypto.EncryptedFileInfo; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/sync/AccountDataElement.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/sync/AccountDataElement.java index 6bad708f5..43b35032d 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/sync/AccountDataElement.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/sync/AccountDataElement.java @@ -29,12 +29,15 @@ public class AccountDataElement implements Serializable { public static final String ACCOUNT_DATA_TYPE_PREVIEW_URLS = "org.matrix.preview_urls"; public static final String ACCOUNT_DATA_TYPE_WIDGETS = "m.widgets"; public static final String ACCOUNT_DATA_TYPE_PUSH_RULES = "m.push_rules"; + public static final String ACCOUNT_DATA_ACCEPTED_TERMS = "m.accepted_terms"; + /** * Account data known possible values for key in {@link #content} */ public static final String ACCOUNT_DATA_KEY_IGNORED_USERS = "ignored_users"; public static final String ACCOUNT_DATA_KEY_URL_PREVIEW_DISABLE = "disable"; + public static final String ACCOUNT_DATA_KEY_ACCEPTED_TERMS = "accepted"; // Type of account data element public String type; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/terms/AcceptTermsBody.kt b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/terms/AcceptTermsBody.kt new file mode 100644 index 000000000..ae5273674 --- /dev/null +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/terms/AcceptTermsBody.kt @@ -0,0 +1,28 @@ +/* + * Copyright 2019 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. + * 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.androidsdk.rest.model.terms + +import com.google.gson.annotations.SerializedName + +/** + * This class represent a list of urls of terms the user wants to accept + */ +data class AcceptTermsBody( + @JvmField + @SerializedName("user_accepts") + val acceptedTermUrls: List +) diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/terms/TermsResponse.kt b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/terms/TermsResponse.kt new file mode 100644 index 000000000..d91f3bce9 --- /dev/null +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/rest/model/terms/TermsResponse.kt @@ -0,0 +1,71 @@ +/* + * Copyright 2019 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. + * 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.androidsdk.rest.model.terms + +import com.google.gson.annotations.SerializedName +import org.matrix.androidsdk.rest.model.login.LocalizedFlowDataLoginTerms + +/** + * This class represent a localized privacy policy for registration Flow. + */ +data class TermsResponse( + @JvmField + @SerializedName("policies") + val policies: Map? = null +) { + + fun getLocalizedTermOfServices(userLanguage: String, + defaultLanguage: String = "en"): LocalizedFlowDataLoginTerms? { + return (policies?.get(TERMS_OF_SERVICE) as? Map<*, *>)?.let { tos -> + ((tos[userLanguage] ?: tos[defaultLanguage]) as? Map<*, *>)?.let { termsMap -> + val name = termsMap[NAME] as? String + val url = termsMap[URL] as? String + LocalizedFlowDataLoginTerms( + policyName = TERMS_OF_SERVICE, + localizedUrl = url, + localizedName = name, + version = tos[VERSION] as? String + ) + } + } + } + + fun getLocalizedPrivacyPolicies(userLanguage: String, + defaultLanguage: String = "en"): LocalizedFlowDataLoginTerms? { + return (policies?.get(PRIVACY_POLICY) as? Map<*, *>)?.let { tos -> + ((tos[userLanguage] ?: tos[defaultLanguage]) as? Map<*, *>)?.let { termsMap -> + val name = termsMap[NAME] as? String + val url = termsMap[URL] as? String + LocalizedFlowDataLoginTerms( + policyName = TERMS_OF_SERVICE, + localizedUrl = url, + localizedName = name, + version = tos[VERSION] as? String + ) + } + } + } + + companion object { + const val TERMS_OF_SERVICE = "terms_of_service" + const val PRIVACY_POLICY = "privacy_policy" + const val VERSION = "version" + const val NAME = "name" + const val URL = "url" + } +} + diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/ssl/CertUtil.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/ssl/CertUtil.java index 13d8208a4..9b8c5a0ec 100644 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/ssl/CertUtil.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/ssl/CertUtil.java @@ -17,7 +17,7 @@ package org.matrix.androidsdk.ssl; -import android.support.annotation.NonNull; +import androidx.annotation.NonNull; import android.util.Pair; import org.matrix.androidsdk.HomeServerConnectionConfig; diff --git a/matrix-sdk/src/main/java/org/matrix/androidsdk/view/HtmlTagHandler.java b/matrix-sdk/src/main/java/org/matrix/androidsdk/view/HtmlTagHandler.java index 45a4d0bf4..5096eaf67 100755 --- a/matrix-sdk/src/main/java/org/matrix/androidsdk/view/HtmlTagHandler.java +++ b/matrix-sdk/src/main/java/org/matrix/androidsdk/view/HtmlTagHandler.java @@ -20,8 +20,8 @@ package org.matrix.androidsdk.view; import android.content.Context; -import android.support.annotation.ColorInt; -import android.support.v4.content.ContextCompat; +import androidx.annotation.ColorInt; +import androidx.core.content.ContextCompat; import android.text.Editable; import android.text.Html; import android.text.Layout; diff --git a/matrix-sdk/src/main/res/values-bg/strings.xml b/matrix-sdk/src/main/res/values-bg/strings.xml index 106febb97..743f38e64 100644 --- a/matrix-sdk/src/main/res/values-bg/strings.xml +++ b/matrix-sdk/src/main/res/values-bg/strings.xml @@ -150,4 +150,21 @@ Папка Карфица + Начална синхронизация: +\nИмпортиране на профил… + Начална синхронизация: +\nИмпортиране на данни за шифроване + Начална синхронизация: +\nИмпортиране на стаи + Начална синхронизация: +\nИмпортиране на стаи, от които съм част + Начална синхронизация: +\nИмпортиране на стаи, към които съм поканен + Начална синхронизация: +\nИмпортиране на стаи, които съм напуснал + Начална синхронизация: +\nИмпортиране на общности + Начална синхронизация: +\nИмпортиране на данни за профила + diff --git a/matrix-sdk/src/main/res/values-eu/strings.xml b/matrix-sdk/src/main/res/values-eu/strings.xml index a211ea04a..5339cf012 100644 --- a/matrix-sdk/src/main/res/values-eu/strings.xml +++ b/matrix-sdk/src/main/res/values-eu/strings.xml @@ -150,4 +150,21 @@ Karpeta Txintxeta + Hasierako sinkronizazioa: +\nKontua inportatzen… + Hasierako sinkronizazioa: +\nZifratzea inportatzen + Hasierako sinkronizazioa: +\nGelak inportatzen + Hasierako sinkronizazioa: +\nElkartutako gelak inportatzen + Hasierako sinkronizazioa: +\nGonbidatutako gelak inportatzen + Hasierako sinkronizazioa: +\nUtzitako gelak inportatzen + Hasierako sinkronizazioa: +\nKomunitateak inportatzen + Hasierako sinkronizazioa: +\nKontuaren datuak inportatzen + diff --git a/matrix-sdk/src/main/res/values-fi/strings.xml b/matrix-sdk/src/main/res/values-fi/strings.xml index a405c14c0..2f3e73c72 100644 --- a/matrix-sdk/src/main/res/values-fi/strings.xml +++ b/matrix-sdk/src/main/res/values-fi/strings.xml @@ -2,7 +2,7 @@ %1$s lähetti kuvan. - %s:n kutsu + Käyttäjän %s kutsu %1$s kutsui käyttäjän %2$s %1$s kutsui sinut %1$s liittyi @@ -16,15 +16,15 @@ %1$s asetti näyttönimekseen %2$s %1$s muutti näyttönimensä nimestä %2$s nimeen %3$s %1$s poisti näyttönimensä (%2$s) - %1$s muutti aiheeksi %2$s - %1$s muutti huoneen nimeksi %2$s + %1$s vaihtoi aiheeksi %2$s + %1$s vaihtoi huoneen nimeksi %2$s %s soitti videopuhelun. %s soitti äänipuhelun. %s vastasi puheluun. %s lopetti puhelun. %1$s muutti tulevan huonehistorian näkyväksi käyttäjälle %2$s - kaikki huoneen jäsenet, heidän kutsumisestaan asti. - kaikki huoneen jäsenet, heidän liittymisestään asti. + kaikki huoneen jäsenet, kutsumisestaan asti. + kaikki huoneen jäsenet, liittymisestään asti. kaikki huoneen jäsenet. kaikki. tuntematon (%s). @@ -34,7 +34,7 @@ VoIP-konferenssi alkoi VoIP-konferenssi päättyi - (profiilikuva muuttui myös) + (myös profiilikuva vaihdettiin) %1$s poisti huoneen nimen %1$s poisti huoneen aiheen %1$s päivitti profiilinsa %2$s @@ -151,4 +151,21 @@ Kansio Nuppineula + Alkusynkronointi: +\nTuodaan tiliä… + Alkusynkronointi: +\nTuodaan kryptoa + Alkusynkronointi: +\nTuodaan huoneita + Alkusynkronointi: +\nTuodaan liityttyjä huoneita + Alkusynkronointi: +\nTuodaan kutsuttuja huoneita + Alkusynkronointi: +\nTuodaan poistuttuja huoneita + Alkusynkronointi: +\nTuodaan yhteisöjä + Alkusynkronointi: +\nTuodaan tilin tietoja + diff --git a/matrix-sdk/src/main/res/values-fr/strings.xml b/matrix-sdk/src/main/res/values-fr/strings.xml index 542f0174d..5d211e014 100644 --- a/matrix-sdk/src/main/res/values-fr/strings.xml +++ b/matrix-sdk/src/main/res/values-fr/strings.xml @@ -150,4 +150,21 @@ Dossier Épingle + Synchronisation initiale : +\nImportation du compte… + Synchronisation initiale : +\nImportation de la cryptographie + Synchronisation initiale : +\nImportation des salons + Synchronisation initiale : +\nImportation des salons que vous avez rejoints + Synchronisation initiale : +\nImportation des salons où vous avez été invités + Synchronisation initiale : +\nImportation des salons que vous avez quittés + Synchronisation initiale : +\nImportation des communautés + Synchronisation initiale : +\nImportation des données du compte + diff --git a/matrix-sdk/src/main/res/values-hu/strings.xml b/matrix-sdk/src/main/res/values-hu/strings.xml index cf257cab6..b183a1b4a 100644 --- a/matrix-sdk/src/main/res/values-hu/strings.xml +++ b/matrix-sdk/src/main/res/values-hu/strings.xml @@ -149,4 +149,21 @@ Mappa + Induló szinkronizáció: +\nFiók betöltése… + Induló szinkronizáció: +\nTitkosítás betöltése + Induló szinkronizáció: +\nSzobák betöltése + Induló szinkronizáció: +\nCsatlakozott szobák betöltése + Induló szinkronizáció: +\nMeghívott szobák betöltése + Induló szinkronizáció: +\nElhagyott szobák betöltése + Induló szinkronizáció: +\nKözösségek betöltése + Induló szinkronizáció: +\nFiók adatok betöltése + diff --git a/matrix-sdk/src/main/res/values-it/strings.xml b/matrix-sdk/src/main/res/values-it/strings.xml index 7adc3638e..3f067c2a8 100644 --- a/matrix-sdk/src/main/res/values-it/strings.xml +++ b/matrix-sdk/src/main/res/values-it/strings.xml @@ -150,4 +150,21 @@ Cartella Spillo + Sync iniziale: +\nImportazione account… + Sync iniziale: +\nImportazione cifratura + Sync iniziale: +\nImportazione stanze + Sync iniziale: +\nImportazione stanze partecipate + Sync iniziale: +\nImportazione stanze invitate + Sync iniziale: +\nImportazione stanze lasciate + Sync iniziale: +\nImportazione comunità + Sync iniziale: +\nImportazione dati account + diff --git a/matrix-sdk/src/main/res/values-nl/strings.xml b/matrix-sdk/src/main/res/values-nl/strings.xml index c20124d16..b46b79ea0 100644 --- a/matrix-sdk/src/main/res/values-nl/strings.xml +++ b/matrix-sdk/src/main/res/values-nl/strings.xml @@ -159,4 +159,21 @@ Map Speld + Initiële synchronisatie: +\nAccount wordt geïmporteerd… + Initiële synchronisatie: +\nCrypto wordt geïmporteerd + Initiële synchronisatie: +\nGesprekken worden geïmporteerd + Initiële synchronisatie: +\nDeelgenomen gesprekken worden geïmporteerd + Initiële synchronisatie: +\nUitgenodigde gesprekken worden geïmporteerd + Initiële synchronisatie: +\nVerlaten gesprekken worden geïmporteerd + Initiële synchronisatie: +\nGemeenschappen worden geïmporteerd + Initiële synchronisatie: +\nAccountgegevens worden geïmporteerd + diff --git a/matrix-sdk/src/main/res/values-ru/strings.xml b/matrix-sdk/src/main/res/values-ru/strings.xml index 63a456553..4563fa89f 100644 --- a/matrix-sdk/src/main/res/values-ru/strings.xml +++ b/matrix-sdk/src/main/res/values-ru/strings.xml @@ -159,8 +159,25 @@ Труба Колокол Якорь - Гарнитура + Наушники Папка Булавка + Начальная синхронизация: +\nИмпорт учетной записи… + Начальная синхронизация: +\nИмпорт криптографии + Начальная синхронизация: +\nИмпорт комнат + Начальная синхронизация: +\nИмпорт присоединенных комнат + Начальная синхронизация: +\nИмпорт приглашенных комнат + Начальная синхронизация: +\nИмпорт покинутых комнат + Начальная синхронизация: +\nИмпорт сообществ + Начальная синхронизация: +\nИмпорт данных учетной записи + diff --git a/matrix-sdk/src/main/res/values-vls/strings.xml b/matrix-sdk/src/main/res/values-vls/strings.xml index 61da51731..29e66940a 100644 --- a/matrix-sdk/src/main/res/values-vls/strings.xml +++ b/matrix-sdk/src/main/res/values-vls/strings.xml @@ -150,4 +150,21 @@ Mappe Pinne + Initiële synchronisoatie: +\nAccount wor geïmporteerd… + Initiële synchronisoatie: +\nCrypto wor geïmporteerd + Initiële synchronisoatie: +\nGesprekkn wordn geïmporteerd + Initiële synchronisoatie: +\nDeelgenoomn gesprekken wordn geïmporteerd + Initiële synchronisoatie: +\nUutgenodigde gesprekkn wordn geïmporteerd + Initiële synchronisoatie: +\nVerloatn gesprekkn wordn geïmporteerd + Initiële synchronisoatie: +\nGemeenschappn wordn geïmporteerd + Initiële synchronisoatie: +\nAccountgegeevns wordn geïmporteerd + diff --git a/matrix-sdk/src/main/res/values-zh-rCN/strings.xml b/matrix-sdk/src/main/res/values-zh-rCN/strings.xml index b92c72e5f..70c990895 100644 --- a/matrix-sdk/src/main/res/values-zh-rCN/strings.xml +++ b/matrix-sdk/src/main/res/values-zh-rCN/strings.xml @@ -82,4 +82,84 @@ 消息已被 %1$s 移除 消息已被移除 [原因: %1$s] 消息已被 %1$s 移除 [原因: %2$s] + + + 狮子 + + 独角兽 + + 大象 + 兔子 + 熊猫 + 公鸡 + 企鹅 + 乌龟 + + 章鱼 + 蝴蝶 + + + 仙人掌 + 蘑菇 + 地球 + 月亮 + + + 香蕉 + 苹果 + 草莓 + 玉米 + 披萨 + 蛋糕 + + 微笑 + 机器人 + 帽子 + 眼镜 + 扳手 + 圣诞老人 + 点赞 + 雨伞 + 沙漏 + + 礼物 + 灯泡 + + 铅笔 + 回形针 + 剪刀 + + 钥匙 + 锤子 + 电话 + 旗子 + 火车 + 自行车 + 飞机 + 火箭 + 奖杯 + + 吉他 + 喇叭 + 铃铛 + + 耳机 + 文件夹 + 初始化同步: +\n正在导入账号… + 初始化同步: +\n正在导入加密数据 + 初始化同步: +\n正在导入聊天室 + 初始化同步: +\n正在导入已加入的聊天室 + 初始化同步: +\n正在导入已邀请的聊天室 + 初始化同步: +\n正在导入已离开的聊天室 + 初始化同步: +\n正在导入社区 + 初始化同步: +\n正在导入账号数据 + diff --git a/matrix-sdk/src/main/res/values-zh-rTW/strings.xml b/matrix-sdk/src/main/res/values-zh-rTW/strings.xml index 22cf1c0f5..0a8f0b45f 100644 --- a/matrix-sdk/src/main/res/values-zh-rTW/strings.xml +++ b/matrix-sdk/src/main/res/values-zh-rTW/strings.xml @@ -148,4 +148,21 @@ 資料夾 別針 + 初始化同步: +\n正在匯入帳號…… + 初始化同步: +\n正在匯入 crypto + 初始化同步: +\n正在匯入聊天室 + 初始化同步: +\n正在匯入已加入的聊天室 + 初始化同步: +\n正在匯入已邀請的聊天室 + 初始化同步: +\n正在匯入已離開的聊天室 + 初始化同步: +\n正在匯入社群 + 初始化同步: +\n正在匯入帳號資料 + diff --git a/matrix-sdk/src/main/res/values/strings.xml b/matrix-sdk/src/main/res/values/strings.xml index 5459cf912..40d359076 100644 --- a/matrix-sdk/src/main/res/values/strings.xml +++ b/matrix-sdk/src/main/res/values/strings.xml @@ -31,6 +31,7 @@ anyone. unknown (%s). %1$s turned on end-to-end encryption (%2$s) + %s upgraded this room. %1$s requested a VoIP conference VoIP conference started @@ -238,4 +239,7 @@ Initial Sync:\nImporting Communities Initial Sync:\nImporting Account Data + Sending message… + Clear sending queue + diff --git a/matrix-sdk/src/test/java/org/matrix/androidsdk/MxPatternsTest.java b/matrix-sdk/src/test/java/org/matrix/androidsdk/MxPatternsTest.java index 793a1427b..95ec94845 100644 --- a/matrix-sdk/src/test/java/org/matrix/androidsdk/MxPatternsTest.java +++ b/matrix-sdk/src/test/java/org/matrix/androidsdk/MxPatternsTest.java @@ -49,7 +49,8 @@ public class MxPatternsTest { private static final List validEventIds = Arrays.asList( "$1536732077213115wbNdt:matrix.org", "$1536732077213115wbNdt:matrix.org:1234", - "$pmOSN/DognfuSfhdW/qivXT19lfCWpdSfaPFKDBTJUk+" + "$pmOSN/DognfuSfhdW/qivXT19lfCWpdSfaPFKDBTJUk+", + "$Rqnc-F-dvnEYJTyHq_iKxU2bZ1CI92-kuZq3a5lr5Zg" ); private static final List validGroupIds = Arrays.asList(