Rename UserProfileProxy to UserProfile. It's a pure struct and proxies nothing.

Also remove the redundant `userID` property given `id` already exists (for Identifiable conformance).
This commit is contained in:
Doug
2026-07-01 15:18:03 +01:00
committed by Doug
parent bdf53b64a8
commit 3ef66cdd05
55 changed files with 203 additions and 209 deletions
@@ -19,7 +19,7 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr
private let userIndicatorController: UserIndicatorControllerProtocol
private let appSettings: AppSettings
private var suggestedUsers = [UserProfileProxy]()
private var suggestedUsers = [UserProfile]()
private let actionsSubject: PassthroughSubject<InviteUsersScreenViewModelAction, Never> = .init()
var actions: AnyPublisher<InviteUsersScreenViewModelAction, Never> {
@@ -38,7 +38,7 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr
self.userIndicatorController = userIndicatorController
self.appSettings = appSettings
let mandatoryInvitees: [UserProfileProxy] = if case .draft(let invitees) = roomType {
let mandatoryInvitees: [UserProfile] = if case .draft(let invitees) = roomType {
invitees
} else {
[]
@@ -70,12 +70,12 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr
case .proceed:
switch roomType {
case .draft:
createDraftRoom(mandatoryUserIDs: state.selectedUsers.map(\.userID))
createDraftRoom(mandatoryUserIDs: state.selectedUsers.map(\.id))
case .existingRoom(let roomProxy):
guard roomProxy.details.historySharingState != RoomHistorySharingState.hidden,
!state.usersToConfirm.isEmpty,
!state.isSkippable else {
inviteUsers(state.selectedUsers.map(\.userID), roomProxy: roomProxy)
inviteUsers(state.selectedUsers.map(\.id), roomProxy: roomProxy)
return
}
state.bindings.presentConfirmationDialog = true
@@ -83,14 +83,14 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr
case .removeUnknownUsers:
state.bindings.presentConfirmationDialog = false
state.selectedUsers.removeAll { user in
state.usersToConfirm.contains { $0.userID == user.userID }
state.usersToConfirm.contains { $0.id == user.id }
}
state.usersToConfirm = []
case .confirmUnknownUsers:
state.bindings.presentConfirmationDialog = false
state.usersToConfirm = []
if case .existingRoom(let roomProxy) = roomType {
inviteUsers(state.selectedUsers.map(\.userID), roomProxy: roomProxy)
inviteUsers(state.selectedUsers.map(\.id), roomProxy: roomProxy)
}
case .toggleUser(let user):
toggleUser(user)
@@ -99,16 +99,16 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr
// MARK: - Private
private func toggleUser(_ user: UserProfileProxy) {
private func toggleUser(_ user: UserProfile) {
guard !state.isInviteeMandatory(user) else { return }
if state.selectedUsers.contains(user) {
state.selectedUsers.removeAll { $0.userID == user.userID }
state.selectedUsers.removeAll { $0.id == user.id }
} else {
state.selectedUsers.append(user)
withElementAnimation(.easeInOut) { state.bindings.selectedUsersPosition = user.userID }
withElementAnimation(.easeInOut) { state.bindings.selectedUsersPosition = user.id }
Task {
let identityUnknown = if case .success(let identity) = await self.clientProxy.userIdentity(for: user.userID, fallBackToServer: false) {
let identityUnknown = if case .success(let identity) = await self.clientProxy.userIdentity(for: user.id, fallBackToServer: false) {
identity == nil
} else {
true