mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
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:
@@ -23,7 +23,7 @@ class BlockedUsersScreenViewModel: BlockedUsersScreenViewModelType, BlockedUsers
|
||||
clientProxy = userSession.clientProxy
|
||||
self.userIndicatorController = userIndicatorController
|
||||
|
||||
let ignoredUsers = clientProxy.ignoredUsersPublisher.value?.map { UserProfileProxy(userID: $0) }
|
||||
let ignoredUsers = clientProxy.ignoredUsersPublisher.value?.map { UserProfile(userID: $0) }
|
||||
|
||||
super.init(initialViewState: BlockedUsersScreenViewState(blockedUsers: ignoredUsers ?? []),
|
||||
mediaProvider: userSession.mediaProvider)
|
||||
@@ -64,16 +64,16 @@ class BlockedUsersScreenViewModel: BlockedUsersScreenViewModelType, BlockedUsers
|
||||
defer { hideLoadingIndicator() }
|
||||
|
||||
if hideProfiles {
|
||||
state.blockedUsers = blockedUsers.map { UserProfileProxy(userID: $0) }
|
||||
state.blockedUsers = blockedUsers.map { UserProfile(userID: $0) }
|
||||
} else {
|
||||
state.blockedUsers = await withTaskGroup(of: UserProfileProxy.self) { group in
|
||||
state.blockedUsers = await withTaskGroup(of: UserProfile.self) { group in
|
||||
for userID in blockedUsers {
|
||||
group.addTask {
|
||||
await self.profile(for: userID)
|
||||
}
|
||||
}
|
||||
|
||||
var profiles = [UserProfileProxy]()
|
||||
var profiles = [UserProfile]()
|
||||
for await profile in group {
|
||||
profiles.append(profile)
|
||||
}
|
||||
@@ -84,19 +84,19 @@ class BlockedUsersScreenViewModel: BlockedUsersScreenViewModelType, BlockedUsers
|
||||
|
||||
/// The client proxy isn't Sendable, fetch through this helper so that it
|
||||
/// never leaves the main actor when running calls in parallel.
|
||||
private func profile(for userID: String) async -> UserProfileProxy {
|
||||
private func profile(for userID: String) async -> UserProfile {
|
||||
switch await clientProxy.profile(for: userID) {
|
||||
case .success(let profile): profile
|
||||
case .failure: UserProfileProxy(userID: userID)
|
||||
case .failure: UserProfile(userID: userID)
|
||||
}
|
||||
}
|
||||
|
||||
private func unblockUser(_ user: UserProfileProxy) {
|
||||
private func unblockUser(_ user: UserProfile) {
|
||||
showLoadingIndicator()
|
||||
state.processingUserID = user.userID
|
||||
state.processingUserID = user.id
|
||||
|
||||
Task {
|
||||
if case .failure = await clientProxy.unignoreUser(user.userID) {
|
||||
if case .failure = await clientProxy.unignoreUser(user.id) {
|
||||
state.bindings.alertInfo = .init(id: .error)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user