mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Cleanup dead code after Periphery run
This commit is contained in:
parent
bb038e8064
commit
b2afa04832
@ -251,8 +251,7 @@ class AppLockSetupFlowCoordinator: FlowCoordinatorProtocol {
|
||||
}
|
||||
|
||||
private func showSettings() {
|
||||
let coordinator = AppLockSetupSettingsScreenCoordinator(parameters: .init(isMandatory: appLockService.isMandatory,
|
||||
appLockService: appLockService))
|
||||
let coordinator = AppLockSetupSettingsScreenCoordinator(parameters: .init(appLockService: appLockService))
|
||||
coordinator.actions.sink { [weak self] action in
|
||||
guard let self else { return }
|
||||
switch action {
|
||||
|
@ -1036,8 +1036,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
||||
initialFocussedEventID: nil,
|
||||
timelineItemFactory: timelineItemFactory)
|
||||
|
||||
let parameters = RoomPollsHistoryScreenCoordinatorParameters(roomProxy: roomProxy,
|
||||
pollInteractionHandler: PollInteractionHandler(analyticsService: analytics, roomProxy: roomProxy),
|
||||
let parameters = RoomPollsHistoryScreenCoordinatorParameters(pollInteractionHandler: PollInteractionHandler(analyticsService: analytics, roomProxy: roomProxy),
|
||||
roomTimelineController: roomTimelineController)
|
||||
let coordinator = RoomPollsHistoryScreenCoordinator(parameters: parameters)
|
||||
coordinator.actions
|
||||
|
@ -364,9 +364,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
||||
|
||||
private func presentHomeScreen() {
|
||||
let parameters = HomeScreenCoordinatorParameters(userSession: userSession,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
bugReportService: bugReportService,
|
||||
navigationStackCoordinator: detailNavigationStackCoordinator,
|
||||
selectedRoomPublisher: selectedRoomSubject.asCurrentValuePublisher())
|
||||
let coordinator = HomeScreenCoordinator(parameters: parameters)
|
||||
|
||||
|
@ -10710,70 +10710,6 @@ class SessionVerificationControllerProxyMock: SessionVerificationControllerProxy
|
||||
}
|
||||
var underlyingCallbacks: PassthroughSubject<SessionVerificationControllerProxyCallback, Never>!
|
||||
|
||||
//MARK: - isVerified
|
||||
|
||||
var isVerifiedUnderlyingCallsCount = 0
|
||||
var isVerifiedCallsCount: Int {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return isVerifiedUnderlyingCallsCount
|
||||
} else {
|
||||
var returnValue: Int? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = isVerifiedUnderlyingCallsCount
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
isVerifiedUnderlyingCallsCount = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
isVerifiedUnderlyingCallsCount = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var isVerifiedCalled: Bool {
|
||||
return isVerifiedCallsCount > 0
|
||||
}
|
||||
|
||||
var isVerifiedUnderlyingReturnValue: Result<Bool, SessionVerificationControllerProxyError>!
|
||||
var isVerifiedReturnValue: Result<Bool, SessionVerificationControllerProxyError>! {
|
||||
get {
|
||||
if Thread.isMainThread {
|
||||
return isVerifiedUnderlyingReturnValue
|
||||
} else {
|
||||
var returnValue: Result<Bool, SessionVerificationControllerProxyError>? = nil
|
||||
DispatchQueue.main.sync {
|
||||
returnValue = isVerifiedUnderlyingReturnValue
|
||||
}
|
||||
|
||||
return returnValue!
|
||||
}
|
||||
}
|
||||
set {
|
||||
if Thread.isMainThread {
|
||||
isVerifiedUnderlyingReturnValue = newValue
|
||||
} else {
|
||||
DispatchQueue.main.sync {
|
||||
isVerifiedUnderlyingReturnValue = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var isVerifiedClosure: (() async -> Result<Bool, SessionVerificationControllerProxyError>)?
|
||||
|
||||
func isVerified() async -> Result<Bool, SessionVerificationControllerProxyError> {
|
||||
isVerifiedCallsCount += 1
|
||||
if let isVerifiedClosure = isVerifiedClosure {
|
||||
return await isVerifiedClosure()
|
||||
} else {
|
||||
return isVerifiedReturnValue
|
||||
}
|
||||
}
|
||||
//MARK: - requestVerification
|
||||
|
||||
var requestVerificationUnderlyingCallsCount = 0
|
||||
@ -11096,11 +11032,6 @@ class SessionVerificationControllerProxyMock: SessionVerificationControllerProxy
|
||||
}
|
||||
}
|
||||
class TimelineProxyMock: TimelineProxyProtocol {
|
||||
var isLive: Bool {
|
||||
get { return underlyingIsLive }
|
||||
set(value) { underlyingIsLive = value }
|
||||
}
|
||||
var underlyingIsLive: Bool!
|
||||
var timelineProvider: RoomTimelineProviderProtocol {
|
||||
get { return underlyingTimelineProvider }
|
||||
set(value) { underlyingTimelineProvider = value }
|
||||
|
@ -30,7 +30,6 @@ extension SessionVerificationControllerProxyMock {
|
||||
requestDelay: Duration = .seconds(1)) -> SessionVerificationControllerProxyMock {
|
||||
let mock = SessionVerificationControllerProxyMock()
|
||||
mock.underlyingCallbacks = callbacks
|
||||
mock.isVerifiedReturnValue = .success(isVerified)
|
||||
|
||||
mock.requestVerificationClosure = { [unowned mock] in
|
||||
Task.detached {
|
||||
|
@ -18,7 +18,6 @@ import Combine
|
||||
import Foundation
|
||||
|
||||
struct UserSessionMockConfiguration {
|
||||
var sessionVerificationController: SessionVerificationControllerProxyProtocol?
|
||||
let clientProxy: ClientProxyProtocol
|
||||
}
|
||||
|
||||
|
@ -93,9 +93,7 @@ enum A11yIdentifiers {
|
||||
|
||||
struct HomeScreen {
|
||||
let userAvatar = "home_screen-user_avatar"
|
||||
let verificationBannerContinue = "home_screen-verification_continue"
|
||||
let recoveryKeyConfirmationBannerContinue = "home_screen-recovery_key_confirmation_continue"
|
||||
let invites = "home_screen-invites"
|
||||
let startChat = "home_screen-start_chat"
|
||||
|
||||
let roomNamePrefix = "home_screen-room_name"
|
||||
@ -164,7 +162,6 @@ enum A11yIdentifiers {
|
||||
let avatar = "room_details-avatar"
|
||||
let dmAvatar = "room_details-dm_avatar"
|
||||
let people = "room_details-people"
|
||||
let invite = "room_details-invite"
|
||||
let notifications = "room_details-notifications"
|
||||
let pollsHistory = "room_details-polls_history"
|
||||
let favourite = "room_details-favourite"
|
||||
@ -200,8 +197,6 @@ enum A11yIdentifiers {
|
||||
let declineChallenge = "session_verification-decline_challenge"
|
||||
let emojiWrapper = "session_verification-emojis"
|
||||
let verificationComplete = "session_verification-verification_complete"
|
||||
let close = "session_verification-close"
|
||||
let enterRecoveryKey = "session_verification-enter_recovery_key"
|
||||
}
|
||||
|
||||
struct SettingsScreen {
|
||||
|
@ -120,15 +120,6 @@ private extension Data {
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
init(_ halves: [HalfByte]) {
|
||||
var halves = halves
|
||||
var result = [UInt8]()
|
||||
while halves.count > 1 {
|
||||
result.append(halves.takeUInt8())
|
||||
}
|
||||
self.init(result)
|
||||
}
|
||||
}
|
||||
|
||||
private extension UInt8 {
|
||||
|
@ -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)
|
||||
|
@ -23,7 +23,6 @@ import MatrixRustSDK
|
||||
|
||||
class ClientProxy: ClientProxyProtocol {
|
||||
private let client: ClientProtocol
|
||||
private let appSettings: AppSettings
|
||||
private let networkMonitor: NetworkMonitorProtocol
|
||||
|
||||
private let mediaLoader: MediaLoaderProtocol
|
||||
@ -124,10 +123,8 @@ class ClientProxy: ClientProxyProtocol {
|
||||
private let sendingQueueStatusSubject = CurrentValueSubject<Bool, Never>(false)
|
||||
|
||||
init(client: ClientProtocol,
|
||||
appSettings: AppSettings,
|
||||
networkMonitor: NetworkMonitorProtocol) async {
|
||||
self.client = client
|
||||
self.appSettings = appSettings
|
||||
self.networkMonitor = networkMonitor
|
||||
|
||||
clientQueue = .init(label: "ClientProxyQueue", attributes: .concurrent)
|
||||
|
@ -18,8 +18,6 @@ import Combine
|
||||
import Foundation
|
||||
|
||||
class UserSession: UserSessionProtocol {
|
||||
private let sessionVerificationStateSubject: CurrentValueSubject<SessionVerificationState, Never> = .init(.unknown)
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
private var authErrorCancellable: AnyCancellable?
|
||||
|
@ -71,15 +71,6 @@ class SessionVerificationControllerProxy: SessionVerificationControllerProxyProt
|
||||
|
||||
let callbacks = PassthroughSubject<SessionVerificationControllerProxyCallback, Never>()
|
||||
|
||||
func isVerified() async -> Result<Bool, SessionVerificationControllerProxyError> {
|
||||
do {
|
||||
let result = try await sessionVerificationController.isVerified()
|
||||
return .success(result)
|
||||
} catch {
|
||||
return .failure(.failedCheckingVerificationState)
|
||||
}
|
||||
}
|
||||
|
||||
func requestVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
||||
sessionVerificationController.setDelegate(delegate: WeakSessionVerificationControllerProxy(proxy: self))
|
||||
|
||||
|
@ -18,7 +18,6 @@ import Combine
|
||||
import Foundation
|
||||
|
||||
enum SessionVerificationControllerProxyError: Error {
|
||||
case failedCheckingVerificationState
|
||||
case failedRequestingVerification
|
||||
case failedStartingSasVerification
|
||||
case failedApprovingVerification
|
||||
@ -48,8 +47,6 @@ struct SessionVerificationEmoji: Hashable {
|
||||
protocol SessionVerificationControllerProxyProtocol {
|
||||
var callbacks: PassthroughSubject<SessionVerificationControllerProxyCallback, Never> { get }
|
||||
|
||||
func isVerified() async -> Result<Bool, SessionVerificationControllerProxyError>
|
||||
|
||||
func requestVerification() async -> Result<Void, SessionVerificationControllerProxyError>
|
||||
|
||||
func startSasVerification() async -> Result<Void, SessionVerificationControllerProxyError>
|
||||
|
@ -26,8 +26,6 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
|
||||
private let appSettings: AppSettings
|
||||
private let serialDispatchQueue: DispatchQueue
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
let callbacks = PassthroughSubject<RoomTimelineControllerCallback, Never>()
|
||||
|
||||
private var activeTimeline: TimelineProxyProtocol
|
||||
|
@ -21,8 +21,6 @@ import MatrixRustSDK
|
||||
final class TimelineProxy: TimelineProxyProtocol {
|
||||
private let timeline: Timeline
|
||||
|
||||
private let messageSendingDispatchQueue = DispatchQueue(label: "io.element.elementx.roomproxy.message_sending", qos: .userInitiated)
|
||||
|
||||
private var backPaginationStatusObservationToken: TaskHandle?
|
||||
private var roomTimelineObservationToken: TaskHandle?
|
||||
|
||||
|
@ -28,8 +28,6 @@ enum TimelineProxyError: Error {
|
||||
|
||||
// sourcery: AutoMockable
|
||||
protocol TimelineProxyProtocol {
|
||||
var isLive: Bool { get }
|
||||
|
||||
var timelineProvider: RoomTimelineProviderProtocol { get }
|
||||
|
||||
func subscribeForUpdates() async
|
||||
|
@ -148,7 +148,6 @@ class UserSessionStore: UserSessionStoreProtocol {
|
||||
|
||||
private func setupProxyForClient(_ client: Client) async -> ClientProxyProtocol {
|
||||
await ClientProxy(client: client,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
networkMonitor: ServiceLocator.shared.networkMonitor)
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,6 @@ class ComposerToolbarViewModelTests: XCTestCase {
|
||||
viewModel = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
||||
completionSuggestionService: completionSuggestionServiceMock,
|
||||
mediaProvider: MockMediaProvider(),
|
||||
appSettings: appSettings,
|
||||
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
||||
analyticsService: ServiceLocator.shared.analytics)
|
||||
|
||||
@ -113,7 +112,6 @@ class ComposerToolbarViewModelTests: XCTestCase {
|
||||
viewModel = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
||||
completionSuggestionService: mockCompletionSuggestionService,
|
||||
mediaProvider: MockMediaProvider(),
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
||||
analyticsService: ServiceLocator.shared.analytics)
|
||||
|
||||
|
@ -34,8 +34,7 @@ class PillContextTests: XCTestCase {
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
notificationCenter: NotificationCenterMock())
|
||||
analyticsService: ServiceLocator.shared.analytics)
|
||||
let context = PillContext(roomContext: mock.context, data: PillTextAttachmentData(type: .user(userID: id), font: .preferredFont(forTextStyle: .body)))
|
||||
|
||||
XCTAssertFalse(context.viewState.isOwnMention)
|
||||
@ -63,8 +62,7 @@ class PillContextTests: XCTestCase {
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
notificationCenter: NotificationCenterMock())
|
||||
analyticsService: ServiceLocator.shared.analytics)
|
||||
let context = PillContext(roomContext: mock.context, data: PillTextAttachmentData(type: .user(userID: id), font: .preferredFont(forTextStyle: .body)))
|
||||
|
||||
XCTAssertTrue(context.viewState.isOwnMention)
|
||||
@ -85,8 +83,7 @@ class PillContextTests: XCTestCase {
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
notificationCenter: NotificationCenterMock())
|
||||
analyticsService: ServiceLocator.shared.analytics)
|
||||
let context = PillContext(roomContext: mock.context, data: PillTextAttachmentData(type: .allUsers, font: .preferredFont(forTextStyle: .body)))
|
||||
|
||||
XCTAssertTrue(context.viewState.isOwnMention)
|
||||
|
@ -353,8 +353,7 @@ class RoomScreenViewModelTests: XCTestCase {
|
||||
userIndicatorController: userIndicatorControllerMock,
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
notificationCenter: notificationCenter)
|
||||
analyticsService: ServiceLocator.shared.analytics)
|
||||
return (viewModel, roomProxy, timelineProxy, timelineController, notificationCenter)
|
||||
}
|
||||
|
||||
@ -378,8 +377,7 @@ class RoomScreenViewModelTests: XCTestCase {
|
||||
userIndicatorController: userIndicatorControllerMock,
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
notificationCenter: NotificationCenterMock())
|
||||
analyticsService: ServiceLocator.shared.analytics)
|
||||
|
||||
let deferred = deferFulfillment(viewModel.context.$viewState) { value in
|
||||
value.bindings.readReceiptsSummaryInfo?.orderedReceipts == receipts
|
||||
@ -403,8 +401,7 @@ class RoomScreenViewModelTests: XCTestCase {
|
||||
userIndicatorController: userIndicatorControllerMock,
|
||||
appMediator: AppMediatorMock.default,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
notificationCenter: NotificationCenterMock())
|
||||
analyticsService: ServiceLocator.shared.analytics)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user