mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Replace AppSettings with UserSettings from the UserSessionFlow and below.
Remove some redundant injections when passed alongside a user session too. # Conflicts: # ElementX/Sources/Screens/PinnedEventsTimelineScreen/View/PinnedEventsTimelineScreen.swift # ElementX/Sources/Screens/Timeline/TimelineViewModel.swift
This commit is contained in:
@@ -298,12 +298,11 @@ class MockScreen: Identifiable {
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Some room name", avatarURL: nil)),
|
||||
timelineController: TimelineControllerMock(.init()),
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
emojiProvider: EmojiProvider(userSettings: .volatile()),
|
||||
linkMetadataProvider: LinkMetadataProvider(),
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
ongoingCallRoomIDPublisher: .init(.init(nil)),
|
||||
appMediator: AppMediatorMock(.init()),
|
||||
appSettings: appSettings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
@@ -319,12 +318,11 @@ class MockScreen: Identifiable {
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "New room", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
emojiProvider: EmojiProvider(userSettings: .volatile()),
|
||||
linkMetadataProvider: LinkMetadataProvider(),
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
ongoingCallRoomIDPublisher: .init(.init(nil)),
|
||||
appMediator: AppMediatorMock(.init()),
|
||||
appSettings: appSettings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
@@ -340,12 +338,11 @@ class MockScreen: Identifiable {
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "New room", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
emojiProvider: EmojiProvider(userSettings: .volatile()),
|
||||
linkMetadataProvider: LinkMetadataProvider(),
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
ongoingCallRoomIDPublisher: .init(.init(nil)),
|
||||
appMediator: AppMediatorMock(.init()),
|
||||
appSettings: appSettings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
@@ -360,12 +357,11 @@ class MockScreen: Identifiable {
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "New room", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
emojiProvider: EmojiProvider(userSettings: .volatile()),
|
||||
linkMetadataProvider: LinkMetadataProvider(),
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
ongoingCallRoomIDPublisher: .init(.init(nil)),
|
||||
appMediator: AppMediatorMock(.init()),
|
||||
appSettings: appSettings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
@@ -386,12 +382,11 @@ class MockScreen: Identifiable {
|
||||
roomProxy: roomProxy,
|
||||
timelineController: timelineController,
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
emojiProvider: EmojiProvider(userSettings: .volatile()),
|
||||
linkMetadataProvider: LinkMetadataProvider(),
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
ongoingCallRoomIDPublisher: .init(.init(nil)),
|
||||
appMediator: AppMediatorMock(.init()),
|
||||
appSettings: appSettings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
@@ -412,12 +407,11 @@ class MockScreen: Identifiable {
|
||||
roomProxy: roomProxy,
|
||||
timelineController: timelineController,
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
emojiProvider: EmojiProvider(userSettings: .volatile()),
|
||||
linkMetadataProvider: LinkMetadataProvider(),
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
ongoingCallRoomIDPublisher: .init(.init(nil)),
|
||||
appMediator: AppMediatorMock(.init()),
|
||||
appSettings: appSettings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()), timelineControllerFactory: TimelineControllerFactoryMock(.init()), userIndicatorController: UserIndicatorControllerMock())
|
||||
@@ -437,12 +431,11 @@ class MockScreen: Identifiable {
|
||||
roomProxy: roomProxy,
|
||||
timelineController: timelineController,
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
emojiProvider: EmojiProvider(userSettings: .volatile()),
|
||||
linkMetadataProvider: LinkMetadataProvider(),
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
ongoingCallRoomIDPublisher: .init(.init(nil)),
|
||||
appMediator: AppMediatorMock(.init()),
|
||||
appSettings: appSettings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
@@ -464,12 +457,11 @@ class MockScreen: Identifiable {
|
||||
roomProxy: roomProxy,
|
||||
timelineController: timelineController,
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
emojiProvider: EmojiProvider(userSettings: .volatile()),
|
||||
linkMetadataProvider: LinkMetadataProvider(),
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
ongoingCallRoomIDPublisher: .init(.init(nil)),
|
||||
appMediator: AppMediatorMock(.init()),
|
||||
appSettings: appSettings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
@@ -490,12 +482,11 @@ class MockScreen: Identifiable {
|
||||
roomProxy: roomProxy,
|
||||
timelineController: timelineController,
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
emojiProvider: EmojiProvider(userSettings: .volatile()),
|
||||
linkMetadataProvider: LinkMetadataProvider(),
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
ongoingCallRoomIDPublisher: .init(.init(nil)),
|
||||
appMediator: AppMediatorMock(.init()),
|
||||
appSettings: appSettings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
@@ -512,12 +503,11 @@ class MockScreen: Identifiable {
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Timeline highlight", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
emojiProvider: EmojiProvider(userSettings: .volatile()),
|
||||
linkMetadataProvider: LinkMetadataProvider(),
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
ongoingCallRoomIDPublisher: .init(.init(nil)),
|
||||
appMediator: AppMediatorMock(.init()),
|
||||
appSettings: appSettings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
@@ -547,12 +537,11 @@ class MockScreen: Identifiable {
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Polls timeline", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
emojiProvider: EmojiProvider(userSettings: .volatile()),
|
||||
linkMetadataProvider: LinkMetadataProvider(),
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
ongoingCallRoomIDPublisher: .init(.init(nil)),
|
||||
appMediator: AppMediatorMock(.init()),
|
||||
appSettings: appSettings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
@@ -569,12 +558,11 @@ class MockScreen: Identifiable {
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Polls timeline", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
emojiProvider: EmojiProvider(userSettings: .volatile()),
|
||||
linkMetadataProvider: LinkMetadataProvider(),
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
ongoingCallRoomIDPublisher: .init(.init(nil)),
|
||||
appMediator: AppMediatorMock(.init()),
|
||||
appSettings: appSettings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
@@ -591,12 +579,11 @@ class MockScreen: Identifiable {
|
||||
roomProxy: JoinedRoomProxyMock(.init(name: "Polls timeline", avatarURL: .mockMXCAvatar)),
|
||||
timelineController: timelineController,
|
||||
mediaPlayerProvider: MediaPlayerProviderMock(),
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
emojiProvider: EmojiProvider(userSettings: .volatile()),
|
||||
linkMetadataProvider: LinkMetadataProvider(),
|
||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||
ongoingCallRoomIDPublisher: .init(.init(nil)),
|
||||
appMediator: AppMediatorMock(.init()),
|
||||
appSettings: appSettings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: analytics,
|
||||
composerDraftService: ComposerDraftServiceMock(.init()),
|
||||
@@ -610,7 +597,7 @@ class MockScreen: Identifiable {
|
||||
requestDelay: .seconds(5))
|
||||
let parameters = SessionVerificationScreenCoordinatorParameters(sessionVerificationControllerProxy: sessionVerificationControllerProxy,
|
||||
flow: .deviceInitiator,
|
||||
appSettings: appSettings,
|
||||
userSettings: .volatile(),
|
||||
mediaProvider: MediaProviderMock(.init()))
|
||||
return SessionVerificationScreenCoordinator(parameters: parameters)
|
||||
case .userSessionScreen, .userSessionScreenReply, .userSessionSpacesFlow:
|
||||
@@ -647,18 +634,19 @@ class MockScreen: Identifiable {
|
||||
|
||||
let timelineControllerFactory = TimelineControllerFactoryMock(.init(timelineController: timelineController))
|
||||
|
||||
let userSession = UserSessionMock(.init(clientProxy: clientProxy))
|
||||
let flowCoordinator = UserSessionFlowCoordinator(isNewLogin: false,
|
||||
navigationRootCoordinator: navigationRootCoordinator,
|
||||
appLockService: AppLockService(keychainController: KeychainControllerMock(),
|
||||
appSettings: appSettings),
|
||||
flowParameters: CommonFlowParameters(userSession: UserSessionMock(.init(clientProxy: clientProxy)),
|
||||
flowParameters: CommonFlowParameters(userSession: userSession,
|
||||
bugReportService: BugReportServiceMock(.init()),
|
||||
elementCallService: ElementCallServiceMock(.init()),
|
||||
timelineControllerFactory: timelineControllerFactory,
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
emojiProvider: EmojiProvider(userSettings: userSession.userSettings),
|
||||
linkMetadataProvider: LinkMetadataProvider(),
|
||||
appMediator: appMediator,
|
||||
appSettings: appSettings,
|
||||
userSettings: userSession.userSettings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: analytics,
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
@@ -695,6 +683,7 @@ class MockScreen: Identifiable {
|
||||
clientProxy.createRoomNameTopicAccessTypeIsSpaceUserIDsAvatarURLAliasLocalPartReturnValue =
|
||||
.success("!new-room:client.com")
|
||||
clientProxy.roomForIdentifierClosure = { roomID in .joined(JoinedRoomProxyMock(.init(id: roomID, members: []))) }
|
||||
let userSession = UserSessionMock(.init(clientProxy: clientProxy))
|
||||
|
||||
let userDiscoveryService = UserDiscoveryServiceMock()
|
||||
userDiscoveryService.searchProfilesWithReturnValue = .success([.mockBob, .mockBobby])
|
||||
@@ -703,14 +692,14 @@ class MockScreen: Identifiable {
|
||||
let flowCoordinator = StartChatFlowCoordinator(entryPoint: .startChat,
|
||||
userDiscoveryService: userDiscoveryService,
|
||||
navigationStackCoordinator: navigationStackCoordinator,
|
||||
flowParameters: CommonFlowParameters(userSession: UserSessionMock(.init(clientProxy: clientProxy)),
|
||||
flowParameters: CommonFlowParameters(userSession: userSession,
|
||||
bugReportService: BugReportServiceMock(.init()),
|
||||
elementCallService: ElementCallServiceMock(.init()),
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()),
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
emojiProvider: EmojiProvider(userSettings: userSession.userSettings),
|
||||
linkMetadataProvider: LinkMetadataProvider(),
|
||||
appMediator: AppMediatorMock(.init()),
|
||||
appSettings: appSettings,
|
||||
userSettings: userSession.userSettings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: analytics,
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
@@ -752,7 +741,6 @@ class MockScreen: Identifiable {
|
||||
navigationStackCoordinator.setRootCoordinator(BlankFormCoordinator())
|
||||
|
||||
let coordinator = EncryptionSettingsFlowCoordinator(parameters: .init(userSession: userSession,
|
||||
appSettings: appSettings,
|
||||
appHooks: AppHooks(),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
navigationStackCoordinator: navigationStackCoordinator))
|
||||
@@ -771,7 +759,6 @@ class MockScreen: Identifiable {
|
||||
|
||||
let coordinator = EncryptionResetFlowCoordinator(parameters: .init(userSession: userSession,
|
||||
appMediator: AppMediatorMock(.init()),
|
||||
appSettings: appSettings,
|
||||
appHooks: AppHooks(),
|
||||
userIndicatorController: userIndicatorController,
|
||||
navigationStackCoordinator: navigationStackCoordinator,
|
||||
@@ -787,6 +774,7 @@ class MockScreen: Identifiable {
|
||||
|
||||
let clientProxy = ClientProxyMock(.init())
|
||||
clientProxy.linkNewDeviceServiceReturnValue = linkNewDeviceService
|
||||
let userSession = UserSessionMock(.init(clientProxy: clientProxy))
|
||||
|
||||
let keychainController = KeychainController(service: .tests, accessGroup: InfoPlistReader.main.keychainAccessGroupIdentifier)
|
||||
keychainController.resetSecrets()
|
||||
@@ -805,14 +793,14 @@ class MockScreen: Identifiable {
|
||||
let navigationStackCoordinator = NavigationStackCoordinator()
|
||||
let flowCoordinator = LinkNewDeviceFlowCoordinator(navigationStackCoordinator: navigationStackCoordinator,
|
||||
appLockService: appLockService,
|
||||
flowParameters: CommonFlowParameters(userSession: UserSessionMock(.init(clientProxy: clientProxy)),
|
||||
flowParameters: CommonFlowParameters(userSession: userSession,
|
||||
bugReportService: BugReportServiceMock(.init()),
|
||||
elementCallService: ElementCallServiceMock(.init()),
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init()),
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
emojiProvider: EmojiProvider(userSettings: userSession.userSettings),
|
||||
linkMetadataProvider: LinkMetadataProvider(),
|
||||
appMediator: AppMediatorMock(.init()),
|
||||
appSettings: appSettings,
|
||||
userSettings: userSession.userSettings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: analytics,
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
@@ -837,7 +825,7 @@ class MockScreen: Identifiable {
|
||||
navigationRootCoordinator.setSheetCoordinator(navigationStackCoordinator)
|
||||
return PlaceholderScreenCoordinator(hideBrandChrome: false)
|
||||
case .autoUpdatingTimeline:
|
||||
let appSettings: AppSettings = appSettings
|
||||
let userSettings = UserSettings.volatile()
|
||||
appSettings.hasRunIdentityConfirmationOnboarding = true
|
||||
appSettings.hasRunNotificationPermissionsOnboarding = true
|
||||
appSettings.analyticsConsentState = .optedOut
|
||||
@@ -845,6 +833,7 @@ class MockScreen: Identifiable {
|
||||
navigationRootCoordinator.setRootCoordinator(navigationSplitCoordinator)
|
||||
|
||||
let clientProxy = ClientProxyMock(.init(userID: "@mock:client.com", roomSummaryProvider: RoomSummaryProviderMock(.init(state: .loaded(.mockRooms)))))
|
||||
let userSession = UserSessionMock(.init(clientProxy: clientProxy, userSettings: userSettings))
|
||||
|
||||
let roomProxy = JoinedRoomProxyMock(.init(id: "whatever", name: "okay", shouldUseAutoUpdatingTimeline: true))
|
||||
|
||||
@@ -857,17 +846,17 @@ class MockScreen: Identifiable {
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
stateEventStringBuilder: RoomStateEventStringBuilder(userID: "@alice:matrix.org")),
|
||||
mediaProvider: MediaProviderMock(.init()),
|
||||
appSettings: appSettings)
|
||||
userSettings: userSettings)
|
||||
|
||||
let flowCoordinator = ChatsTabFlowCoordinator(navigationSplitCoordinator: navigationSplitCoordinator,
|
||||
flowParameters: CommonFlowParameters(userSession: UserSessionMock(.init(clientProxy: clientProxy)),
|
||||
flowParameters: CommonFlowParameters(userSession: userSession,
|
||||
bugReportService: BugReportServiceMock(.init()),
|
||||
elementCallService: ElementCallServiceMock(.init()),
|
||||
timelineControllerFactory: TimelineControllerFactoryMock(.init(timelineController: timelineController)),
|
||||
emojiProvider: EmojiProvider(appSettings: appSettings),
|
||||
emojiProvider: EmojiProvider(userSettings: userSession.userSettings),
|
||||
linkMetadataProvider: LinkMetadataProvider(),
|
||||
appMediator: AppMediatorMock(.init()),
|
||||
appSettings: appSettings,
|
||||
userSettings: userSession.userSettings,
|
||||
appHooks: AppHooks(),
|
||||
analytics: analytics,
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
@@ -915,6 +904,6 @@ class MockScreen: Identifiable {
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
stateEventStringBuilder: RoomStateEventStringBuilder(userID: "@alice:matrix.org")),
|
||||
mediaProvider: MediaProviderMock(.init()),
|
||||
appSettings: appSettings)
|
||||
userSettings: .volatile())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user