mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Fix preview tests/snapshots.
This commit is contained in:
@@ -14,6 +14,7 @@ struct ClientProxyMockConfiguration {
|
||||
var homeserver = ""
|
||||
var userIDServerName: String?
|
||||
var userID: String = RoomMemberProxyMock.mockMe.userID
|
||||
var displayName: String? = "User display name"
|
||||
var deviceID: String?
|
||||
var roomSummaryProvider: RoomSummaryProviderProtocol = RoomSummaryProviderMock(.init())
|
||||
var spaceServiceConfiguration: SpaceServiceProxyMock.Configuration = .init()
|
||||
@@ -64,7 +65,7 @@ extension ClientProxyMock {
|
||||
verificationStatePublisher = .init(.unknown)
|
||||
homeserverReachabilityPublisher = .init(.reachable)
|
||||
|
||||
userProfilePublisher = .init(UserProfile(userID: configuration.userID, displayName: "User display name"))
|
||||
userProfilePublisher = .init(UserProfile(userID: configuration.userID, displayName: configuration.displayName))
|
||||
|
||||
ignoredUsersPublisher = .init([RoomMemberProxyMock].allMembers.map(\.userID))
|
||||
|
||||
|
||||
+5
-2
@@ -28,8 +28,11 @@ class UserDetailsEditScreenViewModel: UserDetailsEditScreenViewModelType, UserDe
|
||||
self.mediaUploadingPreprocessor = mediaUploadingPreprocessor
|
||||
self.userIndicatorController = userIndicatorController
|
||||
|
||||
super.init(initialViewState: UserDetailsEditScreenViewState(currentUserProfile: clientProxy.userProfilePublisher.value,
|
||||
bindings: .init()), mediaProvider: userSession.mediaProvider)
|
||||
let profile = clientProxy.userProfilePublisher.value
|
||||
super.init(initialViewState: UserDetailsEditScreenViewState(currentUserProfile: profile,
|
||||
selectedAvatarURL: profile.avatarURL,
|
||||
bindings: .init(name: profile.displayName ?? "")),
|
||||
mediaProvider: userSession.mediaProvider)
|
||||
|
||||
clientProxy.userProfilePublisher
|
||||
.receive(on: DispatchQueue.main)
|
||||
|
||||
+8
-5
@@ -138,10 +138,13 @@ struct UserDetailsEditScreen_Previews: PreviewProvider, TestablePreview {
|
||||
}
|
||||
|
||||
static func makeViewModel(canChangeProfile: Bool = true) -> UserDetailsEditScreenViewModel {
|
||||
UserDetailsEditScreenViewModel(userSession: UserSessionMock(.init(clientProxy: ClientProxyMock(.init(userID: "@stefan:matrix.org",
|
||||
canChangeAvatar: canChangeProfile,
|
||||
canChangeDisplayName: canChangeProfile)))),
|
||||
mediaUploadingPreprocessor: .init(appSettings: .volatile()),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
let userSession = UserSessionMock(.init(clientProxy: ClientProxyMock(.init(userID: "@stefan:matrix.org",
|
||||
displayName: "Stefan",
|
||||
canChangeAvatar: canChangeProfile,
|
||||
canChangeDisplayName: canChangeProfile))))
|
||||
|
||||
return UserDetailsEditScreenViewModel(userSession: userSession,
|
||||
mediaUploadingPreprocessor: .init(appSettings: .volatile()),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user