mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-21 17:05:39 +03:00
Use RxRelay instead of Subjects
This commit is contained in:
parent
d7de986365
commit
acf2301fc9
3 changed files with 7 additions and 5 deletions
|
@ -65,6 +65,7 @@ dependencies {
|
|||
// rx
|
||||
implementation 'io.reactivex.rxjava2:rxkotlin:2.3.0'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
|
||||
implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.0'
|
||||
|
||||
implementation("com.airbnb.android:epoxy:$epoxy_version")
|
||||
kapt "com.airbnb.android:epoxy-processor:$epoxy_version"
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
package im.vector.riotredesign.features.home.group
|
||||
|
||||
import arrow.core.Option
|
||||
import com.jakewharton.rxrelay2.BehaviorRelay
|
||||
import im.vector.matrix.android.api.session.group.model.GroupSummary
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.subjects.BehaviorSubject
|
||||
|
||||
class SelectedGroupHolder {
|
||||
|
||||
private val selectedGroupStream = BehaviorSubject.createDefault<Option<GroupSummary>>(Option.empty())
|
||||
private val selectedGroupStream = BehaviorRelay.createDefault<Option<GroupSummary>>(Option.empty())
|
||||
|
||||
fun setSelectedGroup(group: GroupSummary?) {
|
||||
val optionValue = Option.fromNullable(group)
|
||||
selectedGroupStream.onNext(optionValue)
|
||||
selectedGroupStream.accept(optionValue)
|
||||
}
|
||||
|
||||
fun selectedGroup(): Observable<Option<GroupSummary>> {
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
package im.vector.riotredesign.features.home.room
|
||||
|
||||
import com.jakewharton.rxrelay2.BehaviorRelay
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.subjects.BehaviorSubject
|
||||
|
||||
class VisibleRoomHolder {
|
||||
|
||||
private val visibleRoomStream = BehaviorSubject.create<String>()
|
||||
private val visibleRoomStream = BehaviorRelay.create<String>()
|
||||
|
||||
fun setVisibleRoom(roomId: String) {
|
||||
visibleRoomStream.onNext(roomId)
|
||||
visibleRoomStream.accept(roomId)
|
||||
}
|
||||
|
||||
fun visibleRoom(): Observable<String> {
|
||||
|
|
Loading…
Reference in a new issue