Improve fetch members performance, relax regexes for validating ids (#964)
* Fetched `RoomMembers` are mapped in parallel * Add horizontal padding to room/user name in room details screen * Relax User & Event id regex matches --------- Co-authored-by: ElementBot <benoitm+elementbot@element.io>
This commit is contained in:
parent
05f7037939
commit
dbec1a0a60
32 changed files with 79 additions and 62 deletions
|
|
@ -49,6 +49,7 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.res.vectorResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.features.leaveroom.api.LeaveRoomView
|
||||
|
|
@ -236,7 +237,13 @@ internal fun RoomHeaderSection(
|
|||
Text(roomName, style = ElementTheme.typography.fontHeadingLgBold)
|
||||
if (roomAlias != null) {
|
||||
Spacer(modifier = Modifier.height(6.dp))
|
||||
Text(roomAlias, style = ElementTheme.typography.fontBodyLgRegular, color = MaterialTheme.colorScheme.secondary)
|
||||
Text(
|
||||
text = roomAlias,
|
||||
style = ElementTheme.typography.fontBodyLgRegular,
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp),
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
}
|
||||
Spacer(Modifier.height(32.dp))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import io.element.android.features.roomdetails.impl.blockuser.BlockUserDialogs
|
||||
|
|
@ -118,10 +119,16 @@ internal fun RoomMemberHeaderSection(
|
|||
}
|
||||
Spacer(modifier = Modifier.height(24.dp))
|
||||
if (userName != null) {
|
||||
Text(userName, style = ElementTheme.typography.fontHeadingLgBold)
|
||||
Text(text = userName, style = ElementTheme.typography.fontHeadingLgBold)
|
||||
Spacer(modifier = Modifier.height(6.dp))
|
||||
}
|
||||
Text(userId, style = ElementTheme.typography.fontBodyLgRegular, color = MaterialTheme.colorScheme.secondary)
|
||||
Text(
|
||||
text = userId,
|
||||
style = ElementTheme.typography.fontBodyLgRegular,
|
||||
color = MaterialTheme.colorScheme.secondary,
|
||||
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp),
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
Spacer(Modifier.height(40.dp))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ object MatrixPatterns {
|
|||
|
||||
// regex pattern to find matrix user ids in a string.
|
||||
// See https://matrix.org/docs/spec/appendices#historical-user-ids
|
||||
private const val MATRIX_USER_IDENTIFIER_REGEX = "@[A-Z0-9\\x21-\\x39\\x3B-\\x7F]+$DOMAIN_REGEX"
|
||||
// Sadly, we need to relax the regex pattern a bit as there already exist some ids that don't match the spec.
|
||||
private const val MATRIX_USER_IDENTIFIER_REGEX = "^@.*?$DOMAIN_REGEX$"
|
||||
val PATTERN_CONTAIN_MATRIX_USER_IDENTIFIER = MATRIX_USER_IDENTIFIER_REGEX.toRegex(RegexOption.IGNORE_CASE)
|
||||
|
||||
// regex pattern to find room ids in a string.
|
||||
|
|
@ -42,7 +43,8 @@ object MatrixPatterns {
|
|||
private val PATTERN_CONTAIN_MATRIX_ALIAS = MATRIX_ROOM_ALIAS_REGEX.toRegex(RegexOption.IGNORE_CASE)
|
||||
|
||||
// regex pattern to find message ids in a string.
|
||||
private const val MATRIX_EVENT_IDENTIFIER_REGEX = "\\$[A-Z0-9]+$DOMAIN_REGEX"
|
||||
// Sadly, we need to relax the regex pattern a bit as there already exist some ids that don't match the spec.
|
||||
private const val MATRIX_EVENT_IDENTIFIER_REGEX = "^\\$.+$DOMAIN_REGEX$"
|
||||
private val PATTERN_CONTAIN_MATRIX_EVENT_IDENTIFIER = MATRIX_EVENT_IDENTIFIER_REGEX.toRegex(RegexOption.IGNORE_CASE)
|
||||
|
||||
// regex pattern to find message ids in a string.
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package io.element.android.libraries.matrix.impl.room
|
|||
|
||||
import io.element.android.libraries.core.coroutine.CoroutineDispatchers
|
||||
import io.element.android.libraries.core.coroutine.childScope
|
||||
import io.element.android.libraries.core.coroutine.parallelMap
|
||||
import io.element.android.libraries.matrix.api.core.EventId
|
||||
import io.element.android.libraries.matrix.api.core.ProgressCallback
|
||||
import io.element.android.libraries.matrix.api.core.RoomId
|
||||
|
|
@ -168,7 +169,7 @@ class RustMatrixRoom(
|
|||
val currentMembers = currentState.roomMembers()
|
||||
_membersStateFlow.value = MatrixRoomMembersState.Pending(prevRoomMembers = currentMembers)
|
||||
runCatching {
|
||||
innerRoom.members().map(RoomMemberMapper::map)
|
||||
innerRoom.members().parallelMap(RoomMemberMapper::map)
|
||||
}.map {
|
||||
_membersStateFlow.value = MatrixRoomMembersState.Ready(it)
|
||||
}.onFailure {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0e61170e31a1fb6d697e08c73e13dec40e88759f880a5c1720788a3b231800d7
|
||||
size 19587
|
||||
oid sha256:b32936346c597afcdc11ed72650e8651f77a5e2e3db88e12ae95bf65961c415b
|
||||
size 19662
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:37722b8d9c417f8b1a22083dcf9f1d48b166e39c64f6e11713b6f85b6182ce6f
|
||||
size 17510
|
||||
oid sha256:a9143534f5405494e1cc2c0335d0652460d4a29aafb9efd1e1f6940c5917f281
|
||||
size 17542
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d979a957761c00848ca0ef3b115b5787d5a26eee5e4d4db6ba5b837c1f05be77
|
||||
size 20035
|
||||
oid sha256:5834c50a2faef01976abcf85b9d1800f4dd94fb02684fa2951d5367c326831f8
|
||||
size 20114
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0e61170e31a1fb6d697e08c73e13dec40e88759f880a5c1720788a3b231800d7
|
||||
size 19587
|
||||
oid sha256:b32936346c597afcdc11ed72650e8651f77a5e2e3db88e12ae95bf65961c415b
|
||||
size 19662
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0e61170e31a1fb6d697e08c73e13dec40e88759f880a5c1720788a3b231800d7
|
||||
size 19587
|
||||
oid sha256:b32936346c597afcdc11ed72650e8651f77a5e2e3db88e12ae95bf65961c415b
|
||||
size 19662
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c7ca068387cff8faf728a989488e7c4b5b07983c4b24162ff82a14fd90b82d05
|
||||
size 20609
|
||||
oid sha256:213318b5c5556a6667b9a48701f738e7c55a40c763f3bd79df05e321b1fdc74a
|
||||
size 20684
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:57a16092b5e13be5f76f4cc42cf3e0c2bad983695a6b761fdb400a885c239ddb
|
||||
size 20078
|
||||
oid sha256:db61e15a906b09def466314727c21809c8019863ba4365e9bca54bca1f00bcfd
|
||||
size 20100
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:802a6878cd7eaabdccea21f1d430f0e498ef7470ca963c6b2b869913d2a2d0a9
|
||||
size 17859
|
||||
oid sha256:755af35da6c6e3238201b016c8de7af8e5adba70904ab99f3320406490753b41
|
||||
size 17932
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f1e93f5807f4a1dad7be55a918f2bcbdfb9ea1b95140bab26005812c3e363e1b
|
||||
size 20558
|
||||
oid sha256:bf0402f33d86d5b112c1ba6ae50f9135d87ba6fcad1f73add6eed56ae520b4ee
|
||||
size 20579
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:57a16092b5e13be5f76f4cc42cf3e0c2bad983695a6b761fdb400a885c239ddb
|
||||
size 20078
|
||||
oid sha256:db61e15a906b09def466314727c21809c8019863ba4365e9bca54bca1f00bcfd
|
||||
size 20100
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:57a16092b5e13be5f76f4cc42cf3e0c2bad983695a6b761fdb400a885c239ddb
|
||||
size 20078
|
||||
oid sha256:db61e15a906b09def466314727c21809c8019863ba4365e9bca54bca1f00bcfd
|
||||
size 20100
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:e1599be0c5a37083c015378ee47a78a90dcf670f4df5d85dd25d39f4b2edbdf6
|
||||
size 21147
|
||||
oid sha256:edd5b6edd1e7b3217ae5502758de3c65333244c308ae1280a61d99e10c3438c5
|
||||
size 21167
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:41972465c065b84fe047cf59394a7e83c036ef21b2eed5e2ec8c8e57f76a1408
|
||||
size 53943
|
||||
oid sha256:34d2fd15e0a0d432b9e9399e69ae14e899676a7534f5860242d7fa7ec091b1ef
|
||||
size 54000
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a744e1072897c73906d1e87931586c9124b73c066e0fa4ab7d2c5d41d4abb344
|
||||
size 45347
|
||||
oid sha256:ebe4c5e10556936d62f1545e84605d9daf9ca3de3cef3d3f0dbe9bb02f1cf1b1
|
||||
size 45415
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9b0d8fcf96f22d9f7c4d8b417c2dfa8956b46866c0123ad365122c3080d4ac25
|
||||
size 46231
|
||||
oid sha256:fb0b6c742691a788fb44896f738b936dba95c6c16eefbb9bd593aa6e6bfe4480
|
||||
size 46309
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c134e38cf600120bf43d0329042c6b24ccd2fa25bd48c70c028606a8598dd546
|
||||
size 48409
|
||||
oid sha256:71a7a8ac71a073a6f4ce65b7ad3a4a2a35dd1512d7ecc4cdbf53c9d52be4dba1
|
||||
size 48463
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:855bd0ec680f2e8f53d7e186c2f6228839f39c6e7b56ce3361f6b71740584ccf
|
||||
size 60275
|
||||
oid sha256:e73465a898e07b1c0d78aa87a771b574d50f536655dd63209426b79e1156efcf
|
||||
size 60356
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:855bd0ec680f2e8f53d7e186c2f6228839f39c6e7b56ce3361f6b71740584ccf
|
||||
size 60275
|
||||
oid sha256:e73465a898e07b1c0d78aa87a771b574d50f536655dd63209426b79e1156efcf
|
||||
size 60356
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:368f31f5485fe14f49b727c05328027ed7026bc6ec466f0c08d013832abfa084
|
||||
size 49190
|
||||
oid sha256:a8ea686919da2a33f9ecde5efb70ac9c434a24c28c30138f425acc56350a5590
|
||||
size 49227
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6e7796a991784b30ec4117d304d7eecc09777019703bba1eb97deacf175f566c
|
||||
size 54205
|
||||
oid sha256:c90d81b34d6876b7d4406adce0a775dc67b48da91eac6b4a814eaae9a7b028c2
|
||||
size 54262
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f1a1489ff6a9e2929209aac79d57b4ec8868e7a17d4830bfac4cc764a1af4714
|
||||
size 56054
|
||||
oid sha256:34ca7db5dc561482c657b7617740848aafdbd144fe755276d8cf92f5dbccf077
|
||||
size 56119
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7862b2b99c0879ec4fda3904795cecb87a7beb6dc317635c4efcaf815a7eb6b4
|
||||
size 47428
|
||||
oid sha256:bd706136ddd94395eb8587e068578d281f5a4d20908121e4584bf98459533299
|
||||
size 47485
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:7e22a7534c46b166706ea0161f57b1b826d31e2a6ed971afcec7878049e820f8
|
||||
size 48394
|
||||
oid sha256:7007f5a568a31a9580ceea6c694dd3311066ef22c76eaf50e5e62476b48ae31f
|
||||
size 48465
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:34862731fdb1ae399e38ba2f45fef6a976241652b1188ee66e3d8be4c5fb49d1
|
||||
size 49668
|
||||
oid sha256:c8d76d954e33c53fd9d658e8cef59ca7c2ffbd0f51322572a99e8e74803d9a9c
|
||||
size 49731
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:10b32d81962ba03e246ee359ce64fec133345459e5bafc9976f8c9e1f2409960
|
||||
size 62345
|
||||
oid sha256:613eb68e1d88b3374c5b23884f5c992c548e636bc958e215cf3e5fec34186a88
|
||||
size 62364
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:10b32d81962ba03e246ee359ce64fec133345459e5bafc9976f8c9e1f2409960
|
||||
size 62345
|
||||
oid sha256:613eb68e1d88b3374c5b23884f5c992c548e636bc958e215cf3e5fec34186a88
|
||||
size 62364
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:297ea8debad4e91466865615e197b51b4ef719fbba45d26993f4a7d82e6c9a85
|
||||
size 50504
|
||||
oid sha256:977d10c74342d1d25ce19add8793cca2b4d4b400881163e58c5f8298308e29e7
|
||||
size 50563
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0b062c4ff23b014d270fa414cef3870aa47eba6c5096075c1508000d16631d8e
|
||||
size 56292
|
||||
oid sha256:0e1999174751655dd87b042f1ea22f281cbf9b5deecc494f05307f125d6e9dac
|
||||
size 56358
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue