Merge pull request #1905 from vector-im/feature/refresh_device_list
Live sessions list
This commit is contained in:
commit
81a4b5edbc
|
@ -12,6 +12,7 @@ Bugfix 🐛:
|
||||||
- Fix invisible toolbar (Status.im theme) (#1746)
|
- Fix invisible toolbar (Status.im theme) (#1746)
|
||||||
- Fix relative date time formatting (#822)
|
- Fix relative date time formatting (#822)
|
||||||
- Fix crash reported by RageShake
|
- Fix crash reported by RageShake
|
||||||
|
- Fix refreshing of sessions list when another session is logged out
|
||||||
|
|
||||||
Translations 🗣:
|
Translations 🗣:
|
||||||
- Add PlayStore description resources in the Triple-T format, to let Weblate handle them
|
- Add PlayStore description resources in the Triple-T format, to let Weblate handle them
|
||||||
|
|
|
@ -71,7 +71,7 @@ class RxSession(private val session: Session) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun liveMyDeviceInfo(): Observable<List<DeviceInfo>> {
|
fun liveMyDevicesInfo(): Observable<List<DeviceInfo>> {
|
||||||
return session.cryptoService().getLiveMyDevicesInfo().asObservable()
|
return session.cryptoService().getLiveMyDevicesInfo().asObservable()
|
||||||
.startWithCallable {
|
.startWithCallable {
|
||||||
session.cryptoService().getMyDevicesInfo()
|
session.cryptoService().getMyDevicesInfo()
|
||||||
|
|
|
@ -39,11 +39,8 @@ internal data class UploadSignatureQueryBuilder(
|
||||||
fun build(): Map<String, Map<String, @JvmSuppressWildcards Any>> {
|
fun build(): Map<String, Map<String, @JvmSuppressWildcards Any>> {
|
||||||
val map = HashMap<String, HashMap<String, Any>>()
|
val map = HashMap<String, HashMap<String, Any>>()
|
||||||
|
|
||||||
val usersList = (
|
val usersList = (deviceInfoList.map { it.userId } + signingKeyInfoList.map { it.userId })
|
||||||
deviceInfoList.map { it.userId }
|
.distinct()
|
||||||
+ signingKeyInfoList
|
|
||||||
.map { it.userId }
|
|
||||||
).distinct()
|
|
||||||
|
|
||||||
usersList.forEach { userID ->
|
usersList.forEach { userID ->
|
||||||
val userMap = HashMap<String, Any>()
|
val userMap = HashMap<String, Any>()
|
||||||
|
|
|
@ -66,7 +66,7 @@ class BootstrapAccountPasswordFragment @Inject constructor(
|
||||||
.disposeOnDestroyView()
|
.disposeOnDestroyView()
|
||||||
|
|
||||||
bootstrapAccountPasswordEditText.textChanges()
|
bootstrapAccountPasswordEditText.textChanges()
|
||||||
.distinct()
|
.distinctUntilChanged()
|
||||||
.subscribe {
|
.subscribe {
|
||||||
if (!it.isNullOrBlank()) {
|
if (!it.isNullOrBlank()) {
|
||||||
bootstrapAccountPasswordTil.error = null
|
bootstrapAccountPasswordTil.error = null
|
||||||
|
|
|
@ -61,7 +61,7 @@ class ShortcutsHandler @Inject constructor(
|
||||||
|
|
||||||
return homeRoomListStore
|
return homeRoomListStore
|
||||||
.observe()
|
.observe()
|
||||||
.distinct()
|
.distinctUntilChanged()
|
||||||
.observeOn(Schedulers.computation())
|
.observeOn(Schedulers.computation())
|
||||||
.subscribe { rooms ->
|
.subscribe { rooms ->
|
||||||
val shortcuts = rooms
|
val shortcuts = rooms
|
||||||
|
|
|
@ -100,7 +100,7 @@ class UnknownDeviceDetectorSharedViewModel @AssistedInject constructor(@Assisted
|
||||||
|
|
||||||
Observable.combineLatest<List<CryptoDeviceInfo>, List<DeviceInfo>, Optional<PrivateKeysInfo>, List<DeviceDetectionInfo>>(
|
Observable.combineLatest<List<CryptoDeviceInfo>, List<DeviceInfo>, Optional<PrivateKeysInfo>, List<DeviceDetectionInfo>>(
|
||||||
session.rx().liveUserCryptoDevices(session.myUserId),
|
session.rx().liveUserCryptoDevices(session.myUserId),
|
||||||
session.rx().liveMyDeviceInfo(),
|
session.rx().liveMyDevicesInfo(),
|
||||||
session.rx().liveCrossSigningPrivateKeys(),
|
session.rx().liveCrossSigningPrivateKeys(),
|
||||||
Function3 { cryptoList, infoList, pInfo ->
|
Function3 { cryptoList, infoList, pInfo ->
|
||||||
// Timber.v("## Detector trigger ${cryptoList.map { "${it.deviceId} ${it.trustLevel}" }}")
|
// Timber.v("## Detector trigger ${cryptoList.map { "${it.deviceId} ${it.trustLevel}" }}")
|
||||||
|
@ -133,12 +133,13 @@ class UnknownDeviceDetectorSharedViewModel @AssistedInject constructor(@Assisted
|
||||||
}
|
}
|
||||||
|
|
||||||
session.rx().liveUserCryptoDevices(session.myUserId)
|
session.rx().liveUserCryptoDevices(session.myUserId)
|
||||||
.distinct()
|
.distinctUntilChanged()
|
||||||
.throttleLast(5_000, TimeUnit.MILLISECONDS)
|
.throttleLast(5_000, TimeUnit.MILLISECONDS)
|
||||||
.subscribe {
|
.subscribe {
|
||||||
// If we have a new crypto device change, we might want to trigger refresh of device info
|
// If we have a new crypto device change, we might want to trigger refresh of device info
|
||||||
session.cryptoService().fetchDevicesList(NoOpMatrixCallback())
|
session.cryptoService().fetchDevicesList(NoOpMatrixCallback())
|
||||||
}.disposeOnClear()
|
}
|
||||||
|
.disposeOnClear()
|
||||||
|
|
||||||
// trigger a refresh of lastSeen / last Ip
|
// trigger a refresh of lastSeen / last Ip
|
||||||
session.cryptoService().fetchDevicesList(NoOpMatrixCallback())
|
session.cryptoService().fetchDevicesList(NoOpMatrixCallback())
|
||||||
|
|
|
@ -37,10 +37,10 @@ class CrossSigningSettingsViewModel @AssistedInject constructor(@Assisted privat
|
||||||
|
|
||||||
init {
|
init {
|
||||||
Observable.combineLatest<List<DeviceInfo>, Optional<MXCrossSigningInfo>, Pair<List<DeviceInfo>, Optional<MXCrossSigningInfo>>>(
|
Observable.combineLatest<List<DeviceInfo>, Optional<MXCrossSigningInfo>, Pair<List<DeviceInfo>, Optional<MXCrossSigningInfo>>>(
|
||||||
session.rx().liveMyDeviceInfo(),
|
session.rx().liveMyDevicesInfo(),
|
||||||
session.rx().liveCrossSigningInfo(session.myUserId),
|
session.rx().liveCrossSigningInfo(session.myUserId),
|
||||||
BiFunction { myDeviceInfo, mxCrossSigningInfo ->
|
BiFunction { myDevicesInfo, mxCrossSigningInfo ->
|
||||||
(myDeviceInfo to mxCrossSigningInfo)
|
myDevicesInfo to mxCrossSigningInfo
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.execute { data ->
|
.execute { data ->
|
||||||
|
|
|
@ -81,7 +81,7 @@ class DeviceVerificationInfoBottomSheetViewModel @AssistedInject constructor(@As
|
||||||
copy(deviceInfo = Loading())
|
copy(deviceInfo = Loading())
|
||||||
}
|
}
|
||||||
|
|
||||||
session.rx().liveMyDeviceInfo()
|
session.rx().liveMyDevicesInfo()
|
||||||
.map { devices ->
|
.map { devices ->
|
||||||
devices.firstOrNull { it.deviceId == deviceId } ?: DeviceInfo(deviceId = deviceId)
|
devices.firstOrNull { it.deviceId == deviceId } ?: DeviceInfo(deviceId = deviceId)
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ class DevicesViewModel @AssistedInject constructor(
|
||||||
|
|
||||||
Observable.combineLatest<List<CryptoDeviceInfo>, List<DeviceInfo>, List<DeviceFullInfo>>(
|
Observable.combineLatest<List<CryptoDeviceInfo>, List<DeviceInfo>, List<DeviceFullInfo>>(
|
||||||
session.rx().liveUserCryptoDevices(session.myUserId),
|
session.rx().liveUserCryptoDevices(session.myUserId),
|
||||||
session.rx().liveMyDeviceInfo(),
|
session.rx().liveMyDevicesInfo(),
|
||||||
BiFunction { cryptoList, infoList ->
|
BiFunction { cryptoList, infoList ->
|
||||||
infoList
|
infoList
|
||||||
.sortedByDescending { it.lastSeenTs }
|
.sortedByDescending { it.lastSeenTs }
|
||||||
|
@ -113,7 +113,7 @@ class DevicesViewModel @AssistedInject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.distinct()
|
.distinctUntilChanged()
|
||||||
.execute { async ->
|
.execute { async ->
|
||||||
copy(
|
copy(
|
||||||
devices = async
|
devices = async
|
||||||
|
@ -137,12 +137,14 @@ class DevicesViewModel @AssistedInject constructor(
|
||||||
// }
|
// }
|
||||||
|
|
||||||
session.rx().liveUserCryptoDevices(session.myUserId)
|
session.rx().liveUserCryptoDevices(session.myUserId)
|
||||||
.distinct()
|
.map { it.size }
|
||||||
|
.distinctUntilChanged()
|
||||||
.throttleLast(5_000, TimeUnit.MILLISECONDS)
|
.throttleLast(5_000, TimeUnit.MILLISECONDS)
|
||||||
.subscribe {
|
.subscribe {
|
||||||
// If we have a new crypto device change, we might want to trigger refresh of device info
|
// If we have a new crypto device change, we might want to trigger refresh of device info
|
||||||
session.cryptoService().fetchDevicesList(NoOpMatrixCallback())
|
session.cryptoService().fetchDevicesList(NoOpMatrixCallback())
|
||||||
}.disposeOnClear()
|
}
|
||||||
|
.disposeOnClear()
|
||||||
|
|
||||||
// session.rx().liveUserCryptoDevices(session.myUserId)
|
// session.rx().liveUserCryptoDevices(session.myUserId)
|
||||||
// .execute {
|
// .execute {
|
||||||
|
|
Loading…
Reference in New Issue