Cleanup dead code after Periphery run

This commit is contained in:
Stefan Ceriu
2024-06-06 15:57:44 +03:00
committed by Stefan Ceriu
parent bb038e8064
commit b2afa04832
43 changed files with 20 additions and 204 deletions
@@ -18,8 +18,6 @@ import Combine
import SwiftUI
struct AppLockSetupSettingsScreenCoordinatorParameters {
/// Whether App Lock is mandatory and can be disabled by the user.
let isMandatory: Bool
let appLockService: AppLockServiceProtocol
}
@@ -20,7 +20,6 @@ import SwiftUI
typealias AuthenticationStartScreenViewModelType = StateStoreViewModel<AuthenticationStartScreenViewState, AuthenticationStartScreenViewAction>
class AuthenticationStartScreenViewModel: AuthenticationStartScreenViewModelType, AuthenticationStartScreenViewModelProtocol {
private let appSettings: AppSettings
private var actionsSubject: PassthroughSubject<AuthenticationStartScreenViewModelAction, Never> = .init()
var actions: AnyPublisher<AuthenticationStartScreenViewModelAction, Never> {
@@ -28,7 +27,6 @@ class AuthenticationStartScreenViewModel: AuthenticationStartScreenViewModelType
}
init(appSettings: AppSettings) {
self.appSettings = appSettings
super.init(initialViewState: AuthenticationStartScreenViewState())
if !ProcessInfo.processInfo.isiOSAppOnMac {
if appSettings.isDevelopmentBuild {
@@ -19,9 +19,7 @@ import SwiftUI
struct HomeScreenCoordinatorParameters {
let userSession: UserSessionProtocol
let attributedStringBuilder: AttributedStringBuilderProtocol
let bugReportService: BugReportServiceProtocol
let navigationStackCoordinator: NavigationStackCoordinator
let selectedRoomPublisher: CurrentValuePublisher<String?, Never>
}
@@ -21,7 +21,6 @@ import SwiftUI
typealias InviteUsersScreenViewModelType = StateStoreViewModel<InviteUsersScreenViewState, InviteUsersScreenViewAction>
class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScreenViewModelProtocol {
private let clientProxy: ClientProxyProtocol
private let roomType: InviteUsersScreenRoomType
private let userDiscoveryService: UserDiscoveryServiceProtocol
private let userIndicatorController: UserIndicatorControllerProtocol
@@ -39,7 +38,6 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr
mediaProvider: MediaProviderProtocol,
userDiscoveryService: UserDiscoveryServiceProtocol,
userIndicatorController: UserIndicatorControllerProtocol) {
self.clientProxy = clientProxy
self.roomType = roomType
self.userDiscoveryService = userDiscoveryService
self.userIndicatorController = userIndicatorController
@@ -31,7 +31,6 @@ enum JoinRoomScreenCoordinatorAction {
}
final class JoinRoomScreenCoordinator: CoordinatorProtocol {
private let parameters: JoinRoomScreenCoordinatorParameters
private let viewModel: JoinRoomScreenViewModelProtocol
private var cancellables = Set<AnyCancellable>()
@@ -42,8 +41,6 @@ final class JoinRoomScreenCoordinator: CoordinatorProtocol {
}
init(parameters: JoinRoomScreenCoordinatorParameters) {
self.parameters = parameters
viewModel = JoinRoomScreenViewModel(roomID: parameters.roomID,
via: parameters.via,
clientProxy: parameters.clientProxy,
@@ -42,8 +42,7 @@ struct MediaUploadPreviewScreen: View {
.font(.compound.headingMD)
.foregroundColor(.compound.textSecondary)
} else {
PreviewView(context: context,
fileURL: context.viewState.url,
PreviewView(fileURL: context.viewState.url,
title: context.viewState.title)
}
}
@@ -65,7 +64,6 @@ struct MediaUploadPreviewScreen: View {
}
private struct PreviewView: UIViewControllerRepresentable {
let context: MediaUploadPreviewScreenViewModel.Context
let fileURL: URL
let title: String?
@@ -107,15 +107,6 @@ enum QRCodeLoginState: Equatable {
}
}
var isDisplayingCode: Bool {
switch self {
case .displayCode:
return true
default:
return false
}
}
var isScanning: Bool {
switch self {
case .scan(let state):
@@ -66,7 +66,6 @@ struct QRCodeScannerView: UIViewControllerRepresentable {
final class QRScannerController: UIViewController {
private var captureSession = AVCaptureSession()
private var videoPreviewLayer: AVCaptureVideoPreviewLayer?
private var qrCodeFrameView: UIView?
weak var delegate: AVCaptureMetadataOutputObjectsDelegate?
@@ -20,7 +20,6 @@ import SwiftUI
typealias RoomDirectorySearchScreenViewModelType = StateStoreViewModel<RoomDirectorySearchScreenViewState, RoomDirectorySearchScreenViewAction>
class RoomDirectorySearchScreenViewModel: RoomDirectorySearchScreenViewModelType, RoomDirectorySearchScreenViewModelProtocol {
private let clientProxy: ClientProxyProtocol
private let roomDirectorySearchProxy: RoomDirectorySearchProxyProtocol
private let userIndicatorController: UserIndicatorControllerProtocol
@@ -32,7 +31,6 @@ class RoomDirectorySearchScreenViewModel: RoomDirectorySearchScreenViewModelType
init(clientProxy: ClientProxyProtocol,
userIndicatorController: UserIndicatorControllerProtocol,
imageProvider: ImageProviderProtocol) {
self.clientProxy = clientProxy
roomDirectorySearchProxy = clientProxy.roomDirectorySearchProxy()
self.userIndicatorController = userIndicatorController
@@ -18,7 +18,6 @@ import Combine
import SwiftUI
struct RoomPollsHistoryScreenCoordinatorParameters {
let roomProxy: RoomProxyProtocol
let pollInteractionHandler: PollInteractionHandlerProtocol
let roomTimelineController: RoomTimelineControllerProtocol
}
@@ -26,7 +26,6 @@ typealias ComposerToolbarViewModelType = StateStoreViewModel<ComposerToolbarView
final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerToolbarViewModelProtocol {
private let wysiwygViewModel: WysiwygComposerViewModel
private let completionSuggestionService: CompletionSuggestionServiceProtocol
private let appSettings: AppSettings
private let analyticsService: AnalyticsService
private let mentionBuilder: MentionBuilderProtocol
@@ -51,12 +50,10 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
init(wysiwygViewModel: WysiwygComposerViewModel,
completionSuggestionService: CompletionSuggestionServiceProtocol,
mediaProvider: MediaProviderProtocol,
appSettings: AppSettings,
mentionDisplayHelper: MentionDisplayHelper,
analyticsService: AnalyticsService) {
self.wysiwygViewModel = wysiwygViewModel
self.completionSuggestionService = completionSuggestionService
self.appSettings = appSettings
self.analyticsService = analyticsService
mentionBuilder = MentionBuilder()
@@ -291,7 +291,6 @@ struct ComposerToolbar_Previews: PreviewProvider, TestablePreview {
static let composerViewModel = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init(suggestions: suggestions)),
mediaProvider: MockMediaProvider(),
appSettings: ServiceLocator.shared.settings,
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
analyticsService: ServiceLocator.shared.analytics)
static let suggestions: [SuggestionItem] = [.user(item: MentionSuggestionItem(id: "@user_mention_1:matrix.org", displayName: "User 1", avatarURL: nil, range: .init())),
@@ -328,7 +327,6 @@ extension ComposerToolbar {
let model = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
mediaProvider: MockMediaProvider(),
appSettings: ServiceLocator.shared.settings,
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
analyticsService: ServiceLocator.shared.analytics)
model.state.composerEmpty = focused
@@ -345,7 +343,6 @@ extension ComposerToolbar {
let model = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
mediaProvider: MockMediaProvider(),
appSettings: ServiceLocator.shared.settings,
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
analyticsService: ServiceLocator.shared.analytics)
model.state.composerEmpty = focused
@@ -362,7 +359,6 @@ extension ComposerToolbar {
let model = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
mediaProvider: MockMediaProvider(),
appSettings: ServiceLocator.shared.settings,
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
analyticsService: ServiceLocator.shared.analytics)
model.state.composerMode = .recordVoiceMessage(state: AudioRecorderState())
@@ -380,7 +376,6 @@ extension ComposerToolbar {
let model = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
mediaProvider: MockMediaProvider(),
appSettings: ServiceLocator.shared.settings,
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
analyticsService: ServiceLocator.shared.analytics)
model.state.composerMode = .previewVoiceMessage(state: AudioPlayerState(id: .recorderPreview, duration: 10.0), waveform: .data(waveformData), isUploading: uploading)
@@ -99,7 +99,6 @@ struct RoomAttachmentPicker_Previews: PreviewProvider, TestablePreview {
static let viewModel = ComposerToolbarViewModel(wysiwygViewModel: WysiwygComposerViewModel(),
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
mediaProvider: MockMediaProvider(),
appSettings: ServiceLocator.shared.settings,
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
analyticsService: ServiceLocator.shared.analytics)
@@ -68,8 +68,7 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
userIndicatorController: ServiceLocator.shared.userIndicatorController,
appMediator: parameters.appMediator,
appSettings: parameters.appSettings,
analyticsService: ServiceLocator.shared.analytics,
notificationCenter: NotificationCenter.default)
analyticsService: ServiceLocator.shared.analytics)
wysiwygViewModel = WysiwygComposerViewModel(minHeight: ComposerConstant.minHeight,
maxCompressedHeight: ComposerConstant.maxHeight,
@@ -78,7 +77,6 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
composerViewModel = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
completionSuggestionService: parameters.completionSuggestionService,
mediaProvider: parameters.mediaProvider,
appSettings: parameters.appSettings,
mentionDisplayHelper: ComposerMentionDisplayHelper(roomContext: viewModel.context),
analyticsService: ServiceLocator.shared.analytics)
}
@@ -36,7 +36,6 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
private let appMediator: AppMediatorProtocol
private let appSettings: AppSettings
private let analyticsService: AnalyticsService
private let notificationCenter: NotificationCenterProtocol
private let roomScreenInteractionHandler: RoomScreenInteractionHandler
@@ -59,8 +58,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
userIndicatorController: UserIndicatorControllerProtocol,
appMediator: AppMediatorProtocol,
appSettings: AppSettings,
analyticsService: AnalyticsService,
notificationCenter: NotificationCenterProtocol) {
analyticsService: AnalyticsService) {
self.timelineController = timelineController
self.mediaPlayerProvider = mediaPlayerProvider
self.roomProxy = roomProxy
@@ -68,7 +66,6 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
self.analyticsService = analyticsService
self.userIndicatorController = userIndicatorController
self.appMediator = appMediator
self.notificationCenter = notificationCenter
let voiceMessageRecorder = VoiceMessageRecorder(audioRecorder: AudioRecorder(), mediaPlayerProvider: mediaPlayerProvider)
@@ -792,8 +789,7 @@ extension RoomScreenViewModel {
userIndicatorController: ServiceLocator.shared.userIndicatorController,
appMediator: AppMediatorMock.default,
appSettings: ServiceLocator.shared.settings,
analyticsService: ServiceLocator.shared.analytics,
notificationCenter: NotificationCenterMock())
analyticsService: ServiceLocator.shared.analytics)
}
private struct RoomContextKey: EnvironmentKey {
@@ -60,8 +60,7 @@ struct ReadReceiptsSummaryView_Previews: PreviewProvider, TestablePreview {
userIndicatorController: UserIndicatorControllerMock(),
appMediator: AppMediatorMock.default,
appSettings: ServiceLocator.shared.settings,
analyticsService: ServiceLocator.shared.analytics,
notificationCenter: NotificationCenterMock())
analyticsService: ServiceLocator.shared.analytics)
return mock
}()
@@ -192,8 +192,7 @@ struct RoomScreen_Previews: PreviewProvider, TestablePreview {
userIndicatorController: ServiceLocator.shared.userIndicatorController,
appMediator: AppMediatorMock.default,
appSettings: ServiceLocator.shared.settings,
analyticsService: ServiceLocator.shared.analytics,
notificationCenter: NotificationCenterMock())
analyticsService: ServiceLocator.shared.analytics)
static var previews: some View {
NavigationStack {
@@ -98,8 +98,7 @@ struct TimelineReadReceiptsView_Previews: PreviewProvider, TestablePreview {
userIndicatorController: ServiceLocator.shared.userIndicatorController,
appMediator: AppMediatorMock.default,
appSettings: ServiceLocator.shared.settings,
analyticsService: ServiceLocator.shared.analytics,
notificationCenter: NotificationCenterMock())
analyticsService: ServiceLocator.shared.analytics)
static let singleReceipt = [ReadReceipt(userID: RoomMemberProxyMock.mockAlice.userID, formattedTimestamp: "Now")]
static let doubleReceipt = [ReadReceipt(userID: RoomMemberProxyMock.mockAlice.userID, formattedTimestamp: "Now"),
@@ -103,8 +103,7 @@ struct HighlightedTimelineItemTimeline_Previews: PreviewProvider {
userIndicatorController: ServiceLocator.shared.userIndicatorController,
appMediator: AppMediatorMock.default,
appSettings: ServiceLocator.shared.settings,
analyticsService: ServiceLocator.shared.analytics,
notificationCenter: NotificationCenterMock())
analyticsService: ServiceLocator.shared.analytics)
static var previews: some View {
NavigationStack {
@@ -92,8 +92,7 @@ struct TimelineView_Previews: PreviewProvider, TestablePreview {
userIndicatorController: ServiceLocator.shared.userIndicatorController,
appMediator: AppMediatorMock.default,
appSettings: ServiceLocator.shared.settings,
analyticsService: ServiceLocator.shared.analytics,
notificationCenter: NotificationCenterMock())
analyticsService: ServiceLocator.shared.analytics)
static var previews: some View {
NavigationStack {
@@ -49,7 +49,6 @@ protocol DeveloperOptionsProtocol: AnyObject {
var hideUnreadMessagesBadge: Bool { get set }
var elementCallBaseURL: URL { get set }
var publicSearchEnabled: Bool { get set }
var qrCodeLoginEnabled: Bool { get set }
}
extension AppSettings: DeveloperOptionsProtocol { }
@@ -28,7 +28,6 @@ enum NotificationSettingsEditScreenDefaultMode {
struct NotificationSettingsEditScreenViewState: BindableState {
var bindings: NotificationSettingsEditScreenViewStateBindings
var strings: NotificationSettingsEditScreenStrings
var chatType: NotificationSettingsChatType
var availableDefaultModes: [NotificationSettingsEditScreenDefaultMode] = [.allMessages, .mentionsAndKeywordsOnly]
var defaultMode: NotificationSettingsEditScreenDefaultMode?
var pendingMode: NotificationSettingsEditScreenDefaultMode?
@@ -43,8 +43,7 @@ class NotificationSettingsEditScreenViewModel: NotificationSettingsEditScreenVie
roomSummaryProvider = userSession.clientProxy.roomSummaryProvider
super.init(initialViewState: NotificationSettingsEditScreenViewState(bindings: bindings,
strings: NotificationSettingsEditScreenStrings(chatType: chatType),
chatType: chatType),
strings: NotificationSettingsEditScreenStrings(chatType: chatType)),
imageProvider: userSession.mediaProvider)
setupNotificationSettingsSubscription()
@@ -218,25 +218,11 @@ struct SettingsScreen: View {
}
}
private extension TimelineStyle {
var name: String {
switch self {
case .plain:
return L10n.commonModern
case .bubbles:
return L10n.commonBubbles
}
}
}
// MARK: - Previews
struct SettingsScreen_Previews: PreviewProvider, TestablePreview {
static let viewModel = {
let verificationController = SessionVerificationControllerProxyMock()
verificationController.isVerifiedReturnValue = .success(false)
let userSession = UserSessionMock(.init(sessionVerificationController: verificationController,
clientProxy: ClientProxyMock(.init(userID: "@userid:example.com",
let userSession = UserSessionMock(.init(clientProxy: ClientProxyMock(.init(userID: "@userid:example.com",
deviceID: "AAAAAAAAAAA"))))
return SettingsScreenViewModel(userSession: userSession,
appSettings: ServiceLocator.shared.settings)