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 @@ struct UserProfileScreenViewState: BindableState {
let isOwnUser: Bool
let isPresentedModally: Bool
var userProfile: UserProfileProxy?
var userProfile: UserProfile?
var isIdentityKnown = false
var isVerified: Bool?
var permalink: URL?
@@ -77,7 +77,7 @@ class UserProfileScreenViewModel: UserProfileScreenViewModelType, UserProfileScr
// The proxies aren't Sendable, fetch through these helpers so that
// they never leave the main actor when running calls in parallel.
private func fetchProfile() async -> Result<UserProfileProxy, ClientProxyError> {
private func fetchProfile() async -> Result<UserProfile, ClientProxyError> {
await userSession.clientProxy.profile(for: state.userID)
}
@@ -94,7 +94,7 @@ class UserProfileScreenViewModel: UserProfileScreenViewModelType, UserProfileScr
state.userProfile = userProfile
state.permalink = (try? matrixToUserPermalink(userId: state.userID)).flatMap(URL.init(string:))
switch userSession.clientProxy.directRoomForUserID(userProfile.userID) {
switch userSession.clientProxy.directRoomForUserID(userProfile.id) {
case .success(let roomID):
state.dmRoomID = roomID
case .failure:
@@ -133,13 +133,13 @@ class UserProfileScreenViewModel: UserProfileScreenViewModelType, UserProfileScr
showLoadingIndicator(allowsInteraction: false)
defer { hideLoadingIndicator() }
switch userSession.clientProxy.directRoomForUserID(userProfile.userID) {
switch userSession.clientProxy.directRoomForUserID(userProfile.id) {
case .success(let roomID):
if let roomID {
actionsSubject.send(.openDirectChat(roomID: roomID))
} else {
Task {
let isUnknown = if case let .success(identity) = await userSession.clientProxy.userIdentity(for: userProfile.userID, fallBackToServer: false) {
let isUnknown = if case let .success(identity) = await userSession.clientProxy.userIdentity(for: userProfile.id, fallBackToServer: false) {
identity == nil
} else {
true
@@ -158,7 +158,7 @@ class UserProfileScreenViewModel: UserProfileScreenViewModelType, UserProfileScr
showLoadingIndicator(allowsInteraction: false)
defer { hideLoadingIndicator() }
switch await userSession.clientProxy.createDirectRoom(with: userProfile.userID, expectedRoomName: userProfile.displayName) {
switch await userSession.clientProxy.createDirectRoom(with: userProfile.id, expectedRoomName: userProfile.displayName) {
case .success(let roomID):
analytics.trackCreatedRoom(isDM: true)
actionsSubject.send(.openDirectChat(roomID: roomID))
@@ -45,7 +45,7 @@ struct UserProfileScreen: View {
otherUserFooter
}
} else {
AvatarHeaderView(user: UserProfileProxy(userID: context.viewState.userID),
AvatarHeaderView(user: UserProfile(userID: context.viewState.userID),
isVerified: context.viewState.showVerifiedBadge,
avatarSize: .user(on: .memberDetails),
mediaProvider: context.mediaProvider) { }