Skip to content

Commit 15c9d68

Browse files
authored
Merge branch 'develop' into feature/display_device_key
2 parents 5fa22fe + 81a4b5e commit 15c9d68

File tree

12 files changed

+39
-28
lines changed

12 files changed

+39
-28
lines changed

CHANGES.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ Features ✨:
77
Improvements 🙌:
88
- Give user the possibility to prevent accidental call (#1869)
99
- Display device information (name, id and key) in Cryptography setting screen (#1784)
10+
- Ensure users do not accidentally ignore other users (#1890)
1011

1112
Bugfix 🐛:
1213
- Fix invisible toolbar (Status.im theme) (#1746)
1314
- Fix relative date time formatting (#822)
1415
- Fix crash reported by RageShake
16+
- Fix refreshing of sessions list when another session is logged out
1517

1618
Translations 🗣:
1719
- 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>()

matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/user/accountdata/UpdateIgnoredUserIdsTask.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
package org.matrix.android.sdk.internal.session.user.accountdata
1919

2020
import com.zhuinden.monarchy.Monarchy
21+
import org.greenrobot.eventbus.EventBus
22+
import org.matrix.android.sdk.api.session.accountdata.UserAccountDataTypes
2123
import org.matrix.android.sdk.internal.database.model.IgnoredUserEntity
2224
import org.matrix.android.sdk.internal.di.SessionDatabase
2325
import org.matrix.android.sdk.internal.di.UserId
2426
import org.matrix.android.sdk.internal.network.executeRequest
2527
import org.matrix.android.sdk.internal.session.sync.model.accountdata.IgnoredUsersContent
26-
import org.matrix.android.sdk.api.session.accountdata.UserAccountDataTypes
2728
import org.matrix.android.sdk.internal.task.Task
28-
import org.greenrobot.eventbus.EventBus
2929
import javax.inject.Inject
3030

3131
internal interface UpdateIgnoredUserIdsTask : Task<UpdateIgnoredUserIdsTask.Params, Unit> {
@@ -51,7 +51,7 @@ internal class DefaultUpdateIgnoredUserIdsTask @Inject constructor(
5151
{ it.userId }
5252
).toMutableSet()
5353

54-
val original = ignoredUserIds.toList()
54+
val original = ignoredUserIds.toSet()
5555

5656
ignoredUserIds.removeAll { it in params.userIdsToUnIgnore }
5757
ignoredUserIds.addAll(params.userIdsToIgnore)

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/home/room/detail/RoomDetailFragment.kt

+13-4
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,7 @@ class RoomDetailFragment @Inject constructor(
14911491
promptReasonToReportContent(action)
14921492
}
14931493
is EventSharedAction.IgnoreUser -> {
1494-
roomDetailViewModel.handle(RoomDetailAction.IgnoreUser(action.senderId))
1494+
action.senderId?.let { askConfirmationToIgnoreUser(it) }
14951495
}
14961496
is EventSharedAction.OnUrlClicked -> {
14971497
onUrlClicked(action.url, action.title)
@@ -1507,12 +1507,21 @@ class RoomDetailFragment @Inject constructor(
15071507
startActivity(KeysBackupRestoreActivity.intent(it))
15081508
}
15091509
}
1510-
else -> {
1511-
Toast.makeText(context, "Action $action is not implemented yet", Toast.LENGTH_LONG).show()
1512-
}
15131510
}
15141511
}
15151512

1513+
private fun askConfirmationToIgnoreUser(senderId: String) {
1514+
AlertDialog.Builder(requireContext())
1515+
.setTitle(R.string.room_participants_action_ignore_title)
1516+
.setMessage(R.string.room_participants_action_ignore_prompt_msg)
1517+
.setNegativeButton(R.string.cancel, null)
1518+
.setPositiveButton(R.string.room_participants_action_ignore) { _, _ ->
1519+
roomDetailViewModel.handle(RoomDetailAction.IgnoreUser(senderId))
1520+
}
1521+
.show()
1522+
.withColoredButton(DialogInterface.BUTTON_POSITIVE)
1523+
}
1524+
15161525
/**
15171526
* Insert a user displayName in the message editor.
15181527
*

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 {

vector/src/main/res/values/strings.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1801,7 +1801,7 @@
18011801
<string name="report_content_custom_title">"Report this content"</string>
18021802
<string name="report_content_custom_hint">"Reason for reporting this content"</string>
18031803
<string name="report_content_custom_submit">"REPORT"</string>
1804-
<string name="block_user">"BLOCK USER"</string>
1804+
<string name="block_user">"IGNORE USER"</string>
18051805

18061806
<string name="content_reported_title">"Content reported"</string>
18071807
<string name="content_reported_content">"This content was reported.\n\nIf you don't want to see any more content from this user, you can block him to hide his messages"</string>
@@ -1814,7 +1814,7 @@
18141814

18151815
<string name="no_network_indicator">There is no network connection right now</string>
18161816

1817-
<string name="message_ignore_user">Block user</string>
1817+
<string name="message_ignore_user">Ignore user</string>
18181818

18191819
<string name="room_list_quick_actions_notifications_all_noisy">"All messages (noisy)"</string>
18201820
<string name="room_list_quick_actions_notifications_all">"All messages"</string>

0 commit comments

Comments
 (0)