mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 11:58:32 +00:00
Removing dead code part 2 (#2235)
Co-authored-by: Doug <6060466+pixlwave@users.noreply.github.com>
This commit is contained in:
@@ -58,7 +58,7 @@ private struct PINTextFieldStyle: TextFieldStyle {
|
||||
let pinCode: String
|
||||
let isSecure: Bool
|
||||
|
||||
public func _body(configuration: TextField<_Label>) -> some View {
|
||||
func _body(configuration: TextField<_Label>) -> some View {
|
||||
HStack(spacing: 8) {
|
||||
ForEach(0..<4) { index in
|
||||
PINDigitField(digit: digit(index))
|
||||
|
||||
@@ -35,22 +35,4 @@ enum LoginMode: Equatable {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
var supportsPasswordFlow: Bool {
|
||||
switch self {
|
||||
case .password:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
var isUnsupported: Bool {
|
||||
switch self {
|
||||
case .unsupported:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,9 +37,7 @@ enum LoginScreenCoordinatorAction {
|
||||
final class LoginScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: LoginScreenCoordinatorParameters
|
||||
private var viewModel: LoginScreenViewModelProtocol
|
||||
|
||||
@CancellableTask private var currentTask: Task<Void, Error>?
|
||||
|
||||
|
||||
private var authenticationService: AuthenticationServiceProxyProtocol { parameters.authenticationService }
|
||||
|
||||
private let actionsSubject: PassthroughSubject<LoginScreenCoordinatorAction, Never> = .init()
|
||||
|
||||
@@ -203,7 +203,6 @@ struct MessageComposer_Previews: PreviewProvider, TestablePreview {
|
||||
]
|
||||
|
||||
static func messageComposer(_ content: String = "",
|
||||
sendingDisabled: Bool = false,
|
||||
mode: RoomScreenComposerMode = .default) -> MessageComposer {
|
||||
let viewModel = WysiwygComposerViewModel(minHeight: 22,
|
||||
maxExpandedHeight: 250)
|
||||
@@ -228,7 +227,7 @@ struct MessageComposer_Previews: PreviewProvider, TestablePreview {
|
||||
|
||||
static var previews: some View {
|
||||
VStack(spacing: 8) {
|
||||
messageComposer(sendingDisabled: true)
|
||||
messageComposer()
|
||||
|
||||
messageComposer("Some message",
|
||||
mode: .edit(originalItemId: .random))
|
||||
|
||||
@@ -28,7 +28,6 @@ enum PollFormScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class PollFormScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: PollFormScreenCoordinatorParameters
|
||||
private var viewModel: PollFormScreenViewModelProtocol
|
||||
private let actionsSubject: PassthroughSubject<PollFormScreenCoordinatorAction, Never> = .init()
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -38,8 +37,6 @@ final class PollFormScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: PollFormScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = PollFormScreenViewModel(mode: parameters.mode)
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,6 @@ private struct MediaPreviewViewController: UIViewControllerRepresentable {
|
||||
class PreviewHostingController: UIViewController, QLPreviewControllerDataSource, QLPreviewControllerDelegate {
|
||||
let previewItem: MediaPreviewItem
|
||||
let shouldHideControls: Bool
|
||||
let dismissalPublisher: PassthroughSubject<Void, Never>
|
||||
let onDismiss: () -> Void
|
||||
|
||||
private var dismissalObserver: AnyCancellable?
|
||||
@@ -81,7 +80,6 @@ private struct MediaPreviewViewController: UIViewControllerRepresentable {
|
||||
onDismiss: @escaping () -> Void) {
|
||||
self.previewItem = previewItem
|
||||
self.shouldHideControls = shouldHideControls
|
||||
self.dismissalPublisher = dismissalPublisher
|
||||
self.onDismiss = onDismiss
|
||||
|
||||
super.init(nibName: nil, bundle: nil)
|
||||
|
||||
@@ -152,6 +152,7 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
}
|
||||
}
|
||||
|
||||
// perphery: ignore - used in release mode
|
||||
func presentCrashedLastRunAlert() {
|
||||
state.bindings.alertInfo = AlertInfo(id: UUID(),
|
||||
title: L10n.crashDetectionDialogContent(InfoPlistReader.main.bundleDisplayName),
|
||||
|
||||
@@ -22,5 +22,6 @@ protocol HomeScreenViewModelProtocol {
|
||||
|
||||
var context: HomeScreenViewModelType.Context { get }
|
||||
|
||||
// periphery: ignore - used in release mode
|
||||
func presentCrashedLastRunAlert()
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ enum InviteUsersScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class InviteUsersScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: InviteUsersScreenCoordinatorParameters
|
||||
private let viewModel: InviteUsersScreenViewModelProtocol
|
||||
private let actionsSubject: PassthroughSubject<InviteUsersScreenCoordinatorAction, Never> = .init()
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -43,8 +42,6 @@ final class InviteUsersScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: InviteUsersScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = InviteUsersScreenViewModel(selectedUsers: parameters.selectedUsers,
|
||||
roomType: parameters.roomType,
|
||||
mediaProvider: parameters.mediaProvider,
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
import Foundation
|
||||
import MatrixRustSDK
|
||||
|
||||
// periphery:ignore - for generic conformance
|
||||
enum InviteUsersScreenErrorType: Error {
|
||||
case unknown
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ typealias InviteUsersScreenViewModelType = StateStoreViewModel<InviteUsersScreen
|
||||
|
||||
class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScreenViewModelProtocol {
|
||||
private let roomType: InviteUsersScreenRoomType
|
||||
private let mediaProvider: MediaProviderProtocol
|
||||
private let userDiscoveryService: UserDiscoveryServiceProtocol
|
||||
private let appSettings: AppSettings
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
@@ -40,7 +39,6 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr
|
||||
appSettings: AppSettings,
|
||||
userIndicatorController: UserIndicatorControllerProtocol) {
|
||||
self.roomType = roomType
|
||||
self.mediaProvider = mediaProvider
|
||||
self.userDiscoveryService = userDiscoveryService
|
||||
self.appSettings = appSettings
|
||||
self.userIndicatorController = userIndicatorController
|
||||
@@ -89,6 +87,7 @@ class InviteUsersScreenViewModel: InviteUsersScreenViewModelType, InviteUsersScr
|
||||
}
|
||||
}
|
||||
|
||||
// periphery:ignore - automatically cancelled when set to nil
|
||||
@CancellableTask
|
||||
private var fetchUsersTask: Task<Void, Never>?
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ enum InvitesScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class InvitesScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: InvitesScreenCoordinatorParameters
|
||||
private var viewModel: InvitesScreenViewModelProtocol
|
||||
private let actionsSubject: PassthroughSubject<InvitesScreenCoordinatorAction, Never> = .init()
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -36,7 +35,6 @@ final class InvitesScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: InvitesScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
viewModel = InvitesScreenViewModel(userSession: parameters.userSession,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
analytics: ServiceLocator.shared.analytics,
|
||||
|
||||
@@ -155,6 +155,7 @@ class InvitesScreenViewModel: InvitesScreenViewModelType, InvitesScreenViewModel
|
||||
}
|
||||
|
||||
private func displayError(_ error: RoomProxyError) {
|
||||
MXLog.error("Failed to accept/decline invite: \(error)")
|
||||
state.bindings.alertInfo = .init(id: true,
|
||||
title: L10n.commonError,
|
||||
message: L10n.errorUnknown)
|
||||
|
||||
-3
@@ -29,7 +29,6 @@ enum MessageForwardingScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class MessageForwardingScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: MessageForwardingScreenCoordinatorParameters
|
||||
private var viewModel: MessageForwardingScreenViewModelProtocol
|
||||
private let actionsSubject: PassthroughSubject<MessageForwardingScreenCoordinatorAction, Never> = .init()
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
@@ -39,8 +38,6 @@ final class MessageForwardingScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: MessageForwardingScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = MessageForwardingScreenViewModel(roomSummaryProvider: parameters.roomSummaryProvider,
|
||||
mediaProvider: parameters.mediaProvider,
|
||||
sourceRoomID: parameters.sourceRoomID)
|
||||
|
||||
@@ -19,7 +19,6 @@ import SwiftUI
|
||||
|
||||
final class MigrationScreenCoordinator: CoordinatorProtocol {
|
||||
private var viewModel: MigrationScreenViewModelProtocol
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
init() {
|
||||
viewModel = MigrationScreenViewModel()
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
enum MigrationScreenViewModelAction { }
|
||||
|
||||
struct MigrationScreenViewState: BindableState { }
|
||||
|
||||
enum MigrationScreenViewAction { }
|
||||
|
||||
@@ -20,12 +20,6 @@ import SwiftUI
|
||||
typealias MigrationScreenViewModelType = StateStoreViewModel<MigrationScreenViewState, MigrationScreenViewAction>
|
||||
|
||||
class MigrationScreenViewModel: MigrationScreenViewModelType, MigrationScreenViewModelProtocol {
|
||||
private var actionsSubject: PassthroughSubject<MigrationScreenViewModelAction, Never> = .init()
|
||||
|
||||
var actions: AnyPublisher<MigrationScreenViewModelAction, Never> {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init() {
|
||||
super.init(initialViewState: MigrationScreenViewState())
|
||||
}
|
||||
|
||||
@@ -18,6 +18,5 @@ import Combine
|
||||
|
||||
@MainActor
|
||||
protocol MigrationScreenViewModelProtocol {
|
||||
var actions: AnyPublisher<MigrationScreenViewModelAction, Never> { get }
|
||||
var context: MigrationScreenViewModelType.Context { get }
|
||||
}
|
||||
|
||||
@@ -22,13 +22,6 @@ enum OnboardingScreenCoordinatorAction {
|
||||
case login
|
||||
}
|
||||
|
||||
/// The content displayed in a single screen page.
|
||||
struct OnboardingScreenPageContent {
|
||||
let title: AttributedString
|
||||
let message: String
|
||||
let image: ImageAsset
|
||||
}
|
||||
|
||||
enum OnboardingScreenViewModelAction {
|
||||
case login
|
||||
}
|
||||
|
||||
@@ -18,13 +18,7 @@ import Compound
|
||||
import SwiftUI
|
||||
|
||||
struct ReportContentScreen: View {
|
||||
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
|
||||
|
||||
@ObservedObject var context: ReportContentScreenViewModel.Context
|
||||
|
||||
private var horizontalPadding: CGFloat {
|
||||
horizontalSizeClass == .regular ? 50 : 16
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
Form {
|
||||
|
||||
@@ -35,7 +35,6 @@ enum RoomDetailsScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class RoomDetailsScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: RoomDetailsScreenCoordinatorParameters
|
||||
private var viewModel: RoomDetailsScreenViewModelProtocol
|
||||
|
||||
private let actionsSubject: PassthroughSubject<RoomDetailsScreenCoordinatorAction, Never> = .init()
|
||||
@@ -46,8 +45,6 @@ final class RoomDetailsScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: RoomDetailsScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = RoomDetailsScreenViewModel(accountUserID: parameters.accountUserID,
|
||||
roomProxy: parameters.roomProxy,
|
||||
mediaProvider: parameters.mediaProvider,
|
||||
|
||||
@@ -219,12 +219,6 @@ extension RoomDetailsNotificationSettingsState {
|
||||
return false
|
||||
}
|
||||
|
||||
/// Returns `true` when the settings are loaded and `isDefault` is true.
|
||||
var isDefault: Bool {
|
||||
guard case let .loaded(settings) = self else { return false }
|
||||
return settings.isDefault
|
||||
}
|
||||
|
||||
/// Returns `true` when the settings are loaded and `isDefault` is false.
|
||||
var isCustom: Bool {
|
||||
guard case let .loaded(settings) = self else { return false }
|
||||
|
||||
-3
@@ -29,7 +29,6 @@ enum RoomMemberDetailsScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class RoomMemberDetailsScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: RoomMemberDetailsScreenCoordinatorParameters
|
||||
private var viewModel: RoomMemberDetailsScreenViewModelProtocol
|
||||
|
||||
private let actionsSubject: PassthroughSubject<RoomMemberDetailsScreenCoordinatorAction, Never> = .init()
|
||||
@@ -40,8 +39,6 @@ final class RoomMemberDetailsScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: RoomMemberDetailsScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = RoomMemberDetailsScreenViewModel(roomProxy: parameters.roomProxy,
|
||||
roomMemberProxy: parameters.roomMemberProxy,
|
||||
mediaProvider: parameters.mediaProvider,
|
||||
|
||||
@@ -83,6 +83,5 @@ enum RoomMemberDetailsScreenViewAction {
|
||||
}
|
||||
|
||||
enum RoomMemberDetailsScreenError: Hashable {
|
||||
case alert(String)
|
||||
case unknown
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ enum RoomMembersListScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class RoomMembersListScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: RoomMembersListScreenCoordinatorParameters
|
||||
private var viewModel: RoomMembersListScreenViewModelProtocol
|
||||
|
||||
private let actionsSubject: PassthroughSubject<RoomMembersListScreenCoordinatorAction, Never> = .init()
|
||||
@@ -39,8 +38,6 @@ final class RoomMembersListScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: RoomMembersListScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = RoomMembersListScreenViewModel(roomProxy: parameters.roomProxy,
|
||||
mediaProvider: parameters.mediaProvider,
|
||||
userIndicatorController: ServiceLocator.shared.userIndicatorController)
|
||||
|
||||
@@ -18,8 +18,6 @@ import Compound
|
||||
import SwiftUI
|
||||
|
||||
struct RoomMembersListScreen: View {
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
|
||||
@ObservedObject var context: RoomMembersListScreenViewModel.Context
|
||||
|
||||
var body: some View {
|
||||
|
||||
-4
@@ -38,10 +38,6 @@ final class RoomNotificationSettingsScreenCoordinator: CoordinatorProtocol {
|
||||
var actions: AnyPublisher<RoomNotificationSettingsScreenCoordinatorAction, Never> {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
private var navigationStackCoordinator: NavigationStackCoordinator? {
|
||||
parameters.navigationStackCoordinator
|
||||
}
|
||||
|
||||
init(parameters: RoomNotificationSettingsScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
-1
@@ -81,7 +81,6 @@ struct RoomNotificationSettingsScreenViewState: BindableState {
|
||||
|
||||
struct RoomNotificationSettingsScreenViewStateBindings {
|
||||
var allowCustomSetting = false
|
||||
var customMode: RoomNotificationModeProxy = .allMessages
|
||||
/// Information describing the currently displayed alert.
|
||||
var alertInfo: AlertInfo<RoomNotificationSettingsScreenErrorType>?
|
||||
}
|
||||
|
||||
+1
-3
@@ -24,6 +24,7 @@ class RoomNotificationSettingsScreenViewModel: RoomNotificationSettingsScreenVie
|
||||
private let notificationSettingsProxy: NotificationSettingsProxyProtocol
|
||||
private let roomProxy: RoomProxyProtocol
|
||||
|
||||
// periphery:ignore - cancellable tasks cancel when reassigned
|
||||
@CancellableTask private var fetchNotificationSettingsTask: Task<Void, Error>?
|
||||
|
||||
var actions: AnyPublisher<RoomNotificationSettingsScreenViewModelAction, Never> {
|
||||
@@ -94,9 +95,6 @@ class RoomNotificationSettingsScreenViewModel: RoomNotificationSettingsScreenVie
|
||||
if !state.isRestoringDefaultSetting {
|
||||
state.bindings.allowCustomSetting = !settings.isDefault
|
||||
}
|
||||
if state.pendingCustomMode == nil {
|
||||
state.bindings.customMode = settings.mode
|
||||
}
|
||||
} catch {
|
||||
state.notificationSettingsState = .error
|
||||
displayError(.loadingSettingsFailed)
|
||||
|
||||
@@ -45,7 +45,6 @@ enum RoomScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class RoomScreenCoordinator: CoordinatorProtocol {
|
||||
private var parameters: RoomScreenCoordinatorParameters
|
||||
private var viewModel: RoomScreenViewModelProtocol
|
||||
private var composerViewModel: ComposerToolbarViewModel
|
||||
private var wysiwygViewModel: WysiwygComposerViewModel
|
||||
@@ -58,8 +57,6 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
|
||||
}
|
||||
|
||||
init(parameters: RoomScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = RoomScreenViewModel(roomProxy: parameters.roomProxy,
|
||||
timelineController: parameters.timelineController,
|
||||
mediaProvider: parameters.mediaProvider,
|
||||
|
||||
@@ -23,10 +23,6 @@ struct ReactionsSummaryView: View {
|
||||
|
||||
@State var selectedReactionKey: String
|
||||
|
||||
var selectedReactionIndex: Int {
|
||||
reactions.firstIndex(where: { $0.key == selectedReactionKey }) ?? 0
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
reactionButtons
|
||||
|
||||
@@ -18,7 +18,6 @@ import SwiftUI
|
||||
|
||||
struct PollRoomTimelineView: View {
|
||||
let timelineItem: PollRoomTimelineItem
|
||||
@Environment(\.timelineStyle) var timelineStyle
|
||||
@EnvironmentObject private var context: RoomScreenViewModel.Context
|
||||
|
||||
private let feedbackGenerator = UIImpactFeedbackGenerator(style: .heavy)
|
||||
|
||||
+1
-1
@@ -14,13 +14,13 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
// periphery:ignore:all - subscripts lead to false positives
|
||||
import Foundation
|
||||
|
||||
struct AdvancedSettingsScreenViewState: BindableState {
|
||||
var bindings: AdvancedSettingsScreenViewStateBindings
|
||||
}
|
||||
|
||||
// periphery:ignore - subscript are seen as false positives
|
||||
@dynamicMemberLookup
|
||||
struct AdvancedSettingsScreenViewStateBindings {
|
||||
private let advancedSettings: AdvancedSettingsProtocol
|
||||
|
||||
+1
@@ -16,6 +16,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
// periphery:ignore - required for the architecture
|
||||
enum LegalInformationScreenViewModelAction { }
|
||||
|
||||
struct LegalInformationScreenViewState: BindableState {
|
||||
|
||||
+1
@@ -16,6 +16,7 @@
|
||||
|
||||
import Combine
|
||||
|
||||
// periphery:ignore - markdown protocol
|
||||
@MainActor
|
||||
protocol LegalInformationScreenViewModelProtocol {
|
||||
var context: LegalInformationScreenViewModelType.Context { get }
|
||||
|
||||
-7
@@ -24,18 +24,11 @@ struct NotificationSettingsEditScreenCoordinatorParameters {
|
||||
let notificationSettings: NotificationSettingsProxyProtocol
|
||||
}
|
||||
|
||||
enum NotificationSettingsEditScreenCoordinatorAction { }
|
||||
|
||||
final class NotificationSettingsEditScreenCoordinator: CoordinatorProtocol {
|
||||
private let parameters: NotificationSettingsEditScreenCoordinatorParameters
|
||||
private var viewModel: NotificationSettingsEditScreenViewModelProtocol
|
||||
private let actionsSubject: PassthroughSubject<NotificationSettingsEditScreenCoordinatorAction, Never> = .init()
|
||||
private var cancellables = Set<AnyCancellable>()
|
||||
|
||||
var actions: AnyPublisher<NotificationSettingsEditScreenCoordinatorAction, Never> {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init(parameters: NotificationSettingsEditScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
|
||||
-12
@@ -53,7 +53,6 @@ struct NotificationSettingsEditScreenViewState: BindableState {
|
||||
}
|
||||
|
||||
struct NotificationSettingsEditScreenViewStateBindings {
|
||||
var searchQuery = ""
|
||||
var alertInfo: AlertInfo<NotificationSettingsEditScreenErrorType>?
|
||||
}
|
||||
|
||||
@@ -103,8 +102,6 @@ struct NotificationSettingsEditScreenStrings {
|
||||
}
|
||||
|
||||
struct NotificationSettingsEditScreenRoom: Identifiable, Equatable {
|
||||
static let placeholderLastMessage = AttributedString("Hidden last message")
|
||||
|
||||
/// The list item identifier can be a real room identifier, a custom one for invalidated entries
|
||||
/// or a completely unique one for empty items and skeletons
|
||||
let id: String
|
||||
@@ -117,13 +114,4 @@ struct NotificationSettingsEditScreenRoom: Identifiable, Equatable {
|
||||
var avatarURL: URL?
|
||||
|
||||
var notificationMode: RoomNotificationModeProxy?
|
||||
|
||||
var isPlaceholder = false
|
||||
|
||||
static func placeholder() -> NotificationSettingsEditScreenRoom {
|
||||
NotificationSettingsEditScreenRoom(id: UUID().uuidString,
|
||||
roomId: nil,
|
||||
name: "Placeholder room name",
|
||||
isPlaceholder: true)
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -26,7 +26,9 @@ 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
@@ -19,7 +19,6 @@ import SwiftUI
|
||||
|
||||
struct NotificationSettingsEditScreen: View {
|
||||
@ObservedObject var context: NotificationSettingsEditScreenViewModel.Context
|
||||
@State var isSearching = false
|
||||
|
||||
var body: some View {
|
||||
Form {
|
||||
|
||||
+1
-2
@@ -46,8 +46,7 @@ final class NotificationSettingsScreenCoordinator: CoordinatorProtocol {
|
||||
init(parameters: NotificationSettingsScreenCoordinatorParameters) {
|
||||
self.parameters = parameters
|
||||
|
||||
viewModel = NotificationSettingsScreenViewModel(userSession: parameters.userSession,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
viewModel = NotificationSettingsScreenViewModel(appSettings: ServiceLocator.shared.settings,
|
||||
userNotificationCenter: parameters.userNotificationCenter,
|
||||
notificationSettingsProxy: parameters.notificationSettings,
|
||||
isModallyPresented: parameters.isModallyPresented)
|
||||
|
||||
-1
@@ -27,7 +27,6 @@ struct NotificationSettingsScreenViewState: BindableState {
|
||||
var strings = NotificationSettingsScreenStrings()
|
||||
let isModallyPresented: Bool
|
||||
var isUserPermissionGranted: Bool?
|
||||
var allowedNotificationModes: [RoomNotificationModeProxy] = [.allMessages, .mentionsAndKeywordsOnly]
|
||||
var fixingConfigurationMismatch = false
|
||||
// Hide calls settings until calls are available in El-X
|
||||
let showCallsSettings = false
|
||||
|
||||
+2
-3
@@ -24,15 +24,14 @@ class NotificationSettingsScreenViewModel: NotificationSettingsScreenViewModelTy
|
||||
private let appSettings: AppSettings
|
||||
private let userNotificationCenter: UserNotificationCenterProtocol
|
||||
private let notificationSettingsProxy: NotificationSettingsProxyProtocol
|
||||
private let userSession: UserSessionProtocol
|
||||
// periphery:ignore - cancellable tasks get cancelled when reassigned
|
||||
@CancellableTask private var fetchSettingsTask: Task<Void, Error>?
|
||||
|
||||
var actions: AnyPublisher<NotificationSettingsScreenViewModelAction, Never> {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init(userSession: UserSessionProtocol, appSettings: AppSettings, userNotificationCenter: UserNotificationCenterProtocol, notificationSettingsProxy: NotificationSettingsProxyProtocol, isModallyPresented: Bool) {
|
||||
self.userSession = userSession
|
||||
init(appSettings: AppSettings, userNotificationCenter: UserNotificationCenterProtocol, notificationSettingsProxy: NotificationSettingsProxyProtocol, isModallyPresented: Bool) {
|
||||
self.appSettings = appSettings
|
||||
self.userNotificationCenter = userNotificationCenter
|
||||
self.notificationSettingsProxy = notificationSettingsProxy
|
||||
|
||||
+2
-4
@@ -220,8 +220,7 @@ struct NotificationSettingsScreen_Previews: PreviewProvider, TestablePreview {
|
||||
let userSession = MockUserSession(clientProxy: MockClientProxy(userID: "John Doe"), mediaProvider: MockMediaProvider(),
|
||||
voiceMessageMediaManager: VoiceMessageMediaManagerMock())
|
||||
|
||||
var viewModel = NotificationSettingsScreenViewModel(userSession: userSession,
|
||||
appSettings: appSettings,
|
||||
var viewModel = NotificationSettingsScreenViewModel(appSettings: appSettings,
|
||||
userNotificationCenter: notificationCenter,
|
||||
notificationSettingsProxy: notificationSettingsProxy,
|
||||
isModallyPresented: true)
|
||||
@@ -249,8 +248,7 @@ struct NotificationSettingsScreen_Previews: PreviewProvider, TestablePreview {
|
||||
|
||||
let userSession = MockUserSession(clientProxy: MockClientProxy(userID: "John Doe"), mediaProvider: MockMediaProvider(), voiceMessageMediaManager: VoiceMessageMediaManagerMock())
|
||||
|
||||
var viewModel = NotificationSettingsScreenViewModel(userSession: userSession,
|
||||
appSettings: appSettings,
|
||||
var viewModel = NotificationSettingsScreenViewModel(appSettings: appSettings,
|
||||
userNotificationCenter: notificationCenter,
|
||||
notificationSettingsProxy: notificationSettingsProxy,
|
||||
isModallyPresented: true)
|
||||
|
||||
Reference in New Issue
Block a user