diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml
index e60595e8b9..cf1cd5b9ff 100644
--- a/.buildkite/pipeline.yml
+++ b/.buildkite/pipeline.yml
@@ -54,4 +54,13 @@ steps:
# Code quality
- label: "Code quality"
- command: "./tools/check/check_code_quality.sh"
+ command:
+ - "./tools/check/check_code_quality.sh"
+
+ - label: "ktlint"
+ command:
+ - "curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.34.2/ktlint && chmod a+x ktlint"
+ - "./ktlint --android --experimental -v"
+ plugins:
+ - docker#v3.1.0:
+ image: "openjdk"
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000000..19a95806d3
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,32 @@
+# For ktlint configuration. Ref: https://ktlint.github.io/
+
+[*.{kt,kts}]
+# possible values: number (e.g. 2), "unset" (makes ktlint ignore indentation completely)
+indent_size=unset
+# true (recommended) / false
+insert_final_newline=true
+# possible values: number (e.g. 120) (package name, imports & comments are ignored), "off"
+# it's automatically set to 100 on `ktlint --android ...` (per Android Kotlin Style Guide)
+max_line_length=off
+
+# Comma-separated list of rules to disable (Since 0.34.0)
+# Note that rules in any ruleset other than the standard ruleset will need to be prefixed
+# by the ruleset identifier.
+disabled_rules=no-wildcard-imports,no-multi-spaces,colon-spacing,chain-wrapping,import-ordering,experimental:annotation
+
+# The following (so far identified) rules are kept:
+# no-blank-line-before-rbrace
+# final-newline
+# no-consecutive-blank-lines
+# comment-spacing
+# filename
+# comma-spacing
+# paren-spacing
+# op-spacing
+# string-template
+# no-unused-imports
+# curly-spacing
+# no-semi
+# no-empty-class-body
+# experimental:multiline-if-else
+# experimental:no-empty-first-line-in-method-block
diff --git a/.gitignore b/.gitignore
index 0722110715..76cd170215 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,14 +1,18 @@
*.iml
.gradle
/local.properties
-.idea/*
-/.idea/*
-/.idea/libraries
-/.idea/modules.xml
-/.idea/workspace.xml
+# idea files: exclude everything except dictionnaries
+.idea/caches
+.idea/codeStyles
+.idea/libraries
+.idea/*.xml
.DS_Store
/build
/captures
.externalNativeBuild
/tmp
+
+ktlint
+.idea/copyright/New_vector.xml
+.idea/copyright/profiles_settings.xml
diff --git a/.idea/dictionaries/bmarty.xml b/.idea/dictionaries/bmarty.xml
new file mode 100644
index 0000000000..01981ada12
--- /dev/null
+++ b/.idea/dictionaries/bmarty.xml
@@ -0,0 +1,19 @@
+
+
+
+ backstack
+ bytearray
+ ciphertext
+ decryptor
+ emoji
+ emojis
+ hmac
+ ktlint
+ linkified
+ linkify
+ megolm
+ pbkdf
+ pkcs
+
+
+
\ No newline at end of file
diff --git a/CHANGES.md b/CHANGES.md
index 22701ff529..48d0be34cd 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,3 +1,29 @@
+Changes in RiotX 0.7.0 (2019-10-24)
+===================================================
+
+Features:
+ - Share elements from other app to RiotX (#58)
+ - Read marker (#84)
+ - Add ability to report content (#515)
+
+Improvements:
+ - Persist active tab between sessions (#503)
+ - Do not upload file too big for the homeserver (#587)
+ - Attachments: start using system pickers (#52)
+ - Mark all messages as read (#396)
+
+Other changes:
+ - Accessibility improvements to read receipts in the room timeline and reactions emoji chooser
+
+Bugfix:
+ - Fix issue on upload error in loop (#587)
+ - Fix opening a permalink: the targeted event is displayed twice (#556)
+ - Fix opening a permalink paginates all the history up to the last event (#282)
+ - after login, the icon in the top left is a green 'A' for (all communities) rather than my avatar (#267)
+ - Picture uploads are unreliable, pictures are shown in wrong aspect ratio on desktop client (#517)
+ - Invitation notifications are not dismissed automatically if room is joined from another client (#347)
+ - Opening links from RiotX reuses browser tab (#599)
+
Changes in RiotX 0.6.1 (2019-09-24)
===================================================
@@ -141,21 +167,21 @@ Mode details here: https://medium.com/@RiotChat/introducing-the-riotx-beta-for-a
Changes in RiotX 0.0.0 (2019-XX-XX)
===================================================
-Features:
+Features ✨:
-
-Improvements:
+Improvements 🙌:
-
Other changes:
-
-Bugfix:
+Bugfix 🐛:
-
-Translations:
+Translations 🗣:
-
-Build:
+Build 🧱:
-
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 449f6421cf..d64dd7110e 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -40,19 +40,45 @@ Please add a line to the top of the file `CHANGES.md` describing your change.
Make sure the following commands execute without any error:
-> ./tools/check/check_code_quality.sh
+#### Internal tool
-> ./gradlew lintGplayRelease
+
+./tools/check/check_code_quality.sh
+
+
+#### ktlint
+
+
+curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.34.2/ktlint && chmod a+x ktlint
+./ktlint --android --experimental -v
+
+
+Note that you can run
+
+
+./ktlint --android --experimental -v -F
+
+
+For ktlint to fix some detected errors for you (you still have to check and commit the fix of course)
+
+#### lint
+
+
+./gradlew lintGplayRelease
+./gradlew lintFdroidRelease
+
### Unit tests
Make sure the following commands execute without any error:
-> ./gradlew testGplayReleaseUnitTest
+
+./gradlew testGplayReleaseUnitTest
+
### Tests
-RiotX is currently supported on Android Jelly Bean (API 16+): please test your change on an Android device (or Android emulator) running with API 16. Many issues can happen (including crashes) on older devices.
+RiotX is currently supported on Android KitKat (API 19+): please test your change on an Android device (or Android emulator) running with API 19. Many issues can happen (including crashes) on older devices.
Also, if possible, please test your change on a real device. Testing on Android emulator may not be sufficient.
### Internationalisation
diff --git a/build.gradle b/build.gradle
index b52707d527..714152370e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,9 +1,7 @@
-import javax.tools.JavaCompiler
-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
- ext.kotlin_version = '1.3.21'
+ ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
@@ -12,11 +10,11 @@ buildscript {
}
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.4.1'
- classpath 'com.google.gms:google-services:4.2.0'
- classpath "com.airbnb.okreplay:gradle-plugin:1.4.0"
+ classpath 'com.android.tools.build:gradle:3.5.1'
+ classpath 'com.google.gms:google-services:4.3.2'
+ classpath "com.airbnb.okreplay:gradle-plugin:1.5.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
- classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2'
+ classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7.1'
classpath 'com.google.android.gms:oss-licenses-plugin:0.9.5'
// NOTE: Do not place your application dependencies here; they belong
@@ -61,6 +59,11 @@ allprojects {
]
}
+ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
+ // Warnings are potential errors, so stop ignoring them
+ kotlinOptions.allWarningsAsErrors = true
+ }
+
afterEvaluate {
extensions.findByName("kapt")?.arguments {
arg("dagger.gradle.incremental", "enabled")
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 240d7e10ef..51b92600a0 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Tue Mar 19 09:53:05 CET 2019
+#Fri Sep 27 10:10:35 CEST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
diff --git a/matrix-sdk-android-rx/build.gradle b/matrix-sdk-android-rx/build.gradle
index 6e24d1d582..31f928c241 100644
--- a/matrix-sdk-android-rx/build.gradle
+++ b/matrix-sdk-android-rx/build.gradle
@@ -5,8 +5,6 @@ apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 28
-
-
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
@@ -14,7 +12,6 @@ android {
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
-
}
buildTypes {
@@ -29,12 +26,14 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
-
+ kotlinOptions {
+ jvmTarget = "1.8"
+ }
}
dependencies {
implementation project(":matrix-sdk-android")
- implementation 'androidx.appcompat:appcompat:1.1.0-beta01'
+ implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
// Paging
diff --git a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/LiveDataObservable.kt b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/LiveDataObservable.kt
index a1943bbe1c..7958d3efa1 100644
--- a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/LiveDataObservable.kt
+++ b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/LiveDataObservable.kt
@@ -20,7 +20,6 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.Observer
import io.reactivex.Observable
import io.reactivex.android.MainThreadDisposable
-import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
private class LiveDataObservable(
@@ -60,4 +59,4 @@ private class LiveDataObservable(
fun LiveData.asObservable(): Observable {
return LiveDataObservable(this).observeOn(Schedulers.computation())
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/MatrixCallbackCompletable.kt b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/MatrixCallbackCompletable.kt
index 58c015dfdd..cf0e955b00 100644
--- a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/MatrixCallbackCompletable.kt
+++ b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/MatrixCallbackCompletable.kt
@@ -19,7 +19,6 @@ package im.vector.matrix.rx
import im.vector.matrix.android.api.MatrixCallback
import im.vector.matrix.android.api.util.Cancelable
import io.reactivex.CompletableEmitter
-import io.reactivex.SingleEmitter
internal class MatrixCallbackCompletable(private val completableEmitter: CompletableEmitter) : MatrixCallback {
@@ -36,4 +35,4 @@ fun Cancelable.toCompletable(completableEmitter: CompletableEmitter) {
completableEmitter.setCancellable {
this.cancel()
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/MatrixCallbackSingle.kt b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/MatrixCallbackSingle.kt
index 8d554df270..d638354dfd 100644
--- a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/MatrixCallbackSingle.kt
+++ b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/MatrixCallbackSingle.kt
@@ -35,4 +35,4 @@ fun Cancelable.toSingle(singleEmitter: SingleEmitter) {
singleEmitter.setCancellable {
this.cancel()
}
-}
\ No newline at end of file
+}
diff --git a/vector/src/main/java/im/vector/riotx/core/dialogs/DialogSendItemAdapter.kt b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/OptionalRx.kt
similarity index 72%
rename from vector/src/main/java/im/vector/riotx/core/dialogs/DialogSendItemAdapter.kt
rename to matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/OptionalRx.kt
index 8689168e77..d608837d4a 100644
--- a/vector/src/main/java/im/vector/riotx/core/dialogs/DialogSendItemAdapter.kt
+++ b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/OptionalRx.kt
@@ -14,13 +14,11 @@
* limitations under the License.
*/
-package im.vector.riotx.core.dialogs
+package im.vector.matrix.rx
-import android.content.Context
+import im.vector.matrix.android.api.util.Optional
+import io.reactivex.Observable
-internal class DialogSendItemAdapter(context: Context, items: MutableList) : DialogAdapter(context) {
-
- init {
- addAll(items)
- }
+fun Observable>.unwrap(): Observable {
+ return filter { it.hasValue() }.map { it.get() }
}
diff --git a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxRoom.kt b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxRoom.kt
index 28a3d40070..e058b2716c 100644
--- a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxRoom.kt
+++ b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxRoom.kt
@@ -22,25 +22,34 @@ import im.vector.matrix.android.api.session.room.model.ReadReceipt
import im.vector.matrix.android.api.session.room.model.RoomSummary
import im.vector.matrix.android.api.session.room.send.UserDraft
import im.vector.matrix.android.api.session.room.timeline.TimelineEvent
+import im.vector.matrix.android.api.util.Optional
import io.reactivex.Observable
import io.reactivex.Single
class RxRoom(private val room: Room) {
- fun liveRoomSummary(): Observable {
- return room.liveRoomSummary().asObservable()
+ fun liveRoomSummary(): Observable> {
+ return room.getRoomSummaryLive().asObservable()
}
fun liveRoomMemberIds(): Observable> {
return room.getRoomMemberIdsLive().asObservable()
}
- fun liveAnnotationSummary(eventId: String): Observable {
+ fun liveAnnotationSummary(eventId: String): Observable> {
return room.getEventSummaryLive(eventId).asObservable()
}
- fun liveTimelineEvent(eventId: String): Observable {
- return room.liveTimeLineEvent(eventId).asObservable()
+ fun liveTimelineEvent(eventId: String): Observable> {
+ return room.getTimeLineEventLive(eventId).asObservable()
+ }
+
+ fun liveReadMarker(): Observable> {
+ return room.getReadMarkerLive().asObservable()
+ }
+
+ fun liveReadReceipt(): Observable> {
+ return room.getMyReadReceiptLive().asObservable()
}
fun loadRoomMembersIfNeeded(): Single = Single.create {
@@ -58,9 +67,8 @@ class RxRoom(private val room: Room) {
fun liveDrafts(): Observable> {
return room.getDraftsLive().asObservable()
}
-
}
fun Room.rx(): RxRoom {
return RxRoom(this)
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxSession.kt b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxSession.kt
index f3fb06a45a..f19777b6f5 100644
--- a/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxSession.kt
+++ b/matrix-sdk-android-rx/src/main/java/im/vector/matrix/rx/RxSession.kt
@@ -24,6 +24,7 @@ import im.vector.matrix.android.api.session.room.model.RoomSummary
import im.vector.matrix.android.api.session.room.model.create.CreateRoomParams
import im.vector.matrix.android.api.session.sync.SyncState
import im.vector.matrix.android.api.session.user.model.User
+import im.vector.matrix.android.api.util.Optional
import io.reactivex.Observable
import io.reactivex.Single
@@ -45,6 +46,10 @@ class RxSession(private val session: Session) {
return session.livePushers().asObservable()
}
+ fun liveUser(userId: String): Observable> {
+ return session.liveUser(userId).asObservable().distinctUntilChanged()
+ }
+
fun liveUsers(): Observable> {
return session.liveUsers().asObservable()
}
@@ -66,9 +71,8 @@ class RxSession(private val session: Session) {
fun joinRoom(roomId: String, viaServers: List = emptyList()): Single = Single.create {
session.joinRoom(roomId, viaServers, MatrixCallbackSingle(it)).toSingle(it)
}
-
}
fun Session.rx(): RxSession {
return RxSession(this)
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/build.gradle b/matrix-sdk-android/build.gradle
index 8002625e12..3e6d3ea88b 100644
--- a/matrix-sdk-android/build.gradle
+++ b/matrix-sdk-android/build.gradle
@@ -67,6 +67,10 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
+
+ kotlinOptions {
+ jvmTarget = "1.8"
+ }
}
static def gitRevision() {
@@ -86,41 +90,43 @@ static def gitRevisionDate() {
dependencies {
- def arrow_version = "0.8.0"
- def support_version = '1.1.0-beta01'
+ def arrow_version = "0.8.2"
def moshi_version = '1.8.0'
- def lifecycle_version = '2.0.0'
- def coroutines_version = "1.0.1"
- def markwon_version = '3.0.0'
- def daggerVersion = '2.23.1'
+ def lifecycle_version = '2.1.0'
+ def coroutines_version = "1.3.2"
+ def markwon_version = '3.1.0'
+ def daggerVersion = '2.24'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
- implementation "androidx.appcompat:appcompat:1.1.0-rc01"
- implementation "androidx.recyclerview:recyclerview:1.1.0-beta01"
+ implementation "androidx.appcompat:appcompat:1.1.0"
+ implementation "androidx.recyclerview:recyclerview:1.1.0-beta05"
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
// Network
- implementation 'com.squareup.retrofit2:retrofit:2.6.0'
- implementation 'com.squareup.retrofit2:converter-moshi:2.4.0'
- implementation 'com.squareup.okhttp3:okhttp:3.14.1'
- implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
+ implementation 'com.squareup.retrofit2:retrofit:2.6.2'
+ implementation 'com.squareup.retrofit2:converter-moshi:2.6.2'
+ implementation 'com.squareup.okhttp3:okhttp:4.2.2'
+ implementation 'com.squareup.okhttp3:logging-interceptor:4.2.2'
implementation 'com.novoda:merlin:1.2.0'
implementation "com.squareup.moshi:moshi-adapters:$moshi_version"
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"
implementation "ru.noties.markwon:core:$markwon_version"
+ // Image
+ implementation 'androidx.exifinterface:exifinterface:1.0.0'
+
// Database
implementation 'com.github.Zhuinden:realm-monarchy:0.5.1'
kapt 'dk.ilios:realmfieldnameshelper:1.1.1'
// Work
- implementation "androidx.work:work-runtime-ktx:2.1.0-rc01"
+ implementation "androidx.work:work-runtime-ktx:2.3.0-alpha01"
// FP
implementation "io.arrow-kt:arrow-core:$arrow_version"
@@ -132,24 +138,24 @@ dependencies {
// DI
implementation "com.google.dagger:dagger:$daggerVersion"
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
- compileOnly 'com.squareup.inject:assisted-inject-annotations-dagger2:0.4.0'
- kapt 'com.squareup.inject:assisted-inject-processor-dagger2:0.4.0'
+ compileOnly 'com.squareup.inject:assisted-inject-annotations-dagger2:0.5.0'
+ kapt 'com.squareup.inject:assisted-inject-processor-dagger2:0.5.0'
// Logging
implementation 'com.jakewharton.timber:timber:4.7.1'
- implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
+ implementation 'com.facebook.stetho:stetho-okhttp3:1.5.1'
// Bus
implementation 'org.greenrobot:eventbus:3.1.1'
- debugImplementation 'com.airbnb.okreplay:okreplay:1.4.0'
- releaseImplementation 'com.airbnb.okreplay:noop:1.4.0'
- androidTestImplementation 'com.airbnb.okreplay:espresso:1.4.0'
+ debugImplementation 'com.airbnb.okreplay:okreplay:1.5.0'
+ releaseImplementation 'com.airbnb.okreplay:noop:1.5.0'
+ androidTestImplementation 'com.airbnb.okreplay:espresso:1.5.0'
testImplementation 'junit:junit:4.12'
- testImplementation 'org.robolectric:robolectric:4.0.2'
+ testImplementation 'org.robolectric:robolectric:4.3'
//testImplementation 'org.robolectric:shadows-support-v4:3.0'
- testImplementation "io.mockk:mockk:1.8.13.kotlin13"
+ testImplementation 'io.mockk:mockk:1.9.3.kotlin12'
testImplementation 'org.amshove.kluent:kluent-android:1.44'
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
@@ -159,7 +165,7 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'org.amshove.kluent:kluent-android:1.44'
- androidTestImplementation "io.mockk:mockk-android:1.8.13.kotlin13"
+ androidTestImplementation 'io.mockk:mockk-android:1.9.3.kotlin12'
androidTestImplementation "androidx.arch.core:core-testing:$lifecycle_version"
androidTestImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
diff --git a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/InstrumentedTest.kt b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/InstrumentedTest.kt
index c6db522c46..3cd47d4998 100644
--- a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/InstrumentedTest.kt
+++ b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/InstrumentedTest.kt
@@ -28,4 +28,4 @@ interface InstrumentedTest {
fun cacheDir(): File {
return context().cacheDir
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/OkReplayRuleChainNoActivity.kt b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/OkReplayRuleChainNoActivity.kt
index 9fd1fe6b5c..098e927a9f 100644
--- a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/OkReplayRuleChainNoActivity.kt
+++ b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/OkReplayRuleChainNoActivity.kt
@@ -29,4 +29,4 @@ class OkReplayRuleChainNoActivity(
return RuleChain.outerRule(PermissionRule(configuration))
.around(RecorderRule(configuration))
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/SingleThreadCoroutineDispatcher.kt b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/SingleThreadCoroutineDispatcher.kt
index 69803c5dc1..e63123f3b3 100644
--- a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/SingleThreadCoroutineDispatcher.kt
+++ b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/SingleThreadCoroutineDispatcher.kt
@@ -19,4 +19,4 @@ package im.vector.matrix.android
import im.vector.matrix.android.internal.util.MatrixCoroutineDispatchers
import kotlinx.coroutines.Dispatchers.Main
-internal val testCoroutineDispatchers = MatrixCoroutineDispatchers(Main, Main, Main, Main, Main)
\ No newline at end of file
+internal val testCoroutineDispatchers = MatrixCoroutineDispatchers(Main, Main, Main, Main, Main)
diff --git a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/auth/AuthenticatorTest.kt b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/auth/AuthenticatorTest.kt
index 3dfc06196e..7d33fae4d8 100644
--- a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/auth/AuthenticatorTest.kt
+++ b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/auth/AuthenticatorTest.kt
@@ -28,7 +28,6 @@ import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
-
@RunWith(AndroidJUnit4::class)
internal class AuthenticatorTest : InstrumentedTest {
@@ -50,7 +49,6 @@ internal class AuthenticatorTest : InstrumentedTest {
@UiThreadTest
@OkReplay(tape = "auth", mode = TapeMode.READ_WRITE)
fun auth() {
-
}
companion object {
@@ -59,6 +57,4 @@ internal class AuthenticatorTest : InstrumentedTest {
val grantExternalStoragePermissionRule: GrantPermissionRule =
GrantPermissionRule.grant(android.Manifest.permission.WRITE_EXTERNAL_STORAGE)
}
-
-
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/CryptoStoreHelper.kt b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/CryptoStoreHelper.kt
index c0fc6c4454..6b0ebbf6a4 100644
--- a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/CryptoStoreHelper.kt
+++ b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/CryptoStoreHelper.kt
@@ -41,4 +41,4 @@ internal class CryptoStoreHelper {
refreshToken = null,
deviceId = "deviceId_sample"
)
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/CryptoStoreTest.kt b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/CryptoStoreTest.kt
index 0f65ad3ee5..3fc3079cc7 100644
--- a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/CryptoStoreTest.kt
+++ b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/crypto/CryptoStoreTest.kt
@@ -114,4 +114,4 @@ class CryptoStoreTest {
olmAccount1.releaseAccount()
olmAccount2.releaseAccount()
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/util/JsonCanonicalizerTest.kt b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/util/JsonCanonicalizerTest.kt
index 1ea6105da4..0a7c8f6439 100644
--- a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/util/JsonCanonicalizerTest.kt
+++ b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/internal/util/JsonCanonicalizerTest.kt
@@ -62,8 +62,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
JsonCanonicalizer.canonicalize("{\"a\":\"\\\"\"}"))
}
-
-
/* ==========================================================================================
* Test from https://matrix.org/docs/spec/appendices.html#examples
* ========================================================================================== */
@@ -74,7 +72,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
JsonCanonicalizer.canonicalize("""{}"""))
}
-
@Test
fun matrixOrg002Test() {
assertEquals("""{"one":1,"two":"Two"}""",
@@ -84,7 +81,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
}"""))
}
-
@Test
fun matrixOrg003Test() {
assertEquals("""{"a":"1","b":"2"}""",
@@ -94,14 +90,12 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
}"""))
}
-
@Test
fun matrixOrg004Test() {
assertEquals("""{"a":"1","b":"2"}""",
JsonCanonicalizer.canonicalize("""{"b":"2","a":"1"}"""))
}
-
@Test
fun matrixOrg005Test() {
assertEquals("""{"auth":{"mxid":"@john.doe:example.com","profile":{"display_name":"John Doe","three_pids":[{"address":"john.doe@example.org","medium":"email"},{"address":"123456789","medium":"msisdn"}]},"success":true}}""",
@@ -126,7 +120,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
}"""))
}
-
@Test
fun matrixOrg006Test() {
assertEquals("""{"a":"日本語"}""",
@@ -135,7 +128,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
}"""))
}
-
@Test
fun matrixOrg007Test() {
assertEquals("""{"日":1,"本":2}""",
@@ -145,7 +137,6 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
}"""))
}
-
@Test
fun matrixOrg008Test() {
assertEquals("""{"a":"日"}""",
@@ -159,4 +150,4 @@ internal class JsonCanonicalizerTest : InstrumentedTest {
"a": null
}"""))
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/ChunkEntityTest.kt b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/ChunkEntityTest.kt
index c6da3c4628..abb990c979 100644
--- a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/ChunkEntityTest.kt
+++ b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/ChunkEntityTest.kt
@@ -35,7 +35,6 @@ import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
-
@RunWith(AndroidJUnit4::class)
internal class ChunkEntityTest : InstrumentedTest {
@@ -48,7 +47,6 @@ internal class ChunkEntityTest : InstrumentedTest {
monarchy = Monarchy.Builder().setRealmConfiguration(testConfig).build()
}
-
@Test
fun add_shouldAdd_whenNotAlreadyIncluded() {
monarchy.runTransactionSync { realm ->
@@ -194,5 +192,4 @@ internal class ChunkEntityTest : InstrumentedTest {
chunk1.nextToken shouldEqual nextToken
}
}
-
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/FakeGetContextOfEventTask.kt b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/FakeGetContextOfEventTask.kt
index 48f223925c..0e1980f134 100644
--- a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/FakeGetContextOfEventTask.kt
+++ b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/FakeGetContextOfEventTask.kt
@@ -32,6 +32,4 @@ internal class FakeGetContextOfEventTask constructor(private val tokenChunkEvent
)
return tokenChunkEventPersistor.insertInDb(tokenChunkEvent, params.roomId, PaginationDirection.BACKWARDS)
}
-
-
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/FakePaginationTask.kt b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/FakePaginationTask.kt
index 2f7f63d77c..be67ffdbba 100644
--- a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/FakePaginationTask.kt
+++ b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/FakePaginationTask.kt
@@ -28,6 +28,4 @@ internal class FakePaginationTask @Inject constructor(private val tokenChunkEven
val tokenChunkEvent = FakeTokenChunkEvent(params.from, Random.nextLong(System.currentTimeMillis()).toString(), fakeEvents)
return tokenChunkEventPersistor.insertInDb(tokenChunkEvent, params.roomId, params.direction)
}
-
}
-
diff --git a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/FakeTokenChunkEvent.kt b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/FakeTokenChunkEvent.kt
index 2a9163e4ba..3f74df2c2e 100644
--- a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/FakeTokenChunkEvent.kt
+++ b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/FakeTokenChunkEvent.kt
@@ -23,4 +23,4 @@ internal data class FakeTokenChunkEvent(override val start: String?,
override val end: String?,
override val events: List = emptyList(),
override val stateEvents: List = emptyList()
-) : TokenChunkEvent
\ No newline at end of file
+) : TokenChunkEvent
diff --git a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/RoomDataHelper.kt b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/RoomDataHelper.kt
index 7ff693584e..8a8ee11854 100644
--- a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/RoomDataHelper.kt
+++ b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/RoomDataHelper.kt
@@ -88,6 +88,4 @@ object RoomDataHelper {
roomEntity.addOrUpdate(chunkEntity)
}
}
-
-
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/TimelineTest.kt b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/TimelineTest.kt
index f09b037605..06651f9ba3 100644
--- a/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/TimelineTest.kt
+++ b/matrix-sdk-android/src/androidTest/java/im/vector/matrix/android/session/room/timeline/TimelineTest.kt
@@ -81,6 +81,4 @@ internal class TimelineTest : InstrumentedTest {
// timelineEvents.size shouldEqual initialLoad + paginationCount
// timeline.dispose()
// }
-
-
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/debug/java/im/vector/matrix/android/internal/network/interceptors/CurlLoggingInterceptor.kt b/matrix-sdk-android/src/debug/java/im/vector/matrix/android/internal/network/interceptors/CurlLoggingInterceptor.kt
index 3d499be3c1..c96786ba3b 100644
--- a/matrix-sdk-android/src/debug/java/im/vector/matrix/android/internal/network/interceptors/CurlLoggingInterceptor.kt
+++ b/matrix-sdk-android/src/debug/java/im/vector/matrix/android/internal/network/interceptors/CurlLoggingInterceptor.kt
@@ -22,6 +22,7 @@ import okhttp3.Interceptor
import okhttp3.Response
import okhttp3.logging.HttpLoggingInterceptor
import okio.Buffer
+import timber.log.Timber
import java.io.IOException
import java.nio.charset.Charset
import javax.inject.Inject
@@ -51,27 +52,33 @@ internal class CurlLoggingInterceptor @Inject constructor(private val logger: Ht
var compressed = false
var curlCmd = "curl"
- if (curlOptions != null) {
- curlCmd += " " + curlOptions!!
+ curlOptions?.let {
+ curlCmd += " $it"
}
- curlCmd += " -X " + request.method()
+ curlCmd += " -X " + request.method
- val requestBody = request.body()
+ val requestBody = request.body
if (requestBody != null) {
- val buffer = Buffer()
- requestBody.writeTo(buffer)
- var charset: Charset? = UTF8
- val contentType = requestBody.contentType()
- if (contentType != null) {
- charset = contentType.charset(UTF8)
+ if (requestBody.contentLength() > 100_000) {
+ Timber.w("Unable to log curl command data, size is too big (${requestBody.contentLength()})")
+ // Ensure the curl command will failed
+ curlCmd += "DATA IS TOO BIG"
+ } else {
+ val buffer = Buffer()
+ requestBody.writeTo(buffer)
+ var charset: Charset? = UTF8
+ val contentType = requestBody.contentType()
+ if (contentType != null) {
+ charset = contentType.charset(UTF8)
+ }
+ // try to keep to a single line and use a subshell to preserve any line breaks
+ curlCmd += " --data $'" + buffer.readString(charset!!).replace("\n", "\\n") + "'"
}
- // try to keep to a single line and use a subshell to preserve any line breaks
- curlCmd += " --data $'" + buffer.readString(charset!!).replace("\n", "\\n") + "'"
}
- val headers = request.headers()
+ val headers = request.headers
var i = 0
- val count = headers.size()
+ val count = headers.size
while (i < count) {
val name = headers.name(i)
val value = headers.value(i)
@@ -82,7 +89,7 @@ internal class CurlLoggingInterceptor @Inject constructor(private val logger: Ht
i++
}
- curlCmd += ((if (compressed) " --compressed " else " ") + "'" + request.url().toString()
+ curlCmd += ((if (compressed) " --compressed " else " ") + "'" + request.url.toString()
// Replace localhost for emulator by localhost for shell
.replace("://10.0.2.2:8080/".toRegex(), "://127.0.0.1:8080/")
+ "'")
@@ -90,7 +97,7 @@ internal class CurlLoggingInterceptor @Inject constructor(private val logger: Ht
// Add Json formatting
curlCmd += " | python -m json.tool"
- logger.log("--- cURL (" + request.url() + ")")
+ logger.log("--- cURL (" + request.url + ")")
logger.log(curlCmd)
return chain.proceed(request)
diff --git a/matrix-sdk-android/src/debug/java/im/vector/matrix/android/internal/network/interceptors/FormattedJsonHttpLogger.kt b/matrix-sdk-android/src/debug/java/im/vector/matrix/android/internal/network/interceptors/FormattedJsonHttpLogger.kt
index 655134d1e3..43f1373daf 100644
--- a/matrix-sdk-android/src/debug/java/im/vector/matrix/android/internal/network/interceptors/FormattedJsonHttpLogger.kt
+++ b/matrix-sdk-android/src/debug/java/im/vector/matrix/android/internal/network/interceptors/FormattedJsonHttpLogger.kt
@@ -51,7 +51,6 @@ class FormattedJsonHttpLogger : HttpLoggingInterceptor.Logger {
// Finally this is not a JSON string...
Timber.e(e)
}
-
} else if (message.startsWith("[")) {
// JSON Array detected
try {
@@ -61,7 +60,6 @@ class FormattedJsonHttpLogger : HttpLoggingInterceptor.Logger {
// Finally not JSON...
Timber.e(e)
}
-
}
// Else not a json string to log
}
@@ -73,4 +71,4 @@ class FormattedJsonHttpLogger : HttpLoggingInterceptor.Logger {
Timber.v(s)
}
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/Matrix.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/Matrix.kt
index bdc988d2f7..1bfa871a42 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/Matrix.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/Matrix.kt
@@ -38,7 +38,6 @@ data class MatrixConfiguration(
interface Provider {
fun providesMatrixConfiguration(): MatrixConfiguration
}
-
}
/**
@@ -98,5 +97,4 @@ class Matrix private constructor(context: Context, matrixConfiguration: MatrixCo
return BuildConfig.VERSION_NAME + " (" + BuildConfig.GIT_SDK_REVISION + ")"
}
}
-
}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/MatrixCallback.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/MatrixCallback.kt
index 00d22b1f9f..c2f70ce5dc 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/MatrixCallback.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/MatrixCallback.kt
@@ -27,7 +27,7 @@ interface MatrixCallback {
* @param data the data successfully returned from the async function
*/
fun onSuccess(data: T) {
- //no-op
+ // no-op
}
/**
@@ -35,7 +35,6 @@ interface MatrixCallback {
* @param failure the failure data returned from the async function
*/
fun onFailure(failure: Throwable) {
- //no-op
+ // no-op
}
-
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/MatrixPatterns.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/MatrixPatterns.kt
index 935408296c..e30d139cd3 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/MatrixPatterns.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/MatrixPatterns.kt
@@ -16,7 +16,6 @@
package im.vector.matrix.android.api
-
/**
* This class contains pattern to match the different Matrix ids
*/
@@ -154,6 +153,5 @@ object MatrixPatterns {
return if (index == -1) {
null
} else matrixId.substring(index + 1)
-
}
}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/Authenticator.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/Authenticator.kt
index 2dc2d0ef5f..77a3cde249 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/Authenticator.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/Authenticator.kt
@@ -68,4 +68,4 @@ interface Authenticator {
* Create a session after a SSO successful login
*/
fun createSessionFromSso(credentials: Credentials, homeServerConnectionConfig: HomeServerConnectionConfig): Session
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/data/HomeServerConnectionConfig.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/data/HomeServerConnectionConfig.kt
index 850c4f7186..e85b05092f 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/data/HomeServerConnectionConfig.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/auth/data/HomeServerConnectionConfig.kt
@@ -253,13 +253,5 @@ data class HomeServerConnectionConfig(
forceUsageTlsVersions
)
}
-
}
-
-
}
-
-
-
-
-
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/comparators/DatedObjectComparators.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/comparators/DatedObjectComparators.kt
index c9245e7331..a9d30f823c 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/comparators/DatedObjectComparators.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/comparators/DatedObjectComparators.kt
@@ -37,4 +37,4 @@ object DatedObjectComparators {
(datedObject2.date - datedObject1.date).toInt()
}
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/extensions/MatrixSdkExtensions.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/extensions/MatrixSdkExtensions.kt
index 180d80c5c5..685a522f60 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/extensions/MatrixSdkExtensions.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/extensions/MatrixSdkExtensions.kt
@@ -19,7 +19,6 @@ package im.vector.matrix.android.api.extensions
import im.vector.matrix.android.api.comparators.DatedObjectComparators
import im.vector.matrix.android.internal.crypto.model.MXDeviceInfo
import im.vector.matrix.android.internal.crypto.model.rest.DeviceInfo
-import java.util.Collections
/* ==========================================================================================
* MXDeviceInfo
@@ -29,7 +28,6 @@ fun MXDeviceInfo.getFingerprintHumanReadable() = fingerprint()
?.chunked(4)
?.joinToString(separator = " ")
-
-fun List.sortByLastSeen() {
- Collections.sort(this, DatedObjectComparators.descComparator)
-}
\ No newline at end of file
+fun MutableList.sortByLastSeen() {
+ sortWith(DatedObjectComparators.descComparator)
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/failure/ConsentNotGivenError.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/failure/ConsentNotGivenError.kt
index c780720a18..80ee6811bb 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/failure/ConsentNotGivenError.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/failure/ConsentNotGivenError.kt
@@ -19,4 +19,4 @@ package im.vector.matrix.android.api.failure
// This data class will be sent to the bus
data class ConsentNotGivenError(
val consentUri: String
-)
\ No newline at end of file
+)
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/failure/Failure.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/failure/Failure.kt
index 26170a288f..6c418ed831 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/failure/Failure.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/failure/Failure.kt
@@ -42,5 +42,4 @@ sealed class Failure(cause: Throwable? = null) : Throwable(cause = cause) {
data class CryptoError(val error: MXCryptoError) : Failure(error)
abstract class FeatureFailure : Failure()
-
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/failure/MatrixError.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/failure/MatrixError.kt
index 7d433ba7ba..70a982089c 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/failure/MatrixError.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/failure/MatrixError.kt
@@ -33,7 +33,6 @@ data class MatrixError(
@Json(name = "limit_type") val limitType: String? = null,
@Json(name = "admin_contact") val adminUri: String? = null) {
-
companion object {
const val FORBIDDEN = "M_FORBIDDEN"
const val UNKNOWN = "M_UNKNOWN"
@@ -64,4 +63,4 @@ data class MatrixError(
// Possible value for "limit_type"
const val LIMIT_TYPE_MAU = "monthly_active_user"
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/listeners/ProgressListener.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/listeners/ProgressListener.kt
index 854f0e9fb6..ad47260f86 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/listeners/ProgressListener.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/listeners/ProgressListener.kt
@@ -25,4 +25,4 @@ interface ProgressListener {
* @param total
*/
fun onProgress(progress: Int, total: Int)
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/listeners/StepProgressListener.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/listeners/StepProgressListener.kt
index af5b815c1a..196aa6d655 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/listeners/StepProgressListener.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/listeners/StepProgressListener.kt
@@ -31,4 +31,4 @@ interface StepProgressListener {
* @param step The current step, containing progress data if available. Else you should consider progress as indeterminate
*/
fun onStepProgress(step: Step)
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/MatrixLinkify.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/MatrixLinkify.kt
index fb3dbcc26c..fc02cf4a61 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/MatrixLinkify.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/MatrixLinkify.kt
@@ -30,9 +30,9 @@ object MatrixLinkify {
*
* @param spannable the text in which the matrix items has to be clickable.
*/
- fun addLinks(spannable: Spannable?, callback: MatrixPermalinkSpan.Callback?): Boolean {
+ fun addLinks(spannable: Spannable, callback: MatrixPermalinkSpan.Callback?): Boolean {
// sanity checks
- if (spannable.isNullOrEmpty()) {
+ if (spannable.isEmpty()) {
return false
}
val text = spannable.toString()
@@ -51,5 +51,4 @@ object MatrixLinkify {
}
return hasMatch
}
-
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/MatrixPermalinkSpan.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/MatrixPermalinkSpan.kt
index 58cd76a0a6..afba5ab040 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/MatrixPermalinkSpan.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/MatrixPermalinkSpan.kt
@@ -35,6 +35,4 @@ class MatrixPermalinkSpan(private val url: String,
override fun onClick(widget: View) {
callback?.onUrlClicked(url)
}
-
-
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/PermalinkData.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/PermalinkData.kt
index 615892a107..47f8bf4505 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/PermalinkData.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/PermalinkData.kt
@@ -33,5 +33,4 @@ sealed class PermalinkData {
data class GroupLink(val groupId: String) : PermalinkData()
data class FallbackLink(val uri: Uri) : PermalinkData()
-
}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/PermalinkFactory.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/PermalinkFactory.kt
index 15d56eacb3..1af77869ee 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/PermalinkFactory.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/PermalinkFactory.kt
@@ -16,7 +16,6 @@
package im.vector.matrix.android.api.permalinks
-import android.text.TextUtils
import im.vector.matrix.android.api.session.events.model.Event
/**
@@ -48,10 +47,9 @@ object PermalinkFactory {
* @return the permalink, or null in case of error
*/
fun createPermalink(id: String): String? {
- return if (TextUtils.isEmpty(id)) {
+ return if (id.isEmpty()) {
null
} else MATRIX_TO_URL_BASE + escape(id)
-
}
/**
@@ -72,16 +70,14 @@ object PermalinkFactory {
* @param url the universal link, Ex: "https://matrix.to/#/@benoit:matrix.org"
* @return the id from the url, ex: "@benoit:matrix.org", or null if the url is not a permalink
*/
- fun getLinkedId(url: String?): String? {
- val isSupported = url != null && url.startsWith(MATRIX_TO_URL_BASE)
+ fun getLinkedId(url: String): String? {
+ val isSupported = url.startsWith(MATRIX_TO_URL_BASE)
return if (isSupported) {
- url!!.substring(MATRIX_TO_URL_BASE.length)
+ url.substring(MATRIX_TO_URL_BASE.length)
} else null
-
}
-
/**
* Escape '/' in id, because it is used as a separator
*
@@ -89,6 +85,6 @@ object PermalinkFactory {
* @return the escaped id
*/
private fun escape(id: String): String {
- return id.replace("/".toRegex(), "%2F")
+ return id.replace("/", "%2F")
}
}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/PermalinkParser.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/PermalinkParser.kt
index 71fd16e778..531f4ae523 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/PermalinkParser.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/permalinks/PermalinkParser.kt
@@ -72,5 +72,4 @@ object PermalinkParser {
else -> PermalinkData.FallbackLink(uri)
}
}
-
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/Action.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/Action.kt
index b34d2d0d34..d135504055 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/Action.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/Action.kt
@@ -18,7 +18,6 @@ package im.vector.matrix.android.api.pushrules
import im.vector.matrix.android.api.pushrules.rest.PushRule
import timber.log.Timber
-
sealed class Action {
object Notify : Action()
object DoNotNotify : Action()
@@ -26,7 +25,6 @@ sealed class Action {
data class Highlight(val highlight: Boolean) : Action()
}
-
private const val ACTION_NOTIFY = "notify"
private const val ACTION_DONT_NOTIFY = "dont_notify"
private const val ACTION_COALESCE = "coalesce"
@@ -80,7 +78,6 @@ fun PushRule.getActions(): List {
}
// When the value is not there, default sound (not specified by the spec)
?: Action.Sound(ACTION_OBJECT_VALUE_VALUE_DEFAULT)
-
}
ACTION_OBJECT_SET_TWEAK_VALUE_HIGHLIGHT -> {
(actionStrOrObj[ACTION_OBJECT_VALUE_KEY] as? Boolean)?.let { boolValue ->
@@ -104,7 +101,5 @@ fun PushRule.getActions(): List {
}
}
-
return result
}
-
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/Condition.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/Condition.kt
index c0bb4f16f4..ecc78996db 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/Condition.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/Condition.kt
@@ -35,9 +35,7 @@ abstract class Condition(val kind: Kind) {
else -> UNRECOGNIZE
}
}
-
}
-
}
abstract fun isSatisfied(conditionResolver: ConditionResolver): Boolean
@@ -45,4 +43,4 @@ abstract class Condition(val kind: Kind) {
open fun technicalDescription(): String {
return "Kind: $kind"
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/ConditionResolver.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/ConditionResolver.kt
index 4d15d5deec..340810bc80 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/ConditionResolver.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/ConditionResolver.kt
@@ -25,4 +25,4 @@ interface ConditionResolver {
fun resolveRoomMemberCountCondition(roomMemberCountCondition: RoomMemberCountCondition): Boolean
fun resolveSenderNotificationPermissionCondition(senderNotificationPermissionCondition: SenderNotificationPermissionCondition): Boolean
fun resolveContainsDisplayNameCondition(containsDisplayNameCondition: ContainsDisplayNameCondition) : Boolean
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/ContainsDisplayNameCondition.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/ContainsDisplayNameCondition.kt
index 37bc75ad57..166ec4f05f 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/ContainsDisplayNameCondition.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/ContainsDisplayNameCondition.kt
@@ -15,13 +15,11 @@
*/
package im.vector.matrix.android.api.pushrules
-import android.text.TextUtils
import im.vector.matrix.android.api.session.events.model.Event
import im.vector.matrix.android.api.session.events.model.EventType
import im.vector.matrix.android.api.session.events.model.toModel
import im.vector.matrix.android.api.session.room.model.message.MessageContent
import timber.log.Timber
-import java.util.regex.Pattern
class ContainsDisplayNameCondition : Condition(Kind.contains_display_name) {
@@ -34,11 +32,11 @@ class ContainsDisplayNameCondition : Condition(Kind.contains_display_name) {
}
fun isSatisfied(event: Event, displayName: String): Boolean {
- var message = when (event.type) {
+ val message = when (event.type) {
EventType.MESSAGE -> {
event.content.toModel()
}
- //TODO the spec says:
+ // TODO the spec says:
// Matches any message whose content is unencrypted and contains the user's current display name
// EventType.ENCRYPTED -> {
// event.root.getClearContent()?.toModel()
@@ -49,7 +47,6 @@ class ContainsDisplayNameCondition : Condition(Kind.contains_display_name) {
return caseInsensitiveFind(displayName, message.body)
}
-
companion object {
/**
* Returns whether a string contains an occurrence of another, as a standalone word, regardless of case.
@@ -60,20 +57,18 @@ class ContainsDisplayNameCondition : Condition(Kind.contains_display_name) {
*/
fun caseInsensitiveFind(subString: String, longString: String): Boolean {
// add sanity checks
- if (TextUtils.isEmpty(subString) || TextUtils.isEmpty(longString)) {
+ if (subString.isEmpty() || longString.isEmpty()) {
return false
}
- var res = false
-
try {
- val pattern = Pattern.compile("(\\W|^)" + Pattern.quote(subString) + "(\\W|$)", Pattern.CASE_INSENSITIVE)
- res = pattern.matcher(longString).find()
+ val regex = Regex("(\\W|^)" + Regex.escape(subString) + "(\\W|$)", RegexOption.IGNORE_CASE)
+ return regex.containsMatchIn(longString)
} catch (e: Exception) {
Timber.e(e, "## caseInsensitiveFind() : failed")
}
- return res
+ return false
}
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/EventMatchCondition.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/EventMatchCondition.kt
index 7325abba2a..a4eacc9018 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/EventMatchCondition.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/EventMatchCondition.kt
@@ -29,28 +29,25 @@ class EventMatchCondition(val key: String, val pattern: String) : Condition(Kind
return "'$key' Matches '$pattern'"
}
-
fun isSatisfied(event: Event): Boolean {
- //TODO encrypted events?
+ // TODO encrypted events?
val rawJson = MoshiProvider.providesMoshi().adapter(Event::class.java).toJsonValue(event) as? Map<*, *>
?: return false
val value = extractField(rawJson, key) ?: return false
- //Patterns with no special glob characters should be treated as having asterisks prepended
+ // Patterns with no special glob characters should be treated as having asterisks prepended
// and appended when testing the condition.
try {
val modPattern = if (hasSpecialGlobChar(pattern)) simpleGlobToRegExp(pattern) else simpleGlobToRegExp("*$pattern*")
val regex = Regex(modPattern, RegexOption.DOT_MATCHES_ALL)
return regex.containsMatchIn(value)
} catch (e: Throwable) {
- //e.g PatternSyntaxException
+ // e.g PatternSyntaxException
Timber.e(e, "Failed to evaluate push condition")
return false
}
-
}
-
private fun extractField(jsonObject: Map<*, *>, fieldPath: String): String? {
val fieldParts = fieldPath.split(".")
if (fieldParts.isEmpty()) return null
@@ -77,9 +74,9 @@ class EventMatchCondition(val key: String, val pattern: String) : Condition(Kind
return glob.contains("*") || glob.contains("?")
}
- //Very simple glob to regexp converter
+ // Very simple glob to regexp converter
private fun simpleGlobToRegExp(glob: String): String {
- var out = ""//"^"
+ var out = "" // "^"
for (i in 0 until glob.length) {
val c = glob[i]
when (c) {
@@ -90,8 +87,8 @@ class EventMatchCondition(val key: String, val pattern: String) : Condition(Kind
else -> out += c
}
}
- out += ""//'$'.toString()
+ out += "" // '$'.toString()
return out
}
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/PushRuleService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/PushRuleService.kt
index c0204d181d..aa277ea8bd 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/PushRuleService.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/PushRuleService.kt
@@ -27,10 +27,10 @@ interface PushRuleService {
*/
fun fetchPushRules(scope: String = RuleScope.GLOBAL)
- //TODO get push rule set
+ // TODO get push rule set
fun getPushRules(scope: String = RuleScope.GLOBAL): List
- //TODO update rule
+ // TODO update rule
fun updatePushRuleEnableStatus(kind: RuleKind, pushRule: PushRule, enabled: Boolean, callback: MatrixCallback): Cancelable
@@ -42,8 +42,9 @@ interface PushRuleService {
interface PushRuleListener {
fun onMatchRule(event: Event, actions: List)
+ fun onRoomJoined(roomId: String)
fun onRoomLeft(roomId: String)
fun onEventRedacted(redactedEventId: String)
fun batchFinish()
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/RoomMemberCountCondition.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/RoomMemberCountCondition.kt
index d0b76fbab7..d41788234b 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/RoomMemberCountCondition.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/RoomMemberCountCondition.kt
@@ -62,6 +62,5 @@ class RoomMemberCountCondition(val iz: String) : Condition(Kind.room_member_coun
Timber.d(t)
}
return null
-
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/SenderNotificationPermissionCondition.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/SenderNotificationPermissionCondition.kt
index 35b731c5c3..46fc9a5c6d 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/SenderNotificationPermissionCondition.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/SenderNotificationPermissionCondition.kt
@@ -18,7 +18,6 @@ package im.vector.matrix.android.api.pushrules
import im.vector.matrix.android.api.session.events.model.Event
import im.vector.matrix.android.api.session.room.model.PowerLevels
-
class SenderNotificationPermissionCondition(val key: String) : Condition(Kind.sender_notification_permission) {
override fun isSatisfied(conditionResolver: ConditionResolver): Boolean {
@@ -29,8 +28,7 @@ class SenderNotificationPermissionCondition(val key: String) : Condition(Kind.se
return "User power level <$key>"
}
-
fun isSatisfied(event: Event, powerLevels: PowerLevels): Boolean {
return event.senderId != null && powerLevels.getUserPowerLevel(event.senderId) >= powerLevels.notificationLevel(key)
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/rest/PushCondition.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/rest/PushCondition.kt
index 7b71a344a0..4b643a0b42 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/rest/PushCondition.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/rest/PushCondition.kt
@@ -76,4 +76,4 @@ data class PushCondition(
}
}
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/rest/PushRule.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/rest/PushRule.kt
index 1e36a0d867..e9423d7c40 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/rest/PushRule.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/rest/PushRule.kt
@@ -19,7 +19,6 @@ package im.vector.matrix.android.api.pushrules.rest
import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass
-
@JsonClass(generateAdapter = true)
data class PushRule(
/**
@@ -47,4 +46,3 @@ data class PushRule(
*/
val pattern: String? = null
)
-
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/rest/Ruleset.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/rest/Ruleset.kt
index 5f4ca15ac0..72692d5afd 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/rest/Ruleset.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/pushrules/rest/Ruleset.kt
@@ -24,4 +24,4 @@ data class Ruleset(
val room: List? = null,
val sender: List? = null,
val underride: List? = null
-)
\ No newline at end of file
+)
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/InitialSyncProgressService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/InitialSyncProgressService.kt
index a4c9d81beb..4d65179307 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/InitialSyncProgressService.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/InitialSyncProgressService.kt
@@ -26,4 +26,4 @@ interface InitialSyncProgressService {
@StringRes val statusText: Int,
val percentProgress: Int = 0
)
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/Session.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/Session.kt
index 53dc8e77a0..2440713a40 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/Session.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/Session.kt
@@ -19,6 +19,7 @@ package im.vector.matrix.android.api.session
import androidx.annotation.MainThread
import androidx.lifecycle.LiveData
import im.vector.matrix.android.api.auth.data.SessionParams
+import im.vector.matrix.android.api.failure.ConsentNotGivenError
import im.vector.matrix.android.api.pushrules.PushRuleService
import im.vector.matrix.android.api.session.cache.CacheService
import im.vector.matrix.android.api.session.content.ContentUploadStateTracker
@@ -26,6 +27,7 @@ import im.vector.matrix.android.api.session.content.ContentUrlResolver
import im.vector.matrix.android.api.session.crypto.CryptoService
import im.vector.matrix.android.api.session.file.FileService
import im.vector.matrix.android.api.session.group.GroupService
+import im.vector.matrix.android.api.session.homeserver.HomeServerCapabilitiesService
import im.vector.matrix.android.api.session.pushers.PushersService
import im.vector.matrix.android.api.session.room.RoomDirectoryService
import im.vector.matrix.android.api.session.room.RoomService
@@ -52,6 +54,7 @@ interface Session :
PushRuleService,
PushersService,
InitialSyncProgressService,
+ HomeServerCapabilitiesService,
SecureStorageService {
/**
@@ -65,7 +68,6 @@ interface Session :
val myUserId: String
get() = sessionParams.credentials.userId
-
/**
* This method allow to open a session. It does start some service on the background.
*/
@@ -138,6 +140,9 @@ interface Session :
*/
fun onInvalidToken()
+ /**
+ * A M_CONSENT_NOT_GIVEN error has been received from the homeserver
+ */
+ fun onConsentNotGivenError(consentNotGivenError: ConsentNotGivenError)
}
-
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/cache/CacheService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/cache/CacheService.kt
index 43ab78b5aa..f1e4ca6c7b 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/cache/CacheService.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/cache/CacheService.kt
@@ -27,5 +27,4 @@ interface CacheService {
* Clear the whole cached data, except credentials. Once done, the session is closed and has to be opened again
*/
fun clearCache(callback: MatrixCallback)
-
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/content/ContentAttachmentData.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/content/ContentAttachmentData.kt
index c8dca8692c..933657b2fb 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/content/ContentAttachmentData.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/content/ContentAttachmentData.kt
@@ -17,6 +17,7 @@
package im.vector.matrix.android.api.session.content
import android.os.Parcelable
+import androidx.exifinterface.media.ExifInterface
import kotlinx.android.parcel.Parcelize
@Parcelize
@@ -26,6 +27,7 @@ data class ContentAttachmentData(
val date: Long = 0,
val height: Long? = 0,
val width: Long? = 0,
+ val exifOrientation: Int = ExifInterface.ORIENTATION_UNDEFINED,
val name: String? = null,
val path: String,
val mimeType: String,
@@ -38,5 +40,4 @@ data class ContentAttachmentData(
AUDIO,
VIDEO
}
-
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/content/ContentUploadStateTracker.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/content/ContentUploadStateTracker.kt
index 26273ebb8a..540b164aa5 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/content/ContentUploadStateTracker.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/content/ContentUploadStateTracker.kt
@@ -35,4 +35,4 @@ interface ContentUploadStateTracker {
object Success : State()
data class Failure(val throwable: Throwable) : State()
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/content/ContentUrlResolver.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/content/ContentUrlResolver.kt
index 0a20bef809..9ba1631aec 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/content/ContentUrlResolver.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/content/ContentUrlResolver.kt
@@ -44,4 +44,4 @@ interface ContentUrlResolver {
* @return the URL to access the described resource, or null if the url is invalid.
*/
fun resolveThumbnail(contentUrl: String?, width: Int, height: Int, method: ThumbnailMethod): String?
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/CryptoService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/CryptoService.kt
index 43c783a13d..706f89dfc9 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/CryptoService.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/CryptoService.kt
@@ -112,5 +112,4 @@ interface CryptoService {
fun addNewSessionListener(newSessionListener: NewSessionListener)
fun removeSessionListener(listener: NewSessionListener)
-
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/MXCryptoError.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/MXCryptoError.kt
index b61a1e4149..fe41b6c074 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/MXCryptoError.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/MXCryptoError.kt
@@ -90,4 +90,4 @@ sealed class MXCryptoError : Throwable() {
const val NO_MORE_ALGORITHM_REASON = "Room was previously configured to use encryption, but is no longer." +
" Perhaps the homeserver is hiding the configuration event."
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/keysbackup/KeysBackupService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/keysbackup/KeysBackupService.kt
index 6728daa527..cb06dbf665 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/keysbackup/KeysBackupService.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/keysbackup/KeysBackupService.kt
@@ -210,5 +210,4 @@ interface KeysBackupService {
val isEnabled: Boolean
val isStucked: Boolean
val state: KeysBackupState
-
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/keysbackup/KeysBackupState.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/keysbackup/KeysBackupState.kt
index a1bd29e78d..a20f1c61b4 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/keysbackup/KeysBackupState.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/keysbackup/KeysBackupState.kt
@@ -72,4 +72,4 @@ enum class KeysBackupState {
WillBackUp,
// e2e keys are being sent to the homeserver
BackingUp
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/keysbackup/KeysBackupStateListener.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/keysbackup/KeysBackupStateListener.kt
index f145d779f1..be1f2e5f3e 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/keysbackup/KeysBackupStateListener.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/keysbackup/KeysBackupStateListener.kt
@@ -23,4 +23,4 @@ interface KeysBackupStateListener {
* @param newState the new state
*/
fun onStateChange(newState: KeysBackupState)
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/CancelCode.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/CancelCode.kt
index d999d06fc5..92a69bcad6 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/CancelCode.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/CancelCode.kt
@@ -30,4 +30,4 @@ enum class CancelCode(val value: String, val humanReadable: String) {
fun safeValueOf(code: String?): CancelCode {
return CancelCode.values().firstOrNull { code == it.value } ?: CancelCode.User
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/EmojiRepresentation.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/EmojiRepresentation.kt
index 0bcb96a999..031610f0c6 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/EmojiRepresentation.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/EmojiRepresentation.kt
@@ -19,4 +19,4 @@ package im.vector.matrix.android.api.session.crypto.sas
import androidx.annotation.StringRes
data class EmojiRepresentation(val emoji: String,
- @StringRes val nameResId: Int)
\ No newline at end of file
+ @StringRes val nameResId: Int)
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/IncomingSasVerificationTransaction.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/IncomingSasVerificationTransaction.kt
index 791c63dc15..57dfc74236 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/IncomingSasVerificationTransaction.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/IncomingSasVerificationTransaction.kt
@@ -31,4 +31,4 @@ interface IncomingSasVerificationTransaction {
CANCELLED_BY_ME,
CANCELLED_BY_OTHER
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/OutgoingSasVerificationRequest.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/OutgoingSasVerificationRequest.kt
index 6aeed55549..f2c16da997 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/OutgoingSasVerificationRequest.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/OutgoingSasVerificationRequest.kt
@@ -29,4 +29,4 @@ interface OutgoingSasVerificationRequest {
CANCELLED_BY_ME,
CANCELLED_BY_OTHER
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/Mode.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/SasMode.kt
similarity index 99%
rename from matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/Mode.kt
rename to matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/SasMode.kt
index da72e98bad..f58485decd 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/Mode.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/SasMode.kt
@@ -19,4 +19,4 @@ package im.vector.matrix.android.api.session.crypto.sas
object SasMode {
const val DECIMAL = "decimal"
const val EMOJI = "emoji"
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/SasVerificationService.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/SasVerificationService.kt
index a11c69cd7e..88c0787b4d 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/SasVerificationService.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/SasVerificationService.kt
@@ -36,4 +36,4 @@ interface SasVerificationService {
fun transactionUpdated(tx: SasVerificationTransaction)
fun markedAsManuallyVerified(userId: String, deviceId: String)
}
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/SasVerificationTransaction.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/SasVerificationTransaction.kt
index dc489cf644..d24ccadb55 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/SasVerificationTransaction.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/SasVerificationTransaction.kt
@@ -47,4 +47,4 @@ interface SasVerificationTransaction {
* both short codes do match
*/
fun userHasVerifiedShortCode()
-}
\ No newline at end of file
+}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/SasVerificationTxState.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/SasVerificationTxState.kt
index 60ce8f0cc6..350ec2c381 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/SasVerificationTxState.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/crypto/sas/SasVerificationTxState.kt
@@ -43,7 +43,7 @@ enum class SasVerificationTxState {
Verifying,
Verified,
- //Global: The verification has been cancelled (by me or other), see cancelReason for details
+ // Global: The verification has been cancelled (by me or other), see cancelReason for details
Cancelled,
OnCancelled
}
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/events/model/AggregatedAnnotation.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/events/model/AggregatedAnnotation.kt
index 3f1c619906..ef164cd17b 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/events/model/AggregatedAnnotation.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/events/model/AggregatedAnnotation.kt
@@ -34,9 +34,9 @@ import com.squareup.moshi.JsonClass
*/
@JsonClass(generateAdapter = true)
-data class AggregatedAnnotation (
+data class AggregatedAnnotation(
override val limited: Boolean? = false,
override val count: Int? = 0,
val chunk: List? = null
-) : UnsignedRelationInfo
\ No newline at end of file
+) : UnsignedRelationInfo
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/events/model/AggregatedRelations.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/events/model/AggregatedRelations.kt
index 0f8d21f532..d04a72bac5 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/events/model/AggregatedRelations.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/events/model/AggregatedRelations.kt
@@ -50,4 +50,4 @@ import com.squareup.moshi.JsonClass
data class AggregatedRelations(
@Json(name = "m.annotation") val annotations: AggregatedAnnotation? = null,
@Json(name = "m.reference") val references: DefaultUnsignedRelationInfo? = null
-)
\ No newline at end of file
+)
diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/events/model/DefaultUnsignedRelationInfo.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/events/model/DefaultUnsignedRelationInfo.kt
index 3e2df0aaf2..f7a573ca28 100644
--- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/events/model/DefaultUnsignedRelationInfo.kt
+++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/api/session/events/model/DefaultUnsignedRelationInfo.kt
@@ -23,4 +23,4 @@ data class DefaultUnsignedRelationInfo(
override val count: Int? = 0,
val chunk: List