mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
User verification state indicators (#3793)
* Introduce a `UserIdentityProxy` and have it combine upstream methods into an easy to digest `UserIdentityVerificationState`. Use it in a dedicated `VerificationBadge` UI component * Show a DMs counterpart verification state in the room header * Show a warning on the room details `People` entry when there are identity verification state violations on any of the members. * Show verification badges in the room member list * Show a withdraw verification section on the room member details for users that have pinning violations. * Remove the verification section from the profile screen as there's no reliable way to keep it up to date - the underlying Rust SDK Olm Machine can be rebuilt without notice which would break any existing user identity change streams. * Update preview test snapshots
This commit is contained in:
@@ -59,23 +59,23 @@ struct RoomMembersListScreen: View {
|
||||
|
||||
var roomMembers: some View {
|
||||
LazyVStack(alignment: .leading, spacing: 12) {
|
||||
membersSection(data: context.viewState.visibleInvitedMembers, sectionTitle: L10n.screenRoomMemberListPendingHeaderTitle)
|
||||
membersSection(data: context.viewState.visibleJoinedMembers, sectionTitle: L10n.screenRoomMemberListHeaderTitle(Int(context.viewState.joinedMembersCount)))
|
||||
membersSection(entries: context.viewState.visibleInvitedMembers, sectionTitle: L10n.screenRoomMemberListPendingHeaderTitle)
|
||||
membersSection(entries: context.viewState.visibleJoinedMembers, sectionTitle: L10n.screenRoomMemberListHeaderTitle(Int(context.viewState.joinedMembersCount)))
|
||||
}
|
||||
}
|
||||
|
||||
var bannedUsers: some View {
|
||||
LazyVStack(alignment: .leading, spacing: 12) {
|
||||
membersSection(data: context.viewState.visibleBannedMembers)
|
||||
membersSection(entries: context.viewState.visibleBannedMembers)
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func membersSection(data: [RoomMemberDetails], sectionTitle: String? = nil) -> some View {
|
||||
if !data.isEmpty {
|
||||
private func membersSection(entries: [RoomMemberListScreenEntry], sectionTitle: String? = nil) -> some View {
|
||||
if !entries.isEmpty {
|
||||
Section {
|
||||
ForEach(data, id: \.id) { member in
|
||||
RoomMembersListScreenMemberCell(member: member, context: context)
|
||||
ForEach(entries, id: \.member.id) { entry in
|
||||
RoomMembersListScreenMemberCell(listEntry: entry, context: context)
|
||||
}
|
||||
} header: {
|
||||
if let sectionTitle {
|
||||
@@ -179,7 +179,22 @@ struct RoomMembersListScreen_Previews: PreviewProvider, TestablePreview {
|
||||
members.append(.mockInvited)
|
||||
}
|
||||
|
||||
let clientProxyMock = ClientProxyMock(.init())
|
||||
clientProxyMock.userIdentityForClosure = { userID in
|
||||
let identity = switch userID {
|
||||
case RoomMemberProxyMock.mockAlice.userID:
|
||||
UserIdentityProxyMock(configuration: .init(verificationState: .verified))
|
||||
case RoomMemberProxyMock.mockBob.userID:
|
||||
UserIdentityProxyMock(configuration: .init(verificationState: .verificationViolation))
|
||||
default:
|
||||
UserIdentityProxyMock(configuration: .init())
|
||||
}
|
||||
|
||||
return .success(identity)
|
||||
}
|
||||
|
||||
return RoomMembersListScreenViewModel(initialMode: initialMode,
|
||||
clientProxy: clientProxyMock,
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Some room",
|
||||
members: members,
|
||||
ownUserID: ownUserID,
|
||||
|
||||
Reference in New Issue
Block a user