Skip to content

Commit 81a4b5e

Browse files
authored
Merge pull request #1905 from vector-im/feature/refresh_device_list
Live sessions list
2 parents 87c903a + d1b6cff commit 81a4b5e

File tree

9 files changed

+20
-19
lines changed

9 files changed

+20
-19
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Bugfix 🐛:
1212
- Fix invisible toolbar (Status.im theme) (#1746)
1313
- Fix relative date time formatting (#822)
1414
- Fix crash reported by RageShake
15+
- Fix refreshing of sessions list when another session is logged out
1516

1617
Translations 🗣:
1718
- Add PlayStore description resources in the Triple-T format, to let Weblate handle them

matrix-sdk-android-rx/src/main/java/org/matrix/android/sdk/rx/RxSession.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class RxSession(private val session: Session) {
7171
}
7272
}
7373

74-
fun liveMyDeviceInfo(): Observable<List<DeviceInfo>> {
74+
fun liveMyDevicesInfo(): Observable<List<DeviceInfo>> {
7575
return session.cryptoService().getLiveMyDevicesInfo().asObservable()
7676
.startWithCallable {
7777
session.cryptoService().getMyDevicesInfo()

matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/crypto/model/rest/UploadSignatureQueryBuilder.kt

+2-5
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,8 @@ internal data class UploadSignatureQueryBuilder(
3939
fun build(): Map<String, Map<String, @JvmSuppressWildcards Any>> {
4040
val map = HashMap<String, HashMap<String, Any>>()
4141

42-
val usersList = (
43-
deviceInfoList.map { it.userId }
44-
+ signingKeyInfoList
45-
.map { it.userId }
46-
).distinct()
42+
val usersList = (deviceInfoList.map { it.userId } + signingKeyInfoList.map { it.userId })
43+
.distinct()
4744

4845
usersList.forEach { userID ->
4946
val userMap = HashMap<String, Any>()

vector/src/main/java/im/vector/app/features/crypto/recover/BootstrapAccountPasswordFragment.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class BootstrapAccountPasswordFragment @Inject constructor(
6666
.disposeOnDestroyView()
6767

6868
bootstrapAccountPasswordEditText.textChanges()
69-
.distinct()
69+
.distinctUntilChanged()
7070
.subscribe {
7171
if (!it.isNullOrBlank()) {
7272
bootstrapAccountPasswordTil.error = null

vector/src/main/java/im/vector/app/features/home/ShortcutsHandler.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class ShortcutsHandler @Inject constructor(
6161

6262
return homeRoomListStore
6363
.observe()
64-
.distinct()
64+
.distinctUntilChanged()
6565
.observeOn(Schedulers.computation())
6666
.subscribe { rooms ->
6767
val shortcuts = rooms

vector/src/main/java/im/vector/app/features/home/UnknownDeviceDetectorSharedViewModel.kt

+4-3
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class UnknownDeviceDetectorSharedViewModel @AssistedInject constructor(@Assisted
100100

101101
Observable.combineLatest<List<CryptoDeviceInfo>, List<DeviceInfo>, Optional<PrivateKeysInfo>, List<DeviceDetectionInfo>>(
102102
session.rx().liveUserCryptoDevices(session.myUserId),
103-
session.rx().liveMyDeviceInfo(),
103+
session.rx().liveMyDevicesInfo(),
104104
session.rx().liveCrossSigningPrivateKeys(),
105105
Function3 { cryptoList, infoList, pInfo ->
106106
// Timber.v("## Detector trigger ${cryptoList.map { "${it.deviceId} ${it.trustLevel}" }}")
@@ -133,12 +133,13 @@ class UnknownDeviceDetectorSharedViewModel @AssistedInject constructor(@Assisted
133133
}
134134

135135
session.rx().liveUserCryptoDevices(session.myUserId)
136-
.distinct()
136+
.distinctUntilChanged()
137137
.throttleLast(5_000, TimeUnit.MILLISECONDS)
138138
.subscribe {
139139
// If we have a new crypto device change, we might want to trigger refresh of device info
140140
session.cryptoService().fetchDevicesList(NoOpMatrixCallback())
141-
}.disposeOnClear()
141+
}
142+
.disposeOnClear()
142143

143144
// trigger a refresh of lastSeen / last Ip
144145
session.cryptoService().fetchDevicesList(NoOpMatrixCallback())

vector/src/main/java/im/vector/app/features/settings/crosssigning/CrossSigningSettingsViewModel.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ class CrossSigningSettingsViewModel @AssistedInject constructor(@Assisted privat
3737

3838
init {
3939
Observable.combineLatest<List<DeviceInfo>, Optional<MXCrossSigningInfo>, Pair<List<DeviceInfo>, Optional<MXCrossSigningInfo>>>(
40-
session.rx().liveMyDeviceInfo(),
40+
session.rx().liveMyDevicesInfo(),
4141
session.rx().liveCrossSigningInfo(session.myUserId),
42-
BiFunction { myDeviceInfo, mxCrossSigningInfo ->
43-
(myDeviceInfo to mxCrossSigningInfo)
42+
BiFunction { myDevicesInfo, mxCrossSigningInfo ->
43+
myDevicesInfo to mxCrossSigningInfo
4444
}
4545
)
4646
.execute { data ->

vector/src/main/java/im/vector/app/features/settings/devices/DeviceVerificationInfoBottomSheetViewModel.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class DeviceVerificationInfoBottomSheetViewModel @AssistedInject constructor(@As
8181
copy(deviceInfo = Loading())
8282
}
8383

84-
session.rx().liveMyDeviceInfo()
84+
session.rx().liveMyDevicesInfo()
8585
.map { devices ->
8686
devices.firstOrNull { it.deviceId == deviceId } ?: DeviceInfo(deviceId = deviceId)
8787
}

vector/src/main/java/im/vector/app/features/settings/devices/DevicesViewModel.kt

+6-4
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class DevicesViewModel @AssistedInject constructor(
103103

104104
Observable.combineLatest<List<CryptoDeviceInfo>, List<DeviceInfo>, List<DeviceFullInfo>>(
105105
session.rx().liveUserCryptoDevices(session.myUserId),
106-
session.rx().liveMyDeviceInfo(),
106+
session.rx().liveMyDevicesInfo(),
107107
BiFunction { cryptoList, infoList ->
108108
infoList
109109
.sortedByDescending { it.lastSeenTs }
@@ -113,7 +113,7 @@ class DevicesViewModel @AssistedInject constructor(
113113
}
114114
}
115115
)
116-
.distinct()
116+
.distinctUntilChanged()
117117
.execute { async ->
118118
copy(
119119
devices = async
@@ -137,12 +137,14 @@ class DevicesViewModel @AssistedInject constructor(
137137
// }
138138

139139
session.rx().liveUserCryptoDevices(session.myUserId)
140-
.distinct()
140+
.map { it.size }
141+
.distinctUntilChanged()
141142
.throttleLast(5_000, TimeUnit.MILLISECONDS)
142143
.subscribe {
143144
// If we have a new crypto device change, we might want to trigger refresh of device info
144145
session.cryptoService().fetchDevicesList(NoOpMatrixCallback())
145-
}.disposeOnClear()
146+
}
147+
.disposeOnClear()
146148

147149
// session.rx().liveUserCryptoDevices(session.myUserId)
148150
// .execute {

0 commit comments

Comments
 (0)