Flow migration: more update after PR reviews

This commit is contained in:
ganfra 2021-11-02 11:50:56 +01:00
parent bb4a820c31
commit e43bfaebc6
3 changed files with 6 additions and 21 deletions

View File

@ -279,25 +279,9 @@ SOFTWARE.
Copyright 2012 The Dagger Authors
</li>
<li>
<b>rxkotlin</b>
<b>FlowBinding</b>
<br/>
Copyright io.reactivex.
</li>
<li>
<b>rxandroid</b>
<br/>
Copyright io.reactivex.
</li>
<li>
<b>rxrelay</b>
<br/>
Copyright 2014 Netflix, Inc.
Copyright 2015 Jake Wharton
</li>
<li>
<b>rxbinding</b>
<br/>
Copyright (C) 2015 Jake Wharton
Copyright 2019 Yang Chen
</li>
<li>
<b>Epoxy</b>

View File

@ -32,12 +32,12 @@ import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.EmojiCompatFontProvider
import im.vector.app.R
import im.vector.app.core.extensions.observeEvent
import im.vector.app.core.flow.throttleFirst
import im.vector.app.core.platform.VectorBaseActivity
import im.vector.app.databinding.ActivityEmojiReactionPickerBinding
import im.vector.app.features.reactions.data.EmojiDataSource
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.sample
import kotlinx.coroutines.launch
import reactivecircus.flowbinding.android.widget.queryTextChanges
import javax.inject.Inject
@ -167,7 +167,7 @@ class EmojiReactionPickerActivity : VectorBaseActivity<ActivityEmojiReactionPick
}
searchView.queryTextChanges()
.sample(600)
.throttleFirst(600)
.onEach { query ->
onQueryText(query.toString())
}

View File

@ -29,6 +29,7 @@ import dagger.assisted.AssistedInject
import im.vector.app.R
import im.vector.app.core.di.MavericksAssistedViewModelFactory
import im.vector.app.core.di.hiltMavericksViewModelFactory
import im.vector.app.core.flow.throttleFirst
import im.vector.app.core.platform.VectorViewModel
import im.vector.app.core.resources.StringProvider
import im.vector.app.core.utils.PublishDataSource
@ -165,7 +166,7 @@ class DevicesViewModel @AssistedInject constructor(
// )
// }
refreshSource.stream().sample(4_000)
refreshSource.stream().throttleFirst(4_000)
.onEach {
session.cryptoService().fetchDevicesList(NoOpMatrixCallback())
session.cryptoService().downloadKeys(listOf(session.myUserId), true, NoOpMatrixCallback())