mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Periphery cleanup (#5893)
This commit is contained in:
@@ -58,6 +58,7 @@ private struct PINTextFieldStyle: TextFieldStyle {
|
||||
let maxLength: Int
|
||||
let size: PINDigitField.Size
|
||||
|
||||
// periphery:ignore - called by SwiftUI via the TextFieldStyle protocol
|
||||
func _body(configuration: TextField<_Label>) -> some View {
|
||||
HStack(spacing: 8) {
|
||||
ForEach(0..<maxLength, id: \.self) { index in
|
||||
|
||||
@@ -16,7 +16,6 @@ struct LoginScreenCoordinatorParameters {
|
||||
let loginHint: String?
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
let appSettings: AppSettings
|
||||
let analytics: AnalyticsServiceProtocol
|
||||
}
|
||||
|
||||
enum LoginScreenCoordinatorAction {
|
||||
@@ -28,13 +27,8 @@ enum LoginScreenCoordinatorAction {
|
||||
|
||||
/// Note: This code was brought over from Riot, we should move the authentication service logic into the view model.
|
||||
final class LoginScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: LoginScreenCoordinatorParameters
|
||||
private var viewModel: LoginScreenViewModelProtocol
|
||||
|
||||
private var authenticationService: AuthenticationServiceProtocol {
|
||||
parameters.authenticationService
|
||||
}
|
||||
|
||||
private let actionsSubject: PassthroughSubject<LoginScreenCoordinatorAction, Never> = .init()
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
@@ -45,13 +39,10 @@ final class LoginScreenCoordinator: CoordinatorProtocol {
|
||||
// MARK: - Setup
|
||||
|
||||
init(parameters: LoginScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = LoginScreenViewModel(authenticationService: parameters.authenticationService,
|
||||
loginHint: parameters.loginHint,
|
||||
userIndicatorController: parameters.userIndicatorController,
|
||||
appSettings: parameters.appSettings,
|
||||
analytics: parameters.analytics)
|
||||
appSettings: parameters.appSettings)
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
@@ -63,14 +63,10 @@ enum LoginScreenViewAction {
|
||||
}
|
||||
|
||||
enum LoginScreenErrorType: Hashable {
|
||||
/// A specific error message shown in an alert.
|
||||
case alert(String)
|
||||
/// An alert that informs the user to check their username/password.
|
||||
case credentialsAlert
|
||||
/// An alert that informs the user that their account has been deactivated.
|
||||
case deactivatedAlert
|
||||
/// An alert that informs the user about a bad well-known file.
|
||||
case invalidWellKnownAlert(String)
|
||||
/// An alert that allows the user to learn about sliding sync.
|
||||
case slidingSyncAlert
|
||||
/// An alert that informs the user that Element Pro should be used for a particular server.
|
||||
|
||||
@@ -15,7 +15,6 @@ class LoginScreenViewModel: LoginScreenViewModelType, LoginScreenViewModelProtoc
|
||||
private let authenticationService: AuthenticationServiceProtocol
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
private let appSettings: AppSettings
|
||||
private let analytics: AnalyticsServiceProtocol
|
||||
|
||||
private var actionsSubject: PassthroughSubject<LoginScreenViewModelAction, Never> = .init()
|
||||
var actions: AnyPublisher<LoginScreenViewModelAction, Never> {
|
||||
@@ -25,12 +24,10 @@ class LoginScreenViewModel: LoginScreenViewModelType, LoginScreenViewModelProtoc
|
||||
init(authenticationService: AuthenticationServiceProtocol,
|
||||
loginHint: String?,
|
||||
userIndicatorController: UserIndicatorControllerProtocol,
|
||||
appSettings: AppSettings,
|
||||
analytics: AnalyticsServiceProtocol) {
|
||||
appSettings: AppSettings) {
|
||||
self.authenticationService = authenticationService
|
||||
self.userIndicatorController = userIndicatorController
|
||||
self.appSettings = appSettings
|
||||
self.analytics = analytics
|
||||
|
||||
let username = switch loginHint {
|
||||
case .some(let hint) where hint.hasPrefix("mxid:"): String(hint.dropFirst(5)) // MSC4198
|
||||
|
||||
@@ -156,8 +156,7 @@ struct LoginScreen_Previews: PreviewProvider, TestablePreview {
|
||||
let viewModel = LoginScreenViewModel(authenticationService: authenticationService,
|
||||
loginHint: nil,
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
appSettings: .volatile(),
|
||||
analytics: AnalyticsServiceMock(.init()))
|
||||
appSettings: .volatile())
|
||||
|
||||
if withCredentials {
|
||||
viewModel.context.username = "alice"
|
||||
|
||||
-5
@@ -25,11 +25,7 @@ enum ServerSelectionScreenCoordinatorAction {
|
||||
/// Note: This code was brought over from Riot, we should move the authentication service logic into the view model.
|
||||
final class ServerSelectionScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: ServerSelectionScreenCoordinatorParameters
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
private var viewModel: ServerSelectionScreenViewModelProtocol
|
||||
private var authenticationService: AuthenticationServiceProtocol {
|
||||
parameters.authenticationService
|
||||
}
|
||||
|
||||
private let actionsSubject: PassthroughSubject<ServerSelectionScreenCoordinatorAction, Never> = .init()
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -44,7 +40,6 @@ final class ServerSelectionScreenCoordinator: CoordinatorProtocol {
|
||||
authenticationFlow: parameters.authenticationFlow,
|
||||
appSettings: parameters.appSettings,
|
||||
userIndicatorController: parameters.userIndicatorController)
|
||||
userIndicatorController = parameters.userIndicatorController
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
-2
@@ -57,8 +57,6 @@ enum ServerSelectionScreenViewAction {
|
||||
}
|
||||
|
||||
enum ServerSelectionScreenErrorType: Hashable {
|
||||
/// An error message to be shown in the text field footer.
|
||||
case footerMessage(String)
|
||||
/// An alert that informs the user about a bad well-known file.
|
||||
case invalidWellKnownAlert(String)
|
||||
/// An alert that allows the user to learn about sliding sync.
|
||||
|
||||
-2
@@ -15,7 +15,6 @@ class AuthenticationStartScreenViewModel: AuthenticationStartScreenViewModelType
|
||||
private let authenticationService: AuthenticationServiceProtocol
|
||||
private let provisioningParameters: AccountProvisioningParameters?
|
||||
private let appMediator: AppMediatorProtocol
|
||||
private let appSettings: AppSettings
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
|
||||
private let canReportProblem: Bool
|
||||
@@ -37,7 +36,6 @@ class AuthenticationStartScreenViewModel: AuthenticationStartScreenViewModelType
|
||||
self.authenticationService = authenticationService
|
||||
self.provisioningParameters = provisioningParameters
|
||||
self.appMediator = appMediator
|
||||
self.appSettings = appSettings
|
||||
self.userIndicatorController = userIndicatorController
|
||||
canReportProblem = isBugReportServiceEnabled
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ class BugReportScreenViewModel: BugReportScreenViewModelType, BugReportScreenVie
|
||||
private let logFiles: [URL]
|
||||
|
||||
private let actionsSubject: PassthroughSubject<BugReportScreenViewModelAction, Never> = .init()
|
||||
// periphery:ignore - when set to nil this is automatically cancelled
|
||||
@CancellableTask private var uploadTask: Task<Void, Never>?
|
||||
|
||||
var actions: AnyPublisher<BugReportScreenViewModelAction, Never> {
|
||||
|
||||
@@ -179,6 +179,7 @@ private struct CallView: UIViewRepresentable {
|
||||
}
|
||||
}
|
||||
|
||||
// periphery:ignore:parameters userContentController - delegate convention
|
||||
func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
|
||||
guard let handlerID = CallScreenJavaScriptMessageName(rawValue: message.name) else {
|
||||
return
|
||||
@@ -290,10 +291,6 @@ private struct CallView: UIViewRepresentable {
|
||||
return .success(())
|
||||
}
|
||||
|
||||
func stopPictureInPicture() {
|
||||
pictureInPictureController?.stopPictureInPicture()
|
||||
}
|
||||
|
||||
nonisolated func pictureInPictureControllerWillStartPictureInPicture(_ pictureInPictureController: AVPictureInPictureController) {
|
||||
Task { @MainActor in
|
||||
// We move the view via the delegate so it works when you background the app without calling requestPictureInPicture
|
||||
|
||||
-4
@@ -11,8 +11,6 @@ import SwiftUI
|
||||
typealias ChatsSpaceFiltersScreenViewModelType = StateStoreViewModelV2<ChatsSpaceFiltersScreenViewState, ChatsSpaceFiltersScreenViewAction>
|
||||
|
||||
class ChatsSpaceFiltersScreenViewModel: ChatsSpaceFiltersScreenViewModelType, ChatsSpaceFiltersScreenViewModelProtocol, Identifiable {
|
||||
private let spaceService: SpaceServiceProxyProtocol
|
||||
|
||||
private let actionsSubject: PassthroughSubject<ChatsSpaceFiltersScreenViewModelAction, Never> = .init()
|
||||
var actionsPublisher: AnyPublisher<ChatsSpaceFiltersScreenViewModelAction, Never> {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
@@ -22,8 +20,6 @@ class ChatsSpaceFiltersScreenViewModel: ChatsSpaceFiltersScreenViewModelType, Ch
|
||||
|
||||
init(spaceService: SpaceServiceProxyProtocol,
|
||||
mediaProvider: MediaProviderProtocol) {
|
||||
self.spaceService = spaceService
|
||||
|
||||
super.init(initialViewState: ChatsSpaceFiltersScreenViewState(bindings: .init()),
|
||||
mediaProvider: mediaProvider)
|
||||
|
||||
|
||||
+1
@@ -7,6 +7,7 @@
|
||||
|
||||
import Combine
|
||||
|
||||
// periphery:ignore - required for the architecture
|
||||
protocol ChatsSpaceFiltersScreenViewModelProtocol {
|
||||
var actionsPublisher: AnyPublisher<ChatsSpaceFiltersScreenViewModelAction, Never> { get }
|
||||
var context: ChatsSpaceFiltersScreenViewModelType.Context { get }
|
||||
|
||||
@@ -53,16 +53,6 @@ struct CreateRoomScreenViewState: BindableState {
|
||||
}
|
||||
|
||||
var aliasErrors: Set<CreateRoomScreenAliasErrorState> = []
|
||||
var aliasErrorDescription: String? {
|
||||
if aliasErrors.contains(.alreadyExists) {
|
||||
L10n.errorRoomAddressAlreadyExists
|
||||
} else if aliasErrors.contains(.invalidSymbols) {
|
||||
L10n.errorRoomAddressInvalidSymbols
|
||||
} else {
|
||||
nil
|
||||
}
|
||||
}
|
||||
|
||||
var availableAccessTypes: [CreateRoomScreenAccessType] {
|
||||
var availableAccessTypes: [CreateRoomScreenAccessType] = []
|
||||
if isSpace {
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
// periphery:ignore:all - this is just a reportInvite remove this comment once generating the final file
|
||||
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
@@ -23,7 +21,6 @@ enum DeclineAndBlockScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class DeclineAndBlockScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: DeclineAndBlockScreenCoordinatorParameters
|
||||
private let viewModel: DeclineAndBlockScreenViewModelProtocol
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -34,8 +31,6 @@ final class DeclineAndBlockScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: DeclineAndBlockScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = DeclineAndBlockScreenViewModel(userID: parameters.userID,
|
||||
roomID: parameters.roomID,
|
||||
clientProxy: parameters.clientProxy,
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
// Please see LICENSE in the repository root for full details.
|
||||
//
|
||||
|
||||
// periphery:ignore:all - this is just a editRoomAddress remove this comment once generating the final file
|
||||
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ enum EmojiPickerScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class EmojiPickerScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: EmojiPickerScreenCoordinatorParameters
|
||||
private var viewModel: EmojiPickerScreenViewModelProtocol
|
||||
|
||||
private let actionsSubject: PassthroughSubject<EmojiPickerScreenCoordinatorAction, Never> = .init()
|
||||
@@ -32,8 +31,6 @@ final class EmojiPickerScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: EmojiPickerScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = EmojiPickerScreenViewModel(itemID: parameters.itemID,
|
||||
selectedEmojis: parameters.selectedEmojis,
|
||||
emojiProvider: parameters.emojiProvider,
|
||||
|
||||
-3
@@ -18,7 +18,6 @@ enum EncryptionResetPasswordScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class EncryptionResetPasswordScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: EncryptionResetPasswordScreenCoordinatorParameters
|
||||
private let viewModel: EncryptionResetPasswordScreenViewModelProtocol
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -29,8 +28,6 @@ final class EncryptionResetPasswordScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: EncryptionResetPasswordScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = EncryptionResetPasswordScreenViewModel(passwordPublisher: parameters.passwordPublisher)
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -18,7 +18,6 @@ struct EncryptionResetPasswordScreenViewState: BindableState {
|
||||
|
||||
struct EncryptionResetPasswordScreenViewStateBindings {
|
||||
var password: String
|
||||
var alertInfo: AlertInfo<UUID>?
|
||||
}
|
||||
|
||||
enum EncryptionResetPasswordScreenViewAction {
|
||||
|
||||
-2
@@ -22,7 +22,6 @@ struct EncryptionResetScreenCoordinatorParameters {
|
||||
}
|
||||
|
||||
final class EncryptionResetScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: EncryptionResetScreenCoordinatorParameters
|
||||
private let viewModel: EncryptionResetScreenViewModelProtocol
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -33,7 +32,6 @@ final class EncryptionResetScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: EncryptionResetScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
viewModel = EncryptionResetScreenViewModel(clientProxy: parameters.clientProxy,
|
||||
userIndicatorController: parameters.userIndicatorController)
|
||||
}
|
||||
|
||||
-19
@@ -17,25 +17,6 @@ enum EncryptionResetScreenViewModelAction {
|
||||
}
|
||||
|
||||
struct EncryptionResetScreenViewState: BindableState {
|
||||
private let listItem3AttributedText = {
|
||||
let boldPlaceholder = "{bold}"
|
||||
var finalString = AttributedString(L10n.screenCreateNewRecoveryKeyListItem3(boldPlaceholder))
|
||||
var boldString = AttributedString(L10n.screenCreateNewRecoveryKeyListItem3ResetAll)
|
||||
boldString.bold()
|
||||
finalString.replace(boldPlaceholder, with: boldString)
|
||||
return finalString
|
||||
}()
|
||||
|
||||
var listItems: [AttributedString] {
|
||||
[
|
||||
AttributedString(L10n.screenCreateNewRecoveryKeyListItem1(InfoPlistReader.main.productionAppName)),
|
||||
AttributedString(L10n.screenCreateNewRecoveryKeyListItem2),
|
||||
listItem3AttributedText,
|
||||
AttributedString(L10n.screenCreateNewRecoveryKeyListItem4),
|
||||
AttributedString(L10n.screenCreateNewRecoveryKeyListItem5)
|
||||
]
|
||||
}
|
||||
|
||||
var bindings: EncryptionResetScreenViewStateBindings
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ class TimelineMediaPreviewDataSource: NSObject, QLPreviewControllerDataSource {
|
||||
private(set) var previewItems: [TimelineMediaPreviewItem.Media]
|
||||
let previewItemsPaginationPublisher = PassthroughSubject<Void, Never>()
|
||||
|
||||
private let initialItem: EventBasedMessageTimelineItemProtocol
|
||||
/// The index of the initial item inside of `previewItems` that is to be shown.
|
||||
let initialItemIndex: Int
|
||||
|
||||
@@ -41,7 +40,6 @@ class TimelineMediaPreviewDataSource: NSObject, QLPreviewControllerDataSource {
|
||||
initialPadding: Int = 100,
|
||||
paginationState: TimelinePaginationState) {
|
||||
previewItems = itemViewStates.compactMap(TimelineMediaPreviewItem.Media.init)
|
||||
self.initialItem = initialItem
|
||||
|
||||
if let initialItemArrayIndex = previewItems.firstIndex(where: { $0.id == initialItem.id.eventOrTransactionID }) {
|
||||
initialItemIndex = initialItemArrayIndex + initialPadding
|
||||
|
||||
@@ -74,10 +74,6 @@ struct TimelineMediaPreviewViewStateBindings {
|
||||
var redactConfirmationItem: TimelineMediaPreviewItem.Media?
|
||||
}
|
||||
|
||||
enum TimelineMediaPreviewAlertType {
|
||||
case authorizationRequired
|
||||
}
|
||||
|
||||
enum TimelineMediaPreviewViewAction {
|
||||
case updateCurrentItem(TimelineMediaPreviewItem)
|
||||
case showItemDetails(TimelineMediaPreviewItem.Media)
|
||||
|
||||
@@ -62,7 +62,6 @@ private struct MediaPreviewViewController: UIViewControllerRepresentable {
|
||||
private var hasBeenPresented = false
|
||||
|
||||
private var dismissalObserver: AnyCancellable?
|
||||
private var cancellables: Set<AnyCancellable> = []
|
||||
|
||||
init(viewModel: TimelineMediaPreviewViewModel,
|
||||
dismissalPublisher: PassthroughSubject<Void, Never>,
|
||||
|
||||
@@ -196,7 +196,6 @@ class TimelineMediaPreviewViewModel: TimelineMediaPreviewViewModelType {
|
||||
canCurrentUserRedactOthers: timelineContext.viewState.canCurrentUserRedactOthers,
|
||||
canCurrentUserPin: timelineContext.viewState.canCurrentUserPin,
|
||||
pinnedEventIDs: timelineContext.viewState.pinnedEventIDs,
|
||||
isDM: timelineContext.viewState.isDM,
|
||||
isViewSourceEnabled: timelineContext.viewState.isViewSourceEnabled,
|
||||
areThreadsEnabled: timelineContext.viewState.areThreadsEnabled,
|
||||
timelineKind: timelineContext.viewState.timelineKind,
|
||||
|
||||
@@ -335,10 +335,6 @@ private struct DetailsButton: View {
|
||||
context.viewState.currentItem
|
||||
}
|
||||
|
||||
var isHidden: Bool {
|
||||
currentItem.mediaItem == nil
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
if let mediaItem = currentItem.mediaItem {
|
||||
Button { context.send(viewAction: .showItemDetails(mediaItem)) } label: {
|
||||
|
||||
@@ -11,8 +11,6 @@ import SentrySwiftUI
|
||||
import SwiftUI
|
||||
|
||||
struct HomeScreenContent: View {
|
||||
@Environment(\.verticalSizeClass) private var verticalSizeClass
|
||||
|
||||
@ObservedObject var context: HomeScreenViewModel.Context
|
||||
let scrollViewAdapter: ScrollViewAdapter
|
||||
|
||||
|
||||
@@ -266,17 +266,6 @@ struct HomeScreenRoomCell_Previews: PreviewProvider, TestablePreview {
|
||||
HomeScreenRoom(summary: summary)
|
||||
}
|
||||
|
||||
static func makeViewModel(roomSummaryProvider: RoomSummaryProviderProtocol) -> HomeScreenViewModel {
|
||||
let userSession = UserSessionMock(.init(clientProxy: ClientProxyMock(.init(userID: "John Doe", roomSummaryProvider: roomSummaryProvider))))
|
||||
|
||||
return HomeScreenViewModel(userSession: userSession,
|
||||
selectedRoomPublisher: CurrentValueSubject<String?, Never>(nil).asCurrentValuePublisher(),
|
||||
appSettings: .volatile(),
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
notificationManager: NotificationManagerMock(),
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
}
|
||||
|
||||
static func makeRoom(lastMessageState: RoomSummary.LastMessageState? = nil,
|
||||
heroes: [UserProfile] = []) -> HomeScreenRoom {
|
||||
let name = if heroes.count == 1 {
|
||||
|
||||
@@ -15,7 +15,6 @@ struct InviteUsersScreenCoordinatorParameters {
|
||||
let isSkippable: Bool
|
||||
let userDiscoveryService: UserDiscoveryServiceProtocol
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
let appSettings: AppSettings
|
||||
}
|
||||
|
||||
enum InviteUsersScreenCoordinatorAction {
|
||||
@@ -37,8 +36,7 @@ final class InviteUsersScreenCoordinator: CoordinatorProtocol {
|
||||
roomType: parameters.roomType,
|
||||
isSkippable: parameters.isSkippable,
|
||||
userDiscoveryService: parameters.userDiscoveryService,
|
||||
userIndicatorController: parameters.userIndicatorController,
|
||||
appSettings: parameters.appSettings)
|
||||
userIndicatorController: parameters.userIndicatorController)
|
||||
}
|
||||
|
||||
func start() {
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
|
||||
// periphery:ignore - for generic conformance
|
||||
enum InviteUsersScreenErrorType: Error {
|
||||
case unknown
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr
|
||||
private let roomType: InviteUsersScreenRoomType
|
||||
private let userDiscoveryService: UserDiscoveryServiceProtocol
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
private let appSettings: AppSettings
|
||||
|
||||
private var suggestedUsers = [UserProfile]()
|
||||
|
||||
@@ -30,13 +29,11 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr
|
||||
roomType: InviteUsersScreenRoomType,
|
||||
isSkippable: Bool,
|
||||
userDiscoveryService: UserDiscoveryServiceProtocol,
|
||||
userIndicatorController: UserIndicatorControllerProtocol,
|
||||
appSettings: AppSettings) {
|
||||
userIndicatorController: UserIndicatorControllerProtocol) {
|
||||
clientProxy = userSession.clientProxy
|
||||
self.roomType = roomType
|
||||
self.userDiscoveryService = userDiscoveryService
|
||||
self.userIndicatorController = userIndicatorController
|
||||
self.appSettings = appSettings
|
||||
|
||||
let mandatoryInvitees: [UserProfile] = if case .draft(let invitees) = roomType {
|
||||
invitees
|
||||
@@ -194,7 +191,6 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr
|
||||
}
|
||||
}
|
||||
|
||||
// periphery:ignore - automatically cancelled when set to nil
|
||||
@CancellableTask
|
||||
private var fetchUsersTask: Task<Void, Never>?
|
||||
|
||||
|
||||
+1
-2
@@ -64,8 +64,7 @@ struct InviteUsersConfirmationSheetView_Previews: PreviewProvider, TestablePrevi
|
||||
roomType: .existingRoom(roomProxy: JoinedRoomProxyMock(.init(members: []))),
|
||||
isSkippable: true,
|
||||
userDiscoveryService: UserDiscoveryServiceMock(),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
appSettings: .volatile())
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
|
||||
viewModel.state.usersToConfirm = [.mockAlice, .mockCharlie, .mockBob, .mockDan]
|
||||
|
||||
|
||||
@@ -212,8 +212,7 @@ struct InviteUsersScreen_Previews: PreviewProvider, TestablePreview {
|
||||
roomType: roomType ?? .existingRoom(roomProxy: JoinedRoomProxyMock(.init(members: []))),
|
||||
isSkippable: isSkippable,
|
||||
userDiscoveryService: userDiscoveryService,
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
appSettings: .volatile())
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
|
||||
if let searchQuery {
|
||||
viewModel.context.searchQuery = searchQuery
|
||||
|
||||
@@ -48,13 +48,6 @@ struct InviteUsersScreenSelectedItem: View {
|
||||
avatarImage.overlayRemoveItemButton(action: dismissAction)
|
||||
}
|
||||
}
|
||||
|
||||
var closeButtonLabel: some View {
|
||||
CompoundIcon(\.close, size: .custom(12), relativeTo: .compound.bodySM)
|
||||
.foregroundStyle(.compound.iconOnSolidPrimary)
|
||||
.padding(2)
|
||||
.background(.compound.iconPrimary, in: Circle())
|
||||
}
|
||||
}
|
||||
|
||||
struct InviteUsersScreenSelectedItem_Previews: PreviewProvider, TestablePreview {
|
||||
|
||||
@@ -48,6 +48,7 @@ struct JoinRoomScreenRoomDetails {
|
||||
let isDirect: Bool?
|
||||
|
||||
let isSpace: Bool?
|
||||
// periphery:ignore - might be useful to have
|
||||
let childrenCount: Int?
|
||||
let spaceVisibility: SpaceServiceRoomVisibility?
|
||||
}
|
||||
|
||||
+8
-3
@@ -6,8 +6,6 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
// periphery:ignore:all - this is just a knockRequestsList remove this comment once generating the final file
|
||||
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
@@ -17,6 +15,7 @@ struct KnockRequestsListScreenCoordinatorParameters {
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
}
|
||||
|
||||
// periphery:ignore - required for the architecture
|
||||
enum KnockRequestsListScreenCoordinatorAction { }
|
||||
|
||||
final class KnockRequestsListScreenCoordinator: CoordinatorProtocol {
|
||||
@@ -24,7 +23,9 @@ final class KnockRequestsListScreenCoordinator: CoordinatorProtocol {
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
// periphery:ignore - required for the architecture
|
||||
private let actionsSubject: PassthroughSubject<KnockRequestsListScreenCoordinatorAction, Never> = .init()
|
||||
// periphery:ignore - required for the architecture
|
||||
var actionsPublisher: AnyPublisher<KnockRequestsListScreenCoordinatorAction, Never> {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
@@ -35,7 +36,11 @@ final class KnockRequestsListScreenCoordinator: CoordinatorProtocol {
|
||||
userIndicatorController: parameters.userIndicatorController)
|
||||
}
|
||||
|
||||
func start() { }
|
||||
func start() {
|
||||
viewModel.actionsPublisher
|
||||
.sink { _ in }
|
||||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
func toPresentable() -> AnyView {
|
||||
AnyView(KnockRequestsListScreen(context: viewModel.context))
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
// periphery:ignore:all - this is just a labs remove this comment once generating the final file
|
||||
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ struct LabsScreenViewState: BindableState {
|
||||
var bindings: LabsScreenViewStateBindings
|
||||
}
|
||||
|
||||
// periphery: ignore - subscripts are seen as false positive
|
||||
@dynamicMemberLookup
|
||||
struct LabsScreenViewStateBindings {
|
||||
private let labsOptions: LabsOptionsProtocol
|
||||
|
||||
-2
@@ -5,8 +5,6 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
// periphery:ignore:all - this is just a manageAuthorizedSpaces remove this comment once generating the final file
|
||||
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
|
||||
+1
@@ -8,6 +8,7 @@
|
||||
|
||||
import Combine
|
||||
|
||||
// periphery:ignore - required for the architecture
|
||||
protocol ManageRoomMemberSheetViewModelProtocol {
|
||||
var actions: AnyPublisher<ManageRoomMemberSheetViewModelAction, Never> { get }
|
||||
var context: ManageRoomMemberSheetViewModelType.Context { get }
|
||||
|
||||
-3
@@ -30,7 +30,6 @@ enum MediaEventsTimelineScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class MediaEventsTimelineScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: MediaEventsTimelineScreenCoordinatorParameters
|
||||
private let viewModel: MediaEventsTimelineScreenViewModelProtocol
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -41,8 +40,6 @@ final class MediaEventsTimelineScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: MediaEventsTimelineScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
let mediaTimelineViewModel = TimelineViewModel(roomProxy: parameters.roomProxy,
|
||||
timelineController: parameters.mediaTimelineController,
|
||||
userSession: parameters.userSession,
|
||||
|
||||
-2
@@ -29,8 +29,6 @@ class MediaEventsTimelineScreenViewModel: MediaEventsTimelineScreenViewModelType
|
||||
}
|
||||
}
|
||||
|
||||
private var mediaPreviewCancellable: AnyCancellable?
|
||||
|
||||
private let actionsSubject: PassthroughSubject<MediaEventsTimelineScreenViewModelAction, Never> = .init()
|
||||
var actionsPublisher: AnyPublisher<MediaEventsTimelineScreenViewModelAction, Never> {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ struct VideoMediaEventsTimelineView_Previews: PreviewProvider, TestablePreview {
|
||||
.background(.black)
|
||||
}
|
||||
|
||||
private static func makeTimelineItem(caption: String? = nil, isEdited: Bool = false) -> VideoRoomTimelineItem {
|
||||
private static func makeTimelineItem() -> VideoRoomTimelineItem {
|
||||
VideoRoomTimelineItem(id: .randomEvent,
|
||||
timestamp: .mock,
|
||||
isOutgoing: false,
|
||||
|
||||
-2
@@ -13,7 +13,6 @@ struct MediaUploadPreviewScreenCoordinatorParameters {
|
||||
let mediaURLs: [URL]
|
||||
let caption: NSAttributedString?
|
||||
let title: String?
|
||||
let isRoomEncrypted: Bool
|
||||
let shouldShowCaptionWarning: Bool
|
||||
let mediaUploadingPreprocessor: MediaUploadingPreprocessor
|
||||
let timelineController: TimelineControllerProtocol
|
||||
@@ -38,7 +37,6 @@ final class MediaUploadPreviewScreenCoordinator: CoordinatorProtocol {
|
||||
viewModel = MediaUploadPreviewScreenViewModel(mediaURLs: parameters.mediaURLs,
|
||||
caption: parameters.caption,
|
||||
title: parameters.title,
|
||||
isRoomEncrypted: parameters.isRoomEncrypted,
|
||||
shouldShowCaptionWarning: parameters.shouldShowCaptionWarning,
|
||||
mediaUploadingPreprocessor: parameters.mediaUploadingPreprocessor,
|
||||
timelineController: parameters.timelineController,
|
||||
|
||||
@@ -17,7 +17,6 @@ struct MediaUploadPreviewScreenViewState: BindableState {
|
||||
let mediaURLs: [URL]
|
||||
let title: String?
|
||||
let shouldShowCaptionWarning: Bool
|
||||
let isRoomEncrypted: Bool
|
||||
var shouldDisableInteraction = false
|
||||
|
||||
var mediaEditVersion = 0
|
||||
|
||||
-2
@@ -32,7 +32,6 @@ class MediaUploadPreviewScreenViewModel: MediaUploadPreviewScreenViewModelType,
|
||||
init(mediaURLs: [URL],
|
||||
caption: NSAttributedString?,
|
||||
title: String?,
|
||||
isRoomEncrypted: Bool,
|
||||
shouldShowCaptionWarning: Bool,
|
||||
mediaUploadingPreprocessor: MediaUploadingPreprocessor,
|
||||
timelineController: TimelineControllerProtocol,
|
||||
@@ -50,7 +49,6 @@ class MediaUploadPreviewScreenViewModel: MediaUploadPreviewScreenViewModelType,
|
||||
super.init(initialViewState: MediaUploadPreviewScreenViewState(mediaURLs: mediaURLs,
|
||||
title: title,
|
||||
shouldShowCaptionWarning: shouldShowCaptionWarning,
|
||||
isRoomEncrypted: isRoomEncrypted,
|
||||
bindings: .init(caption: caption ?? NSAttributedString())))
|
||||
}
|
||||
|
||||
|
||||
@@ -388,12 +388,10 @@ private struct ImageEditorView: UIViewControllerRepresentable {
|
||||
|
||||
struct MediaUploadPreviewScreen_Previews: PreviewProvider, TestablePreview {
|
||||
static let snapshotURL = URL.picturesDirectory
|
||||
static let testURL = Bundle.main.url(forResource: "AppIcon60x60@2x", withExtension: "png")
|
||||
|
||||
static let viewModel = MediaUploadPreviewScreenViewModel(mediaURLs: [snapshotURL],
|
||||
caption: nil,
|
||||
title: "App Icon.png",
|
||||
isRoomEncrypted: true,
|
||||
shouldShowCaptionWarning: true,
|
||||
mediaUploadingPreprocessor: MediaUploadingPreprocessor(appSettings: .volatile()),
|
||||
timelineController: TimelineControllerMock(.init()),
|
||||
|
||||
-3
@@ -25,7 +25,6 @@ enum IdentityConfirmationScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class IdentityConfirmationScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: IdentityConfirmationScreenCoordinatorParameters
|
||||
private let viewModel: IdentityConfirmationScreenViewModelProtocol
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -36,8 +35,6 @@ final class IdentityConfirmationScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: IdentityConfirmationScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = IdentityConfirmationScreenViewModel(userSession: parameters.userSession,
|
||||
appSettings: parameters.appSettings,
|
||||
userIndicatorController: parameters.userIndicatorController)
|
||||
|
||||
+1
-6
@@ -9,14 +9,11 @@
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
struct IdentityConfirmedScreenCoordinatorParameters { }
|
||||
|
||||
enum IdentityConfirmedScreenCoordinatorAction {
|
||||
case done
|
||||
}
|
||||
|
||||
final class IdentityConfirmedScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: IdentityConfirmedScreenCoordinatorParameters
|
||||
private let viewModel: IdentityConfirmedScreenViewModelProtocol
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -26,9 +23,7 @@ final class IdentityConfirmedScreenCoordinator: CoordinatorProtocol {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init(parameters: IdentityConfirmedScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
init() {
|
||||
viewModel = IdentityConfirmedScreenViewModel()
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
// periphery:ignore:all - this is just a reportRoom remove this comment once generating the final file
|
||||
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
@@ -21,7 +19,6 @@ enum ReportRoomScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class ReportRoomScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: ReportRoomScreenCoordinatorParameters
|
||||
private let viewModel: ReportRoomScreenViewModelProtocol
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -32,8 +29,6 @@ final class ReportRoomScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: ReportRoomScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = ReportRoomScreenViewModel(roomProxy: parameters.roomProxy,
|
||||
userIndicatorController: parameters.userIndicatorController)
|
||||
}
|
||||
|
||||
-3
@@ -21,7 +21,6 @@ enum ResolveVerifiedUserSendFailureScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class ResolveVerifiedUserSendFailureScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: ResolveVerifiedUserSendFailureScreenCoordinatorParameters
|
||||
private let viewModel: ResolveVerifiedUserSendFailureScreenViewModelProtocol
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -32,8 +31,6 @@ final class ResolveVerifiedUserSendFailureScreenCoordinator: CoordinatorProtocol
|
||||
}
|
||||
|
||||
init(parameters: ResolveVerifiedUserSendFailureScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = ResolveVerifiedUserSendFailureScreenViewModel(failure: parameters.failure,
|
||||
sendHandle: parameters.sendHandle,
|
||||
roomProxy: parameters.roomProxy,
|
||||
|
||||
@@ -22,7 +22,6 @@ enum RoomChangeRolesScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class RoomChangeRolesScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: RoomChangeRolesScreenCoordinatorParameters
|
||||
private let viewModel: RoomChangeRolesScreenViewModelProtocol
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -33,8 +32,6 @@ final class RoomChangeRolesScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: RoomChangeRolesScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = RoomChangeRolesScreenViewModel(mode: parameters.mode,
|
||||
roomProxy: parameters.roomProxy,
|
||||
mediaProvider: parameters.mediaProvider,
|
||||
|
||||
@@ -16,7 +16,6 @@ struct RoomDetailsEditScreenCoordinatorParameters {
|
||||
weak var navigationStackCoordinator: NavigationStackCoordinator?
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
let orientationManager: OrientationManagerProtocol
|
||||
let appSettings: AppSettings
|
||||
}
|
||||
|
||||
enum RoomDetailsEditScreenCoordinatorAction {
|
||||
|
||||
@@ -16,7 +16,6 @@ struct RoomDetailsScreenCoordinatorParameters {
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
let notificationSettings: NotificationSettingsProxyProtocol
|
||||
let attributedStringBuilder: AttributedStringBuilderProtocol
|
||||
let appSettings: AppSettings
|
||||
}
|
||||
|
||||
enum RoomDetailsScreenCoordinatorAction {
|
||||
@@ -56,8 +55,7 @@ final class RoomDetailsScreenCoordinator: CoordinatorProtocol {
|
||||
analyticsService: parameters.analyticsService,
|
||||
userIndicatorController: parameters.userIndicatorController,
|
||||
notificationSettingsProxy: parameters.notificationSettings,
|
||||
attributedStringBuilder: parameters.attributedStringBuilder,
|
||||
appSettings: parameters.appSettings)
|
||||
attributedStringBuilder: parameters.attributedStringBuilder)
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
@@ -18,7 +18,6 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
private let notificationSettingsProxy: NotificationSettingsProxyProtocol
|
||||
private let attributedStringBuilder: AttributedStringBuilderProtocol
|
||||
private let appSettings: AppSettings
|
||||
|
||||
private var pinnedEventsTimelineItemProvider: TimelineItemProviderProtocol? {
|
||||
didSet {
|
||||
@@ -49,15 +48,13 @@ class RoomDetailsScreenViewModel: RoomDetailsScreenViewModelType, RoomDetailsScr
|
||||
analyticsService: AnalyticsServiceProtocol,
|
||||
userIndicatorController: UserIndicatorControllerProtocol,
|
||||
notificationSettingsProxy: NotificationSettingsProxyProtocol,
|
||||
attributedStringBuilder: AttributedStringBuilderProtocol,
|
||||
appSettings: AppSettings) {
|
||||
attributedStringBuilder: AttributedStringBuilderProtocol) {
|
||||
self.roomProxy = roomProxy
|
||||
self.userSession = userSession
|
||||
self.analyticsService = analyticsService
|
||||
self.userIndicatorController = userIndicatorController
|
||||
self.notificationSettingsProxy = notificationSettingsProxy
|
||||
self.attributedStringBuilder = attributedStringBuilder
|
||||
self.appSettings = appSettings
|
||||
|
||||
let topic = attributedStringBuilder.fromPlain(roomProxy.infoPublisher.value.topic)
|
||||
|
||||
|
||||
@@ -444,8 +444,7 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: notificationSettingsProxy,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
}
|
||||
|
||||
private static func makeSimpleRoomViewModel() -> RoomDetailsScreenViewModel {
|
||||
@@ -472,8 +471,7 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: notificationSettingsProxy,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
}
|
||||
|
||||
private static func makeDMViewModel(verificationState: UserIdentityVerificationState) -> RoomDetailsScreenViewModel {
|
||||
@@ -510,7 +508,6 @@ struct RoomDetailsScreen_Previews: PreviewProvider, TestablePreview {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: notificationSettingsProxy,
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -15,7 +15,6 @@ struct RoomMemberDetailsScreenCoordinatorParameters {
|
||||
let userSession: UserSessionProtocol
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
let analytics: AnalyticsServiceProtocol
|
||||
let appSettings: AppSettings
|
||||
}
|
||||
|
||||
enum RoomMemberDetailsScreenCoordinatorAction {
|
||||
@@ -40,8 +39,7 @@ final class RoomMemberDetailsScreenCoordinator: CoordinatorProtocol {
|
||||
roomProxy: parameters.roomProxy,
|
||||
userSession: parameters.userSession,
|
||||
userIndicatorController: parameters.userIndicatorController,
|
||||
analytics: parameters.analytics,
|
||||
appSettings: parameters.appSettings)
|
||||
analytics: parameters.analytics)
|
||||
}
|
||||
|
||||
func start() {
|
||||
|
||||
+1
-4
@@ -16,7 +16,6 @@ class RoomMemberDetailsScreenViewModel: RoomMemberDetailsScreenViewModelType, Ro
|
||||
private let userSession: UserSessionProtocol
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
private let analytics: AnalyticsServiceProtocol
|
||||
private let appSettings: AppSettings
|
||||
|
||||
private var actionsSubject: PassthroughSubject<RoomMemberDetailsScreenViewModelAction, Never> = .init()
|
||||
|
||||
@@ -30,13 +29,11 @@ class RoomMemberDetailsScreenViewModel: RoomMemberDetailsScreenViewModelType, Ro
|
||||
roomProxy: JoinedRoomProxyProtocol,
|
||||
userSession: UserSessionProtocol,
|
||||
userIndicatorController: UserIndicatorControllerProtocol,
|
||||
analytics: AnalyticsServiceProtocol,
|
||||
appSettings: AppSettings) {
|
||||
analytics: AnalyticsServiceProtocol) {
|
||||
self.roomProxy = roomProxy
|
||||
self.userSession = userSession
|
||||
self.userIndicatorController = userIndicatorController
|
||||
self.analytics = analytics
|
||||
self.appSettings = appSettings
|
||||
|
||||
let initialViewState = RoomMemberDetailsScreenViewState(userID: userID, bindings: .init())
|
||||
|
||||
|
||||
@@ -240,7 +240,6 @@ struct RoomMemberDetailsScreen_Previews: PreviewProvider, TestablePreview {
|
||||
roomProxy: roomProxyMock,
|
||||
userSession: UserSessionMock(.init(clientProxy: clientProxyMock)),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
analytics: AnalyticsServiceMock(.init()),
|
||||
appSettings: .volatile())
|
||||
analytics: AnalyticsServiceMock(.init()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,8 +104,4 @@ enum RoomMembersListScreenViewAction {
|
||||
case invite
|
||||
}
|
||||
|
||||
enum RoomMembersListScreenAlertType: Hashable {
|
||||
case unbanConfirmation(RoomMemberDetails)
|
||||
case kickConfirmation
|
||||
case banConfirmation
|
||||
}
|
||||
enum RoomMembersListScreenAlertType: Hashable { }
|
||||
|
||||
@@ -218,22 +218,6 @@ class RoomMembersListScreenViewModel: RoomMembersListScreenViewModelType, RoomMe
|
||||
private func hideLoadingIndicator(_ identifier: String) {
|
||||
userIndicatorController.retractIndicatorWithId(identifier)
|
||||
}
|
||||
|
||||
private func showManageMemberIndicator(title: String) {
|
||||
userIndicatorController.submitIndicator(UserIndicator(id: title,
|
||||
type: .toast(progress: .indeterminate),
|
||||
title: title,
|
||||
persistent: true))
|
||||
}
|
||||
|
||||
private func hideManageMemberIndicator(title: String) {
|
||||
userIndicatorController.retractIndicatorWithId(title)
|
||||
}
|
||||
|
||||
private func showManageMemberFailure(title: String) {
|
||||
userIndicatorController.retractIndicatorWithId(title)
|
||||
userIndicatorController.submitIndicator(UserIndicator(title: L10n.commonFailed, icon: \.close))
|
||||
}
|
||||
}
|
||||
|
||||
private nonisolated struct RoomMembersDetails {
|
||||
|
||||
@@ -216,8 +216,7 @@ struct RoomMembersListScreen_Previews: PreviewProvider, TestablePreview {
|
||||
static func makeViewModel(withInvites: Bool = false,
|
||||
withBanned: Bool = true,
|
||||
isAdmin: Bool = false,
|
||||
initialMode: RoomMembersListScreenMode = .members,
|
||||
searchQuery: String = "") -> RoomMembersListScreenViewModel {
|
||||
initialMode: RoomMembersListScreenMode = .members) -> RoomMembersListScreenViewModel {
|
||||
let mockAdmin = RoomMemberProxyMock.mockAdmin
|
||||
|
||||
let ownUserID = isAdmin ? mockAdmin.userID : RoomMemberProxyMock.mockMe.userID
|
||||
|
||||
-1
@@ -16,7 +16,6 @@ class RoomNotificationSettingsScreenViewModel: RoomNotificationSettingsScreenVie
|
||||
private let notificationSettingsProxy: NotificationSettingsProxyProtocol
|
||||
private let roomProxy: JoinedRoomProxyProtocol
|
||||
|
||||
// periphery:ignore - cancellable tasks cancel when reassigned
|
||||
@CancellableTask private var fetchNotificationSettingsTask: Task<Void, Error>?
|
||||
|
||||
var actions: AnyPublisher<RoomNotificationSettingsScreenViewModelAction, Never> {
|
||||
|
||||
-1
@@ -15,7 +15,6 @@ class RoomRolesAndPermissionsScreenViewModel: RoomRolesAndPermissionsScreenViewM
|
||||
private let roomProxy: JoinedRoomProxyProtocol
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
private let analytics: AnalyticsServiceProtocol
|
||||
private var ownUser: RoomMemberDetails?
|
||||
|
||||
private var actionsSubject: PassthroughSubject<RoomRolesAndPermissionsScreenViewModelAction, Never> = .init()
|
||||
var actionsPublisher: AnyPublisher<RoomRolesAndPermissionsScreenViewModelAction, Never> {
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ final class CompletionSuggestionService: CompletionSuggestionServiceProtocol {
|
||||
// MARK: - Private
|
||||
|
||||
private func updateRoomInfo(_ roomInfo: RoomInfoProxyProtocol) {
|
||||
if let powerLevels = roomProxy.infoPublisher.value.powerLevels {
|
||||
if let powerLevels = roomInfo.powerLevels {
|
||||
canMentionAllUsers = powerLevels.canOwnUserTriggerRoomNotification()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,8 +75,6 @@ struct ComposerToolbarViewState: BindableState {
|
||||
/// Could be false if sending is disabled in the room
|
||||
var canSend = true
|
||||
var suggestions: [SuggestionItem] = []
|
||||
var audioPlayerState: AudioPlayerState
|
||||
var audioRecorderState: AudioRecorderState
|
||||
|
||||
var isRoomEncrypted: Bool
|
||||
var isLocationSharingEnabled: Bool
|
||||
|
||||
@@ -35,7 +35,6 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
||||
}
|
||||
|
||||
private struct WysiwygLinkData {
|
||||
let action: LinkAction
|
||||
let range: NSRange
|
||||
var url: String
|
||||
var text: String
|
||||
@@ -65,8 +64,6 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
||||
attributedStringBuilder = AttributedStringBuilder(cacheKey: "Composer", mentionBuilder: mentionBuilder)
|
||||
|
||||
super.init(initialViewState: ComposerToolbarViewState(wysiwygViewModel: wysiwygViewModel,
|
||||
audioPlayerState: .init(id: .recorderPreview, title: L10n.commonVoiceMessage, duration: 0),
|
||||
audioRecorderState: .init(),
|
||||
isRoomEncrypted: roomProxy.infoPublisher.value.isEncrypted,
|
||||
isLocationSharingEnabled: appSettings.mapTilerSettings.publisher.value.isEnabled,
|
||||
bindings: .init()),
|
||||
@@ -580,10 +577,8 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
||||
switch mode {
|
||||
case .default:
|
||||
break
|
||||
case .recordVoiceMessage(let audioRecorderState):
|
||||
state.audioRecorderState = audioRecorderState
|
||||
case .previewVoiceMessage(let audioPlayerState, _, _):
|
||||
state.audioPlayerState = audioPlayerState
|
||||
case .recordVoiceMessage, .previewVoiceMessage:
|
||||
break
|
||||
case .edit, .reply:
|
||||
// Focus composer when switching to reply/edit
|
||||
state.bindings.composerFocused = true
|
||||
@@ -645,8 +640,7 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
||||
|
||||
private func createLinkAlert() {
|
||||
let linkAction = wysiwygViewModel.getLinkAction()
|
||||
currentLinkData = WysiwygLinkData(action: linkAction,
|
||||
range: wysiwygViewModel.attributedContent.selection,
|
||||
currentLinkData = WysiwygLinkData(range: wysiwygViewModel.attributedContent.selection,
|
||||
url: linkAction.url ?? "",
|
||||
text: "")
|
||||
|
||||
|
||||
-1
@@ -9,7 +9,6 @@
|
||||
import Combine
|
||||
import WysiwygComposer
|
||||
|
||||
// periphery: ignore - markdown protocol
|
||||
protocol ComposerToolbarViewModelProtocol {
|
||||
var actions: AnyPublisher<ComposerToolbarViewModelAction, Never> { get }
|
||||
var context: ComposerToolbarViewModelType.Context { get }
|
||||
|
||||
@@ -33,7 +33,6 @@ struct MessageComposer: View {
|
||||
let onAppearAction: () -> Void
|
||||
|
||||
@State private var composerTranslation: CGFloat = 0
|
||||
private let composerShape = RoundedRectangle(cornerRadius: 21, style: .circular)
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 0) {
|
||||
|
||||
+2
-15
@@ -151,7 +151,6 @@ private struct UITextViewWrapper: UIViewRepresentable {
|
||||
func makeCoordinator() -> Coordinator {
|
||||
Coordinator(text: $text,
|
||||
selectedRange: $selectedRange,
|
||||
maxHeight: maxHeight,
|
||||
keyHandler: keyHandler,
|
||||
pasteHandler: pasteHandler)
|
||||
}
|
||||
@@ -160,19 +159,15 @@ private struct UITextViewWrapper: UIViewRepresentable {
|
||||
private var text: Binding<NSAttributedString>
|
||||
private var selectedRange: Binding<NSRange>
|
||||
|
||||
private let maxHeight: CGFloat
|
||||
|
||||
private let keyHandler: GenericKeyHandler
|
||||
private let pasteHandler: PasteHandler
|
||||
|
||||
init(text: Binding<NSAttributedString>,
|
||||
selectedRange: Binding<NSRange>,
|
||||
maxHeight: CGFloat,
|
||||
keyHandler: @escaping GenericKeyHandler,
|
||||
pasteHandler: @escaping PasteHandler) {
|
||||
self.text = text
|
||||
self.selectedRange = selectedRange
|
||||
self.maxHeight = maxHeight
|
||||
self.keyHandler = keyHandler
|
||||
self.pasteHandler = pasteHandler
|
||||
}
|
||||
@@ -211,7 +206,6 @@ private protocol ElementTextViewDelegate: AnyObject {
|
||||
|
||||
private class ElementTextView: UITextView, PillAttachmentViewProviderDelegate {
|
||||
private(set) var timelineContext: TimelineViewModel.Context?
|
||||
private var presendCallback: Binding<(() -> Void)?>
|
||||
private var pillViews = NSHashTable<UIView>.weakObjects()
|
||||
|
||||
weak var elementDelegate: ElementTextViewDelegate?
|
||||
@@ -219,7 +213,6 @@ private class ElementTextView: UITextView, PillAttachmentViewProviderDelegate {
|
||||
init(timelineContext: TimelineViewModel.Context?,
|
||||
presendCallback: Binding<(() -> Void)?>) {
|
||||
self.timelineContext = timelineContext
|
||||
self.presendCallback = presendCallback
|
||||
|
||||
super.init(frame: .zero, textContainer: nil)
|
||||
|
||||
@@ -241,10 +234,12 @@ private class ElementTextView: UITextView, PillAttachmentViewProviderDelegate {
|
||||
UIKeyCommand(input: "\r", modifierFlags: [], action: #selector(enterKeyPressed))]
|
||||
}
|
||||
|
||||
// periphery:ignore:parameters sender - required for objc selector
|
||||
@objc func shiftEnterKeyPressed(sender: UIKeyCommand) {
|
||||
elementDelegate?.textViewDidReceiveShiftEnterKeyPress(self)
|
||||
}
|
||||
|
||||
// periphery:ignore:parameters sender - required for objc selector
|
||||
@objc func enterKeyPressed(sender: UIKeyCommand) {
|
||||
elementDelegate?.textViewDidReceiveKeyPress(self, key: .keyboardReturnOrEnter)
|
||||
}
|
||||
@@ -318,14 +313,6 @@ private class ElementTextView: UITextView, PillAttachmentViewProviderDelegate {
|
||||
pillViews.add(pillView)
|
||||
}
|
||||
|
||||
func flushPills() {
|
||||
for view in pillViews.allObjects {
|
||||
view.alpha = 0.0
|
||||
view.removeFromSuperview()
|
||||
}
|
||||
pillViews.removeAllObjects()
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func acceptCurrentSuggestion() {
|
||||
|
||||
@@ -98,55 +98,6 @@ struct SwipeRightAction<Label: View>: ViewModifier {
|
||||
})
|
||||
}
|
||||
|
||||
private var oldGesture: some Gesture {
|
||||
DragGesture()
|
||||
.updating($dragGestureActive) { _, state, _ in
|
||||
// Available actions should be computed on the fly so we use a gesture state change
|
||||
// to ask whether the move should be started or not.
|
||||
state = true
|
||||
}
|
||||
.onChanged { value in
|
||||
guard canStartAction, value.translation.width > value.translation.height else {
|
||||
return
|
||||
}
|
||||
|
||||
// Due to https://forums.developer.apple.com/forums/thread/760035 we had to make
|
||||
// the drag a simultaneous gesture otherwise it was impossible to scroll the timeline.
|
||||
// Therefore we need to prevent the animation to run if the user is to scrolling vertically.
|
||||
// It would be nice if we could somehow abort the gesture in this case.
|
||||
let width: CGFloat = if value.translation.width > abs(value.translation.height) {
|
||||
value.translation.width
|
||||
} else {
|
||||
0.0
|
||||
}
|
||||
|
||||
// We want to add a spring like behaviour to the drag in which the view
|
||||
// moves slower the more it's dragged. We use a circular easing function
|
||||
// to generate those values up to the `swipeThreshold`
|
||||
// The final translation will be between 0 and `swipeThreshold` with the action being enabled from
|
||||
// `actionThreshold` onwards
|
||||
let screenWidthNormalisedTranslation = max(0.0, min(width, swipeThreshold)) / swipeThreshold
|
||||
let easedTranslation = circularEaseOut(screenWidthNormalisedTranslation)
|
||||
xOffset = easedTranslation * xOffsetThreshold
|
||||
|
||||
if xOffset > actionThreshold {
|
||||
if !hasReachedActionThreshold {
|
||||
feedbackGenerator.impactOccurred()
|
||||
hasReachedActionThreshold = true
|
||||
}
|
||||
} else {
|
||||
hasReachedActionThreshold = false
|
||||
}
|
||||
}
|
||||
.onEnded { _ in
|
||||
if xOffset > actionThreshold {
|
||||
action()
|
||||
}
|
||||
|
||||
xOffset = 0.0
|
||||
}
|
||||
}
|
||||
|
||||
/// Used to compute the horizontal translation amount.
|
||||
/// The more it's dragged the less it moves on a circular ease out curve
|
||||
private func circularEaseOut(_ value: Double) -> Double {
|
||||
|
||||
@@ -12,7 +12,6 @@ import SwiftUI
|
||||
typealias RoomSelectionScreenViewModelType = StateStoreViewModel<RoomSelectionScreenViewState, RoomSelectionScreenViewAction>
|
||||
|
||||
class RoomSelectionScreenViewModel: RoomSelectionScreenViewModelType, RoomSelectionScreenViewModelProtocol {
|
||||
private let clientProxy: ClientProxyProtocol
|
||||
private let roomSummaryProvider: RoomSummaryProviderProtocol
|
||||
|
||||
private var actionsSubject: PassthroughSubject<RoomSelectionScreenViewModelAction, Never> = .init()
|
||||
@@ -23,7 +22,6 @@ class RoomSelectionScreenViewModel: RoomSelectionScreenViewModelType, RoomSelect
|
||||
|
||||
init(userSession: UserSessionProtocol,
|
||||
roomSummaryProvider: RoomSummaryProviderProtocol) {
|
||||
clientProxy = userSession.clientProxy
|
||||
self.roomSummaryProvider = roomSummaryProvider
|
||||
|
||||
super.init(initialViewState: RoomSelectionScreenViewState(), mediaProvider: userSession.mediaProvider)
|
||||
|
||||
@@ -18,7 +18,6 @@ enum RoomThreadListScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class RoomThreadListScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: RoomThreadListScreenCoordinatorParameters
|
||||
private let viewModel: RoomThreadListScreenViewModelProtocol
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -29,8 +28,6 @@ final class RoomThreadListScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: RoomThreadListScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = RoomThreadListScreenViewModel(threadListServiceProxy: parameters.threadListServiceProxy,
|
||||
mediaProvider: parameters.mediaProvider)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ typealias SearchScreenViewModelType = StateStoreViewModelV2<SearchScreenViewStat
|
||||
class SearchScreenViewModel: SearchScreenViewModelType, SearchScreenViewModelProtocol {
|
||||
private let roomSummaryProvider: RoomSummaryProviderProtocol
|
||||
private let searchService: SearchServiceProxyProtocol
|
||||
private let clientProxy: ClientProxyProtocol
|
||||
private var searchQueryObservationTask: Task<Void, Never>?
|
||||
private var loadingObservationTask: Task<Void, Never>?
|
||||
private var setQueryTask: Task<Void, Never>?
|
||||
@@ -30,7 +29,6 @@ class SearchScreenViewModel: SearchScreenViewModelType, SearchScreenViewModelPro
|
||||
initialSearchQuery: String = "",
|
||||
initialSearchMode: SearchScreenMode = .rooms) {
|
||||
self.roomSummaryProvider = roomSummaryProvider
|
||||
self.clientProxy = clientProxy
|
||||
searchService = clientProxy.searchService
|
||||
|
||||
super.init(initialViewState: SearchScreenViewState(bindings: .init(searchQuery: initialSearchQuery, searchMode: initialSearchMode)),
|
||||
|
||||
@@ -144,7 +144,6 @@ struct SearchScreen: View {
|
||||
ForEach(context.viewState.rooms) { room in
|
||||
SearchScreenRoomCell(room: room,
|
||||
context: context,
|
||||
isLast: room == context.viewState.rooms.last,
|
||||
isSelected: isHardwareKeyboardConnected && selectedID == room.id)
|
||||
.onAppear {
|
||||
if room == context.viewState.rooms.first {
|
||||
@@ -227,7 +226,6 @@ private extension View {
|
||||
private struct SearchScreenRoomCell: View {
|
||||
let room: SearchScreenRoom
|
||||
let context: SearchScreenViewModel.Context
|
||||
let isLast: Bool
|
||||
let isSelected: Bool
|
||||
|
||||
@Environment(\.dynamicTypeSize) private var dynamicTypeSize
|
||||
|
||||
-1
@@ -17,7 +17,6 @@ class SecureBackupLogoutConfirmationScreenViewModel: SecureBackupLogoutConfirmat
|
||||
|
||||
private let backupUploadStateSubject: CurrentValueSubject<SecureBackupSteadyState, Never> = .init(.waiting)
|
||||
|
||||
// periphery:ignore - auto cancels when reassigned
|
||||
@CancellableTask
|
||||
private var keyUploadWaitingTask: Task<Void, Never>?
|
||||
@CancellableTask
|
||||
|
||||
-3
@@ -21,7 +21,6 @@ enum SecureBackupScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class SecureBackupScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: SecureBackupScreenCoordinatorParameters
|
||||
private var viewModel: SecureBackupScreenViewModelProtocol
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -32,8 +31,6 @@ final class SecureBackupScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: SecureBackupScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = SecureBackupScreenViewModel(secureBackupController: parameters.clientProxy.secureBackupController,
|
||||
userIndicatorController: parameters.userIndicatorController,
|
||||
chatBackupDetailsURL: parameters.appSettings.chatBackupDetailsURL)
|
||||
|
||||
+1
-5
@@ -15,8 +15,6 @@ enum SecurityAndPrivacyScreenViewModelAction {
|
||||
}
|
||||
|
||||
struct SecurityAndPrivacyScreenViewState: BindableState {
|
||||
let serverName: String
|
||||
|
||||
var currentSettings: SecurityAndPrivacySettings
|
||||
var bindings: SecurityAndPrivacyScreenViewStateBindings
|
||||
let strings: SecurityAndPrivacyScreenStrings
|
||||
@@ -153,14 +151,12 @@ struct SecurityAndPrivacyScreenViewState: BindableState {
|
||||
}
|
||||
}
|
||||
|
||||
init(serverName: String,
|
||||
accessType: SecurityAndPrivacyRoomAccessType,
|
||||
init(accessType: SecurityAndPrivacyRoomAccessType,
|
||||
isEncryptionEnabled: Bool,
|
||||
historyVisibility: SecurityAndPrivacyHistoryVisibility,
|
||||
isSpace: Bool,
|
||||
isKnockingEnabled: Bool,
|
||||
historySharingDetailsURL: URL) {
|
||||
self.serverName = serverName
|
||||
self.isKnockingEnabled = isKnockingEnabled
|
||||
self.isSpace = isSpace
|
||||
|
||||
|
||||
+1
-2
@@ -32,8 +32,7 @@ class SecurityAndPrivacyScreenViewModel: SecurityAndPrivacyScreenViewModelType,
|
||||
self.userIndicatorController = userIndicatorController
|
||||
self.appSettings = appSettings
|
||||
|
||||
super.init(initialViewState: SecurityAndPrivacyScreenViewState(serverName: clientProxy.userIDServerName ?? "",
|
||||
accessType: roomProxy.infoPublisher.value.joinRule.toSecurityAndPrivacyRoomAccessType,
|
||||
super.init(initialViewState: SecurityAndPrivacyScreenViewState(accessType: roomProxy.infoPublisher.value.joinRule.toSecurityAndPrivacyRoomAccessType,
|
||||
isEncryptionEnabled: roomProxy.infoPublisher.value.isEncrypted,
|
||||
historyVisibility: roomProxy.infoPublisher.value.historyVisibility.toSecurityAndPrivacyHistoryVisibility,
|
||||
isSpace: roomProxy.infoPublisher.value.isSpace,
|
||||
|
||||
-1
@@ -34,7 +34,6 @@ struct AdvancedSettingsScreenViewState: BindableState {
|
||||
var bindings: AdvancedSettingsScreenViewStateBindings
|
||||
}
|
||||
|
||||
// periphery:ignore - subscript are seen as false positives
|
||||
@dynamicMemberLookup
|
||||
struct AdvancedSettingsScreenViewStateBindings {
|
||||
private let advancedSettings: AdvancedSettingsProtocol
|
||||
|
||||
-3
@@ -19,7 +19,6 @@ enum DeactivateAccountScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class DeactivateAccountScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: DeactivateAccountScreenCoordinatorParameters
|
||||
private let viewModel: DeactivateAccountScreenViewModelProtocol
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -30,8 +29,6 @@ final class DeactivateAccountScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: DeactivateAccountScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = DeactivateAccountScreenViewModel(clientProxy: parameters.clientProxy,
|
||||
userIndicatorController: parameters.userIndicatorController)
|
||||
}
|
||||
|
||||
-1
@@ -25,7 +25,6 @@ final class DeveloperOptionsScreenCoordinator: CoordinatorProtocol {
|
||||
|
||||
init(appSettings: AppSettings, appHooks: AppHooks, clientProxy: ClientProxyProtocol?) {
|
||||
viewModel = DeveloperOptionsScreenViewModel(developerOptions: appSettings,
|
||||
elementCallBaseURL: appSettings.elementCallBaseURL,
|
||||
appHooks: appHooks,
|
||||
clientProxy: clientProxy)
|
||||
|
||||
|
||||
-2
@@ -13,7 +13,6 @@ enum DeveloperOptionsScreenViewModelAction {
|
||||
}
|
||||
|
||||
struct DeveloperOptionsScreenViewState: BindableState {
|
||||
let elementCallBaseURL: URL
|
||||
let appHooks: AppHooks
|
||||
var storeSizes: [StoreSize]?
|
||||
let shouldShowClearCache: Bool
|
||||
@@ -31,7 +30,6 @@ struct DeveloperOptionsScreenViewState: BindableState {
|
||||
}
|
||||
}
|
||||
|
||||
// periphery: ignore - subscripts are seen as false positive
|
||||
@dynamicMemberLookup
|
||||
struct DeveloperOptionsScreenViewStateBindings {
|
||||
private let developerOptions: DeveloperOptionsProtocol
|
||||
|
||||
+2
-3
@@ -20,10 +20,9 @@ class DeveloperOptionsScreenViewModel: DeveloperOptionsScreenViewModelType, Deve
|
||||
|
||||
private let clientProxy: ClientProxyProtocol?
|
||||
|
||||
init(developerOptions: DeveloperOptionsProtocol, elementCallBaseURL: URL, appHooks: AppHooks, clientProxy: ClientProxyProtocol?) {
|
||||
init(developerOptions: DeveloperOptionsProtocol, appHooks: AppHooks, clientProxy: ClientProxyProtocol?) {
|
||||
self.clientProxy = clientProxy
|
||||
super.init(initialViewState: .init(elementCallBaseURL: elementCallBaseURL,
|
||||
appHooks: appHooks,
|
||||
super.init(initialViewState: .init(appHooks: appHooks,
|
||||
shouldShowClearCache: clientProxy != nil,
|
||||
isPresentedModally: clientProxy == nil,
|
||||
bindings: .init(developerOptions: developerOptions)))
|
||||
|
||||
-1
@@ -259,7 +259,6 @@ private extension Set<TraceLogPack> {
|
||||
|
||||
struct DeveloperOptionsScreen_Previews: PreviewProvider {
|
||||
static let viewModel = DeveloperOptionsScreenViewModel(developerOptions: AppSettings.volatile(),
|
||||
elementCallBaseURL: AppSettings.volatile().elementCallBaseURL,
|
||||
appHooks: AppHooks(),
|
||||
clientProxy: ClientProxyMock(.init()))
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ import Combine
|
||||
import SwiftUI
|
||||
|
||||
final class LegalInformationScreenCoordinator: CoordinatorProtocol {
|
||||
private let viewModel: LegalInformationScreenViewModel
|
||||
private let viewModel: LegalInformationScreenViewModelProtocol
|
||||
|
||||
init(appSettings: AppSettings) {
|
||||
viewModel = LegalInformationScreenViewModel(appSettings: appSettings)
|
||||
|
||||
-1
@@ -8,7 +8,6 @@
|
||||
|
||||
import Combine
|
||||
|
||||
// periphery:ignore - markdown protocol
|
||||
protocol LegalInformationScreenViewModelProtocol {
|
||||
var context: LegalInformationScreenViewModelType.Context { get }
|
||||
}
|
||||
|
||||
-2
@@ -18,9 +18,7 @@ class NotificationSettingsEditScreenViewModel: NotificationSettingsEditScreenVie
|
||||
private let userSession: UserSessionProtocol
|
||||
private let roomSummaryProvider: RoomSummaryProviderProtocol?
|
||||
|
||||
// periphery:ignore - cancellable tasks get cancelled when reassigned
|
||||
@CancellableTask private var fetchDefaultRoomNotificationModesTask: Task<Void, Error>?
|
||||
// periphery:ignore - cancellable tasks get cancelled when reassigned
|
||||
@CancellableTask private var updateRoomsWithUserDefinedModeTask: Task<Void, Error>?
|
||||
|
||||
var actions: AnyPublisher<NotificationSettingsEditScreenViewModelAction, Never> {
|
||||
|
||||
-1
@@ -17,7 +17,6 @@ class NotificationSettingsScreenViewModel: NotificationSettingsScreenViewModelTy
|
||||
private let userNotificationCenter: UserNotificationCenterProtocol
|
||||
private let notificationSettingsProxy: NotificationSettingsProxyProtocol
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
// periphery:ignore - cancellable tasks get cancelled when reassigned
|
||||
@CancellableTask private var fetchSettingsTask: Task<Void, Error>?
|
||||
private let notificationTonePreviewer: AudioPlayerProtocol
|
||||
private let notificationToneManager: NotificationToneManagerProtocol
|
||||
|
||||
+2
-3
@@ -15,7 +15,6 @@ struct UserDetailsEditScreenCoordinatorParameters {
|
||||
let mediaUploadingPreprocessor: MediaUploadingPreprocessor
|
||||
weak var navigationStackCoordinator: NavigationStackCoordinator?
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
let appSettings: AppSettings
|
||||
}
|
||||
|
||||
enum UserDetailsEditScreenCoordinatorAction {
|
||||
@@ -27,8 +26,8 @@ final class UserDetailsEditScreenCoordinator: CoordinatorProtocol {
|
||||
private var viewModel: UserDetailsEditScreenViewModelProtocol
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
private let actionsSubject: PassthroughSubject<RoomDetailsEditScreenCoordinatorAction, Never> = .init()
|
||||
var actions: AnyPublisher<RoomDetailsEditScreenCoordinatorAction, Never> {
|
||||
private let actionsSubject: PassthroughSubject<UserDetailsEditScreenCoordinatorAction, Never> = .init()
|
||||
var actions: AnyPublisher<UserDetailsEditScreenCoordinatorAction, Never> {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,9 @@ class LeaveSpaceViewModel: LeaveSpaceViewModelType {
|
||||
}
|
||||
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
private let mediaProvider: MediaProviderProtocol
|
||||
|
||||
init(spaceName: String, canEditRolesAndPermissions: Bool, leaveHandle: LeaveSpaceHandleProxy, userIndicatorController: UserIndicatorControllerProtocol, mediaProvider: MediaProviderProtocol) {
|
||||
self.userIndicatorController = userIndicatorController
|
||||
self.mediaProvider = mediaProvider
|
||||
super.init(initialViewState: LeaveSpaceViewState(spaceName: spaceName, canEditRolesAndPermissions: canEditRolesAndPermissions, leaveHandle: leaveHandle), mediaProvider: mediaProvider)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
// periphery:ignore:all - this is just a space remove this comment once generating the final file
|
||||
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
@@ -33,7 +31,6 @@ enum SpaceScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class SpaceScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: SpaceScreenCoordinatorParameters
|
||||
private let viewModel: SpaceScreenViewModelProtocol
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -44,8 +41,6 @@ final class SpaceScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: SpaceScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = SpaceScreenViewModel(spaceRoomListProxy: parameters.spaceRoomListProxy,
|
||||
spaceServiceProxy: parameters.spaceServiceProxy,
|
||||
selectedSpaceRoomPublisher: parameters.selectedSpaceRoomPublisher,
|
||||
|
||||
@@ -135,8 +135,7 @@ struct SpaceSettingsScreen_Previews: PreviewProvider, TestablePreview {
|
||||
analyticsService: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
notificationSettingsProxy: NotificationSettingsProxyMock(with: NotificationSettingsProxyMockConfiguration()),
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()),
|
||||
appSettings: .volatile())
|
||||
attributedStringBuilder: AttributedStringBuilder(mentionBuilder: MentionBuilder()))
|
||||
}
|
||||
|
||||
static var previews: some View {
|
||||
|
||||
@@ -12,7 +12,6 @@ import SwiftUI
|
||||
struct SpacesScreenCoordinatorParameters {
|
||||
let userSession: UserSessionProtocol
|
||||
let selectedSpacePublisher: CurrentValuePublisher<String?, Never>
|
||||
let appSettings: AppSettings
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
}
|
||||
|
||||
@@ -23,7 +22,6 @@ enum SpacesScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class SpacesScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: SpacesScreenCoordinatorParameters
|
||||
private let viewModel: SpacesScreenViewModelProtocol
|
||||
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -34,11 +32,8 @@ final class SpacesScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: SpacesScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = SpacesScreenViewModel(userSession: parameters.userSession,
|
||||
selectedSpacePublisher: parameters.selectedSpacePublisher,
|
||||
appSettings: parameters.appSettings,
|
||||
userIndicatorController: parameters.userIndicatorController)
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ typealias SpacesScreenViewModelType = StateStoreViewModelV2<SpacesScreenViewStat
|
||||
|
||||
class SpacesScreenViewModel: SpacesScreenViewModelType, SpacesScreenViewModelProtocol {
|
||||
private let spaceServiceProxy: SpaceServiceProxyProtocol
|
||||
private let appSettings: AppSettings
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
|
||||
private let actionsSubject: PassthroughSubject<SpacesScreenViewModelAction, Never> = .init()
|
||||
@@ -23,10 +22,8 @@ class SpacesScreenViewModel: SpacesScreenViewModelType, SpacesScreenViewModelPro
|
||||
|
||||
init(userSession: UserSessionProtocol,
|
||||
selectedSpacePublisher: CurrentValuePublisher<String?, Never>,
|
||||
appSettings: AppSettings,
|
||||
userIndicatorController: UserIndicatorControllerProtocol) {
|
||||
spaceServiceProxy = userSession.clientProxy.spaceService
|
||||
self.appSettings = appSettings
|
||||
self.userIndicatorController = userIndicatorController
|
||||
|
||||
super.init(initialViewState: SpacesScreenViewState(userProfile: userSession.clientProxy.userProfilePublisher.value,
|
||||
|
||||
@@ -151,7 +151,6 @@ struct SpacesScreen_Previews: PreviewProvider, TestablePreview {
|
||||
|
||||
return SpacesScreenViewModel(userSession: UserSessionMock(.init(clientProxy: clientProxy)),
|
||||
selectedSpacePublisher: .init(nil),
|
||||
appSettings: appSettings,
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ struct StartChatScreenCoordinatorParameters {
|
||||
let userSession: UserSessionProtocol
|
||||
let userDiscoveryService: UserDiscoveryServiceProtocol
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
let appSettings: AppSettings
|
||||
let analytics: AnalyticsServiceProtocol
|
||||
}
|
||||
|
||||
@@ -25,7 +24,6 @@ enum StartChatScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class StartChatScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: StartChatScreenCoordinatorParameters
|
||||
private var viewModel: StartChatScreenViewModelProtocol
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
@@ -35,13 +33,10 @@ final class StartChatScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: StartChatScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = StartChatScreenViewModel(userSession: parameters.userSession,
|
||||
analytics: parameters.analytics,
|
||||
userIndicatorController: parameters.userIndicatorController,
|
||||
userDiscoveryService: parameters.userDiscoveryService,
|
||||
appSettings: parameters.appSettings)
|
||||
userDiscoveryService: parameters.userDiscoveryService)
|
||||
}
|
||||
|
||||
func start() {
|
||||
|
||||
@@ -10,7 +10,6 @@ import Foundation
|
||||
|
||||
enum StartChatScreenErrorType: Error {
|
||||
case failedCreatingRoom
|
||||
case unknown
|
||||
}
|
||||
|
||||
enum StartChatScreenViewModelAction: Equatable {
|
||||
|
||||
@@ -17,7 +17,6 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
|
||||
private let analytics: AnalyticsServiceProtocol
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
private let userDiscoveryService: UserDiscoveryServiceProtocol
|
||||
private let appSettings: AppSettings
|
||||
|
||||
private var suggestedUsers = [UserProfile]()
|
||||
|
||||
@@ -29,13 +28,11 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
|
||||
init(userSession: UserSessionProtocol,
|
||||
analytics: AnalyticsServiceProtocol,
|
||||
userIndicatorController: UserIndicatorControllerProtocol,
|
||||
userDiscoveryService: UserDiscoveryServiceProtocol,
|
||||
appSettings: AppSettings) {
|
||||
userDiscoveryService: UserDiscoveryServiceProtocol) {
|
||||
self.userSession = userSession
|
||||
self.analytics = analytics
|
||||
self.userIndicatorController = userIndicatorController
|
||||
self.userDiscoveryService = userDiscoveryService
|
||||
self.appSettings = appSettings
|
||||
|
||||
super.init(initialViewState: StartChatScreenViewState(userID: userSession.clientProxy.userID), mediaProvider: userSession.mediaProvider)
|
||||
|
||||
@@ -92,7 +89,6 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
// periphery:ignore - auto cancels when reassigned
|
||||
@CancellableTask private var resolveAliasTask: Task<Void, Never>?
|
||||
private var internalRoomAddressState: JoinByAddressState = .example
|
||||
|
||||
@@ -162,7 +158,6 @@ class StartChatScreenViewModel: StartChatScreenViewModelType, StartChatScreenVie
|
||||
}
|
||||
}
|
||||
|
||||
// periphery:ignore - auto cancels when reassigned
|
||||
@CancellableTask
|
||||
private var fetchUsersTask: Task<Void, Never>?
|
||||
|
||||
|
||||
@@ -12,8 +12,6 @@ import SwiftUI
|
||||
struct JoinRoomByAddressView: View {
|
||||
@ObservedObject var context: StartChatScreenViewModel.Context
|
||||
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
|
||||
@State private var sheetHeight: CGFloat = .zero
|
||||
@FocusState private var textFieldFocus
|
||||
private let topPadding: CGFloat = 22
|
||||
@@ -87,8 +85,7 @@ struct JoinRoomByAddressView_Previews: PreviewProvider, TestablePreview {
|
||||
return StartChatScreenViewModel(userSession: userSession,
|
||||
analytics: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
userDiscoveryService: userDiscoveryService,
|
||||
appSettings: .volatile())
|
||||
userDiscoveryService: userDiscoveryService)
|
||||
}()
|
||||
|
||||
static var previews: some View {
|
||||
|
||||
@@ -161,8 +161,7 @@ struct StartChatScreen_Previews: PreviewProvider, TestablePreview {
|
||||
return StartChatScreenViewModel(userSession: userSession,
|
||||
analytics: AnalyticsServiceMock(.init()),
|
||||
userIndicatorController: UserIndicatorControllerMock(),
|
||||
userDiscoveryService: userDiscoveryService,
|
||||
appSettings: appSettings)
|
||||
userDiscoveryService: userDiscoveryService)
|
||||
}()
|
||||
|
||||
static var previews: some View {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user