mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-07 12:58:39 +00:00
Cleanup dead code after Periphery run
This commit is contained in:
committed by
Stefan Ceriu
parent
bb038e8064
commit
b2afa04832
@@ -251,8 +251,7 @@ class AppLockSetupFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func showSettings() {
|
private func showSettings() {
|
||||||
let coordinator = AppLockSetupSettingsScreenCoordinator(parameters: .init(isMandatory: appLockService.isMandatory,
|
let coordinator = AppLockSetupSettingsScreenCoordinator(parameters: .init(appLockService: appLockService))
|
||||||
appLockService: appLockService))
|
|
||||||
coordinator.actions.sink { [weak self] action in
|
coordinator.actions.sink { [weak self] action in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
switch action {
|
switch action {
|
||||||
|
|||||||
@@ -1036,8 +1036,7 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
initialFocussedEventID: nil,
|
initialFocussedEventID: nil,
|
||||||
timelineItemFactory: timelineItemFactory)
|
timelineItemFactory: timelineItemFactory)
|
||||||
|
|
||||||
let parameters = RoomPollsHistoryScreenCoordinatorParameters(roomProxy: roomProxy,
|
let parameters = RoomPollsHistoryScreenCoordinatorParameters(pollInteractionHandler: PollInteractionHandler(analyticsService: analytics, roomProxy: roomProxy),
|
||||||
pollInteractionHandler: PollInteractionHandler(analyticsService: analytics, roomProxy: roomProxy),
|
|
||||||
roomTimelineController: roomTimelineController)
|
roomTimelineController: roomTimelineController)
|
||||||
let coordinator = RoomPollsHistoryScreenCoordinator(parameters: parameters)
|
let coordinator = RoomPollsHistoryScreenCoordinator(parameters: parameters)
|
||||||
coordinator.actions
|
coordinator.actions
|
||||||
|
|||||||
@@ -364,9 +364,7 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
|
|
||||||
private func presentHomeScreen() {
|
private func presentHomeScreen() {
|
||||||
let parameters = HomeScreenCoordinatorParameters(userSession: userSession,
|
let parameters = HomeScreenCoordinatorParameters(userSession: userSession,
|
||||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
|
||||||
bugReportService: bugReportService,
|
bugReportService: bugReportService,
|
||||||
navigationStackCoordinator: detailNavigationStackCoordinator,
|
|
||||||
selectedRoomPublisher: selectedRoomSubject.asCurrentValuePublisher())
|
selectedRoomPublisher: selectedRoomSubject.asCurrentValuePublisher())
|
||||||
let coordinator = HomeScreenCoordinator(parameters: parameters)
|
let coordinator = HomeScreenCoordinator(parameters: parameters)
|
||||||
|
|
||||||
|
|||||||
@@ -10710,70 +10710,6 @@ class SessionVerificationControllerProxyMock: SessionVerificationControllerProxy
|
|||||||
}
|
}
|
||||||
var underlyingCallbacks: PassthroughSubject<SessionVerificationControllerProxyCallback, Never>!
|
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
|
//MARK: - requestVerification
|
||||||
|
|
||||||
var requestVerificationUnderlyingCallsCount = 0
|
var requestVerificationUnderlyingCallsCount = 0
|
||||||
@@ -11096,11 +11032,6 @@ class SessionVerificationControllerProxyMock: SessionVerificationControllerProxy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
class TimelineProxyMock: TimelineProxyProtocol {
|
class TimelineProxyMock: TimelineProxyProtocol {
|
||||||
var isLive: Bool {
|
|
||||||
get { return underlyingIsLive }
|
|
||||||
set(value) { underlyingIsLive = value }
|
|
||||||
}
|
|
||||||
var underlyingIsLive: Bool!
|
|
||||||
var timelineProvider: RoomTimelineProviderProtocol {
|
var timelineProvider: RoomTimelineProviderProtocol {
|
||||||
get { return underlyingTimelineProvider }
|
get { return underlyingTimelineProvider }
|
||||||
set(value) { underlyingTimelineProvider = value }
|
set(value) { underlyingTimelineProvider = value }
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ extension SessionVerificationControllerProxyMock {
|
|||||||
requestDelay: Duration = .seconds(1)) -> SessionVerificationControllerProxyMock {
|
requestDelay: Duration = .seconds(1)) -> SessionVerificationControllerProxyMock {
|
||||||
let mock = SessionVerificationControllerProxyMock()
|
let mock = SessionVerificationControllerProxyMock()
|
||||||
mock.underlyingCallbacks = callbacks
|
mock.underlyingCallbacks = callbacks
|
||||||
mock.isVerifiedReturnValue = .success(isVerified)
|
|
||||||
|
|
||||||
mock.requestVerificationClosure = { [unowned mock] in
|
mock.requestVerificationClosure = { [unowned mock] in
|
||||||
Task.detached {
|
Task.detached {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import Combine
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
struct UserSessionMockConfiguration {
|
struct UserSessionMockConfiguration {
|
||||||
var sessionVerificationController: SessionVerificationControllerProxyProtocol?
|
|
||||||
let clientProxy: ClientProxyProtocol
|
let clientProxy: ClientProxyProtocol
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,9 +93,7 @@ enum A11yIdentifiers {
|
|||||||
|
|
||||||
struct HomeScreen {
|
struct HomeScreen {
|
||||||
let userAvatar = "home_screen-user_avatar"
|
let userAvatar = "home_screen-user_avatar"
|
||||||
let verificationBannerContinue = "home_screen-verification_continue"
|
|
||||||
let recoveryKeyConfirmationBannerContinue = "home_screen-recovery_key_confirmation_continue"
|
let recoveryKeyConfirmationBannerContinue = "home_screen-recovery_key_confirmation_continue"
|
||||||
let invites = "home_screen-invites"
|
|
||||||
let startChat = "home_screen-start_chat"
|
let startChat = "home_screen-start_chat"
|
||||||
|
|
||||||
let roomNamePrefix = "home_screen-room_name"
|
let roomNamePrefix = "home_screen-room_name"
|
||||||
@@ -164,7 +162,6 @@ enum A11yIdentifiers {
|
|||||||
let avatar = "room_details-avatar"
|
let avatar = "room_details-avatar"
|
||||||
let dmAvatar = "room_details-dm_avatar"
|
let dmAvatar = "room_details-dm_avatar"
|
||||||
let people = "room_details-people"
|
let people = "room_details-people"
|
||||||
let invite = "room_details-invite"
|
|
||||||
let notifications = "room_details-notifications"
|
let notifications = "room_details-notifications"
|
||||||
let pollsHistory = "room_details-polls_history"
|
let pollsHistory = "room_details-polls_history"
|
||||||
let favourite = "room_details-favourite"
|
let favourite = "room_details-favourite"
|
||||||
@@ -200,8 +197,6 @@ enum A11yIdentifiers {
|
|||||||
let declineChallenge = "session_verification-decline_challenge"
|
let declineChallenge = "session_verification-decline_challenge"
|
||||||
let emojiWrapper = "session_verification-emojis"
|
let emojiWrapper = "session_verification-emojis"
|
||||||
let verificationComplete = "session_verification-verification_complete"
|
let verificationComplete = "session_verification-verification_complete"
|
||||||
let close = "session_verification-close"
|
|
||||||
let enterRecoveryKey = "session_verification-enter_recovery_key"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SettingsScreen {
|
struct SettingsScreen {
|
||||||
|
|||||||
@@ -120,15 +120,6 @@ private extension Data {
|
|||||||
}
|
}
|
||||||
return result
|
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 {
|
private extension UInt8 {
|
||||||
|
|||||||
-2
@@ -18,8 +18,6 @@ import Combine
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct AppLockSetupSettingsScreenCoordinatorParameters {
|
struct AppLockSetupSettingsScreenCoordinatorParameters {
|
||||||
/// Whether App Lock is mandatory and can be disabled by the user.
|
|
||||||
let isMandatory: Bool
|
|
||||||
let appLockService: AppLockServiceProtocol
|
let appLockService: AppLockServiceProtocol
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-2
@@ -20,7 +20,6 @@ import SwiftUI
|
|||||||
typealias AuthenticationStartScreenViewModelType = StateStoreViewModel<AuthenticationStartScreenViewState, AuthenticationStartScreenViewAction>
|
typealias AuthenticationStartScreenViewModelType = StateStoreViewModel<AuthenticationStartScreenViewState, AuthenticationStartScreenViewAction>
|
||||||
|
|
||||||
class AuthenticationStartScreenViewModel: AuthenticationStartScreenViewModelType, AuthenticationStartScreenViewModelProtocol {
|
class AuthenticationStartScreenViewModel: AuthenticationStartScreenViewModelType, AuthenticationStartScreenViewModelProtocol {
|
||||||
private let appSettings: AppSettings
|
|
||||||
private var actionsSubject: PassthroughSubject<AuthenticationStartScreenViewModelAction, Never> = .init()
|
private var actionsSubject: PassthroughSubject<AuthenticationStartScreenViewModelAction, Never> = .init()
|
||||||
|
|
||||||
var actions: AnyPublisher<AuthenticationStartScreenViewModelAction, Never> {
|
var actions: AnyPublisher<AuthenticationStartScreenViewModelAction, Never> {
|
||||||
@@ -28,7 +27,6 @@ class AuthenticationStartScreenViewModel: AuthenticationStartScreenViewModelType
|
|||||||
}
|
}
|
||||||
|
|
||||||
init(appSettings: AppSettings) {
|
init(appSettings: AppSettings) {
|
||||||
self.appSettings = appSettings
|
|
||||||
super.init(initialViewState: AuthenticationStartScreenViewState())
|
super.init(initialViewState: AuthenticationStartScreenViewState())
|
||||||
if !ProcessInfo.processInfo.isiOSAppOnMac {
|
if !ProcessInfo.processInfo.isiOSAppOnMac {
|
||||||
if appSettings.isDevelopmentBuild {
|
if appSettings.isDevelopmentBuild {
|
||||||
|
|||||||
@@ -19,9 +19,7 @@ import SwiftUI
|
|||||||
|
|
||||||
struct HomeScreenCoordinatorParameters {
|
struct HomeScreenCoordinatorParameters {
|
||||||
let userSession: UserSessionProtocol
|
let userSession: UserSessionProtocol
|
||||||
let attributedStringBuilder: AttributedStringBuilderProtocol
|
|
||||||
let bugReportService: BugReportServiceProtocol
|
let bugReportService: BugReportServiceProtocol
|
||||||
let navigationStackCoordinator: NavigationStackCoordinator
|
|
||||||
let selectedRoomPublisher: CurrentValuePublisher<String?, Never>
|
let selectedRoomPublisher: CurrentValuePublisher<String?, Never>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import SwiftUI
|
|||||||
typealias InviteUsersScreenViewModelType = StateStoreViewModel<InviteUsersScreenViewState, InviteUsersScreenViewAction>
|
typealias InviteUsersScreenViewModelType = StateStoreViewModel<InviteUsersScreenViewState, InviteUsersScreenViewAction>
|
||||||
|
|
||||||
class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScreenViewModelProtocol {
|
class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScreenViewModelProtocol {
|
||||||
private let clientProxy: ClientProxyProtocol
|
|
||||||
private let roomType: InviteUsersScreenRoomType
|
private let roomType: InviteUsersScreenRoomType
|
||||||
private let userDiscoveryService: UserDiscoveryServiceProtocol
|
private let userDiscoveryService: UserDiscoveryServiceProtocol
|
||||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||||
@@ -39,7 +38,6 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr
|
|||||||
mediaProvider: MediaProviderProtocol,
|
mediaProvider: MediaProviderProtocol,
|
||||||
userDiscoveryService: UserDiscoveryServiceProtocol,
|
userDiscoveryService: UserDiscoveryServiceProtocol,
|
||||||
userIndicatorController: UserIndicatorControllerProtocol) {
|
userIndicatorController: UserIndicatorControllerProtocol) {
|
||||||
self.clientProxy = clientProxy
|
|
||||||
self.roomType = roomType
|
self.roomType = roomType
|
||||||
self.userDiscoveryService = userDiscoveryService
|
self.userDiscoveryService = userDiscoveryService
|
||||||
self.userIndicatorController = userIndicatorController
|
self.userIndicatorController = userIndicatorController
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ enum JoinRoomScreenCoordinatorAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final class JoinRoomScreenCoordinator: CoordinatorProtocol {
|
final class JoinRoomScreenCoordinator: CoordinatorProtocol {
|
||||||
private let parameters: JoinRoomScreenCoordinatorParameters
|
|
||||||
private let viewModel: JoinRoomScreenViewModelProtocol
|
private let viewModel: JoinRoomScreenViewModelProtocol
|
||||||
|
|
||||||
private var cancellables = Set<AnyCancellable>()
|
private var cancellables = Set<AnyCancellable>()
|
||||||
@@ -42,8 +41,6 @@ final class JoinRoomScreenCoordinator: CoordinatorProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init(parameters: JoinRoomScreenCoordinatorParameters) {
|
init(parameters: JoinRoomScreenCoordinatorParameters) {
|
||||||
self.parameters = parameters
|
|
||||||
|
|
||||||
viewModel = JoinRoomScreenViewModel(roomID: parameters.roomID,
|
viewModel = JoinRoomScreenViewModel(roomID: parameters.roomID,
|
||||||
via: parameters.via,
|
via: parameters.via,
|
||||||
clientProxy: parameters.clientProxy,
|
clientProxy: parameters.clientProxy,
|
||||||
|
|||||||
+1
-3
@@ -42,8 +42,7 @@ struct MediaUploadPreviewScreen: View {
|
|||||||
.font(.compound.headingMD)
|
.font(.compound.headingMD)
|
||||||
.foregroundColor(.compound.textSecondary)
|
.foregroundColor(.compound.textSecondary)
|
||||||
} else {
|
} else {
|
||||||
PreviewView(context: context,
|
PreviewView(fileURL: context.viewState.url,
|
||||||
fileURL: context.viewState.url,
|
|
||||||
title: context.viewState.title)
|
title: context.viewState.title)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,7 +64,6 @@ struct MediaUploadPreviewScreen: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private struct PreviewView: UIViewControllerRepresentable {
|
private struct PreviewView: UIViewControllerRepresentable {
|
||||||
let context: MediaUploadPreviewScreenViewModel.Context
|
|
||||||
let fileURL: URL
|
let fileURL: URL
|
||||||
let title: String?
|
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 {
|
var isScanning: Bool {
|
||||||
switch self {
|
switch self {
|
||||||
case .scan(let state):
|
case .scan(let state):
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ struct QRCodeScannerView: UIViewControllerRepresentable {
|
|||||||
final class QRScannerController: UIViewController {
|
final class QRScannerController: UIViewController {
|
||||||
private var captureSession = AVCaptureSession()
|
private var captureSession = AVCaptureSession()
|
||||||
private var videoPreviewLayer: AVCaptureVideoPreviewLayer?
|
private var videoPreviewLayer: AVCaptureVideoPreviewLayer?
|
||||||
private var qrCodeFrameView: UIView?
|
|
||||||
|
|
||||||
weak var delegate: AVCaptureMetadataOutputObjectsDelegate?
|
weak var delegate: AVCaptureMetadataOutputObjectsDelegate?
|
||||||
|
|
||||||
|
|||||||
-2
@@ -20,7 +20,6 @@ import SwiftUI
|
|||||||
typealias RoomDirectorySearchScreenViewModelType = StateStoreViewModel<RoomDirectorySearchScreenViewState, RoomDirectorySearchScreenViewAction>
|
typealias RoomDirectorySearchScreenViewModelType = StateStoreViewModel<RoomDirectorySearchScreenViewState, RoomDirectorySearchScreenViewAction>
|
||||||
|
|
||||||
class RoomDirectorySearchScreenViewModel: RoomDirectorySearchScreenViewModelType, RoomDirectorySearchScreenViewModelProtocol {
|
class RoomDirectorySearchScreenViewModel: RoomDirectorySearchScreenViewModelType, RoomDirectorySearchScreenViewModelProtocol {
|
||||||
private let clientProxy: ClientProxyProtocol
|
|
||||||
private let roomDirectorySearchProxy: RoomDirectorySearchProxyProtocol
|
private let roomDirectorySearchProxy: RoomDirectorySearchProxyProtocol
|
||||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||||
|
|
||||||
@@ -32,7 +31,6 @@ class RoomDirectorySearchScreenViewModel: RoomDirectorySearchScreenViewModelType
|
|||||||
init(clientProxy: ClientProxyProtocol,
|
init(clientProxy: ClientProxyProtocol,
|
||||||
userIndicatorController: UserIndicatorControllerProtocol,
|
userIndicatorController: UserIndicatorControllerProtocol,
|
||||||
imageProvider: ImageProviderProtocol) {
|
imageProvider: ImageProviderProtocol) {
|
||||||
self.clientProxy = clientProxy
|
|
||||||
roomDirectorySearchProxy = clientProxy.roomDirectorySearchProxy()
|
roomDirectorySearchProxy = clientProxy.roomDirectorySearchProxy()
|
||||||
self.userIndicatorController = userIndicatorController
|
self.userIndicatorController = userIndicatorController
|
||||||
|
|
||||||
|
|||||||
-1
@@ -18,7 +18,6 @@ import Combine
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
struct RoomPollsHistoryScreenCoordinatorParameters {
|
struct RoomPollsHistoryScreenCoordinatorParameters {
|
||||||
let roomProxy: RoomProxyProtocol
|
|
||||||
let pollInteractionHandler: PollInteractionHandlerProtocol
|
let pollInteractionHandler: PollInteractionHandlerProtocol
|
||||||
let roomTimelineController: RoomTimelineControllerProtocol
|
let roomTimelineController: RoomTimelineControllerProtocol
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ typealias ComposerToolbarViewModelType = StateStoreViewModel<ComposerToolbarView
|
|||||||
final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerToolbarViewModelProtocol {
|
final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerToolbarViewModelProtocol {
|
||||||
private let wysiwygViewModel: WysiwygComposerViewModel
|
private let wysiwygViewModel: WysiwygComposerViewModel
|
||||||
private let completionSuggestionService: CompletionSuggestionServiceProtocol
|
private let completionSuggestionService: CompletionSuggestionServiceProtocol
|
||||||
private let appSettings: AppSettings
|
|
||||||
private let analyticsService: AnalyticsService
|
private let analyticsService: AnalyticsService
|
||||||
|
|
||||||
private let mentionBuilder: MentionBuilderProtocol
|
private let mentionBuilder: MentionBuilderProtocol
|
||||||
@@ -51,12 +50,10 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
|||||||
init(wysiwygViewModel: WysiwygComposerViewModel,
|
init(wysiwygViewModel: WysiwygComposerViewModel,
|
||||||
completionSuggestionService: CompletionSuggestionServiceProtocol,
|
completionSuggestionService: CompletionSuggestionServiceProtocol,
|
||||||
mediaProvider: MediaProviderProtocol,
|
mediaProvider: MediaProviderProtocol,
|
||||||
appSettings: AppSettings,
|
|
||||||
mentionDisplayHelper: MentionDisplayHelper,
|
mentionDisplayHelper: MentionDisplayHelper,
|
||||||
analyticsService: AnalyticsService) {
|
analyticsService: AnalyticsService) {
|
||||||
self.wysiwygViewModel = wysiwygViewModel
|
self.wysiwygViewModel = wysiwygViewModel
|
||||||
self.completionSuggestionService = completionSuggestionService
|
self.completionSuggestionService = completionSuggestionService
|
||||||
self.appSettings = appSettings
|
|
||||||
self.analyticsService = analyticsService
|
self.analyticsService = analyticsService
|
||||||
|
|
||||||
mentionBuilder = MentionBuilder()
|
mentionBuilder = MentionBuilder()
|
||||||
|
|||||||
@@ -291,7 +291,6 @@ struct ComposerToolbar_Previews: PreviewProvider, TestablePreview {
|
|||||||
static let composerViewModel = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
static let composerViewModel = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
||||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init(suggestions: suggestions)),
|
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init(suggestions: suggestions)),
|
||||||
mediaProvider: MockMediaProvider(),
|
mediaProvider: MockMediaProvider(),
|
||||||
appSettings: ServiceLocator.shared.settings,
|
|
||||||
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
||||||
analyticsService: ServiceLocator.shared.analytics)
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
static let suggestions: [SuggestionItem] = [.user(item: MentionSuggestionItem(id: "@user_mention_1:matrix.org", displayName: "User 1", avatarURL: nil, range: .init())),
|
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,
|
let model = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
||||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||||
mediaProvider: MockMediaProvider(),
|
mediaProvider: MockMediaProvider(),
|
||||||
appSettings: ServiceLocator.shared.settings,
|
|
||||||
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
||||||
analyticsService: ServiceLocator.shared.analytics)
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
model.state.composerEmpty = focused
|
model.state.composerEmpty = focused
|
||||||
@@ -345,7 +343,6 @@ extension ComposerToolbar {
|
|||||||
let model = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
let model = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
||||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||||
mediaProvider: MockMediaProvider(),
|
mediaProvider: MockMediaProvider(),
|
||||||
appSettings: ServiceLocator.shared.settings,
|
|
||||||
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
||||||
analyticsService: ServiceLocator.shared.analytics)
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
model.state.composerEmpty = focused
|
model.state.composerEmpty = focused
|
||||||
@@ -362,7 +359,6 @@ extension ComposerToolbar {
|
|||||||
let model = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
let model = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
||||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||||
mediaProvider: MockMediaProvider(),
|
mediaProvider: MockMediaProvider(),
|
||||||
appSettings: ServiceLocator.shared.settings,
|
|
||||||
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
||||||
analyticsService: ServiceLocator.shared.analytics)
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
model.state.composerMode = .recordVoiceMessage(state: AudioRecorderState())
|
model.state.composerMode = .recordVoiceMessage(state: AudioRecorderState())
|
||||||
@@ -380,7 +376,6 @@ extension ComposerToolbar {
|
|||||||
let model = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
let model = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
||||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||||
mediaProvider: MockMediaProvider(),
|
mediaProvider: MockMediaProvider(),
|
||||||
appSettings: ServiceLocator.shared.settings,
|
|
||||||
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
||||||
analyticsService: ServiceLocator.shared.analytics)
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
model.state.composerMode = .previewVoiceMessage(state: AudioPlayerState(id: .recorderPreview, duration: 10.0), waveform: .data(waveformData), isUploading: uploading)
|
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(),
|
static let viewModel = ComposerToolbarViewModel(wysiwygViewModel: WysiwygComposerViewModel(),
|
||||||
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
completionSuggestionService: CompletionSuggestionServiceMock(configuration: .init()),
|
||||||
mediaProvider: MockMediaProvider(),
|
mediaProvider: MockMediaProvider(),
|
||||||
appSettings: ServiceLocator.shared.settings,
|
|
||||||
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
||||||
analyticsService: ServiceLocator.shared.analytics)
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
|
|
||||||
|
|||||||
@@ -68,8 +68,7 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
|
|||||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||||
appMediator: parameters.appMediator,
|
appMediator: parameters.appMediator,
|
||||||
appSettings: parameters.appSettings,
|
appSettings: parameters.appSettings,
|
||||||
analyticsService: ServiceLocator.shared.analytics,
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
notificationCenter: NotificationCenter.default)
|
|
||||||
|
|
||||||
wysiwygViewModel = WysiwygComposerViewModel(minHeight: ComposerConstant.minHeight,
|
wysiwygViewModel = WysiwygComposerViewModel(minHeight: ComposerConstant.minHeight,
|
||||||
maxCompressedHeight: ComposerConstant.maxHeight,
|
maxCompressedHeight: ComposerConstant.maxHeight,
|
||||||
@@ -78,7 +77,6 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
|
|||||||
composerViewModel = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
composerViewModel = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
||||||
completionSuggestionService: parameters.completionSuggestionService,
|
completionSuggestionService: parameters.completionSuggestionService,
|
||||||
mediaProvider: parameters.mediaProvider,
|
mediaProvider: parameters.mediaProvider,
|
||||||
appSettings: parameters.appSettings,
|
|
||||||
mentionDisplayHelper: ComposerMentionDisplayHelper(roomContext: viewModel.context),
|
mentionDisplayHelper: ComposerMentionDisplayHelper(roomContext: viewModel.context),
|
||||||
analyticsService: ServiceLocator.shared.analytics)
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
|||||||
private let appMediator: AppMediatorProtocol
|
private let appMediator: AppMediatorProtocol
|
||||||
private let appSettings: AppSettings
|
private let appSettings: AppSettings
|
||||||
private let analyticsService: AnalyticsService
|
private let analyticsService: AnalyticsService
|
||||||
private let notificationCenter: NotificationCenterProtocol
|
|
||||||
|
|
||||||
private let roomScreenInteractionHandler: RoomScreenInteractionHandler
|
private let roomScreenInteractionHandler: RoomScreenInteractionHandler
|
||||||
|
|
||||||
@@ -59,8 +58,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
|||||||
userIndicatorController: UserIndicatorControllerProtocol,
|
userIndicatorController: UserIndicatorControllerProtocol,
|
||||||
appMediator: AppMediatorProtocol,
|
appMediator: AppMediatorProtocol,
|
||||||
appSettings: AppSettings,
|
appSettings: AppSettings,
|
||||||
analyticsService: AnalyticsService,
|
analyticsService: AnalyticsService) {
|
||||||
notificationCenter: NotificationCenterProtocol) {
|
|
||||||
self.timelineController = timelineController
|
self.timelineController = timelineController
|
||||||
self.mediaPlayerProvider = mediaPlayerProvider
|
self.mediaPlayerProvider = mediaPlayerProvider
|
||||||
self.roomProxy = roomProxy
|
self.roomProxy = roomProxy
|
||||||
@@ -68,7 +66,6 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
|||||||
self.analyticsService = analyticsService
|
self.analyticsService = analyticsService
|
||||||
self.userIndicatorController = userIndicatorController
|
self.userIndicatorController = userIndicatorController
|
||||||
self.appMediator = appMediator
|
self.appMediator = appMediator
|
||||||
self.notificationCenter = notificationCenter
|
|
||||||
|
|
||||||
let voiceMessageRecorder = VoiceMessageRecorder(audioRecorder: AudioRecorder(), mediaPlayerProvider: mediaPlayerProvider)
|
let voiceMessageRecorder = VoiceMessageRecorder(audioRecorder: AudioRecorder(), mediaPlayerProvider: mediaPlayerProvider)
|
||||||
|
|
||||||
@@ -792,8 +789,7 @@ extension RoomScreenViewModel {
|
|||||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||||
appMediator: AppMediatorMock.default,
|
appMediator: AppMediatorMock.default,
|
||||||
appSettings: ServiceLocator.shared.settings,
|
appSettings: ServiceLocator.shared.settings,
|
||||||
analyticsService: ServiceLocator.shared.analytics,
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
notificationCenter: NotificationCenterMock())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private struct RoomContextKey: EnvironmentKey {
|
private struct RoomContextKey: EnvironmentKey {
|
||||||
|
|||||||
@@ -60,8 +60,7 @@ struct ReadReceiptsSummaryView_Previews: PreviewProvider, TestablePreview {
|
|||||||
userIndicatorController: UserIndicatorControllerMock(),
|
userIndicatorController: UserIndicatorControllerMock(),
|
||||||
appMediator: AppMediatorMock.default,
|
appMediator: AppMediatorMock.default,
|
||||||
appSettings: ServiceLocator.shared.settings,
|
appSettings: ServiceLocator.shared.settings,
|
||||||
analyticsService: ServiceLocator.shared.analytics,
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
notificationCenter: NotificationCenterMock())
|
|
||||||
return mock
|
return mock
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|||||||
@@ -192,8 +192,7 @@ struct RoomScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||||
appMediator: AppMediatorMock.default,
|
appMediator: AppMediatorMock.default,
|
||||||
appSettings: ServiceLocator.shared.settings,
|
appSettings: ServiceLocator.shared.settings,
|
||||||
analyticsService: ServiceLocator.shared.analytics,
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
notificationCenter: NotificationCenterMock())
|
|
||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
|
|||||||
+1
-2
@@ -98,8 +98,7 @@ struct TimelineReadReceiptsView_Previews: PreviewProvider, TestablePreview {
|
|||||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||||
appMediator: AppMediatorMock.default,
|
appMediator: AppMediatorMock.default,
|
||||||
appSettings: ServiceLocator.shared.settings,
|
appSettings: ServiceLocator.shared.settings,
|
||||||
analyticsService: ServiceLocator.shared.analytics,
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
notificationCenter: NotificationCenterMock())
|
|
||||||
|
|
||||||
static let singleReceipt = [ReadReceipt(userID: RoomMemberProxyMock.mockAlice.userID, formattedTimestamp: "Now")]
|
static let singleReceipt = [ReadReceipt(userID: RoomMemberProxyMock.mockAlice.userID, formattedTimestamp: "Now")]
|
||||||
static let doubleReceipt = [ReadReceipt(userID: RoomMemberProxyMock.mockAlice.userID, formattedTimestamp: "Now"),
|
static let doubleReceipt = [ReadReceipt(userID: RoomMemberProxyMock.mockAlice.userID, formattedTimestamp: "Now"),
|
||||||
|
|||||||
+1
-2
@@ -103,8 +103,7 @@ struct HighlightedTimelineItemTimeline_Previews: PreviewProvider {
|
|||||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||||
appMediator: AppMediatorMock.default,
|
appMediator: AppMediatorMock.default,
|
||||||
appSettings: ServiceLocator.shared.settings,
|
appSettings: ServiceLocator.shared.settings,
|
||||||
analyticsService: ServiceLocator.shared.analytics,
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
notificationCenter: NotificationCenterMock())
|
|
||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
|
|||||||
@@ -92,8 +92,7 @@ struct TimelineView_Previews: PreviewProvider, TestablePreview {
|
|||||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||||
appMediator: AppMediatorMock.default,
|
appMediator: AppMediatorMock.default,
|
||||||
appSettings: ServiceLocator.shared.settings,
|
appSettings: ServiceLocator.shared.settings,
|
||||||
analyticsService: ServiceLocator.shared.analytics,
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
notificationCenter: NotificationCenterMock())
|
|
||||||
|
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
NavigationStack {
|
NavigationStack {
|
||||||
|
|||||||
-1
@@ -49,7 +49,6 @@ protocol DeveloperOptionsProtocol: AnyObject {
|
|||||||
var hideUnreadMessagesBadge: Bool { get set }
|
var hideUnreadMessagesBadge: Bool { get set }
|
||||||
var elementCallBaseURL: URL { get set }
|
var elementCallBaseURL: URL { get set }
|
||||||
var publicSearchEnabled: Bool { get set }
|
var publicSearchEnabled: Bool { get set }
|
||||||
var qrCodeLoginEnabled: Bool { get set }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AppSettings: DeveloperOptionsProtocol { }
|
extension AppSettings: DeveloperOptionsProtocol { }
|
||||||
|
|||||||
-1
@@ -28,7 +28,6 @@ enum NotificationSettingsEditScreenDefaultMode {
|
|||||||
struct NotificationSettingsEditScreenViewState: BindableState {
|
struct NotificationSettingsEditScreenViewState: BindableState {
|
||||||
var bindings: NotificationSettingsEditScreenViewStateBindings
|
var bindings: NotificationSettingsEditScreenViewStateBindings
|
||||||
var strings: NotificationSettingsEditScreenStrings
|
var strings: NotificationSettingsEditScreenStrings
|
||||||
var chatType: NotificationSettingsChatType
|
|
||||||
var availableDefaultModes: [NotificationSettingsEditScreenDefaultMode] = [.allMessages, .mentionsAndKeywordsOnly]
|
var availableDefaultModes: [NotificationSettingsEditScreenDefaultMode] = [.allMessages, .mentionsAndKeywordsOnly]
|
||||||
var defaultMode: NotificationSettingsEditScreenDefaultMode?
|
var defaultMode: NotificationSettingsEditScreenDefaultMode?
|
||||||
var pendingMode: NotificationSettingsEditScreenDefaultMode?
|
var pendingMode: NotificationSettingsEditScreenDefaultMode?
|
||||||
|
|||||||
+1
-2
@@ -43,8 +43,7 @@ class NotificationSettingsEditScreenViewModel: NotificationSettingsEditScreenVie
|
|||||||
roomSummaryProvider = userSession.clientProxy.roomSummaryProvider
|
roomSummaryProvider = userSession.clientProxy.roomSummaryProvider
|
||||||
|
|
||||||
super.init(initialViewState: NotificationSettingsEditScreenViewState(bindings: bindings,
|
super.init(initialViewState: NotificationSettingsEditScreenViewState(bindings: bindings,
|
||||||
strings: NotificationSettingsEditScreenStrings(chatType: chatType),
|
strings: NotificationSettingsEditScreenStrings(chatType: chatType)),
|
||||||
chatType: chatType),
|
|
||||||
imageProvider: userSession.mediaProvider)
|
imageProvider: userSession.mediaProvider)
|
||||||
|
|
||||||
setupNotificationSettingsSubscription()
|
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
|
// MARK: - Previews
|
||||||
|
|
||||||
struct SettingsScreen_Previews: PreviewProvider, TestablePreview {
|
struct SettingsScreen_Previews: PreviewProvider, TestablePreview {
|
||||||
static let viewModel = {
|
static let viewModel = {
|
||||||
let verificationController = SessionVerificationControllerProxyMock()
|
let userSession = UserSessionMock(.init(clientProxy: ClientProxyMock(.init(userID: "@userid:example.com",
|
||||||
verificationController.isVerifiedReturnValue = .success(false)
|
|
||||||
let userSession = UserSessionMock(.init(sessionVerificationController: verificationController,
|
|
||||||
clientProxy: ClientProxyMock(.init(userID: "@userid:example.com",
|
|
||||||
deviceID: "AAAAAAAAAAA"))))
|
deviceID: "AAAAAAAAAAA"))))
|
||||||
return SettingsScreenViewModel(userSession: userSession,
|
return SettingsScreenViewModel(userSession: userSession,
|
||||||
appSettings: ServiceLocator.shared.settings)
|
appSettings: ServiceLocator.shared.settings)
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import MatrixRustSDK
|
|||||||
|
|
||||||
class ClientProxy: ClientProxyProtocol {
|
class ClientProxy: ClientProxyProtocol {
|
||||||
private let client: ClientProtocol
|
private let client: ClientProtocol
|
||||||
private let appSettings: AppSettings
|
|
||||||
private let networkMonitor: NetworkMonitorProtocol
|
private let networkMonitor: NetworkMonitorProtocol
|
||||||
|
|
||||||
private let mediaLoader: MediaLoaderProtocol
|
private let mediaLoader: MediaLoaderProtocol
|
||||||
@@ -124,10 +123,8 @@ class ClientProxy: ClientProxyProtocol {
|
|||||||
private let sendingQueueStatusSubject = CurrentValueSubject<Bool, Never>(false)
|
private let sendingQueueStatusSubject = CurrentValueSubject<Bool, Never>(false)
|
||||||
|
|
||||||
init(client: ClientProtocol,
|
init(client: ClientProtocol,
|
||||||
appSettings: AppSettings,
|
|
||||||
networkMonitor: NetworkMonitorProtocol) async {
|
networkMonitor: NetworkMonitorProtocol) async {
|
||||||
self.client = client
|
self.client = client
|
||||||
self.appSettings = appSettings
|
|
||||||
self.networkMonitor = networkMonitor
|
self.networkMonitor = networkMonitor
|
||||||
|
|
||||||
clientQueue = .init(label: "ClientProxyQueue", attributes: .concurrent)
|
clientQueue = .init(label: "ClientProxyQueue", attributes: .concurrent)
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ import Combine
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
class UserSession: UserSessionProtocol {
|
class UserSession: UserSessionProtocol {
|
||||||
private let sessionVerificationStateSubject: CurrentValueSubject<SessionVerificationState, Never> = .init(.unknown)
|
|
||||||
|
|
||||||
private var cancellables = Set<AnyCancellable>()
|
private var cancellables = Set<AnyCancellable>()
|
||||||
|
|
||||||
private var authErrorCancellable: AnyCancellable?
|
private var authErrorCancellable: AnyCancellable?
|
||||||
|
|||||||
@@ -71,15 +71,6 @@ class SessionVerificationControllerProxy: SessionVerificationControllerProxyProt
|
|||||||
|
|
||||||
let callbacks = PassthroughSubject<SessionVerificationControllerProxyCallback, Never>()
|
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> {
|
func requestVerification() async -> Result<Void, SessionVerificationControllerProxyError> {
|
||||||
sessionVerificationController.setDelegate(delegate: WeakSessionVerificationControllerProxy(proxy: self))
|
sessionVerificationController.setDelegate(delegate: WeakSessionVerificationControllerProxy(proxy: self))
|
||||||
|
|
||||||
|
|||||||
-3
@@ -18,7 +18,6 @@ import Combine
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
enum SessionVerificationControllerProxyError: Error {
|
enum SessionVerificationControllerProxyError: Error {
|
||||||
case failedCheckingVerificationState
|
|
||||||
case failedRequestingVerification
|
case failedRequestingVerification
|
||||||
case failedStartingSasVerification
|
case failedStartingSasVerification
|
||||||
case failedApprovingVerification
|
case failedApprovingVerification
|
||||||
@@ -48,8 +47,6 @@ struct SessionVerificationEmoji: Hashable {
|
|||||||
protocol SessionVerificationControllerProxyProtocol {
|
protocol SessionVerificationControllerProxyProtocol {
|
||||||
var callbacks: PassthroughSubject<SessionVerificationControllerProxyCallback, Never> { get }
|
var callbacks: PassthroughSubject<SessionVerificationControllerProxyCallback, Never> { get }
|
||||||
|
|
||||||
func isVerified() async -> Result<Bool, SessionVerificationControllerProxyError>
|
|
||||||
|
|
||||||
func requestVerification() async -> Result<Void, SessionVerificationControllerProxyError>
|
func requestVerification() async -> Result<Void, SessionVerificationControllerProxyError>
|
||||||
|
|
||||||
func startSasVerification() async -> Result<Void, SessionVerificationControllerProxyError>
|
func startSasVerification() async -> Result<Void, SessionVerificationControllerProxyError>
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ class RoomTimelineController: RoomTimelineControllerProtocol {
|
|||||||
private let appSettings: AppSettings
|
private let appSettings: AppSettings
|
||||||
private let serialDispatchQueue: DispatchQueue
|
private let serialDispatchQueue: DispatchQueue
|
||||||
|
|
||||||
private var cancellables = Set<AnyCancellable>()
|
|
||||||
|
|
||||||
let callbacks = PassthroughSubject<RoomTimelineControllerCallback, Never>()
|
let callbacks = PassthroughSubject<RoomTimelineControllerCallback, Never>()
|
||||||
|
|
||||||
private var activeTimeline: TimelineProxyProtocol
|
private var activeTimeline: TimelineProxyProtocol
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ import MatrixRustSDK
|
|||||||
final class TimelineProxy: TimelineProxyProtocol {
|
final class TimelineProxy: TimelineProxyProtocol {
|
||||||
private let timeline: Timeline
|
private let timeline: Timeline
|
||||||
|
|
||||||
private let messageSendingDispatchQueue = DispatchQueue(label: "io.element.elementx.roomproxy.message_sending", qos: .userInitiated)
|
|
||||||
|
|
||||||
private var backPaginationStatusObservationToken: TaskHandle?
|
private var backPaginationStatusObservationToken: TaskHandle?
|
||||||
private var roomTimelineObservationToken: TaskHandle?
|
private var roomTimelineObservationToken: TaskHandle?
|
||||||
|
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ enum TimelineProxyError: Error {
|
|||||||
|
|
||||||
// sourcery: AutoMockable
|
// sourcery: AutoMockable
|
||||||
protocol TimelineProxyProtocol {
|
protocol TimelineProxyProtocol {
|
||||||
var isLive: Bool { get }
|
|
||||||
|
|
||||||
var timelineProvider: RoomTimelineProviderProtocol { get }
|
var timelineProvider: RoomTimelineProviderProtocol { get }
|
||||||
|
|
||||||
func subscribeForUpdates() async
|
func subscribeForUpdates() async
|
||||||
|
|||||||
@@ -148,7 +148,6 @@ class UserSessionStore: UserSessionStoreProtocol {
|
|||||||
|
|
||||||
private func setupProxyForClient(_ client: Client) async -> ClientProxyProtocol {
|
private func setupProxyForClient(_ client: Client) async -> ClientProxyProtocol {
|
||||||
await ClientProxy(client: client,
|
await ClientProxy(client: client,
|
||||||
appSettings: ServiceLocator.shared.settings,
|
|
||||||
networkMonitor: ServiceLocator.shared.networkMonitor)
|
networkMonitor: ServiceLocator.shared.networkMonitor)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ class ComposerToolbarViewModelTests: XCTestCase {
|
|||||||
viewModel = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
viewModel = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
||||||
completionSuggestionService: completionSuggestionServiceMock,
|
completionSuggestionService: completionSuggestionServiceMock,
|
||||||
mediaProvider: MockMediaProvider(),
|
mediaProvider: MockMediaProvider(),
|
||||||
appSettings: appSettings,
|
|
||||||
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
||||||
analyticsService: ServiceLocator.shared.analytics)
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
|
|
||||||
@@ -113,7 +112,6 @@ class ComposerToolbarViewModelTests: XCTestCase {
|
|||||||
viewModel = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
viewModel = ComposerToolbarViewModel(wysiwygViewModel: wysiwygViewModel,
|
||||||
completionSuggestionService: mockCompletionSuggestionService,
|
completionSuggestionService: mockCompletionSuggestionService,
|
||||||
mediaProvider: MockMediaProvider(),
|
mediaProvider: MockMediaProvider(),
|
||||||
appSettings: ServiceLocator.shared.settings,
|
|
||||||
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
mentionDisplayHelper: ComposerMentionDisplayHelper.mock,
|
||||||
analyticsService: ServiceLocator.shared.analytics)
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ class PillContextTests: XCTestCase {
|
|||||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||||
appMediator: AppMediatorMock.default,
|
appMediator: AppMediatorMock.default,
|
||||||
appSettings: ServiceLocator.shared.settings,
|
appSettings: ServiceLocator.shared.settings,
|
||||||
analyticsService: ServiceLocator.shared.analytics,
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
notificationCenter: NotificationCenterMock())
|
|
||||||
let context = PillContext(roomContext: mock.context, data: PillTextAttachmentData(type: .user(userID: id), font: .preferredFont(forTextStyle: .body)))
|
let context = PillContext(roomContext: mock.context, data: PillTextAttachmentData(type: .user(userID: id), font: .preferredFont(forTextStyle: .body)))
|
||||||
|
|
||||||
XCTAssertFalse(context.viewState.isOwnMention)
|
XCTAssertFalse(context.viewState.isOwnMention)
|
||||||
@@ -63,8 +62,7 @@ class PillContextTests: XCTestCase {
|
|||||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||||
appMediator: AppMediatorMock.default,
|
appMediator: AppMediatorMock.default,
|
||||||
appSettings: ServiceLocator.shared.settings,
|
appSettings: ServiceLocator.shared.settings,
|
||||||
analyticsService: ServiceLocator.shared.analytics,
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
notificationCenter: NotificationCenterMock())
|
|
||||||
let context = PillContext(roomContext: mock.context, data: PillTextAttachmentData(type: .user(userID: id), font: .preferredFont(forTextStyle: .body)))
|
let context = PillContext(roomContext: mock.context, data: PillTextAttachmentData(type: .user(userID: id), font: .preferredFont(forTextStyle: .body)))
|
||||||
|
|
||||||
XCTAssertTrue(context.viewState.isOwnMention)
|
XCTAssertTrue(context.viewState.isOwnMention)
|
||||||
@@ -85,8 +83,7 @@ class PillContextTests: XCTestCase {
|
|||||||
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
userIndicatorController: ServiceLocator.shared.userIndicatorController,
|
||||||
appMediator: AppMediatorMock.default,
|
appMediator: AppMediatorMock.default,
|
||||||
appSettings: ServiceLocator.shared.settings,
|
appSettings: ServiceLocator.shared.settings,
|
||||||
analyticsService: ServiceLocator.shared.analytics,
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
notificationCenter: NotificationCenterMock())
|
|
||||||
let context = PillContext(roomContext: mock.context, data: PillTextAttachmentData(type: .allUsers, font: .preferredFont(forTextStyle: .body)))
|
let context = PillContext(roomContext: mock.context, data: PillTextAttachmentData(type: .allUsers, font: .preferredFont(forTextStyle: .body)))
|
||||||
|
|
||||||
XCTAssertTrue(context.viewState.isOwnMention)
|
XCTAssertTrue(context.viewState.isOwnMention)
|
||||||
|
|||||||
@@ -353,8 +353,7 @@ class RoomScreenViewModelTests: XCTestCase {
|
|||||||
userIndicatorController: userIndicatorControllerMock,
|
userIndicatorController: userIndicatorControllerMock,
|
||||||
appMediator: AppMediatorMock.default,
|
appMediator: AppMediatorMock.default,
|
||||||
appSettings: ServiceLocator.shared.settings,
|
appSettings: ServiceLocator.shared.settings,
|
||||||
analyticsService: ServiceLocator.shared.analytics,
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
notificationCenter: notificationCenter)
|
|
||||||
return (viewModel, roomProxy, timelineProxy, timelineController, notificationCenter)
|
return (viewModel, roomProxy, timelineProxy, timelineController, notificationCenter)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,8 +377,7 @@ class RoomScreenViewModelTests: XCTestCase {
|
|||||||
userIndicatorController: userIndicatorControllerMock,
|
userIndicatorController: userIndicatorControllerMock,
|
||||||
appMediator: AppMediatorMock.default,
|
appMediator: AppMediatorMock.default,
|
||||||
appSettings: ServiceLocator.shared.settings,
|
appSettings: ServiceLocator.shared.settings,
|
||||||
analyticsService: ServiceLocator.shared.analytics,
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
notificationCenter: NotificationCenterMock())
|
|
||||||
|
|
||||||
let deferred = deferFulfillment(viewModel.context.$viewState) { value in
|
let deferred = deferFulfillment(viewModel.context.$viewState) { value in
|
||||||
value.bindings.readReceiptsSummaryInfo?.orderedReceipts == receipts
|
value.bindings.readReceiptsSummaryInfo?.orderedReceipts == receipts
|
||||||
@@ -403,8 +401,7 @@ class RoomScreenViewModelTests: XCTestCase {
|
|||||||
userIndicatorController: userIndicatorControllerMock,
|
userIndicatorController: userIndicatorControllerMock,
|
||||||
appMediator: AppMediatorMock.default,
|
appMediator: AppMediatorMock.default,
|
||||||
appSettings: ServiceLocator.shared.settings,
|
appSettings: ServiceLocator.shared.settings,
|
||||||
analyticsService: ServiceLocator.shared.analytics,
|
analyticsService: ServiceLocator.shared.analytics)
|
||||||
notificationCenter: NotificationCenterMock())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user