From 395c9bd5ec48f78fb08bea6ac15ef1e494a4c7d7 Mon Sep 17 00:00:00 2001 From: Valere Date: Wed, 15 Jan 2025 18:09:16 +0100 Subject: [PATCH] fixup: Fix ComposerToolbar previews --- .../ComposerToolbar/View/ComposerToolbar.swift | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/ComposerToolbar.swift b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/ComposerToolbar.swift index 0ccf76e06f..4f666a9a46 100644 --- a/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/ComposerToolbar.swift +++ b/ElementX/Sources/Screens/RoomScreen/ComposerToolbar/View/ComposerToolbar.swift @@ -5,7 +5,9 @@ // Please see LICENSE files in the repository root for full details. // +import Combine import Compound +import MatrixRustSDK import SwiftUI import WysiwygComposer @@ -298,7 +300,7 @@ struct ComposerToolbar: View { struct ComposerToolbar_Previews: PreviewProvider, TestablePreview { static let wysiwygViewModel = WysiwygComposerViewModel() - static let composerViewModel = ComposerToolbarViewModel(roomProxy: JoinedRoomProxyMock(), wysiwygViewModel: wysiwygViewModel, + static let composerViewModel = ComposerToolbarViewModel(roomProxy: JoinedRoomProxyMock(.init()), wysiwygViewModel: wysiwygViewModel, completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init(suggestions: suggestions)), mediaProvider: MediaProviderMock(configuration: .init()), mentionDisplayHelper: ComposerMentionDisplayHelper.mock, @@ -344,7 +346,7 @@ extension ComposerToolbar { static func mock(focused: Bool = true) -> ComposerToolbar { let wysiwygViewModel = WysiwygComposerViewModel() var composerViewModel: ComposerToolbarViewModel { - let model = ComposerToolbarViewModel(roomProxy: JoinedRoomProxyMock(), wysiwygViewModel: wysiwygViewModel, + let model = ComposerToolbarViewModel(roomProxy: JoinedRoomProxyMock(.init()), wysiwygViewModel: wysiwygViewModel, completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()), mediaProvider: MediaProviderMock(configuration: .init()), mentionDisplayHelper: ComposerMentionDisplayHelper.mock, @@ -361,7 +363,7 @@ extension ComposerToolbar { static func textWithVoiceMessage(focused: Bool = true) -> ComposerToolbar { let wysiwygViewModel = WysiwygComposerViewModel() var composerViewModel: ComposerToolbarViewModel { - let model = ComposerToolbarViewModel(roomProxy: JoinedRoomProxyMock(), wysiwygViewModel: wysiwygViewModel, + let model = ComposerToolbarViewModel(roomProxy: JoinedRoomProxyMock(.init()), wysiwygViewModel: wysiwygViewModel, completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()), mediaProvider: MediaProviderMock(configuration: .init()), mentionDisplayHelper: ComposerMentionDisplayHelper.mock, @@ -378,7 +380,7 @@ extension ComposerToolbar { static func voiceMessageRecordingMock() -> ComposerToolbar { let wysiwygViewModel = WysiwygComposerViewModel() var composerViewModel: ComposerToolbarViewModel { - let model = ComposerToolbarViewModel(roomProxy: JoinedRoomProxyMock(), wysiwygViewModel: wysiwygViewModel, + let model = ComposerToolbarViewModel(roomProxy: JoinedRoomProxyMock(.init()), wysiwygViewModel: wysiwygViewModel, completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()), mediaProvider: MediaProviderMock(configuration: .init()), mentionDisplayHelper: ComposerMentionDisplayHelper.mock, @@ -396,7 +398,7 @@ extension ComposerToolbar { let wysiwygViewModel = WysiwygComposerViewModel() let waveformData: [Float] = Array(repeating: 1.0, count: 1000) var composerViewModel: ComposerToolbarViewModel { - let model = ComposerToolbarViewModel(roomProxy: JoinedRoomProxyMock(), wysiwygViewModel: wysiwygViewModel, + let model = ComposerToolbarViewModel(roomProxy: JoinedRoomProxyMock(.init()), wysiwygViewModel: wysiwygViewModel, completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()), mediaProvider: MediaProviderMock(configuration: .init()), mentionDisplayHelper: ComposerMentionDisplayHelper.mock, @@ -417,7 +419,7 @@ extension ComposerToolbar { static func replyLoadingPreviewMock(isLoading: Bool) -> ComposerToolbar { let wysiwygViewModel = WysiwygComposerViewModel() var composerViewModel: ComposerToolbarViewModel { - let model = ComposerToolbarViewModel(roomProxy: JoinedRoomProxyMock(), wysiwygViewModel: wysiwygViewModel, + let model = ComposerToolbarViewModel(roomProxy: JoinedRoomProxyMock(.init()), wysiwygViewModel: wysiwygViewModel, completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()), mediaProvider: MediaProviderMock(configuration: .init()), mentionDisplayHelper: ComposerMentionDisplayHelper.mock, @@ -440,7 +442,7 @@ extension ComposerToolbar { static func disabledPreviewMock() -> ComposerToolbar { let wysiwygViewModel = WysiwygComposerViewModel() var composerViewModel: ComposerToolbarViewModel { - let model = ComposerToolbarViewModel(roomProxy: JoinedRoomProxyMock(), wysiwygViewModel: wysiwygViewModel, + let model = ComposerToolbarViewModel(roomProxy: JoinedRoomProxyMock(.init()), wysiwygViewModel: wysiwygViewModel, completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()), mediaProvider: MediaProviderMock(configuration: .init()), mentionDisplayHelper: ComposerMentionDisplayHelper.mock,