diff --git a/ElementX.xcodeproj/project.pbxproj b/ElementX.xcodeproj/project.pbxproj index cbabbf850..1a5525930 100644 --- a/ElementX.xcodeproj/project.pbxproj +++ b/ElementX.xcodeproj/project.pbxproj @@ -604,7 +604,6 @@ 9BD3A773186291560DF92B62 /* RoomTimelineProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66F2402D738694F98729A441 /* RoomTimelineProvider.swift */; }; 9BEA56957B3AF954E7321658 /* ComposerToolbarViewModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E44928D844E16EE48A311FCA /* ComposerToolbarViewModelProtocol.swift */; }; 9C5A07E7C33F3F40287D7861 /* SettingsScreenUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8EC57A32ABC80D774CC663DB /* SettingsScreenUITests.swift */; }; - 9CCC77C31CB399661A034739 /* UserProperties+Element.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6A6C4BE591FE5C38CE9C7EF3 /* UserProperties+Element.swift */; }; 9D2E03DB175A6AB14589076D /* AnalyticsEvents in Frameworks */ = {isa = PBXBuildFile; productRef = 2A3F7BCCB18C15B30CCA39A9 /* AnalyticsEvents */; }; 9D79B94493FB32249F7E472F /* PlaceholderAvatarImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C705E605EF57C19DBE86FFA1 /* PlaceholderAvatarImage.swift */; }; 9D9690D2FD4CD26FF670620F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C75EF87651B00A176AB08E97 /* AppDelegate.swift */; }; @@ -1428,7 +1427,6 @@ 69D42EE0102D2857933625DD /* CreateRoomViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateRoomViewModelTests.swift; sourceTree = ""; }; 6A4C9547BBFEEF30AA11329B /* TimelineItemStatusView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineItemStatusView.swift; sourceTree = ""; }; 6A580295A56B55A856CC4084 /* InfoPlistReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoPlistReader.swift; sourceTree = ""; }; - 6A6C4BE591FE5C38CE9C7EF3 /* UserProperties+Element.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UserProperties+Element.swift"; sourceTree = ""; }; 6A8E19C4645D3F5F9FB02355 /* UnitTestsAppCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnitTestsAppCoordinator.swift; sourceTree = ""; }; 6AB54B4F94686CCF0289B72F /* UserIndicatorPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserIndicatorPresenter.swift; sourceTree = ""; }; 6AD1A853D605C2146B0DC028 /* MatrixEntityRegex.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MatrixEntityRegex.swift; sourceTree = ""; }; @@ -2608,7 +2606,6 @@ children = ( B4CFE236419E830E8946639C /* Analytics+SwiftUI.swift */, CBF9AEA706926DD0DA2B954C /* JoinedRoomSize+MemberCount.swift */, - 6A6C4BE591FE5C38CE9C7EF3 /* UserProperties+Element.swift */, ); path = Helpers; sourceTree = ""; @@ -5931,7 +5928,6 @@ 80DEA2A4B20F9E279EAE6B2B /* UserProfile+Mock.swift in Sources */, ED90A59F068FD0CA27E602ED /* UserProfileListRow.swift in Sources */, E21FE4C5B614F311C0955859 /* UserProfileProxy.swift in Sources */, - 9CCC77C31CB399661A034739 /* UserProperties+Element.swift in Sources */, 8AB8ED1051216546CB35FA0E /* UserSession.swift in Sources */, 4A618590DEB72C4F186BFED4 /* UserSessionFlowCoordinator.swift in Sources */, 3113065AABBC14CEAE6843FA /* UserSessionFlowCoordinatorStateMachine.swift in Sources */, diff --git a/ElementX/Sources/Application/Windowing/WindowManager.swift b/ElementX/Sources/Application/Windowing/WindowManager.swift index 1bfdf3b46..e87bd75c9 100644 --- a/ElementX/Sources/Application/Windowing/WindowManager.swift +++ b/ElementX/Sources/Application/Windowing/WindowManager.swift @@ -40,6 +40,7 @@ class WindowManager { [mainWindow, overlayWindow, alternateWindow] } + // periphery:ignore - auto cancels when reassigned /// The task used to switch windows, so that we don't get stuck in the wrong state with a quick switch. @CancellableTask private var switchTask: Task? /// A duration that allows window switching to wait a couple of frames to avoid a transition through black. diff --git a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift index 97b8a1453..7ed4a0307 100644 --- a/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/RoomFlowCoordinator.swift @@ -408,11 +408,9 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { let userID = userSession.clientProxy.userID let timelineItemFactory = RoomTimelineItemFactory(userID: userID, - mediaProvider: userSession.mediaProvider, attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: appSettings.permalinkBaseURL, mentionBuilder: MentionBuilder()), - stateEventStringBuilder: RoomStateEventStringBuilder(userID: userID), - appSettings: appSettings) + stateEventStringBuilder: RoomStateEventStringBuilder(userID: userID)) let timelineController = roomTimelineControllerFactory.buildRoomTimelineController(roomProxy: roomProxy, timelineItemFactory: timelineItemFactory, @@ -889,11 +887,9 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol { let userID = userSession.clientProxy.userID let timelineItemFactory = RoomTimelineItemFactory(userID: userID, - mediaProvider: userSession.mediaProvider, attributedStringBuilder: AttributedStringBuilder(permalinkBaseURL: appSettings.permalinkBaseURL, mentionBuilder: MentionBuilder()), - stateEventStringBuilder: RoomStateEventStringBuilder(userID: userID), - appSettings: appSettings) + stateEventStringBuilder: RoomStateEventStringBuilder(userID: userID)) let roomTimelineController = roomTimelineControllerFactory.buildRoomTimelineController(roomProxy: roomProxy, timelineItemFactory: timelineItemFactory, diff --git a/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift index cc8fbd080..da00e0f1e 100644 --- a/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/UserSessionFlowCoordinator.swift @@ -27,11 +27,8 @@ enum UserSessionFlowCoordinatorAction { class UserSessionFlowCoordinator: FlowCoordinatorProtocol { private let userSession: UserSessionProtocol private let navigationSplitCoordinator: NavigationSplitCoordinator - private let appLockService: AppLockServiceProtocol private let bugReportService: BugReportServiceProtocol - private let roomTimelineControllerFactory: RoomTimelineControllerFactoryProtocol private let appSettings: AppSettings - private let analytics: AnalyticsService private let actionsSubject: PassthroughSubject = .init() private let stateMachine: UserSessionFlowCoordinatorStateMachine @@ -60,11 +57,8 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol { stateMachine = UserSessionFlowCoordinatorStateMachine() self.userSession = userSession self.navigationSplitCoordinator = navigationSplitCoordinator - self.appLockService = appLockService self.bugReportService = bugReportService - self.roomTimelineControllerFactory = roomTimelineControllerFactory self.appSettings = appSettings - self.analytics = analytics sidebarNavigationStackCoordinator = NavigationStackCoordinator(navigationSplitCoordinator: navigationSplitCoordinator) detailNavigationStackCoordinator = NavigationStackCoordinator(navigationSplitCoordinator: navigationSplitCoordinator) diff --git a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift index a8de00dcf..ead2daebc 100644 --- a/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift +++ b/ElementX/Sources/Mocks/Generated/GeneratedMocks.swift @@ -2194,11 +2194,11 @@ class RoomProxyMock: RoomProxyProtocol { } } class RoomTimelineProviderMock: RoomTimelineProviderProtocol { - var updatePublisher: AnyPublisher { + var updatePublisher: AnyPublisher { get { return underlyingUpdatePublisher } set(value) { underlyingUpdatePublisher = value } } - var underlyingUpdatePublisher: AnyPublisher! + var underlyingUpdatePublisher: AnyPublisher! var itemProxies: [TimelineItemProxy] = [] var backPaginationState: BackPaginationStatus { get { return underlyingBackPaginationState } @@ -3225,11 +3225,6 @@ class VoiceMessageMediaManagerMock: VoiceMessageMediaManagerProtocol { } } class VoiceMessageRecorderMock: VoiceMessageRecorderProtocol { - var audioRecorder: AudioRecorderProtocol { - get { return underlyingAudioRecorder } - set(value) { underlyingAudioRecorder = value } - } - var underlyingAudioRecorder: AudioRecorderProtocol! var previewAudioPlayerState: AudioPlayerState? var isRecording: Bool { get { return underlyingIsRecording } @@ -3237,11 +3232,6 @@ class VoiceMessageRecorderMock: VoiceMessageRecorderProtocol { } var underlyingIsRecording: Bool! var recordingURL: URL? - var recordingDuration: TimeInterval { - get { return underlyingRecordingDuration } - set(value) { underlyingRecordingDuration = value } - } - var underlyingRecordingDuration: TimeInterval! var actions: AnyPublisher { get { return underlyingActions } set(value) { underlyingActions = value } @@ -3353,23 +3343,6 @@ class VoiceMessageRecorderMock: VoiceMessageRecorderProtocol { deleteRecordingCallsCount += 1 await deleteRecordingClosure?() } - //MARK: - buildRecordingWaveform - - var buildRecordingWaveformCallsCount = 0 - var buildRecordingWaveformCalled: Bool { - return buildRecordingWaveformCallsCount > 0 - } - var buildRecordingWaveformReturnValue: Result<[UInt16], VoiceMessageRecorderError>! - var buildRecordingWaveformClosure: (() async -> Result<[UInt16], VoiceMessageRecorderError>)? - - func buildRecordingWaveform() async -> Result<[UInt16], VoiceMessageRecorderError> { - buildRecordingWaveformCallsCount += 1 - if let buildRecordingWaveformClosure = buildRecordingWaveformClosure { - return await buildRecordingWaveformClosure() - } else { - return buildRecordingWaveformReturnValue - } - } //MARK: - sendVoiceMessage var sendVoiceMessageInRoomAudioConverterCallsCount = 0 diff --git a/ElementX/Sources/Mocks/RoomProxyMock.swift b/ElementX/Sources/Mocks/RoomProxyMock.swift index 01ffbecbe..cec5f3209 100644 --- a/ElementX/Sources/Mocks/RoomProxyMock.swift +++ b/ElementX/Sources/Mocks/RoomProxyMock.swift @@ -29,7 +29,6 @@ struct RoomProxyMockConfiguration { var isEncrypted = true var hasOngoingCall = false var canonicalAlias: String? - var alternativeAliases: [String] = [] var hasUnreadNotifications = Bool.random() var timeline = { @@ -46,7 +45,6 @@ struct RoomProxyMockConfiguration { var canUserTriggerRoomNotification = false var canUserJoinCall = false - var invitedMembersCount = 100 var joinedMembersCount = 50 var activeMembersCount = 25 } diff --git a/ElementX/Sources/Other/Extensions/String.swift b/ElementX/Sources/Other/Extensions/String.swift index 10aa796d9..a4479fb7c 100644 --- a/ElementX/Sources/Other/Extensions/String.swift +++ b/ElementX/Sources/Other/Extensions/String.swift @@ -31,18 +31,6 @@ extension String { return string } - - /// Calculates a numeric hash same as Element Web - /// See original function here https://github.com/matrix-org/matrix-react-sdk/blob/321dd49db4fbe360fc2ff109ac117305c955b061/src/utils/FormattingUtils.js#L47 - var hashCode: Int32 { - var hash: Int32 = 0 - - for character in self { - let shiftedHash = hash << 5 - hash = shiftedHash.subtractingReportingOverflow(hash).partialValue + Int32(character.unicodeScalars[character.unicodeScalars.startIndex].value) - } - return abs(hash) - } var isASCII: Bool { allSatisfy(\.isASCII) diff --git a/ElementX/Sources/Other/Extensions/UNNotificationContent.swift b/ElementX/Sources/Other/Extensions/UNNotificationContent.swift index b67ffac46..a723de96d 100644 --- a/ElementX/Sources/Other/Extensions/UNNotificationContent.swift +++ b/ElementX/Sources/Other/Extensions/UNNotificationContent.swift @@ -44,10 +44,6 @@ extension UNNotificationContent { @objc var roomID: String? { userInfo[NotificationConstants.UserInfoKey.roomIdentifier] as? String } - - @objc var eventID: String? { - userInfo[NotificationConstants.UserInfoKey.eventIdentifier] as? String - } } extension UNMutableNotificationContent { @@ -69,15 +65,6 @@ extension UNMutableNotificationContent { } } - override var eventID: String? { - get { - userInfo[NotificationConstants.UserInfoKey.eventIdentifier] as? String - } - set { - userInfo[NotificationConstants.UserInfoKey.eventIdentifier] = newValue - } - } - func addMediaAttachment(using mediaProvider: MediaProviderProtocol?, mediaSource: MediaSourceProxy) async -> UNMutableNotificationContent { guard let mediaProvider else { diff --git a/ElementX/Sources/Other/Extensions/URL.swift b/ElementX/Sources/Other/Extensions/URL.swift index bd8fa9875..4aaab5c35 100644 --- a/ElementX/Sources/Other/Extensions/URL.swift +++ b/ElementX/Sources/Other/Extensions/URL.swift @@ -47,17 +47,6 @@ extension URL: ExpressibleByStringLiteral { return applicationSupportSessionsURL } - - /// The base directory where all cache is stored. - static var cacheBaseDirectory: URL { - let url = appGroupContainerDirectory - .appendingPathComponent("Library", isDirectory: true) - .appendingPathComponent("Caches", isDirectory: true) - - try? FileManager.default.createDirectoryIfNeeded(at: url) - - return url - } /// The base directory where all application support data is stored. static var applicationSupportBaseDirectory: URL { diff --git a/ElementX/Sources/Other/ScrollViewAdapter.swift b/ElementX/Sources/Other/ScrollViewAdapter.swift index 7e84515ed..acc37263e 100644 --- a/ElementX/Sources/Other/ScrollViewAdapter.swift +++ b/ElementX/Sources/Other/ScrollViewAdapter.swift @@ -18,11 +18,6 @@ import Combine import UIKit class ScrollViewAdapter: NSObject, UIScrollViewDelegate { - enum ScrollDirection { - case up - case down - } - var scrollView: UIScrollView? { didSet { oldValue?.delegate = nil @@ -42,13 +37,6 @@ class ScrollViewAdapter: NSObject, UIScrollViewDelegate { .init(isScrollingSubject) } - private let scrollDirectionSubject: PassthroughSubject = .init() - var scrollDirection: AnyPublisher { - scrollDirectionSubject - .removeDuplicates() - .eraseToAnyPublisher() - } - private let isAtTopEdgeSubject: CurrentValueSubject = .init(false) var isAtTopEdge: CurrentValuePublisher { isAtTopEdgeSubject @@ -59,7 +47,6 @@ class ScrollViewAdapter: NSObject, UIScrollViewDelegate { func scrollViewDidScroll(_ scrollView: UIScrollView) { didScrollSubject.send(()) - updateScrollDirection(scrollView) let insetContentOffset = scrollView.contentOffset.y + scrollView.contentInset.top isAtTopEdgeSubject.send(insetContentOffset >= 3) } @@ -97,18 +84,4 @@ class ScrollViewAdapter: NSObject, UIScrollViewDelegate { private func updateDidScroll(_ scrollView: UIScrollView) { isScrollingSubject.send(scrollView.isDragging || scrollView.isDecelerating) } - - private func updateScrollDirection(_ scrollView: UIScrollView) { - let velocity = scrollView.panGestureRecognizer.velocity(in: nil) - - if velocity.y > Constant.scrollDirectionThreshold { - scrollDirectionSubject.send(.up) - } else if velocity.y < -Constant.scrollDirectionThreshold { - scrollDirectionSubject.send(.down) - } - } - - private enum Constant { - static let scrollDirectionThreshold: CGFloat = 200 - } } diff --git a/ElementX/Sources/Other/ShareToMapsAppActivity.swift b/ElementX/Sources/Other/ShareToMapsAppActivity.swift index 60b10da5b..937ae218c 100644 --- a/ElementX/Sources/Other/ShareToMapsAppActivity.swift +++ b/ElementX/Sources/Other/ShareToMapsAppActivity.swift @@ -43,10 +43,6 @@ final class ShareToMapsAppActivity: UIActivity { type.activityTitle } - var activityCategory: UIActivity.Category { - .action - } - override var activityType: UIActivity.ActivityType { .shareToMapsApp } diff --git a/ElementX/Sources/Other/UserPreference.swift b/ElementX/Sources/Other/UserPreference.swift index f53bcaa9f..8f5c8d076 100644 --- a/ElementX/Sources/Other/UserPreference.swift +++ b/ElementX/Sources/Other/UserPreference.swift @@ -75,19 +75,6 @@ extension UserPreference { convenience init(key: R, defaultValue: T, storageType: StorageType) where R.RawValue == String { self.init(key: key.rawValue, defaultValue: defaultValue, storageType: storageType) } - - /// Convenience initializer that also immediatelly stores the provided initialValue. - /// The initial value is stored every time the app is launched. - /// And will override any existing values. - /// - /// - Parameters: - /// - key: the raw representable key used to store the value, needs conform also to String - /// - initialValue: the initial value that will be stored when the app is launched, the initialValue is also used as defaultValue - /// - storageType: the storage type where the wrappedValue will be stored. - convenience init(key: R, initialValue: T, storageType: StorageType) where R.RawValue == String { - self.init(key: key, defaultValue: initialValue, storageType: storageType) - wrappedValue = initialValue - } convenience init(key: String, storageType: StorageType) where T: ExpressibleByNilLiteral { self.init(key: key, defaultValue: nil, storageType: storageType) diff --git a/ElementX/Sources/Screens/Authentication/ServerConfirmationScreen/ServerConfirmationScreenCoordinator.swift b/ElementX/Sources/Screens/Authentication/ServerConfirmationScreen/ServerConfirmationScreenCoordinator.swift index 753f86ed5..88d216202 100644 --- a/ElementX/Sources/Screens/Authentication/ServerConfirmationScreen/ServerConfirmationScreenCoordinator.swift +++ b/ElementX/Sources/Screens/Authentication/ServerConfirmationScreen/ServerConfirmationScreenCoordinator.swift @@ -28,7 +28,6 @@ enum ServerConfirmationScreenCoordinatorAction { } final class ServerConfirmationScreenCoordinator: CoordinatorProtocol { - private let parameters: ServerConfirmationScreenCoordinatorParameters private var viewModel: ServerConfirmationScreenViewModelProtocol private let actionsSubject: PassthroughSubject = .init() private var cancellables = Set() @@ -38,8 +37,6 @@ final class ServerConfirmationScreenCoordinator: CoordinatorProtocol { } init(parameters: ServerConfirmationScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = ServerConfirmationScreenViewModel(authenticationService: parameters.authenticationService, authenticationFlow: parameters.authenticationFlow) } diff --git a/ElementX/Sources/Screens/Authentication/SoftLogoutScreen/View/SoftLogoutScreen.swift b/ElementX/Sources/Screens/Authentication/SoftLogoutScreen/View/SoftLogoutScreen.swift index 9ecc3d283..d9a64f5dc 100644 --- a/ElementX/Sources/Screens/Authentication/SoftLogoutScreen/View/SoftLogoutScreen.swift +++ b/ElementX/Sources/Screens/Authentication/SoftLogoutScreen/View/SoftLogoutScreen.swift @@ -161,11 +161,6 @@ struct SoftLogoutScreen: View { context.send(viewAction: .login) } - /// Sends the `forgotPassword` view action. - func forgotPassword() { - context.send(viewAction: .forgotPassword) - } - /// Sends the `clearAllData` view action. func clearData() { context.send(viewAction: .clearAllData) diff --git a/ElementX/Sources/Screens/Authentication/WaitlistScreen/WaitlistScreenModels.swift b/ElementX/Sources/Screens/Authentication/WaitlistScreen/WaitlistScreenModels.swift index 1bec7af3d..4599d9911 100644 --- a/ElementX/Sources/Screens/Authentication/WaitlistScreen/WaitlistScreenModels.swift +++ b/ElementX/Sources/Screens/Authentication/WaitlistScreen/WaitlistScreenModels.swift @@ -43,14 +43,6 @@ struct WaitlistScreenViewState: BindableState { /// Whether or not the user is still waiting in the queue. var isWaiting: Bool { userSession == nil } - var iconSymbolName: String { - if isWaiting { - return "stopwatch" - } else { - return "sparkles" - } - } - var title: String { if isWaiting { return L10n.screenWaitlistTitle diff --git a/ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift b/ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift index 82abff0ea..15dc4ce3f 100644 --- a/ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift +++ b/ElementX/Sources/Screens/CallScreen/CallScreenViewModel.swift @@ -162,19 +162,6 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol """ } - private func evaluateJavaScript(_ script: String) async -> String? { - guard let evaluator = state.bindings.javaScriptEvaluator else { - fatalError("Invalid javaScriptEvaluator") - } - - do { - return try await evaluator(script) as? String - } catch { - MXLog.error("Failed evaluating javaScript with error: \(error)") - return nil - } - } - private func setupVoIPSession(callID: UUID) async throws { try AVAudioSession.sharedInstance().setCategory(.playAndRecord, mode: .videoChat, options: []) try AVAudioSession.sharedInstance().setActive(true, options: .notifyOthersOnDeactivation) diff --git a/ElementX/Sources/Screens/ComposerToolbar/View/VoiceMessagePreviewComposer.swift b/ElementX/Sources/Screens/ComposerToolbar/View/VoiceMessagePreviewComposer.swift index 900561bd8..25673a9a1 100644 --- a/ElementX/Sources/Screens/ComposerToolbar/View/VoiceMessagePreviewComposer.swift +++ b/ElementX/Sources/Screens/ComposerToolbar/View/VoiceMessagePreviewComposer.swift @@ -24,7 +24,6 @@ struct VoiceMessagePreviewComposer: View { let waveform: WaveformSource @ScaledMetric private var waveformLineWidth = 2.0 @ScaledMetric private var waveformLinePadding = 2.0 - @State private var resumePlaybackAfterScrubbing = false @GestureState var isDragging = false let onPlay: () -> Void @@ -95,20 +94,6 @@ struct VoiceMessagePreviewComposer: View { onPlay() } } - - private func onScrubbing(_ scrubbing: Bool) { - if scrubbing { - if playerState.playbackState == .playing { - resumePlaybackAfterScrubbing = true - onPause() - } - } else { - if resumePlaybackAfterScrubbing { - onPlay() - resumePlaybackAfterScrubbing = false - } - } - } } private extension DateFormatter { diff --git a/ElementX/Sources/Screens/ComposerToolbar/View/VoiceMessageRecordingComposer.swift b/ElementX/Sources/Screens/ComposerToolbar/View/VoiceMessageRecordingComposer.swift index c1676d3d2..d05f9682c 100644 --- a/ElementX/Sources/Screens/ComposerToolbar/View/VoiceMessageRecordingComposer.swift +++ b/ElementX/Sources/Screens/ComposerToolbar/View/VoiceMessageRecordingComposer.swift @@ -33,12 +33,6 @@ struct VoiceMessageRecordingComposer: View { } } } - - private func onPlaybackPlayPause() { } - - private func onPlaybackSeek(_ progress: Double) { } - - private func onPlaybackScrubbing(_ dragging: Bool) { } } struct VoiceMessageRecordingComposer_Previews: PreviewProvider, TestablePreview { diff --git a/ElementX/Sources/Screens/LocationSharing/StaticLocationScreenCoordinator.swift b/ElementX/Sources/Screens/LocationSharing/StaticLocationScreenCoordinator.swift index 49689a8dd..514f8213d 100644 --- a/ElementX/Sources/Screens/LocationSharing/StaticLocationScreenCoordinator.swift +++ b/ElementX/Sources/Screens/LocationSharing/StaticLocationScreenCoordinator.swift @@ -27,7 +27,6 @@ enum StaticLocationScreenCoordinatorAction { } final class StaticLocationScreenCoordinator: CoordinatorProtocol { - let parameters: StaticLocationScreenCoordinatorParameters let viewModel: StaticLocationScreenViewModelProtocol private let actionsSubject: PassthroughSubject = .init() @@ -38,8 +37,6 @@ final class StaticLocationScreenCoordinator: CoordinatorProtocol { } init(parameters: StaticLocationScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = StaticLocationScreenViewModel(interactionMode: parameters.interactionMode) } diff --git a/ElementX/Sources/Screens/RoomPollsHistoryScreen/RoomPollsHistoryScreenCoordinator.swift b/ElementX/Sources/Screens/RoomPollsHistoryScreen/RoomPollsHistoryScreenCoordinator.swift index ea69c6156..771a6ad95 100644 --- a/ElementX/Sources/Screens/RoomPollsHistoryScreen/RoomPollsHistoryScreenCoordinator.swift +++ b/ElementX/Sources/Screens/RoomPollsHistoryScreen/RoomPollsHistoryScreenCoordinator.swift @@ -37,8 +37,7 @@ final class RoomPollsHistoryScreenCoordinator: CoordinatorProtocol { } init(parameters: RoomPollsHistoryScreenCoordinatorParameters) { - viewModel = RoomPollsHistoryScreenViewModel(roomProxy: parameters.roomProxy, - pollInteractionHandler: parameters.pollInteractionHandler, + viewModel = RoomPollsHistoryScreenViewModel(pollInteractionHandler: parameters.pollInteractionHandler, roomTimelineController: parameters.roomTimelineController, userIndicatorController: ServiceLocator.shared.userIndicatorController) } diff --git a/ElementX/Sources/Screens/RoomPollsHistoryScreen/RoomPollsHistoryScreenViewModel.swift b/ElementX/Sources/Screens/RoomPollsHistoryScreen/RoomPollsHistoryScreenViewModel.swift index 8485e1b4d..995ad3b27 100644 --- a/ElementX/Sources/Screens/RoomPollsHistoryScreen/RoomPollsHistoryScreenViewModel.swift +++ b/ElementX/Sources/Screens/RoomPollsHistoryScreen/RoomPollsHistoryScreenViewModel.swift @@ -26,7 +26,6 @@ class RoomPollsHistoryScreenViewModel: RoomPollsHistoryScreenViewModelType, Room static let backPaginationEventLimit: UInt = 250 } - private let roomProxy: RoomProxyProtocol private let pollInteractionHandler: PollInteractionHandlerProtocol private let roomTimelineController: RoomTimelineControllerProtocol private let userIndicatorController: UserIndicatorControllerProtocol @@ -40,11 +39,9 @@ class RoomPollsHistoryScreenViewModel: RoomPollsHistoryScreenViewModelType, Room actionsSubject.eraseToAnyPublisher() } - init(roomProxy: RoomProxyProtocol, - pollInteractionHandler: PollInteractionHandlerProtocol, + init(pollInteractionHandler: PollInteractionHandlerProtocol, roomTimelineController: RoomTimelineControllerProtocol, userIndicatorController: UserIndicatorControllerProtocol) { - self.roomProxy = roomProxy self.pollInteractionHandler = pollInteractionHandler self.roomTimelineController = roomTimelineController self.userIndicatorController = userIndicatorController @@ -189,12 +186,3 @@ class RoomPollsHistoryScreenViewModel: RoomPollsHistoryScreenViewModelType, Room } } } - -// MARK: - Mocks - -extension RoomPollsHistoryScreenViewModel { - static let mock = RoomPollsHistoryScreenViewModel(roomProxy: RoomProxyMock(), - pollInteractionHandler: PollInteractionHandlerMock(), - roomTimelineController: MockRoomTimelineController(), - userIndicatorController: UserIndicatorControllerMock()) -} diff --git a/ElementX/Sources/Screens/RoomPollsHistoryScreen/View/RoomPollsHistoryScreen.swift b/ElementX/Sources/Screens/RoomPollsHistoryScreen/View/RoomPollsHistoryScreen.swift index 2212cffb9..2bae70c73 100644 --- a/ElementX/Sources/Screens/RoomPollsHistoryScreen/View/RoomPollsHistoryScreen.swift +++ b/ElementX/Sources/Screens/RoomPollsHistoryScreen/View/RoomPollsHistoryScreen.swift @@ -126,8 +126,7 @@ struct RoomPollsHistoryScreen_Previews: PreviewProvider, TestablePreview { roomTimelineController.timelineItems = [] let roomProxyMockConfiguration = RoomProxyMockConfiguration(displayName: "Polls") roomProxyMockConfiguration.timeline.timelineStartReached = false - let viewModel = RoomPollsHistoryScreenViewModel(roomProxy: RoomProxyMock(with: roomProxyMockConfiguration), - pollInteractionHandler: PollInteractionHandlerMock(), + let viewModel = RoomPollsHistoryScreenViewModel(pollInteractionHandler: PollInteractionHandlerMock(), roomTimelineController: roomTimelineController, userIndicatorController: UserIndicatorControllerMock()) return viewModel @@ -150,8 +149,7 @@ struct RoomPollsHistoryScreen_Previews: PreviewProvider, TestablePreview { let roomProxyMockConfiguration = RoomProxyMockConfiguration(displayName: "Polls") roomProxyMockConfiguration.timeline.timelineStartReached = true - let viewModel = RoomPollsHistoryScreenViewModel(roomProxy: RoomProxyMock(with: roomProxyMockConfiguration), - pollInteractionHandler: PollInteractionHandlerMock(), + let viewModel = RoomPollsHistoryScreenViewModel(pollInteractionHandler: PollInteractionHandlerMock(), roomTimelineController: roomTimelineController, userIndicatorController: UserIndicatorControllerMock()) diff --git a/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemBubbledStylerView.swift b/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemBubbledStylerView.swift index b344f78fe..aa05ab48f 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemBubbledStylerView.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemBubbledStylerView.swift @@ -26,8 +26,6 @@ struct TimelineItemBubbledStylerView: View { let timelineItem: EventBasedTimelineItemProtocol let adjustedDeliveryStatus: TimelineItemDeliveryStatus? @ViewBuilder let content: () -> Content - - @State private var showItemActionMenu = false private var isEncryptedOneToOneRoom: Bool { context.viewState.isEncryptedOneToOneRoom } diff --git a/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemPlainStylerView.swift b/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemPlainStylerView.swift index 300ef1422..4eab07a9a 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemPlainStylerView.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemPlainStylerView.swift @@ -24,8 +24,6 @@ struct TimelineItemPlainStylerView: View { let timelineItem: EventBasedTimelineItemProtocol let adjustedDeliveryStatus: TimelineItemDeliveryStatus? @ViewBuilder let content: () -> Content - - @State private var showItemActionMenu = false var body: some View { VStack(alignment: .trailing, spacing: 0) { diff --git a/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineStyle.swift b/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineStyle.swift index dd6d58cde..b4e0593d5 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineStyle.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineStyle.swift @@ -68,10 +68,6 @@ private struct TimelineGroupStyleKey: EnvironmentKey { static let defaultValue = TimelineGroupStyle.single } -private struct ReadReceiptsEnabledKey: EnvironmentKey { - static let defaultValue = false -} - extension EnvironmentValues { var timelineStyle: TimelineStyle { get { self[TimelineStyleKey.self] } diff --git a/ElementX/Sources/Screens/RoomScreen/View/Supplementary/TimelineReactionsView.swift b/ElementX/Sources/Screens/RoomScreen/View/Supplementary/TimelineReactionsView.swift index ad719d10c..e3776e628 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Supplementary/TimelineReactionsView.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Supplementary/TimelineReactionsView.swift @@ -18,8 +18,6 @@ import SwiftUI @MainActor struct TimelineReactionsView: View { - private static let horizontalSpacing: CGFloat = 4 - private static let verticalSpacing: CGFloat = 4 private let feedbackGenerator = UIImpactFeedbackGenerator(style: .heavy) @Environment(\.layoutDirection) private var layoutDirection: LayoutDirection diff --git a/ElementX/Sources/Screens/RoomScreen/View/Timeline/PollRoomTimelineView.swift b/ElementX/Sources/Screens/RoomScreen/View/Timeline/PollRoomTimelineView.swift index a67e45282..5eaac64d7 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Timeline/PollRoomTimelineView.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Timeline/PollRoomTimelineView.swift @@ -20,8 +20,6 @@ struct PollRoomTimelineView: View { let timelineItem: PollRoomTimelineItem @EnvironmentObject private var context: RoomScreenViewModel.Context - private let feedbackGenerator = UIImpactFeedbackGenerator(style: .heavy) - var body: some View { TimelineStyler(timelineItem: timelineItem) { PollView(poll: poll, editable: timelineItem.isEditable) { action in diff --git a/ElementX/Sources/Screens/RoomScreen/View/Timeline/TimelineTableViewController.swift b/ElementX/Sources/Screens/RoomScreen/View/Timeline/TimelineTableViewController.swift index c9dedc455..c98383228 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Timeline/TimelineTableViewController.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Timeline/TimelineTableViewController.swift @@ -24,6 +24,7 @@ import OrderedCollections class TimelineItemCell: UITableViewCell { static let reuseIdentifier = "TimelineItemCell" + // periphery:ignore - retaining purpose var item: RoomTimelineItemViewState? override func prepareForReuse() { @@ -63,8 +64,6 @@ class TimelineTableViewController: UIViewController { paginateBackwardsPublisher.send(()) } } - - var contextMenuActionProvider: (@MainActor (_ itemID: TimelineItemIdentifier) -> TimelineItemMenuActions?)? @Binding private var isScrolledToBottom: Bool diff --git a/ElementX/Sources/Screens/RoomScreen/View/Timeline/UITimelineView.swift b/ElementX/Sources/Screens/RoomScreen/View/Timeline/UITimelineView.swift index 5e43384f0..21570e634 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Timeline/UITimelineView.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Timeline/UITimelineView.swift @@ -66,9 +66,6 @@ struct UITimelineView: UIViewControllerRepresentable { if tableViewController.isBackPaginating != context.viewState.timelineViewState.isBackPaginating { tableViewController.isBackPaginating = context.viewState.timelineViewState.isBackPaginating } - - // Doesn't have an equatable conformance :( - tableViewController.contextMenuActionProvider = context.viewState.timelineItemMenuActionProvider } func send(viewAction: RoomScreenViewAction) { diff --git a/ElementX/Sources/Screens/RoomScreen/View/TimelineItemMenu.swift b/ElementX/Sources/Screens/RoomScreen/View/TimelineItemMenu.swift index 3d42c61cd..0711af012 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/TimelineItemMenu.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/TimelineItemMenu.swift @@ -133,7 +133,7 @@ extension RoomTimelineItemProtocol { } } -public struct TimelineItemMenu: View { +struct TimelineItemMenu: View { @EnvironmentObject private var context: RoomScreenViewModel.Context @Environment(\.dismiss) private var dismiss @@ -141,7 +141,7 @@ public struct TimelineItemMenu: View { let actions: TimelineItemMenuActions private let feedbackGenerator = UIImpactFeedbackGenerator(style: .heavy) - public var body: some View { + var body: some View { VStack(spacing: 8) { header .frame(idealWidth: 300.0) diff --git a/ElementX/Sources/Screens/SecureBackup/SecureBackupKeyBackupScreen/SecureBackupKeyBackupScreenCoordinator.swift b/ElementX/Sources/Screens/SecureBackup/SecureBackupKeyBackupScreen/SecureBackupKeyBackupScreenCoordinator.swift index 87fc6e6a5..c17f1f4af 100644 --- a/ElementX/Sources/Screens/SecureBackup/SecureBackupKeyBackupScreen/SecureBackupKeyBackupScreenCoordinator.swift +++ b/ElementX/Sources/Screens/SecureBackup/SecureBackupKeyBackupScreen/SecureBackupKeyBackupScreenCoordinator.swift @@ -27,7 +27,6 @@ enum SecureBackupKeyBackupScreenCoordinatorAction { } final class SecureBackupKeyBackupScreenCoordinator: CoordinatorProtocol { - private let parameters: SecureBackupKeyBackupScreenCoordinatorParameters private var viewModel: SecureBackupKeyBackupScreenViewModelProtocol private let actionsSubject: PassthroughSubject = .init() private var cancellables = Set() @@ -37,8 +36,6 @@ final class SecureBackupKeyBackupScreenCoordinator: CoordinatorProtocol { } init(parameters: SecureBackupKeyBackupScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = SecureBackupKeyBackupScreenViewModel(secureBackupController: parameters.secureBackupController, userIndicatorController: parameters.userIndicatorController) } diff --git a/ElementX/Sources/Screens/SecureBackup/SecureBackupKeyBackupScreen/SecureBackupKeyBackupScreenModels.swift b/ElementX/Sources/Screens/SecureBackup/SecureBackupKeyBackupScreen/SecureBackupKeyBackupScreenModels.swift index 10090cb4f..729bc1bf9 100644 --- a/ElementX/Sources/Screens/SecureBackup/SecureBackupKeyBackupScreen/SecureBackupKeyBackupScreenModels.swift +++ b/ElementX/Sources/Screens/SecureBackup/SecureBackupKeyBackupScreen/SecureBackupKeyBackupScreenModels.swift @@ -33,8 +33,6 @@ struct SecureBackupKeyBackupScreenViewStateBindings { var alertInfo: AlertInfo? } -var alertInfo: AlertInfo? - enum SecureBackupKeyBackupScreenViewAction { case cancel case toggleBackup diff --git a/ElementX/Sources/Screens/SecureBackup/SecureBackupLogoutConfirmationScreen/SecureBackupLogoutConfirmationScreenCoordinator.swift b/ElementX/Sources/Screens/SecureBackup/SecureBackupLogoutConfirmationScreen/SecureBackupLogoutConfirmationScreenCoordinator.swift index ab30df1e4..ae9031a9c 100644 --- a/ElementX/Sources/Screens/SecureBackup/SecureBackupLogoutConfirmationScreen/SecureBackupLogoutConfirmationScreenCoordinator.swift +++ b/ElementX/Sources/Screens/SecureBackup/SecureBackupLogoutConfirmationScreen/SecureBackupLogoutConfirmationScreenCoordinator.swift @@ -29,7 +29,6 @@ enum SecureBackupLogoutConfirmationScreenCoordinatorAction { } final class SecureBackupLogoutConfirmationScreenCoordinator: CoordinatorProtocol { - private let parameters: SecureBackupLogoutConfirmationScreenCoordinatorParameters private var viewModel: SecureBackupLogoutConfirmationScreenViewModelProtocol private let actionsSubject: PassthroughSubject = .init() private var cancellables = Set() @@ -39,8 +38,6 @@ final class SecureBackupLogoutConfirmationScreenCoordinator: CoordinatorProtocol } init(parameters: SecureBackupLogoutConfirmationScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = SecureBackupLogoutConfirmationScreenViewModel(secureBackupController: parameters.secureBackupController, networkMonitor: parameters.networkMonitor) } diff --git a/ElementX/Sources/Screens/SecureBackup/SecureBackupLogoutConfirmationScreen/SecureBackupLogoutConfirmationScreenViewModel.swift b/ElementX/Sources/Screens/SecureBackup/SecureBackupLogoutConfirmationScreen/SecureBackupLogoutConfirmationScreenViewModel.swift index 835dd6925..aa53b0654 100644 --- a/ElementX/Sources/Screens/SecureBackup/SecureBackupLogoutConfirmationScreen/SecureBackupLogoutConfirmationScreenViewModel.swift +++ b/ElementX/Sources/Screens/SecureBackup/SecureBackupLogoutConfirmationScreen/SecureBackupLogoutConfirmationScreenViewModel.swift @@ -23,6 +23,7 @@ class SecureBackupLogoutConfirmationScreenViewModel: SecureBackupLogoutConfirmat private let secureBackupController: SecureBackupControllerProtocol private let networkMonitor: NetworkMonitorProtocol + // periphery:ignore - auto cancels when reassigned @CancellableTask private var keyUploadWaitingTask: Task? diff --git a/ElementX/Sources/Screens/SecureBackup/SecureBackupRecoveryKeyScreen/SecureBackupRecoveryKeyScreenCoordinator.swift b/ElementX/Sources/Screens/SecureBackup/SecureBackupRecoveryKeyScreen/SecureBackupRecoveryKeyScreenCoordinator.swift index a083ef719..543767f65 100644 --- a/ElementX/Sources/Screens/SecureBackup/SecureBackupRecoveryKeyScreen/SecureBackupRecoveryKeyScreenCoordinator.swift +++ b/ElementX/Sources/Screens/SecureBackup/SecureBackupRecoveryKeyScreen/SecureBackupRecoveryKeyScreenCoordinator.swift @@ -30,7 +30,6 @@ enum SecureBackupRecoveryKeyScreenCoordinatorAction { } final class SecureBackupRecoveryKeyScreenCoordinator: CoordinatorProtocol { - private let parameters: SecureBackupRecoveryKeyScreenCoordinatorParameters private var viewModel: SecureBackupRecoveryKeyScreenViewModelProtocol private let actionsSubject: PassthroughSubject = .init() private var cancellables = Set() @@ -40,8 +39,6 @@ final class SecureBackupRecoveryKeyScreenCoordinator: CoordinatorProtocol { } init(parameters: SecureBackupRecoveryKeyScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = SecureBackupRecoveryKeyScreenViewModel(secureBackupController: parameters.secureBackupController, userIndicatorController: parameters.userIndicatorController) } diff --git a/ElementX/Sources/Screens/SecureBackup/SecureBackupScreen/SecureBackupScreenCoordinator.swift b/ElementX/Sources/Screens/SecureBackup/SecureBackupScreen/SecureBackupScreenCoordinator.swift index 8683f4436..693d972e9 100644 --- a/ElementX/Sources/Screens/SecureBackup/SecureBackupScreen/SecureBackupScreenCoordinator.swift +++ b/ElementX/Sources/Screens/SecureBackup/SecureBackupScreen/SecureBackupScreenCoordinator.swift @@ -24,18 +24,11 @@ struct SecureBackupScreenCoordinatorParameters { let userIndicatorController: UserIndicatorControllerProtocol } -enum SecureBackupScreenCoordinatorAction { } - final class SecureBackupScreenCoordinator: CoordinatorProtocol { private let parameters: SecureBackupScreenCoordinatorParameters private var viewModel: SecureBackupScreenViewModelProtocol - private let actionsSubject: PassthroughSubject = .init() private var cancellables = Set() - var actions: AnyPublisher { - actionsSubject.eraseToAnyPublisher() - } - init(parameters: SecureBackupScreenCoordinatorParameters) { self.parameters = parameters diff --git a/ElementX/Sources/Screens/SessionVerificationScreen/SessionVerificationScreenCoordinator.swift b/ElementX/Sources/Screens/SessionVerificationScreen/SessionVerificationScreenCoordinator.swift index 31dd8f679..6ec439aef 100644 --- a/ElementX/Sources/Screens/SessionVerificationScreen/SessionVerificationScreenCoordinator.swift +++ b/ElementX/Sources/Screens/SessionVerificationScreen/SessionVerificationScreenCoordinator.swift @@ -26,7 +26,6 @@ struct SessionVerificationScreenCoordinatorParameters { } final class SessionVerificationScreenCoordinator: CoordinatorProtocol { - private let parameters: SessionVerificationScreenCoordinatorParameters private var viewModel: SessionVerificationScreenViewModelProtocol private let actionsSubject: PassthroughSubject = .init() @@ -37,8 +36,6 @@ final class SessionVerificationScreenCoordinator: CoordinatorProtocol { } init(parameters: SessionVerificationScreenCoordinatorParameters) { - self.parameters = parameters - viewModel = SessionVerificationScreenViewModel(sessionVerificationControllerProxy: parameters.sessionVerificationControllerProxy) } diff --git a/ElementX/Sources/Screens/SessionVerificationScreen/View/SessionVerificationScreen.swift b/ElementX/Sources/Screens/SessionVerificationScreen/View/SessionVerificationScreen.swift index 03cc05bd9..910203d39 100644 --- a/ElementX/Sources/Screens/SessionVerificationScreen/View/SessionVerificationScreen.swift +++ b/ElementX/Sources/Screens/SessionVerificationScreen/View/SessionVerificationScreen.swift @@ -211,19 +211,6 @@ struct SessionVerificationScreen: View { .padding(8.0) } } - - struct StateIcon: View { - let systemName: String - - var body: some View { - Image(systemName: systemName) - .resizable() - .font(.compound.bodyLG.weight(.light)) - .scaledToFit() - .foregroundColor(.compound.iconPrimary) - .frame(width: 100, height: 100) - } - } } // MARK: - Previews diff --git a/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenCoordinator.swift b/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenCoordinator.swift index 4111a319e..b3b32d408 100644 --- a/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenCoordinator.swift +++ b/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenCoordinator.swift @@ -41,6 +41,7 @@ final class SettingsScreenCoordinator: CoordinatorProtocol { private let parameters: SettingsScreenCoordinatorParameters private var viewModel: SettingsScreenViewModelProtocol + // periphery:ignore - retaining purpose private var appLockSetupFlowCoordinator: AppLockSetupFlowCoordinator? private let actionsSubject: PassthroughSubject = .init() diff --git a/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenViewModel.swift b/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenViewModel.swift index 590560787..6509ddc24 100644 --- a/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenViewModel.swift +++ b/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenViewModel.swift @@ -20,9 +20,6 @@ import SwiftUI typealias SettingsScreenViewModelType = StateStoreViewModel class SettingsScreenViewModel: SettingsScreenViewModelType, SettingsScreenViewModelProtocol { - private let userSession: UserSessionProtocol - private let appSettings: AppSettings - private var actionsSubject: PassthroughSubject = .init() var actions: AnyPublisher { @@ -30,9 +27,6 @@ class SettingsScreenViewModel: SettingsScreenViewModelType, SettingsScreenViewMo } init(userSession: UserSessionProtocol, appSettings: AppSettings) { - self.userSession = userSession - self.appSettings = appSettings - super.init(initialViewState: .init(deviceID: userSession.deviceID, userID: userSession.userID, accountProfileURL: userSession.clientProxy.accountURL(action: .profile), diff --git a/ElementX/Sources/Screens/Settings/UserDetailsEditScreen/UserDetailsEditScreenCoordinator.swift b/ElementX/Sources/Screens/Settings/UserDetailsEditScreen/UserDetailsEditScreenCoordinator.swift index 62d9c112b..d16d6d09d 100644 --- a/ElementX/Sources/Screens/Settings/UserDetailsEditScreen/UserDetailsEditScreenCoordinator.swift +++ b/ElementX/Sources/Screens/Settings/UserDetailsEditScreen/UserDetailsEditScreenCoordinator.swift @@ -24,18 +24,11 @@ struct UserDetailsEditScreenCoordinatorParameters { let userIndicatorController: UserIndicatorControllerProtocol } -enum UserDetailsEditScreenCoordinatorAction { } - final class UserDetailsEditScreenCoordinator: CoordinatorProtocol { private let parameters: UserDetailsEditScreenCoordinatorParameters private var viewModel: UserDetailsEditScreenViewModelProtocol - private let actionsSubject: PassthroughSubject = .init() private var cancellables = Set() - var actions: AnyPublisher { - actionsSubject.eraseToAnyPublisher() - } - init(parameters: UserDetailsEditScreenCoordinatorParameters) { self.parameters = parameters diff --git a/ElementX/Sources/Screens/Settings/UserDetailsEditScreen/UserDetailsEditScreenModels.swift b/ElementX/Sources/Screens/Settings/UserDetailsEditScreen/UserDetailsEditScreenModels.swift index a0d746b5a..c4c49d5ca 100644 --- a/ElementX/Sources/Screens/Settings/UserDetailsEditScreen/UserDetailsEditScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/UserDetailsEditScreen/UserDetailsEditScreenModels.swift @@ -37,12 +37,7 @@ struct UserDetailsEditScreenViewState: BindableState { var nameDidChange: Bool { bindings.name != currentDisplayName } - - /// The string shown for the room's name when it can't be edited. - var nameRowTitle: String { - bindings.name.isEmpty ? L10n.screenEditProfileDisplayName : bindings.name - } - + var avatarDidChange: Bool { localMedia != nil || selectedAvatarURL != currentAvatarURL } diff --git a/ElementX/Sources/Screens/StartChatScreen/StartChatScreenViewModel.swift b/ElementX/Sources/Screens/StartChatScreen/StartChatScreenViewModel.swift index 5b1891e54..d32c48d2c 100644 --- a/ElementX/Sources/Screens/StartChatScreen/StartChatScreenViewModel.swift +++ b/ElementX/Sources/Screens/StartChatScreen/StartChatScreenViewModel.swift @@ -99,6 +99,7 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie .store(in: &cancellables) } + // periphery:ignore - auto cancels when reassigned @CancellableTask private var fetchUsersTask: Task? diff --git a/ElementX/Sources/Services/Analytics/Helpers/UserProperties+Element.swift b/ElementX/Sources/Services/Analytics/Helpers/UserProperties+Element.swift deleted file mode 100644 index b64cc7942..000000000 --- a/ElementX/Sources/Services/Analytics/Helpers/UserProperties+Element.swift +++ /dev/null @@ -1,28 +0,0 @@ -// -// Copyright 2021 New Vector Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import AnalyticsEvents -import Foundation - -public extension AnalyticsEvent.UserProperties { - // Initializer for Element. Strips all Web properties. - init(ftueUseCaseSelection: FtueUseCaseSelection?, numFavouriteRooms: Int?, numSpaces: Int?, allChatsActiveFilter: AllChatsActiveFilter?) { - self.init(allChatsActiveFilter: nil, - ftueUseCaseSelection: ftueUseCaseSelection, - numFavouriteRooms: numFavouriteRooms, - numSpaces: numSpaces) - } -} diff --git a/ElementX/Sources/Services/Analytics/PostHogAnalyticsClient.swift b/ElementX/Sources/Services/Analytics/PostHogAnalyticsClient.swift index 84c410739..4ad1a3c0d 100644 --- a/ElementX/Sources/Services/Analytics/PostHogAnalyticsClient.swift +++ b/ElementX/Sources/Services/Analytics/PostHogAnalyticsClient.swift @@ -67,10 +67,9 @@ class PostHogAnalyticsClient: AnalyticsClientProtocol { } // Merge the updated user properties with the existing ones - self.pendingUserProperties = AnalyticsEvent.UserProperties(ftueUseCaseSelection: userProperties.ftueUseCaseSelection ?? pendingUserProperties.ftueUseCaseSelection, + self.pendingUserProperties = AnalyticsEvent.UserProperties(allChatsActiveFilter: userProperties.allChatsActiveFilter ?? pendingUserProperties.allChatsActiveFilter, ftueUseCaseSelection: userProperties.ftueUseCaseSelection ?? pendingUserProperties.ftueUseCaseSelection, numFavouriteRooms: userProperties.numFavouriteRooms ?? pendingUserProperties.numFavouriteRooms, - numSpaces: userProperties.numSpaces ?? pendingUserProperties.numSpaces, - allChatsActiveFilter: userProperties.allChatsActiveFilter ?? pendingUserProperties.allChatsActiveFilter) + numSpaces: userProperties.numSpaces ?? pendingUserProperties.numSpaces) } // MARK: - Private diff --git a/ElementX/Sources/Services/Media/Provider/MediaLoader.swift b/ElementX/Sources/Services/Media/Provider/MediaLoader.swift index 49950f384..b98c64170 100644 --- a/ElementX/Sources/Services/Media/Provider/MediaLoader.swift +++ b/ElementX/Sources/Services/Media/Provider/MediaLoader.swift @@ -25,13 +25,11 @@ private final class MediaRequest { actor MediaLoader: MediaLoaderProtocol { private let client: ClientProtocol - private let clientQueue: DispatchQueue private var ongoingRequests = [MediaSourceProxy: MediaRequest]() init(client: ClientProtocol, clientQueue: DispatchQueue = .global()) { self.client = client - self.clientQueue = clientQueue } func loadMediaContentForSource(_ source: MediaSourceProxy) async throws -> Data { diff --git a/ElementX/Sources/Services/Notification/Proxy/NotificationItemProxyProtocol.swift b/ElementX/Sources/Services/Notification/Proxy/NotificationItemProxyProtocol.swift index 701dc34f3..947e59a7b 100644 --- a/ElementX/Sources/Services/Notification/Proxy/NotificationItemProxyProtocol.swift +++ b/ElementX/Sources/Services/Notification/Proxy/NotificationItemProxyProtocol.swift @@ -20,9 +20,7 @@ import UserNotifications protocol NotificationItemProxyProtocol { var event: NotificationEvent? { get } - - var eventID: String { get } - + var senderID: String { get } var roomID: String { get } diff --git a/ElementX/Sources/Services/Room/RoomProxy.swift b/ElementX/Sources/Services/Room/RoomProxy.swift index 19776195b..d9c1d47bc 100644 --- a/ElementX/Sources/Services/Room/RoomProxy.swift +++ b/ElementX/Sources/Services/Room/RoomProxy.swift @@ -29,7 +29,6 @@ class RoomProxy: RoomProxyProtocol { private let backgroundTaskName = "SendRoomEvent" private let userInitiatedDispatchQueue = DispatchQueue(label: "io.element.elementx.roomproxy.user_initiated", qos: .userInitiated) - private let lowPriorityDispatchQueue = DispatchQueue(label: "io.element.elementx.roomproxy.low_priority", qos: .utility) private var sendMessageBackgroundTask: BackgroundTaskProtocol? @@ -141,10 +140,6 @@ class RoomProxy: RoomProxyProtocol { roomListItem.avatarUrl().flatMap(URL.init(string:)) } - var invitedMembersCount: Int { - Int(room.invitedMembersCount()) - } - var joinedMembersCount: Int { Int(room.joinedMembersCount()) } diff --git a/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift b/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift index d068fb93c..5d169f159 100644 --- a/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift +++ b/ElementX/Sources/Services/Room/RoomSummary/RoomSummaryProvider.swift @@ -30,6 +30,7 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol { private let serialDispatchQueue: DispatchQueue + // periphery:ignore - retaining purpose private var roomList: RoomListProtocol? private var cancellables = Set() @@ -39,7 +40,6 @@ class RoomSummaryProvider: RoomSummaryProviderProtocol { private let roomListSubject = CurrentValueSubject<[RoomSummary], Never>([]) private let stateSubject = CurrentValueSubject(.notLoaded) - private let countSubject = CurrentValueSubject(0) private let diffsPublisher = PassthroughSubject<[RoomListEntriesUpdate], Never>() @@ -407,15 +407,6 @@ extension MatrixRustSDK.RoomListEntry { return "Filled(\(roomId))" } } - - var isInvalidated: Bool { - switch self { - case .invalidated: - return true - default: - return false - } - } } private class RoomListEntriesListenerProxy: RoomListEntriesListener { diff --git a/ElementX/Sources/Services/SecureBackup/SecureBackupController.swift b/ElementX/Sources/Services/SecureBackup/SecureBackupController.swift index ffce00e3c..1bb750738 100644 --- a/ElementX/Sources/Services/SecureBackup/SecureBackupController.swift +++ b/ElementX/Sources/Services/SecureBackup/SecureBackupController.swift @@ -24,9 +24,12 @@ class SecureBackupController: SecureBackupControllerProtocol { private let recoveryKeyStateSubject = CurrentValueSubject(.unknown) private let keyBackupStateSubject = CurrentValueSubject(.unknown) + // periphery:ignore - retaining purpose private var backupStateListenerTaskHandle: TaskHandle? + // periphery:ignore - retaining purpose private var recoveryStateListenerTaskHandle: TaskHandle? + // periphery:ignore - auto cancels when reassigned /// Used to dedupe remote backup state requests @CancellableTask private var remoteBackupStateTask: Task? diff --git a/ElementX/Sources/Services/SecureBackup/SecureBackupControllerProtocol.swift b/ElementX/Sources/Services/SecureBackup/SecureBackupControllerProtocol.swift index 7bd0845a6..08c2ae5f1 100644 --- a/ElementX/Sources/Services/SecureBackup/SecureBackupControllerProtocol.swift +++ b/ElementX/Sources/Services/SecureBackup/SecureBackupControllerProtocol.swift @@ -64,11 +64,3 @@ protocol SecureBackupControllerProtocol { func waitForKeyBackupUpload() async -> Result } - -extension SecureBackupControllerMock { - convenience init(keyBackupState: SecureBackupKeyBackupState, recoveryKeyState: SecureBackupRecoveryKeyState) { - self.init() - underlyingKeyBackupState = CurrentValueSubject(keyBackupState).asCurrentValuePublisher() - underlyingRecoveryKeyState = CurrentValueSubject(recoveryKeyState).asCurrentValuePublisher() - } -} diff --git a/ElementX/Sources/Services/Timeline/RoomTimelineProvider.swift b/ElementX/Sources/Services/Timeline/RoomTimelineProvider.swift index 6cb09e477..e3d3bc19c 100644 --- a/ElementX/Sources/Services/Timeline/RoomTimelineProvider.swift +++ b/ElementX/Sources/Services/Timeline/RoomTimelineProvider.swift @@ -32,10 +32,10 @@ class RoomTimelineProvider: RoomTimelineProviderProtocol { itemProxiesSubject.value } - var updatePublisher: AnyPublisher { + var updatePublisher: AnyPublisher { itemProxiesSubject .combineLatest(backPaginationStateSubject) - .map(TimelineProviderUpdate.init) + .map { _, _ in () } .eraseToAnyPublisher() } diff --git a/ElementX/Sources/Services/Timeline/RoomTimelineProviderProtocol.swift b/ElementX/Sources/Services/Timeline/RoomTimelineProviderProtocol.swift index 2e319ecb2..83c20d6e3 100644 --- a/ElementX/Sources/Services/Timeline/RoomTimelineProviderProtocol.swift +++ b/ElementX/Sources/Services/Timeline/RoomTimelineProviderProtocol.swift @@ -19,15 +19,10 @@ import Foundation import MatrixRustSDK -struct TimelineProviderUpdate { - let items: [TimelineItemProxy] - let backPaginationState: BackPaginationStatus -} - @MainActor // sourcery: AutoMockable protocol RoomTimelineProviderProtocol { - var updatePublisher: AnyPublisher { get } + var updatePublisher: AnyPublisher { get } var itemProxies: [TimelineItemProxy] { get } var backPaginationState: BackPaginationStatus { get } } diff --git a/ElementX/Sources/Services/Timeline/TimelineController/RoomTimelineController.swift b/ElementX/Sources/Services/Timeline/TimelineController/RoomTimelineController.swift index c2deb276b..6082e6d01 100644 --- a/ElementX/Sources/Services/Timeline/TimelineController/RoomTimelineController.swift +++ b/ElementX/Sources/Services/Timeline/TimelineController/RoomTimelineController.swift @@ -27,11 +27,6 @@ class RoomTimelineController: RoomTimelineControllerProtocol { private let serialDispatchQueue: DispatchQueue private var cancellables = Set() - private var timelineItemsUpdateTask: Task? { - willSet { - timelineItemsUpdateTask?.cancel() - } - } let callbacks = PassthroughSubject() @@ -257,13 +252,9 @@ class RoomTimelineController: RoomTimelineControllerProtocol { for (index, collapsibleChunk) in collapsibleChunks.enumerated() { let isLastItem = index == collapsibleChunks.indices.last - // Try building a stable identifier for items that don't have one - // We need to avoid duplicates otherwise the diffable datasource will crash - let reversedIndex = collapsibleChunks.count - index - let items = collapsibleChunk.compactMap { itemProxy in - let timelineItem = buildTimelineItem(for: itemProxy, chunkIndex: reversedIndex) + let timelineItem = buildTimelineItem(for: itemProxy) if timelineItem is EncryptedHistoryRoomTimelineItem { canBackPaginate = false @@ -319,7 +310,7 @@ class RoomTimelineController: RoomTimelineControllerProtocol { callbacks.send(.isBackPaginating(isBackPaginating)) } - private func buildTimelineItem(for itemProxy: TimelineItemProxy, chunkIndex: Int) -> RoomTimelineItemProtocol? { + private func buildTimelineItem(for itemProxy: TimelineItemProxy) -> RoomTimelineItemProtocol? { switch itemProxy { case .event(let eventTimelineItem): let timelineItem = timelineItemFactory.buildTimelineItem(for: eventTimelineItem) diff --git a/ElementX/Sources/Services/Timeline/TimelineItemProxy.swift b/ElementX/Sources/Services/Timeline/TimelineItemProxy.swift index 5b5744945..b4e355114 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItemProxy.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItemProxy.swift @@ -89,9 +89,7 @@ class EventTimelineItemProxy { }() lazy var canBeRepliedTo = item.canBeRepliedTo() - - lazy var isRoomState = content.kind().isRoomState - + lazy var content = item.content() lazy var isOwn = item.isOwn() @@ -125,17 +123,6 @@ class EventTimelineItemProxy { lazy var readReceipts = item.readReceipts() } -extension TimelineItemContentKind { - var isRoomState: Bool { - switch self { - case .state, .roomMembership: - return true - default: - return false - } - } -} - struct TimelineItemDebugInfo: Identifiable, CustomStringConvertible { let id = UUID() let model: String diff --git a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift index b1959aa08..378c9d76e 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift @@ -19,24 +19,18 @@ import UIKit import UniformTypeIdentifiers struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol { - private let mediaProvider: MediaProviderProtocol private let attributedStringBuilder: AttributedStringBuilderProtocol private let stateEventStringBuilder: RoomStateEventStringBuilder - private let appSettings: AppSettings /// The Matrix ID of the current user. private let userID: String init(userID: String, - mediaProvider: MediaProviderProtocol, attributedStringBuilder: AttributedStringBuilderProtocol, - stateEventStringBuilder: RoomStateEventStringBuilder, - appSettings: AppSettings) { + stateEventStringBuilder: RoomStateEventStringBuilder) { self.userID = userID - self.mediaProvider = mediaProvider self.attributedStringBuilder = attributedStringBuilder self.stateEventStringBuilder = stateEventStringBuilder - self.appSettings = appSettings } func buildTimelineItem(for eventItemProxy: EventTimelineItemProxy) -> RoomTimelineItemProtocol? { @@ -61,7 +55,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol { case .message: return buildMessageTimelineItem(eventItemProxy, isOutgoing) case .state(let stateKey, let content): - return buildStateTimelineItem(for: eventItemProxy, state: content, stateKey: stateKey, isOutgoing: isOutgoing) + return buildStateTimelineItem(for: eventItemProxy, state: content, isOutgoing: isOutgoing) case .roomMembership(userId: let userID, change: let change): return buildStateMembershipChangeTimelineItem(for: eventItemProxy, member: userID, membershipChange: change, isOutgoing: isOutgoing) case .profileChange(let displayName, let prevDisplayName, let avatarUrl, let prevAvatarUrl): @@ -564,7 +558,6 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol { private func buildStateTimelineItem(for eventItemProxy: EventTimelineItemProxy, state: OtherState, - stateKey: String, isOutgoing: Bool) -> RoomTimelineItemProtocol? { guard let text = stateEventStringBuilder.buildString(for: state, sender: eventItemProxy.sender, isOutgoing: isOutgoing) else { return nil } return buildStateTimelineItem(for: eventItemProxy, text: text, isOutgoing: isOutgoing) diff --git a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemView.swift b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemView.swift index 8fe009060..bdfa6dc81 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemView.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemView.swift @@ -78,8 +78,4 @@ struct RoomTimelineItemView: View { VoiceMessageRoomTimelineView(timelineItem: item, playerState: context.viewState.audioPlayerStateProvider?(item.id) ?? AudioPlayerState(id: .timelineItemIdentifier(item.id), duration: 0)) } } - - var timelineGroupStyle: TimelineGroupStyle { - viewState.groupStyle - } } diff --git a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemViewState.swift b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemViewState.swift index 073ce9d4f..5e2fde3f4 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemViewState.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemViewState.swift @@ -34,10 +34,6 @@ final class RoomTimelineItemViewState: Identifiable, Equatable, ObservableObject identifier.timelineID } - var isReactable: Bool { - type.isReactable - } - init(type: RoomTimelineItemType, groupStyle: TimelineGroupStyle) { self.type = type self.groupStyle = groupStyle @@ -146,18 +142,4 @@ enum RoomTimelineItemType: Equatable { return item.id } } - - /// Whether or not it is possible to send a reaction to this timeline item. - var isReactable: Bool { - switch self { - case .text, .image, .video, .audio, .file, .emote, .notice, .sticker, .location, .poll, .voice: - return true - case .redacted, .encrypted, .unsupported, .state: // Event based items that aren't reactable - return false - case .timelineStart, .encryptedHistory, .separator, .readMarker, .paginationIndicator: // Virtual items are never reactable - return false - case .group: - return false - } - } } diff --git a/ElementX/Sources/Services/Timeline/TimelineProxy.swift b/ElementX/Sources/Services/Timeline/TimelineProxy.swift index 5cfe56b9e..ad5a3469e 100644 --- a/ElementX/Sources/Services/Timeline/TimelineProxy.swift +++ b/ElementX/Sources/Services/Timeline/TimelineProxy.swift @@ -30,6 +30,8 @@ final class TimelineProxy: TimelineProxyProtocol { private var backPaginationStateObservationToken: TaskHandle? private var roomTimelineObservationToken: TaskHandle? + + // periphery:ignore - retaining purpose private var timelineListener: RoomTimelineListener? private let backPaginationStateSubject = PassthroughSubject() @@ -47,10 +49,6 @@ final class TimelineProxy: TimelineProxyProtocol { innerTimelineProvider } - var hasPendingUpdatesSubscription: Bool { - innerTimelineProvider != nil - } - deinit { backPaginationStateObservationToken?.cancel() roomTimelineObservationToken?.cancel() diff --git a/ElementX/Sources/Services/Timeline/TimelineProxyProtocol.swift b/ElementX/Sources/Services/Timeline/TimelineProxyProtocol.swift index 40ad7ec81..b0a2811bc 100644 --- a/ElementX/Sources/Services/Timeline/TimelineProxyProtocol.swift +++ b/ElementX/Sources/Services/Timeline/TimelineProxyProtocol.swift @@ -125,14 +125,3 @@ protocol TimelineProxyProtocol { func sendPollResponse(pollStartID: String, answers: [String]) async -> Result } - -extension TimelineProxyProtocol { - func sendMessage(_ message: String, - html: String, - intentionalMentions: IntentionalMentions) async -> Result { - await sendMessage(message, - html: html, - inReplyTo: nil, - intentionalMentions: intentionalMentions) - } -} diff --git a/ElementX/Sources/Services/UserSession/UserSessionStoreProtocol.swift b/ElementX/Sources/Services/UserSession/UserSessionStoreProtocol.swift index 9ff7b4ba7..ddb484f54 100644 --- a/ElementX/Sources/Services/UserSession/UserSessionStoreProtocol.swift +++ b/ElementX/Sources/Services/UserSession/UserSessionStoreProtocol.swift @@ -21,7 +21,6 @@ enum UserSessionStoreError: Error { case missingCredentials case failedRestoringLogin case failedSettingUpSession - case failedRefreshingRestoreToken } protocol UserSessionStoreProtocol { diff --git a/ElementX/Sources/Services/Users/UserDiscoveryServiceProtocol.swift b/ElementX/Sources/Services/Users/UserDiscoveryServiceProtocol.swift index 0d0d16079..118211a43 100644 --- a/ElementX/Sources/Services/Users/UserDiscoveryServiceProtocol.swift +++ b/ElementX/Sources/Services/Users/UserDiscoveryServiceProtocol.swift @@ -18,7 +18,6 @@ import Foundation enum UserDiscoveryErrorType: Error { case failedSearchingUsers - case failedFetchingSuggestedUsers } // sourcery: AutoMockable diff --git a/ElementX/Sources/Services/VoiceMessage/VoiceMessageRecorder.swift b/ElementX/Sources/Services/VoiceMessage/VoiceMessageRecorder.swift index 80c4f1e50..1d0c641ce 100644 --- a/ElementX/Sources/Services/VoiceMessage/VoiceMessageRecorder.swift +++ b/ElementX/Sources/Services/VoiceMessage/VoiceMessageRecorder.swift @@ -21,7 +21,6 @@ import MatrixRustSDK class VoiceMessageRecorder: VoiceMessageRecorderProtocol { let audioRecorder: AudioRecorderProtocol - private let audioConverter: AudioConverterProtocol private let voiceMessageCache: VoiceMessageCacheProtocol private let mediaPlayerProvider: MediaPlayerProviderProtocol @@ -31,7 +30,6 @@ class VoiceMessageRecorder: VoiceMessageRecorderProtocol { } private let mp4accMimeType = "audio/m4a" - private let waveformSamplesCount = 100 var isRecording: Bool { audioRecorder.isRecording @@ -53,11 +51,9 @@ class VoiceMessageRecorder: VoiceMessageRecorderProtocol { init(audioRecorder: AudioRecorderProtocol = AudioRecorder(), mediaPlayerProvider: MediaPlayerProviderProtocol, - audioConverter: AudioConverterProtocol = AudioConverter(), voiceMessageCache: VoiceMessageCacheProtocol = VoiceMessageCache()) { self.audioRecorder = audioRecorder self.mediaPlayerProvider = mediaPlayerProvider - self.audioConverter = audioConverter self.voiceMessageCache = voiceMessageCache addObservers() diff --git a/ElementX/Sources/Services/VoiceMessage/VoiceMessageRecorderProtocol.swift b/ElementX/Sources/Services/VoiceMessage/VoiceMessageRecorderProtocol.swift index 9eaa08b88..ca1d10d97 100644 --- a/ElementX/Sources/Services/VoiceMessage/VoiceMessageRecorderProtocol.swift +++ b/ElementX/Sources/Services/VoiceMessage/VoiceMessageRecorderProtocol.swift @@ -18,7 +18,6 @@ import Combine import Foundation enum VoiceMessageRecorderError: Error { - case genericError case missingRecordingFile case previewNotAvailable case audioRecorderError(AudioRecorderError) @@ -33,11 +32,9 @@ enum VoiceMessageRecorderAction { } protocol VoiceMessageRecorderProtocol { - var audioRecorder: AudioRecorderProtocol { get } var previewAudioPlayerState: AudioPlayerState? { get } var isRecording: Bool { get } var recordingURL: URL? { get } - var recordingDuration: TimeInterval { get } var actions: AnyPublisher { get } @@ -50,7 +47,6 @@ protocol VoiceMessageRecorderProtocol { func seekPlayback(to progress: Double) async func deleteRecording() async - func buildRecordingWaveform() async -> Result<[UInt16], VoiceMessageRecorderError> func sendVoiceMessage(inRoom roomProxy: RoomProxyProtocol, audioConverter: AudioConverterProtocol) async -> Result } diff --git a/ElementX/Sources/UITests/UITestsAppCoordinator.swift b/ElementX/Sources/UITests/UITestsAppCoordinator.swift index bdb5f90ac..2e2d681f4 100644 --- a/ElementX/Sources/UITests/UITestsAppCoordinator.swift +++ b/ElementX/Sources/UITests/UITestsAppCoordinator.swift @@ -21,10 +21,6 @@ import UIKit class UITestsAppCoordinator: AppCoordinatorProtocol, WindowManagerDelegate { private let navigationRootCoordinator: NavigationRootCoordinator - private var mockScreen: MockScreen? - private var alternateWindowMockScreen: MockScreen? - - let notificationManager: NotificationManagerProtocol = NotificationManagerMock() let windowManager = WindowManager() init() { @@ -51,7 +47,6 @@ class UITestsAppCoordinator: AppCoordinatorProtocol, WindowManagerDelegate { let mockScreen = MockScreen(id: screenID) navigationRootCoordinator.setRootCoordinator(mockScreen.coordinator) - self.mockScreen = mockScreen } func toPresentable() -> AnyView { @@ -69,7 +64,6 @@ class UITestsAppCoordinator: AppCoordinatorProtocol, WindowManagerDelegate { guard let screenID = ProcessInfo.testScreenID, screenID == .appLockFlow || screenID == .appLockFlowDisabled else { return } let screen = MockScreen(id: screenID == .appLockFlow ? .appLockFlowAlternateWindow : .appLockFlowDisabledAlternateWindow, windowManager: windowManager) windowManager.alternateWindow.rootViewController = UIHostingController(rootView: screen.coordinator.toPresentable().statusBarHidden()) - alternateWindowMockScreen = screen } } diff --git a/ElementX/Sources/UITests/UITestsNotificationCenter.swift b/ElementX/Sources/UITests/UITestsNotificationCenter.swift index 383475dad..1e3e60a0b 100644 --- a/ElementX/Sources/UITests/UITestsNotificationCenter.swift +++ b/ElementX/Sources/UITests/UITestsNotificationCenter.swift @@ -25,6 +25,7 @@ import SwiftUI /// - Start the app from the tests and call `client.waitForApp()` to establish communication. /// - Send the notification from the tests you would like posted in the app. class UITestsNotificationCenter: NotificationCenter { + // periphery:ignore - retaining purpose private var client: UITestsSignalling.Client? private var signalCancellable: AnyCancellable? diff --git a/ElementX/Sources/UnitTests/UnitTestsAppCoordinator.swift b/ElementX/Sources/UnitTests/UnitTestsAppCoordinator.swift index bcfbb10e3..2b3af2116 100644 --- a/ElementX/Sources/UnitTests/UnitTestsAppCoordinator.swift +++ b/ElementX/Sources/UnitTests/UnitTestsAppCoordinator.swift @@ -17,7 +17,6 @@ import SwiftUI class UnitTestsAppCoordinator: AppCoordinatorProtocol { - let notificationManager: NotificationManagerProtocol = NotificationManagerMock() let windowManager = WindowManager() init() { diff --git a/IntegrationTests/Sources/TestMeasurementParser.swift b/IntegrationTests/Sources/TestMeasurementParser.swift index 36e96dfc9..16f35fcb7 100644 --- a/IntegrationTests/Sources/TestMeasurementParser.swift +++ b/IntegrationTests/Sources/TestMeasurementParser.swift @@ -39,7 +39,7 @@ enum TestMeasurementParserMetric: String { /// This class is responsible for extracting XCTest measurement run results from stderr in lieu of an official API /// Heavily inspired by https://stackoverflow.com/questions/54814422/how-to-extract-performance-metrics-measured-by-measureblock-in-xctest -class TestMeasurementParser { +final class TestMeasurementParser { private let pipe = Pipe() private let regex: NSRegularExpression private var results = [String: Double]() @@ -118,11 +118,4 @@ class TestMeasurementParser { testCase.waitForExpectations(timeout: 10.0) } - - /// Retrieve the recorded average value for a particular metric - /// - Parameter metric: Needs to match one of the metrics passed in the XCTest measure metrics array - /// - Returns: The resulting average value - func valueForMetric(_ metric: TestMeasurementParserMetric) -> Double? { - results[metric.rawValue] - } } diff --git a/NSE/Sources/NotificationContentBuilder.swift b/NSE/Sources/NotificationContentBuilder.swift index 497af9132..45c629b6c 100644 --- a/NSE/Sources/NotificationContentBuilder.swift +++ b/NSE/Sources/NotificationContentBuilder.swift @@ -59,7 +59,6 @@ struct NotificationContentBuilder { let notification = UNMutableNotificationContent() notification.receiverID = notificationItem.receiverID notification.roomID = notificationItem.roomID - notification.eventID = notificationItem.eventID notification.sound = notificationItem.isNoisy ? UNNotificationSound(named: UNNotificationSoundName(rawValue: "message.caf")) : nil // So that the UI groups notification that are received for the same room but also for the same user // Removing the @ fixes an iOS bug where the notification crashes if the mute button is tapped diff --git a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateScreenCoordinator.swift b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateScreenCoordinator.swift index a39aad8eb..d727dad61 100644 --- a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateScreenCoordinator.swift +++ b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateScreenCoordinator.swift @@ -14,6 +14,8 @@ // limitations under the License. // +// periphery:ignore:all - this is just a template remove this comment once generating the final file + import Combine import SwiftUI diff --git a/UnitTests/Sources/AnalyticsTests.swift b/UnitTests/Sources/AnalyticsTests.swift index 94044e9d0..525808560 100644 --- a/UnitTests/Sources/AnalyticsTests.swift +++ b/UnitTests/Sources/AnalyticsTests.swift @@ -134,10 +134,10 @@ class AnalyticsTests: XCTestCase { XCTAssertNil(client.pendingUserProperties, "No user properties should have been set yet.") // When updating the user properties - client.updateUserProperties(AnalyticsEvent.UserProperties(ftueUseCaseSelection: .PersonalMessaging, + client.updateUserProperties(AnalyticsEvent.UserProperties(allChatsActiveFilter: nil, + ftueUseCaseSelection: .PersonalMessaging, numFavouriteRooms: 4, - numSpaces: 5, - allChatsActiveFilter: nil)) + numSpaces: 5)) // Then the properties should be cached XCTAssertNotNil(client.pendingUserProperties, "The user properties should be cached.") @@ -149,10 +149,9 @@ class AnalyticsTests: XCTestCase { func testMergingUserProperties() { // Given a client with a cached use case user properties let client = PostHogAnalyticsClient() - client.updateUserProperties(AnalyticsEvent.UserProperties(ftueUseCaseSelection: .PersonalMessaging, + client.updateUserProperties(AnalyticsEvent.UserProperties(allChatsActiveFilter: nil, ftueUseCaseSelection: .PersonalMessaging, numFavouriteRooms: nil, - numSpaces: nil, - allChatsActiveFilter: nil)) + numSpaces: nil)) XCTAssertNotNil(client.pendingUserProperties, "The user properties should be cached.") XCTAssertEqual(client.pendingUserProperties?.ftueUseCaseSelection, .PersonalMessaging, "The use case selection should match.") @@ -160,10 +159,9 @@ class AnalyticsTests: XCTestCase { XCTAssertNil(client.pendingUserProperties?.numSpaces, "The number of spaces should not be set.") // When updating the number of spaced - client.updateUserProperties(AnalyticsEvent.UserProperties(ftueUseCaseSelection: nil, + client.updateUserProperties(AnalyticsEvent.UserProperties(allChatsActiveFilter: nil, ftueUseCaseSelection: nil, numFavouriteRooms: 4, - numSpaces: 5, - allChatsActiveFilter: nil)) + numSpaces: 5)) // Then the new properties should be updated and the existing properties should remain unchanged XCTAssertNotNil(client.pendingUserProperties, "The user properties should be cached.") @@ -175,10 +173,9 @@ class AnalyticsTests: XCTestCase { func testSendingUserProperties() { // Given a client with user properties set let client = PostHogAnalyticsClient() - client.updateUserProperties(AnalyticsEvent.UserProperties(ftueUseCaseSelection: .PersonalMessaging, + client.updateUserProperties(AnalyticsEvent.UserProperties(allChatsActiveFilter: nil, ftueUseCaseSelection: .PersonalMessaging, numFavouriteRooms: nil, - numSpaces: nil, - allChatsActiveFilter: nil)) + numSpaces: nil)) client.start(analyticsConfiguration: appSettings.analyticsConfiguration) XCTAssertNotNil(client.pendingUserProperties, "The user properties should be cached.") diff --git a/UnitTests/Sources/NotificationManager/UNNotification+Creator.swift b/UnitTests/Sources/NotificationManager/UNNotification+Creator.swift index 8411bbaec..90e841ecb 100644 --- a/UnitTests/Sources/NotificationManager/UNNotification+Creator.swift +++ b/UnitTests/Sources/NotificationManager/UNNotification+Creator.swift @@ -19,7 +19,7 @@ import UserNotifications import XCTest extension UNNotification { - static func with(userInfo: [AnyHashable: Any], actionIdentifier: String = UNNotificationDefaultActionIdentifier) throws -> UNNotification { + static func with(userInfo: [AnyHashable: Any]) throws -> UNNotification { let content = UNMutableNotificationContent() content.userInfo = userInfo let request = UNNotificationRequest(identifier: "", diff --git a/UnitTests/Sources/RoomPollsHistoryScreenViewModelTests.swift b/UnitTests/Sources/RoomPollsHistoryScreenViewModelTests.swift index 33426da26..4ad097c2a 100644 --- a/UnitTests/Sources/RoomPollsHistoryScreenViewModelTests.swift +++ b/UnitTests/Sources/RoomPollsHistoryScreenViewModelTests.swift @@ -24,17 +24,12 @@ class RoomPollsHistoryScreenViewModelTests: XCTestCase { var interactionHandler: PollInteractionHandlerMock! var timelineController: MockRoomTimelineController! - var context: RoomPollsHistoryScreenViewModelType.Context { - viewModel.context - } - override func setUpWithError() throws { interactionHandler = PollInteractionHandlerMock() timelineController = MockRoomTimelineController() let roomProxyMockConfiguration = RoomProxyMockConfiguration(displayName: "Polls") roomProxyMockConfiguration.timeline.timelineStartReached = false - viewModel = RoomPollsHistoryScreenViewModel(roomProxy: RoomProxyMock(with: roomProxyMockConfiguration), - pollInteractionHandler: interactionHandler, + viewModel = RoomPollsHistoryScreenViewModel(pollInteractionHandler: interactionHandler, roomTimelineController: timelineController, userIndicatorController: UserIndicatorControllerMock()) } diff --git a/UnitTests/Sources/ServerSelectionViewModelTests.swift b/UnitTests/Sources/ServerSelectionViewModelTests.swift index 9ab75d8df..fb476f002 100644 --- a/UnitTests/Sources/ServerSelectionViewModelTests.swift +++ b/UnitTests/Sources/ServerSelectionViewModelTests.swift @@ -20,10 +20,6 @@ import XCTest @MainActor class ServerSelectionViewModelTests: XCTestCase { - private enum Constants { - static let counterInitialValue = 0 - } - var viewModel: ServerSelectionScreenViewModelProtocol! var context: ServerSelectionScreenViewModelType.Context! diff --git a/UnitTests/Sources/StaticLocationScreenViewModelTests.swift b/UnitTests/Sources/StaticLocationScreenViewModelTests.swift index 9277c433f..e70b1b8da 100644 --- a/UnitTests/Sources/StaticLocationScreenViewModelTests.swift +++ b/UnitTests/Sources/StaticLocationScreenViewModelTests.swift @@ -23,7 +23,6 @@ import XCTest class StaticLocationScreenViewModelTests: XCTestCase { var viewModel: StaticLocationScreenViewModelProtocol! - private let usersSubject = CurrentValueSubject<[UserProfileProxy], Never>([]) private var cancellables = Set() var context: StaticLocationScreenViewModel.Context { diff --git a/UnitTests/Sources/VoiceMessageCacheTests.swift b/UnitTests/Sources/VoiceMessageCacheTests.swift index 34af723fa..be57a32dc 100644 --- a/UnitTests/Sources/VoiceMessageCacheTests.swift +++ b/UnitTests/Sources/VoiceMessageCacheTests.swift @@ -26,8 +26,6 @@ class VoiceMessageCacheTests: XCTestCase { private var fileManager: FileManager! private let someURL = URL("/some/url") - private let cachedFileURL = URL("/cache/file/url") - private let audioOGGMimeType = "audio/ogg" private let testFilename = "test-file" private let mpeg4aacFileExtension = "m4a" private let testTemporaryDirectory = URL.temporaryDirectory.appendingPathComponent("test-voice-messsage-cache") diff --git a/UnitTests/Sources/VoiceMessageRecorderTests.swift b/UnitTests/Sources/VoiceMessageRecorderTests.swift index e6a26ff6e..256abfc79 100644 --- a/UnitTests/Sources/VoiceMessageRecorderTests.swift +++ b/UnitTests/Sources/VoiceMessageRecorderTests.swift @@ -61,7 +61,6 @@ class VoiceMessageRecorderTests: XCTestCase { voiceMessageRecorder = VoiceMessageRecorder(audioRecorder: audioRecorder, mediaPlayerProvider: mediaPlayerProvider, - audioConverter: audioConverter, voiceMessageCache: voiceMessageCache) }