diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 22d12ac663..2512052953 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -61,8 +61,9 @@ Supported filename extensions are:
- ``.feature``: Signifying a new feature in Element Android or in the Matrix SDK.
- ``.bugfix``: Signifying a bug fix.
+- ``.wip``: Signifying a work in progress change, typically a component of a larger feature which will be enabled once all tasks are complete.
- ``.doc``: Signifying a documentation improvement.
-- ``.removal``: Signifying a deprecation or removal of public API. Can be used to notifying about API change in the Matrix SDK
+- ``.sdk``: Signifying a change to the Matrix SDK, this could be an addition, deprecation or removal of a public API.
- ``.misc``: Any other changes.
See https://github.com/twisted/towncrier#news-fragments if you need more details.
diff --git a/attachment-viewer/build.gradle b/attachment-viewer/build.gradle
index 02fbfc794c..048710f62c 100644
--- a/attachment-viewer/build.gradle
+++ b/attachment-viewer/build.gradle
@@ -47,12 +47,10 @@ android {
dependencies {
implementation project(":library:ui-styles")
+ implementation project(":library:core-utils")
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
- implementation libs.rx.rxKotlin
- implementation libs.rx.rxAndroid
-
implementation libs.androidx.core
implementation libs.androidx.appCompat
implementation libs.androidx.recyclerview
diff --git a/attachment-viewer/src/main/java/im/vector/lib/attachmentviewer/VideoViewHolder.kt b/attachment-viewer/src/main/java/im/vector/lib/attachmentviewer/VideoViewHolder.kt
index 0b72ef36f0..12213a8786 100644
--- a/attachment-viewer/src/main/java/im/vector/lib/attachmentviewer/VideoViewHolder.kt
+++ b/attachment-viewer/src/main/java/im/vector/lib/attachmentviewer/VideoViewHolder.kt
@@ -20,12 +20,9 @@ import android.util.Log
import android.view.View
import androidx.core.view.isVisible
import im.vector.lib.attachmentviewer.databinding.ItemVideoAttachmentBinding
-import io.reactivex.Observable
-import io.reactivex.android.schedulers.AndroidSchedulers
-import io.reactivex.disposables.Disposable
+import im.vector.lib.core.utils.timer.CountUpTimer
import java.io.File
import java.lang.ref.WeakReference
-import java.util.concurrent.TimeUnit
// TODO, it would be probably better to use a unique media player
// for better customization and control
@@ -35,7 +32,7 @@ class VideoViewHolder constructor(itemView: View) :
private var isSelected = false
private var mVideoPath: String? = null
- private var progressDisposable: Disposable? = null
+ private var countUpTimer: CountUpTimer? = null
private var progress: Int = 0
private var wasPaused = false
@@ -47,8 +44,7 @@ class VideoViewHolder constructor(itemView: View) :
override fun onRecycled() {
super.onRecycled()
- progressDisposable?.dispose()
- progressDisposable = null
+ stopTimer()
mVideoPath = null
}
@@ -72,8 +68,7 @@ class VideoViewHolder constructor(itemView: View) :
override fun entersBackground() {
if (views.videoView.isPlaying) {
progress = views.videoView.currentPosition
- progressDisposable?.dispose()
- progressDisposable = null
+ stopTimer()
views.videoView.stopPlayback()
views.videoView.pause()
}
@@ -91,8 +86,7 @@ class VideoViewHolder constructor(itemView: View) :
} else {
progress = 0
}
- progressDisposable?.dispose()
- progressDisposable = null
+ stopTimer()
} else {
if (mVideoPath != null) {
startPlaying()
@@ -107,17 +101,19 @@ class VideoViewHolder constructor(itemView: View) :
views.videoView.isVisible = true
views.videoView.setOnPreparedListener {
- progressDisposable?.dispose()
- progressDisposable = Observable.interval(100, TimeUnit.MILLISECONDS)
- .timeInterval()
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe {
+ stopTimer()
+ countUpTimer = CountUpTimer(100).also {
+ it.tickListener = object : CountUpTimer.TickListener {
+ override fun onTick(milliseconds: Long) {
val duration = views.videoView.duration
val progress = views.videoView.currentPosition
val isPlaying = views.videoView.isPlaying
// Log.v("FOO", "isPlaying $isPlaying $progress/$duration")
eventListener?.get()?.onEvent(AttachmentEvents.VideoEvent(isPlaying, progress, duration))
}
+ }
+ it.resume()
+ }
}
try {
views.videoView.setVideoPath(mVideoPath)
@@ -134,6 +130,11 @@ class VideoViewHolder constructor(itemView: View) :
}
}
+ private fun stopTimer() {
+ countUpTimer?.stop()
+ countUpTimer = null
+ }
+
override fun handleCommand(commands: AttachmentCommands) {
if (!isSelected) return
when (commands) {
diff --git a/build.gradle b/build.gradle
index f2a286f0d4..8a8289c6fa 100644
--- a/build.gradle
+++ b/build.gradle
@@ -158,13 +158,3 @@ ext {
// }
// }
//}
-//
-//project(":matrix-sdk-android-rx") {
-// sonarqube {
-// properties {
-// property "sonar.sources", project(":matrix-sdk-android-rx").android.sourceSets.main.java.srcDirs
-// // exclude source code from analyses separated by a colon (:)
-// // property "sonar.exclusions", "**/*.*"
-// }
-// }
-//}
diff --git a/changelog.d/3932.bugfix b/changelog.d/3932.bugfix
new file mode 100644
index 0000000000..76e90f2bfd
--- /dev/null
+++ b/changelog.d/3932.bugfix
@@ -0,0 +1 @@
+Explore Rooms overflow menu - content update include "Create room"
\ No newline at end of file
diff --git a/changelog.d/4669.bugfix b/changelog.d/4669.bugfix
new file mode 100644
index 0000000000..8e38becdd9
--- /dev/null
+++ b/changelog.d/4669.bugfix
@@ -0,0 +1 @@
+Fix sync timeout after returning from background
diff --git a/changelog.d/4811.feature b/changelog.d/4811.feature
new file mode 100644
index 0000000000..e113078f21
--- /dev/null
+++ b/changelog.d/4811.feature
@@ -0,0 +1 @@
+Enabling native support for window resizing
\ No newline at end of file
diff --git a/changelog.d/4865.misc b/changelog.d/4865.misc
new file mode 100644
index 0000000000..291c4a099f
--- /dev/null
+++ b/changelog.d/4865.misc
@@ -0,0 +1 @@
+"/kick" command is replaced with "/remove". Also replaced all occurrences in string resources
diff --git a/changelog.d/4880.wip b/changelog.d/4880.wip
new file mode 100644
index 0000000000..e74c56cdc4
--- /dev/null
+++ b/changelog.d/4880.wip
@@ -0,0 +1 @@
+Updates the onboarding carousel images, copy and improves the handling of different device sizes
\ No newline at end of file
diff --git a/changelog.d/4895.removal b/changelog.d/4895.removal
new file mode 100644
index 0000000000..8b3e3adba4
--- /dev/null
+++ b/changelog.d/4895.removal
@@ -0,0 +1 @@
+`StateService.sendStateEvent()` now takes a non-nullable String for the parameter `stateKey`. If null was used, just now use an empty string.
\ No newline at end of file
diff --git a/changelog.d/4914.wip b/changelog.d/4914.wip
new file mode 100644
index 0000000000..9d471d40ac
--- /dev/null
+++ b/changelog.d/4914.wip
@@ -0,0 +1 @@
+Disabling onboarding automatic carousel transitions on user interaction
\ No newline at end of file
diff --git a/changelog.d/4918.wip b/changelog.d/4918.wip
new file mode 100644
index 0000000000..ed5a273e16
--- /dev/null
+++ b/changelog.d/4918.wip
@@ -0,0 +1 @@
+Locking phones to portrait during the FTUE onboarding
\ No newline at end of file
diff --git a/changelog.d/4927.wip b/changelog.d/4927.wip
new file mode 100644
index 0000000000..86e9abad26
--- /dev/null
+++ b/changelog.d/4927.wip
@@ -0,0 +1 @@
+Adds a messaging use case screen to the FTUE onboarding
\ No newline at end of file
diff --git a/changelog.d/4935.bugfix b/changelog.d/4935.bugfix
new file mode 100644
index 0000000000..18967ed4a5
--- /dev/null
+++ b/changelog.d/4935.bugfix
@@ -0,0 +1 @@
+Fix a wrong network error issue in the Legals screen
\ No newline at end of file
diff --git a/changelog.d/4942.misc b/changelog.d/4942.misc
new file mode 100644
index 0000000000..29fb8cee55
--- /dev/null
+++ b/changelog.d/4942.misc
@@ -0,0 +1 @@
+Remove unused module matrix-sdk-android-rx and do some cleanup
\ No newline at end of file
diff --git a/changelog.d/4948.bugfix b/changelog.d/4948.bugfix
new file mode 100644
index 0000000000..da4b0a2500
--- /dev/null
+++ b/changelog.d/4948.bugfix
@@ -0,0 +1 @@
+Prevent Alerts to be displayed in the automatically displayed analytics opt-in screen
\ No newline at end of file
diff --git a/changelog.d/4960.misc b/changelog.d/4960.misc
new file mode 100644
index 0000000000..0829d74b61
--- /dev/null
+++ b/changelog.d/4960.misc
@@ -0,0 +1 @@
+Improves local echo blinking when non room events received
diff --git a/changelog.d/516.bugfix b/changelog.d/516.bugfix
new file mode 100644
index 0000000000..7a5f745c32
--- /dev/null
+++ b/changelog.d/516.bugfix
@@ -0,0 +1 @@
+Fix for stuck local event messages at the bottom of the screen
diff --git a/dependencies.gradle b/dependencies.gradle
index 2243510f92..b4e1a7e7fa 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -42,7 +42,6 @@ ext.libs = [
jetbrains : [
'coroutinesCore' : "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutines",
'coroutinesAndroid' : "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinCoroutines",
- 'coroutinesRx2' : "org.jetbrains.kotlinx:kotlinx-coroutines-rx2:$kotlinCoroutines",
'coroutinesTest' : "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinCoroutines"
],
androidx : [
@@ -87,8 +86,7 @@ ext.libs = [
'retrofitMoshi' : "com.squareup.retrofit2:converter-moshi:$retrofit"
],
rx : [
- 'rxKotlin' : "io.reactivex.rxjava2:rxkotlin:2.4.0",
- 'rxAndroid' : "io.reactivex.rxjava2:rxandroid:2.1.1"
+ 'rxKotlin' : "io.reactivex.rxjava2:rxkotlin:2.4.0"
],
arrow : [
'core' : "io.arrow-kt:arrow-core:$arrow",
diff --git a/library/core-utils/.gitignore b/library/core-utils/.gitignore
new file mode 100644
index 0000000000..42afabfd2a
--- /dev/null
+++ b/library/core-utils/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/library/core-utils/build.gradle b/library/core-utils/build.gradle
new file mode 100644
index 0000000000..ad3a948808
--- /dev/null
+++ b/library/core-utils/build.gradle
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2021 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.
+ */
+
+plugins {
+ id 'com.android.library'
+ id 'kotlin-android'
+}
+
+android {
+ compileSdk versions.compileSdk
+ defaultConfig {
+ minSdk versions.minSdk
+ targetSdk versions.targetSdk
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ consumerProguardFiles "consumer-rules.pro"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility versions.sourceCompat
+ targetCompatibility versions.targetCompat
+ }
+
+ kotlinOptions {
+ jvmTarget = "11"
+ freeCompilerArgs += [
+ "-Xopt-in=kotlin.RequiresOptIn"
+ ]
+ }
+}
+
+dependencies {
+ implementation libs.androidx.appCompat
+ implementation libs.jetbrains.coroutinesAndroid
+}
\ No newline at end of file
diff --git a/library/core-utils/src/main/AndroidManifest.xml b/library/core-utils/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..20a9414519
--- /dev/null
+++ b/library/core-utils/src/main/AndroidManifest.xml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/vector/src/main/java/im/vector/app/core/flow/TimingOperators.kt b/library/core-utils/src/main/java/im/vector/lib/core/utils/flow/TimingOperators.kt
similarity index 97%
rename from vector/src/main/java/im/vector/app/core/flow/TimingOperators.kt
rename to library/core-utils/src/main/java/im/vector/lib/core/utils/flow/TimingOperators.kt
index 621a80d96e..065c19c17a 100644
--- a/vector/src/main/java/im/vector/app/core/flow/TimingOperators.kt
+++ b/library/core-utils/src/main/java/im/vector/lib/core/utils/flow/TimingOperators.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package im.vector.app.core.flow
+package im.vector.lib.core.utils.flow
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -85,10 +85,12 @@ fun Flow.throttleFirst(windowDuration: Long): Flow = flow {
}
}
+@ExperimentalCoroutinesApi
fun tickerFlow(scope: CoroutineScope, delayMillis: Long, initialDelayMillis: Long = delayMillis): Flow {
return scope.fixedPeriodTicker(delayMillis, initialDelayMillis).consumeAsFlow()
}
+@ExperimentalCoroutinesApi
private fun CoroutineScope.fixedPeriodTicker(delayMillis: Long, initialDelayMillis: Long = delayMillis): ReceiveChannel {
require(delayMillis >= 0) { "Expected non-negative delay, but has $delayMillis ms" }
require(initialDelayMillis >= 0) { "Expected non-negative initial delay, but has $initialDelayMillis ms" }
diff --git a/vector/src/main/java/im/vector/app/core/utils/CountUpTimer.kt b/library/core-utils/src/main/java/im/vector/lib/core/utils/timer/CountUpTimer.kt
similarity index 93%
rename from vector/src/main/java/im/vector/app/core/utils/CountUpTimer.kt
rename to library/core-utils/src/main/java/im/vector/lib/core/utils/timer/CountUpTimer.kt
index b58d0fb3f6..e9d311fe03 100644
--- a/vector/src/main/java/im/vector/app/core/utils/CountUpTimer.kt
+++ b/library/core-utils/src/main/java/im/vector/lib/core/utils/timer/CountUpTimer.kt
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package im.vector.app.core.utils
+package im.vector.lib.core.utils.timer
-import im.vector.app.core.flow.tickerFlow
+import im.vector.lib.core.utils.flow.tickerFlow
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.cancel
@@ -27,6 +27,7 @@ import kotlinx.coroutines.flow.onEach
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicLong
+@OptIn(kotlinx.coroutines.ExperimentalCoroutinesApi::class)
class CountUpTimer(private val intervalInMs: Long = 1_000) {
private val coroutineScope = CoroutineScope(Dispatchers.Main)
diff --git a/library/ui-styles/src/main/java/MaterialProgressDialog.kt b/library/ui-styles/src/main/java/im/vector/lib/ui/styles/dialogs/MaterialProgressDialog.kt
similarity index 100%
rename from library/ui-styles/src/main/java/MaterialProgressDialog.kt
rename to library/ui-styles/src/main/java/im/vector/lib/ui/styles/dialogs/MaterialProgressDialog.kt
diff --git a/library/ui-styles/src/main/res/drawable/bg_carousel_page_dark.xml b/library/ui-styles/src/main/res/drawable/bg_carousel_page_dark.xml
new file mode 100644
index 0000000000..f229c51d1b
--- /dev/null
+++ b/library/ui-styles/src/main/res/drawable/bg_carousel_page_dark.xml
@@ -0,0 +1,7 @@
+
+
+
+
\ No newline at end of file
diff --git a/library/ui-styles/src/main/res/values-h720dp/dimens.xml b/library/ui-styles/src/main/res/values-h720dp/dimens.xml
new file mode 100644
index 0000000000..1a7791720d
--- /dev/null
+++ b/library/ui-styles/src/main/res/values-h720dp/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ - 0.05
+ - 0.40
+
\ No newline at end of file
diff --git a/library/ui-styles/src/main/res/values-sw600dp/tablet.xml b/library/ui-styles/src/main/res/values-sw600dp/tablet.xml
index 39f467cf0d..86bab06371 100644
--- a/library/ui-styles/src/main/res/values-sw600dp/tablet.xml
+++ b/library/ui-styles/src/main/res/values-sw600dp/tablet.xml
@@ -2,5 +2,6 @@
0.6
+ true
\ No newline at end of file
diff --git a/library/ui-styles/src/main/res/values/dimens.xml b/library/ui-styles/src/main/res/values/dimens.xml
index 4a54a1681c..7e79218281 100644
--- a/library/ui-styles/src/main/res/values/dimens.xml
+++ b/library/ui-styles/src/main/res/values/dimens.xml
@@ -55,4 +55,7 @@
- 0.05
- 0.95
+
+ - 0.01
+ - 0.35
\ No newline at end of file
diff --git a/library/ui-styles/src/main/res/values/tablet.xml b/library/ui-styles/src/main/res/values/tablet.xml
index a5df8fe17c..8460f0ccf8 100644
--- a/library/ui-styles/src/main/res/values/tablet.xml
+++ b/library/ui-styles/src/main/res/values/tablet.xml
@@ -2,5 +2,6 @@
1
+ false
\ No newline at end of file
diff --git a/matrix-sdk-android-rx/.gitignore b/matrix-sdk-android-rx/.gitignore
deleted file mode 100644
index 796b96d1c4..0000000000
--- a/matrix-sdk-android-rx/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/matrix-sdk-android-rx/build.gradle b/matrix-sdk-android-rx/build.gradle
deleted file mode 100644
index dbd761cee3..0000000000
--- a/matrix-sdk-android-rx/build.gradle
+++ /dev/null
@@ -1,47 +0,0 @@
-apply plugin: 'com.android.library'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-kapt'
-
-android {
- compileSdk versions.compileSdk
-
- defaultConfig {
- minSdk versions.minSdk
- targetSdk versions.targetSdk
-
- // Multidex is useful for tests
- multiDexEnabled true
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
- }
- }
-
- compileOptions {
- sourceCompatibility versions.sourceCompat
- targetCompatibility versions.targetCompat
- }
-
- kotlinOptions {
- jvmTarget = "11"
- }
-}
-
-dependencies {
-
- implementation project(":matrix-sdk-android")
- implementation libs.androidx.appCompat
- implementation libs.rx.rxKotlin
- implementation libs.rx.rxAndroid
- implementation libs.jetbrains.coroutinesRx2
-
- // Paging
- implementation libs.androidx.pagingRuntimeKtx
-
- // Logging
- implementation libs.jakewharton.timber
-}
diff --git a/matrix-sdk-android-rx/proguard-rules.pro b/matrix-sdk-android-rx/proguard-rules.pro
deleted file mode 100644
index f1b424510d..0000000000
--- a/matrix-sdk-android-rx/proguard-rules.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-# Add project specific ProGuard rules here.
-# You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile
diff --git a/matrix-sdk-android-rx/src/main/AndroidManifest.xml b/matrix-sdk-android-rx/src/main/AndroidManifest.xml
deleted file mode 100644
index 5f399e9f84..0000000000
--- a/matrix-sdk-android-rx/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/matrix-sdk-android-rx/src/main/java/org/matrix/android/sdk/rx/LiveDataObservable.kt b/matrix-sdk-android-rx/src/main/java/org/matrix/android/sdk/rx/LiveDataObservable.kt
deleted file mode 100644
index 56b52facf9..0000000000
--- a/matrix-sdk-android-rx/src/main/java/org/matrix/android/sdk/rx/LiveDataObservable.kt
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2020 The Matrix.org Foundation C.I.C.
- *
- * 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.android.sdk.rx
-
-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(
- private val liveData: LiveData,
- private val valueIfNull: T? = null
-) : Observable() {
-
- override fun subscribeActual(observer: io.reactivex.Observer) {
- val relay = RemoveObserverInMainThread(observer)
- observer.onSubscribe(relay)
- liveData.observeForever(relay)
- }
-
- private inner class RemoveObserverInMainThread(private val observer: io.reactivex.Observer) :
- MainThreadDisposable(), Observer {
-
- override fun onChanged(t: T?) {
- if (!isDisposed) {
- if (t == null) {
- if (valueIfNull != null) {
- observer.onNext(valueIfNull)
- } else {
- observer.onError(NullPointerException(
- "convert liveData value t to RxJava onNext(t), t cannot be null"))
- }
- } else {
- observer.onNext(t)
- }
- }
- }
-
- override fun onDispose() {
- liveData.removeObserver(this)
- }
- }
-}
-
-fun LiveData.asObservable(): Observable {
- return LiveDataObservable(this).observeOn(Schedulers.computation())
-}
-
-internal fun Observable.startWithCallable(supplier: () -> T): Observable {
- val startObservable = Observable
- .fromCallable(supplier)
- .subscribeOn(Schedulers.io())
- .observeOn(AndroidSchedulers.mainThread())
- return startWith(startObservable)
-}
diff --git a/matrix-sdk-android-rx/src/main/java/org/matrix/android/sdk/rx/OptionalRx.kt b/matrix-sdk-android-rx/src/main/java/org/matrix/android/sdk/rx/OptionalRx.kt
deleted file mode 100644
index 936bd824e7..0000000000
--- a/matrix-sdk-android-rx/src/main/java/org/matrix/android/sdk/rx/OptionalRx.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright 2020 The Matrix.org Foundation C.I.C.
- *
- * 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.android.sdk.rx
-
-import io.reactivex.Observable
-import org.matrix.android.sdk.api.util.Optional
-
-fun Observable>.unwrap(): Observable {
- return filter { it.hasValue() }.map { it.get() }
-}
-
-fun Observable>.mapOptional(fn: (T) -> U?): Observable> {
- return map {
- it.map(fn)
- }
-}
diff --git a/matrix-sdk-android-rx/src/main/java/org/matrix/android/sdk/rx/RxRoom.kt b/matrix-sdk-android-rx/src/main/java/org/matrix/android/sdk/rx/RxRoom.kt
index 36f59c0058..e69de29bb2 100644
--- a/matrix-sdk-android-rx/src/main/java/org/matrix/android/sdk/rx/RxRoom.kt
+++ b/matrix-sdk-android-rx/src/main/java/org/matrix/android/sdk/rx/RxRoom.kt
@@ -1,161 +0,0 @@
-/*
- * Copyright 2020 The Matrix.org Foundation C.I.C.
- *
- * 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.android.sdk.rx
-
-import android.net.Uri
-import io.reactivex.Completable
-import io.reactivex.Observable
-import io.reactivex.Single
-import kotlinx.coroutines.rx2.rxCompletable
-import kotlinx.coroutines.rx2.rxSingle
-import org.matrix.android.sdk.api.query.QueryStringValue
-import org.matrix.android.sdk.api.session.content.ContentAttachmentData
-import org.matrix.android.sdk.api.session.events.model.Event
-import org.matrix.android.sdk.api.session.identity.ThreePid
-import org.matrix.android.sdk.api.session.room.Room
-import org.matrix.android.sdk.api.session.room.members.RoomMemberQueryParams
-import org.matrix.android.sdk.api.session.room.model.EventAnnotationsSummary
-import org.matrix.android.sdk.api.session.room.model.GuestAccess
-import org.matrix.android.sdk.api.session.room.model.ReadReceipt
-import org.matrix.android.sdk.api.session.room.model.RoomHistoryVisibility
-import org.matrix.android.sdk.api.session.room.model.RoomJoinRules
-import org.matrix.android.sdk.api.session.room.model.RoomMemberSummary
-import org.matrix.android.sdk.api.session.room.model.RoomSummary
-import org.matrix.android.sdk.api.session.room.notification.RoomNotificationState
-import org.matrix.android.sdk.api.session.room.send.UserDraft
-import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
-import org.matrix.android.sdk.api.util.Optional
-import org.matrix.android.sdk.api.util.toOptional
-
-class RxRoom(private val room: Room) {
-
- fun liveRoomSummary(): Observable> {
- return room.getRoomSummaryLive()
- .asObservable()
- .startWithCallable { room.roomSummary().toOptional() }
- }
-
- fun liveRoomMembers(queryParams: RoomMemberQueryParams): Observable> {
- return room.getRoomMembersLive(queryParams).asObservable()
- .startWithCallable {
- room.getRoomMembers(queryParams)
- }
- }
-
- fun liveAnnotationSummary(eventId: String): Observable> {
- return room.getEventAnnotationsSummaryLive(eventId).asObservable()
- .startWithCallable {
- room.getEventAnnotationsSummary(eventId).toOptional()
- }
- }
-
- fun liveTimelineEvent(eventId: String): Observable> {
- return room.getTimeLineEventLive(eventId).asObservable()
- .startWithCallable {
- room.getTimeLineEvent(eventId).toOptional()
- }
- }
-
- fun liveStateEvent(eventType: String, stateKey: QueryStringValue): Observable> {
- return room.getStateEventLive(eventType, stateKey).asObservable()
- .startWithCallable {
- room.getStateEvent(eventType, stateKey).toOptional()
- }
- }
-
- fun liveStateEvents(eventTypes: Set): Observable> {
- return room.getStateEventsLive(eventTypes).asObservable()
- .startWithCallable {
- room.getStateEvents(eventTypes)
- }
- }
-
- fun liveReadMarker(): Observable> {
- return room.getReadMarkerLive().asObservable()
- }
-
- fun liveReadReceipt(): Observable> {
- return room.getMyReadReceiptLive().asObservable()
- }
-
- fun loadRoomMembersIfNeeded(): Single = rxSingle {
- room.loadRoomMembersIfNeeded()
- }
-
- fun joinRoom(reason: String? = null,
- viaServers: List = emptyList()): Single = rxSingle {
- room.join(reason, viaServers)
- }
-
- fun liveEventReadReceipts(eventId: String): Observable> {
- return room.getEventReadReceiptsLive(eventId).asObservable()
- }
-
- fun liveDraft(): Observable> {
- return room.getDraftLive().asObservable()
- .startWithCallable {
- room.getDraft().toOptional()
- }
- }
-
- fun liveNotificationState(): Observable {
- return room.getLiveRoomNotificationState().asObservable()
- }
-
- fun invite(userId: String, reason: String? = null): Completable = rxCompletable {
- room.invite(userId, reason)
- }
-
- fun invite3pid(threePid: ThreePid): Completable = rxCompletable {
- room.invite3pid(threePid)
- }
-
- fun updateTopic(topic: String): Completable = rxCompletable {
- room.updateTopic(topic)
- }
-
- fun updateName(name: String): Completable = rxCompletable {
- room.updateName(name)
- }
-
- fun updateHistoryReadability(readability: RoomHistoryVisibility): Completable = rxCompletable {
- room.updateHistoryReadability(readability)
- }
-
- fun updateJoinRule(joinRules: RoomJoinRules?, guestAccess: GuestAccess?): Completable = rxCompletable {
- room.updateJoinRule(joinRules, guestAccess)
- }
-
- fun updateAvatar(avatarUri: Uri, fileName: String): Completable = rxCompletable {
- room.updateAvatar(avatarUri, fileName)
- }
-
- fun deleteAvatar(): Completable = rxCompletable {
- room.deleteAvatar()
- }
-
- fun sendMedia(attachment: ContentAttachmentData, compressBeforeSending: Boolean, roomIds: Set): Completable = rxCompletable {
- room.sendMedia(
- attachment = attachment,
- compressBeforeSending = compressBeforeSending,
- roomIds = roomIds)
- }
-}
-
-fun Room.rx(): RxRoom {
- return RxRoom(this)
-}
diff --git a/matrix-sdk-android-rx/src/main/java/org/matrix/android/sdk/rx/RxSession.kt b/matrix-sdk-android-rx/src/main/java/org/matrix/android/sdk/rx/RxSession.kt
deleted file mode 100644
index 47203816b4..0000000000
--- a/matrix-sdk-android-rx/src/main/java/org/matrix/android/sdk/rx/RxSession.kt
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Copyright 2020 The Matrix.org Foundation C.I.C.
- *
- * 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.android.sdk.rx
-
-import androidx.paging.PagedList
-import io.reactivex.Observable
-import io.reactivex.Single
-import io.reactivex.functions.Function3
-import kotlinx.coroutines.rx2.rxSingle
-import org.matrix.android.sdk.api.extensions.orFalse
-import org.matrix.android.sdk.api.query.QueryStringValue
-import org.matrix.android.sdk.api.session.Session
-import org.matrix.android.sdk.api.session.accountdata.UserAccountDataEvent
-import org.matrix.android.sdk.api.session.crypto.crosssigning.KEYBACKUP_SECRET_SSSS_NAME
-import org.matrix.android.sdk.api.session.crypto.crosssigning.MASTER_KEY_SSSS_NAME
-import org.matrix.android.sdk.api.session.crypto.crosssigning.MXCrossSigningInfo
-import org.matrix.android.sdk.api.session.crypto.crosssigning.SELF_SIGNING_KEY_SSSS_NAME
-import org.matrix.android.sdk.api.session.crypto.crosssigning.USER_SIGNING_KEY_SSSS_NAME
-import org.matrix.android.sdk.api.session.group.GroupSummaryQueryParams
-import org.matrix.android.sdk.api.session.group.model.GroupSummary
-import org.matrix.android.sdk.api.session.identity.FoundThreePid
-import org.matrix.android.sdk.api.session.identity.ThreePid
-import org.matrix.android.sdk.api.session.pushers.Pusher
-import org.matrix.android.sdk.api.session.room.RoomSummaryQueryParams
-import org.matrix.android.sdk.api.session.room.accountdata.RoomAccountDataEvent
-import org.matrix.android.sdk.api.session.room.members.ChangeMembershipState
-import org.matrix.android.sdk.api.session.room.model.RoomMemberSummary
-import org.matrix.android.sdk.api.session.room.model.RoomSummary
-import org.matrix.android.sdk.api.session.room.model.create.CreateRoomParams
-import org.matrix.android.sdk.api.session.space.SpaceSummaryQueryParams
-import org.matrix.android.sdk.api.session.sync.SyncState
-import org.matrix.android.sdk.api.session.user.model.User
-import org.matrix.android.sdk.api.session.widgets.model.Widget
-import org.matrix.android.sdk.api.util.JsonDict
-import org.matrix.android.sdk.api.util.Optional
-import org.matrix.android.sdk.api.util.toOptional
-import org.matrix.android.sdk.internal.crypto.model.CryptoDeviceInfo
-import org.matrix.android.sdk.internal.crypto.model.rest.DeviceInfo
-import org.matrix.android.sdk.internal.crypto.store.PrivateKeysInfo
-import org.matrix.android.sdk.internal.session.room.alias.RoomAliasDescription
-
-class RxSession(private val session: Session) {
-
- fun liveRoomSummaries(queryParams: RoomSummaryQueryParams): Observable> {
- return session.getRoomSummariesLive(queryParams).asObservable()
- .startWithCallable {
- session.getRoomSummaries(queryParams)
- }
- }
-
- fun liveGroupSummaries(queryParams: GroupSummaryQueryParams): Observable> {
- return session.getGroupSummariesLive(queryParams).asObservable()
- .startWithCallable {
- session.getGroupSummaries(queryParams)
- }
- }
-
- fun liveSpaceSummaries(queryParams: SpaceSummaryQueryParams): Observable> {
- return session.spaceService().getSpaceSummariesLive(queryParams).asObservable()
- .startWithCallable {
- session.spaceService().getSpaceSummaries(queryParams)
- }
- }
-
- fun liveBreadcrumbs(queryParams: RoomSummaryQueryParams): Observable> {
- return session.getBreadcrumbsLive(queryParams).asObservable()
- .startWithCallable {
- session.getBreadcrumbs(queryParams)
- }
- }
-
- fun liveMyDevicesInfo(): Observable> {
- return session.cryptoService().getLiveMyDevicesInfo().asObservable()
- .startWithCallable {
- session.cryptoService().getMyDevicesInfo()
- }
- }
-
- fun liveSyncState(): Observable {
- return session.getSyncStateLive().asObservable()
- }
-
- fun livePushers(): Observable> {
- return session.getPushersLive().asObservable()
- }
-
- fun liveUser(userId: String): Observable> {
- return session.getUserLive(userId).asObservable()
- .startWithCallable {
- session.getUser(userId).toOptional()
- }
- }
-
- fun liveRoomMember(userId: String, roomId: String): Observable> {
- return session.getRoomMemberLive(userId, roomId).asObservable()
- .startWithCallable {
- session.getRoomMember(userId, roomId).toOptional()
- }
- }
-
- fun liveUsers(): Observable> {
- return session.getUsersLive().asObservable()
- }
-
- fun liveIgnoredUsers(): Observable> {
- return session.getIgnoredUsersLive().asObservable()
- }
-
- fun livePagedUsers(filter: String? = null, excludedUserIds: Set? = null): Observable> {
- return session.getPagedUsersLive(filter, excludedUserIds).asObservable()
- }
-
- fun liveThreePIds(refreshData: Boolean): Observable> {
- return session.getThreePidsLive(refreshData).asObservable()
- .startWithCallable { session.getThreePids() }
- }
-
- fun livePendingThreePIds(): Observable> {
- return session.getPendingThreePidsLive().asObservable()
- .startWithCallable { session.getPendingThreePids() }
- }
-
- fun createRoom(roomParams: CreateRoomParams): Single = rxSingle {
- session.createRoom(roomParams)
- }
-
- fun searchUsersDirectory(search: String,
- limit: Int,
- excludedUserIds: Set): Single> = rxSingle {
- session.searchUsersDirectory(search, limit, excludedUserIds)
- }
-
- fun joinRoom(roomIdOrAlias: String,
- reason: String? = null,
- viaServers: List = emptyList()): Single = rxSingle {
- session.joinRoom(roomIdOrAlias, reason, viaServers)
- }
-
- fun getRoomIdByAlias(roomAlias: String,
- searchOnServer: Boolean): Single> = rxSingle {
- session.getRoomIdByAlias(roomAlias, searchOnServer)
- }
-
- fun getProfileInfo(userId: String): Single = rxSingle {
- session.getProfile(userId)
- }
-
- fun liveUserCryptoDevices(userId: String): Observable> {
- return session.cryptoService().getLiveCryptoDeviceInfo(userId).asObservable().startWithCallable {
- session.cryptoService().getCryptoDeviceInfo(userId)
- }
- }
-
- fun liveCrossSigningInfo(userId: String): Observable> {
- return session.cryptoService().crossSigningService().getLiveCrossSigningKeys(userId).asObservable()
- .startWithCallable {
- session.cryptoService().crossSigningService().getUserCrossSigningKeys(userId).toOptional()
- }
- }
-
- fun liveCrossSigningPrivateKeys(): Observable> {
- return session.cryptoService().crossSigningService().getLiveCrossSigningPrivateKeys().asObservable()
- .startWithCallable {
- session.cryptoService().crossSigningService().getCrossSigningPrivateKeys().toOptional()
- }
- }
-
- fun liveUserAccountData(types: Set): Observable> {
- return session.accountDataService().getLiveUserAccountDataEvents(types).asObservable()
- .startWithCallable {
- session.accountDataService().getUserAccountDataEvents(types)
- }
- }
-
- fun liveRoomAccountData(types: Set): Observable> {
- return session.accountDataService().getLiveRoomAccountDataEvents(types).asObservable()
- .startWithCallable {
- session.accountDataService().getRoomAccountDataEvents(types)
- }
- }
-
- fun liveRoomWidgets(
- roomId: String,
- widgetId: QueryStringValue,
- widgetTypes: Set? = null,
- excludedTypes: Set? = null
- ): Observable> {
- return session.widgetService().getRoomWidgetsLive(roomId, widgetId, widgetTypes, excludedTypes).asObservable()
- .startWithCallable {
- session.widgetService().getRoomWidgets(roomId, widgetId, widgetTypes, excludedTypes)
- }
- }
-
- fun liveRoomChangeMembershipState(): Observable