mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Combine the user's own display name/avatar into a single profile.
This is in preparation for adding the user status fields into the profile.
This commit is contained in:
@@ -15,9 +15,7 @@ enum SpacesScreenViewModelAction {
|
||||
}
|
||||
|
||||
struct SpacesScreenViewState: BindableState {
|
||||
let userID: String
|
||||
var userDisplayName: String?
|
||||
var userAvatarURL: URL?
|
||||
var userProfile: UserProfile
|
||||
|
||||
var topLevelSpaces: [SpaceServiceRoom]
|
||||
var selectedSpaceID: String?
|
||||
|
||||
@@ -29,7 +29,7 @@ class SpacesScreenViewModel: SpacesScreenViewModelType, SpacesScreenViewModelPro
|
||||
self.appSettings = appSettings
|
||||
self.userIndicatorController = userIndicatorController
|
||||
|
||||
super.init(initialViewState: SpacesScreenViewState(userID: userSession.clientProxy.userID,
|
||||
super.init(initialViewState: SpacesScreenViewState(userProfile: userSession.clientProxy.userProfilePublisher.value,
|
||||
topLevelSpaces: spaceServiceProxy.topLevelSpacesPublisher.value),
|
||||
mediaProvider: userSession.mediaProvider)
|
||||
|
||||
@@ -42,14 +42,9 @@ class SpacesScreenViewModel: SpacesScreenViewModelType, SpacesScreenViewModelPro
|
||||
.weakAssign(to: \.state.selectedSpaceID, on: self)
|
||||
.store(in: &cancellables)
|
||||
|
||||
userSession.clientProxy.userAvatarURLPublisher
|
||||
userSession.clientProxy.userProfilePublisher
|
||||
.receive(on: DispatchQueue.main)
|
||||
.weakAssign(to: \.state.userAvatarURL, on: self)
|
||||
.store(in: &cancellables)
|
||||
|
||||
userSession.clientProxy.userDisplayNamePublisher
|
||||
.receive(on: DispatchQueue.main)
|
||||
.weakAssign(to: \.state.userDisplayName, on: self)
|
||||
.weakAssign(to: \.state.userProfile, on: self)
|
||||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
|
||||
@@ -96,9 +96,9 @@ struct SpacesScreen: View {
|
||||
Button {
|
||||
context.send(viewAction: .showSettings)
|
||||
} label: {
|
||||
LoadableAvatarImage(url: context.viewState.userAvatarURL,
|
||||
name: context.viewState.userDisplayName,
|
||||
contentID: context.viewState.userID,
|
||||
LoadableAvatarImage(url: context.viewState.userProfile.avatarURL,
|
||||
name: context.viewState.userProfile.displayName,
|
||||
contentID: context.viewState.userProfile.id,
|
||||
avatarSize: .user(on: .spaces),
|
||||
mediaProvider: context.mediaProvider)
|
||||
.accessibilityIdentifier(A11yIdentifiers.homeScreen.userAvatar)
|
||||
|
||||
Reference in New Issue
Block a user