Fix refreshing of sessions list when another session is logged out

Rx: use distinctUntilChanged() instead of distinct()
This commit is contained in:
Benoit Marty 2020-08-12 15:19:03 +02:00 committed by Benoit Marty
parent c9c787b11d
commit 7a2454d816
6 changed files with 14 additions and 13 deletions

View file

@ -11,6 +11,7 @@ Bugfix 🐛:
- Fix invisible toolbar (Status.im theme) (#1746)
- Fix relative date time formatting (#822)
- Fix crash reported by RageShake
- Fix refreshing of sessions list when another session is logged out
Translations 🗣:
- Add PlayStore description resources in the Triple-T format, to let Weblate handle them

View file

@ -39,11 +39,8 @@ internal data class UploadSignatureQueryBuilder(
fun build(): Map<String, Map<String, @JvmSuppressWildcards Any>> {
val map = HashMap<String, HashMap<String, Any>>()
val usersList = (
deviceInfoList.map { it.userId }
+ signingKeyInfoList
.map { it.userId }
).distinct()
val usersList = (deviceInfoList.map { it.userId } + signingKeyInfoList.map { it.userId })
.distinct()
usersList.forEach { userID ->
val userMap = HashMap<String, Any>()

View file

@ -66,7 +66,7 @@ class BootstrapAccountPasswordFragment @Inject constructor(
.disposeOnDestroyView()
bootstrapAccountPasswordEditText.textChanges()
.distinct()
.distinctUntilChanged()
.subscribe {
if (!it.isNullOrBlank()) {
bootstrapAccountPasswordTil.error = null

View file

@ -61,7 +61,7 @@ class ShortcutsHandler @Inject constructor(
return homeRoomListStore
.observe()
.distinct()
.distinctUntilChanged()
.observeOn(Schedulers.computation())
.subscribe { rooms ->
val shortcuts = rooms

View file

@ -133,12 +133,13 @@ class UnknownDeviceDetectorSharedViewModel @AssistedInject constructor(@Assisted
}
session.rx().liveUserCryptoDevices(session.myUserId)
.distinct()
.distinctUntilChanged()
.throttleLast(5_000, TimeUnit.MILLISECONDS)
.subscribe {
// If we have a new crypto device change, we might want to trigger refresh of device info
session.cryptoService().fetchDevicesList(NoOpMatrixCallback())
}.disposeOnClear()
}
.disposeOnClear()
// trigger a refresh of lastSeen / last Ip
session.cryptoService().fetchDevicesList(NoOpMatrixCallback())

View file

@ -113,7 +113,7 @@ class DevicesViewModel @AssistedInject constructor(
}
}
)
.distinct()
.distinctUntilChanged()
.execute { async ->
copy(
devices = async
@ -137,12 +137,14 @@ class DevicesViewModel @AssistedInject constructor(
// }
session.rx().liveUserCryptoDevices(session.myUserId)
.distinct()
.throttleLast(5_000, TimeUnit.MILLISECONDS)
.map { it.size }
.distinctUntilChanged()
.throttleFirst(5_000, TimeUnit.MILLISECONDS)
.subscribe {
// If we have a new crypto device change, we might want to trigger refresh of device info
session.cryptoService().fetchDevicesList(NoOpMatrixCallback())
}.disposeOnClear()
}
.disposeOnClear()
// session.rx().liveUserCryptoDevices(session.myUserId)
// .execute {