diff --git a/ElementX/Sources/Application/AppCoordinator.swift b/ElementX/Sources/Application/AppCoordinator.swift index bfd1bd98e..46b83a40d 100644 --- a/ElementX/Sources/Application/AppCoordinator.swift +++ b/ElementX/Sources/Application/AppCoordinator.swift @@ -666,7 +666,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg ServiceLocator.shared.networkMonitor .reachabilityPublisher .removeDuplicates() - .sink { [weak self] reachability in + .sink { reachability in MXLog.info("Reachability changed to \(reachability)") if reachability == .reachable { diff --git a/ElementX/Sources/Application/AppSettings.swift b/ElementX/Sources/Application/AppSettings.swift index b73a0e135..42fc5b2b2 100644 --- a/ElementX/Sources/Application/AppSettings.swift +++ b/ElementX/Sources/Application/AppSettings.swift @@ -43,9 +43,7 @@ final class AppSettings { case elementCallEncryptionEnabled // Feature flags - case shouldCollapseRoomStateEvents case publicSearchEnabled - case qrCodeLoginEnabled } private static var suiteName: String = InfoPlistReader.main.appGroupIdentifier @@ -78,7 +76,7 @@ final class AppSettings { // MARK: - Application /// Whether or not the app is a development build that isn't in production. - lazy var isDevelopmentBuild: Bool = { + static var isDevelopmentBuild: Bool = { #if DEBUG true #else @@ -240,10 +238,7 @@ final class AppSettings { @UserPreference(key: UserDefaultsKeys.timelineStyle, defaultValue: TimelineStyle.bubbles, storageType: .userDefaults(store)) var timelineStyle - @UserPreference(key: UserDefaultsKeys.shouldCollapseRoomStateEvents, defaultValue: true, storageType: .volatile) - var shouldCollapseRoomStateEvents - - @UserPreference(key: UserDefaultsKeys.viewSourceEnabled, defaultValue: false, storageType: .userDefaults(store)) + @UserPreference(key: UserDefaultsKeys.viewSourceEnabled, defaultValue: isDevelopmentBuild, storageType: .userDefaults(store)) var viewSourceEnabled // MARK: - Element Call @@ -271,12 +266,9 @@ final class AppSettings { // MARK: - Feature Flags - @UserPreference(key: UserDefaultsKeys.publicSearchEnabled, defaultValue: false, storageType: .volatile) + @UserPreference(key: UserDefaultsKeys.publicSearchEnabled, defaultValue: isDevelopmentBuild, storageType: .volatile) var publicSearchEnabled - - @UserPreference(key: UserDefaultsKeys.qrCodeLoginEnabled, defaultValue: false, storageType: .userDefaults(store)) - var qrCodeLoginEnabled - + #endif // MARK: - Shared diff --git a/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift index 66abdbb0b..f84542066 100644 --- a/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/AuthenticationFlowCoordinator.swift @@ -86,7 +86,7 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol { // MARK: - Private private func showStartScreen() { - let coordinator = AuthenticationStartScreenCoordinator(parameters: .init(appSettings: appSettings)) + let coordinator = AuthenticationStartScreenCoordinator() coordinator.actions .sink { [weak self] action in diff --git a/ElementX/Sources/Screens/AuthenticationStartScreen/AuthenticationStartScreenCoordinator.swift b/ElementX/Sources/Screens/AuthenticationStartScreen/AuthenticationStartScreenCoordinator.swift index ee11ed191..067e4bf62 100644 --- a/ElementX/Sources/Screens/AuthenticationStartScreen/AuthenticationStartScreenCoordinator.swift +++ b/ElementX/Sources/Screens/AuthenticationStartScreen/AuthenticationStartScreenCoordinator.swift @@ -17,10 +17,6 @@ import Combine import SwiftUI -struct AuthenticationStartScreenCoordinatorParameters { - let appSettings: AppSettings -} - final class AuthenticationStartScreenCoordinator: CoordinatorProtocol { private var viewModel: AuthenticationStartScreenViewModelProtocol private let actionsSubject: PassthroughSubject = .init() @@ -30,8 +26,8 @@ final class AuthenticationStartScreenCoordinator: CoordinatorProtocol { actionsSubject.eraseToAnyPublisher() } - init(parameters: AuthenticationStartScreenCoordinatorParameters) { - viewModel = AuthenticationStartScreenViewModel(appSettings: parameters.appSettings) + init() { + viewModel = AuthenticationStartScreenViewModel() } // MARK: - Public diff --git a/ElementX/Sources/Screens/AuthenticationStartScreen/AuthenticationStartScreenViewModel.swift b/ElementX/Sources/Screens/AuthenticationStartScreen/AuthenticationStartScreenViewModel.swift index df24dbaa4..96e90ec1d 100644 --- a/ElementX/Sources/Screens/AuthenticationStartScreen/AuthenticationStartScreenViewModel.swift +++ b/ElementX/Sources/Screens/AuthenticationStartScreen/AuthenticationStartScreenViewModel.swift @@ -26,17 +26,9 @@ class AuthenticationStartScreenViewModel: AuthenticationStartScreenViewModelType actionsSubject.eraseToAnyPublisher() } - init(appSettings: AppSettings) { + init() { super.init(initialViewState: AuthenticationStartScreenViewState()) - if !ProcessInfo.processInfo.isiOSAppOnMac { - if appSettings.isDevelopmentBuild { - state.isQRCodeLoginEnabled = true - } else { - appSettings.$qrCodeLoginEnabled - .weakAssign(to: \.state.isQRCodeLoginEnabled, on: self) - .store(in: &cancellables) - } - } + state.isQRCodeLoginEnabled = !ProcessInfo.processInfo.isiOSAppOnMac && AppSettings.isDevelopmentBuild } override func process(viewAction: AuthenticationStartScreenViewAction) { diff --git a/ElementX/Sources/Screens/AuthenticationStartScreen/View/AuthenticationStartScreen.swift b/ElementX/Sources/Screens/AuthenticationStartScreen/View/AuthenticationStartScreen.swift index 23e30c748..ce99e5441 100644 --- a/ElementX/Sources/Screens/AuthenticationStartScreen/View/AuthenticationStartScreen.swift +++ b/ElementX/Sources/Screens/AuthenticationStartScreen/View/AuthenticationStartScreen.swift @@ -117,10 +117,7 @@ struct AuthenticationStartScreen: View { // MARK: - Previews struct AuthenticationStartScreen_Previews: PreviewProvider, TestablePreview { - static let viewModel = { - ServiceLocator.shared.settings.qrCodeLoginEnabled = true - return AuthenticationStartScreenViewModel(appSettings: ServiceLocator.shared.settings) - }() + static let viewModel = AuthenticationStartScreenViewModel() static var previews: some View { AuthenticationStartScreen(context: viewModel.context) diff --git a/ElementX/Sources/Screens/RoomScreen/RoomScreenInteractionHandler.swift b/ElementX/Sources/Screens/RoomScreen/RoomScreenInteractionHandler.swift index ee21a91e6..aefe7646f 100644 --- a/ElementX/Sources/Screens/RoomScreen/RoomScreenInteractionHandler.swift +++ b/ElementX/Sources/Screens/RoomScreen/RoomScreenInteractionHandler.swift @@ -120,7 +120,7 @@ class RoomScreenInteractionHandler { } var debugActions: [TimelineItemMenuAction] = [] - if appSettings.isDevelopmentBuild || appSettings.viewSourceEnabled { + if appSettings.viewSourceEnabled { debugActions.append(.viewSource) } diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift index 2168bc243..1ad95e81f 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/DeveloperOptionsScreenModels.swift @@ -45,10 +45,8 @@ enum DeveloperOptionsScreenViewAction { protocol DeveloperOptionsProtocol: AnyObject { var logLevel: TracingConfiguration.LogLevel { get set } - var shouldCollapseRoomStateEvents: Bool { get set } var hideUnreadMessagesBadge: Bool { get set } var elementCallBaseURL: URL { get set } - var publicSearchEnabled: Bool { get set } } extension AppSettings: DeveloperOptionsProtocol { } diff --git a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift index 085b8845a..299154b6e 100644 --- a/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift +++ b/ElementX/Sources/Screens/Settings/DeveloperOptionsScreen/View/DeveloperOptionsScreen.swift @@ -32,19 +32,7 @@ struct DeveloperOptionsScreen: View { Text("Hide grey dots") } } - - Section("Room Directory Search") { - Toggle(isOn: $context.publicSearchEnabled) { - Text("Public rooms search") - } - } - - Section("Room") { - Toggle(isOn: $context.shouldCollapseRoomStateEvents) { - Text("Collapse room state events") - } - } - + Section("Element Call") { TextField(context.elementCallBaseURL.absoluteString, text: $elementCallBaseURLString) .submitLabel(.done) diff --git a/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenModels.swift b/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenModels.swift index 63ce7308e..3fc611729 100644 --- a/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenModels.swift +++ b/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenModels.swift @@ -64,6 +64,7 @@ enum SettingsScreenViewAction { case secureBackup case manageAccount(url: URL) case notifications + case enableDeveloperOptions case developerOptions case advancedSettings case logout diff --git a/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenViewModel.swift b/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenViewModel.swift index 9f1ec2652..6f05afa4d 100644 --- a/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenViewModel.swift +++ b/ElementX/Sources/Screens/Settings/SettingsScreen/SettingsScreenViewModel.swift @@ -29,7 +29,7 @@ class SettingsScreenViewModel: SettingsScreenViewModelType, SettingsScreenViewMo init(userSession: UserSessionProtocol, appSettings: AppSettings) { super.init(initialViewState: .init(deviceID: userSession.clientProxy.deviceID, userID: userSession.clientProxy.userID, - showDeveloperOptions: appSettings.isDevelopmentBuild), + showDeveloperOptions: AppSettings.isDevelopmentBuild), imageProvider: userSession.mediaProvider) userSession.clientProxy.userAvatarURLPublisher @@ -110,6 +110,8 @@ class SettingsScreenViewModel: SettingsScreenViewModelType, SettingsScreenViewMo actionsSubject.send(.notifications) case .advancedSettings: actionsSubject.send(.advancedSettings) + case .enableDeveloperOptions: + state.showDeveloperOptions = true case .developerOptions: actionsSubject.send(.developerOptions) } diff --git a/ElementX/Sources/Screens/Settings/SettingsScreen/View/SettingsScreen.swift b/ElementX/Sources/Screens/Settings/SettingsScreen/View/SettingsScreen.swift index 35d667f9b..e0433180a 100644 --- a/ElementX/Sources/Screens/Settings/SettingsScreen/View/SettingsScreen.swift +++ b/ElementX/Sources/Screens/Settings/SettingsScreen/View/SettingsScreen.swift @@ -196,6 +196,9 @@ struct SettingsScreen: View { .compoundListSectionFooter() .textSelection(.enabled) .padding(.top, 24) + .onTapGesture(count: 7) { + context.send(viewAction: .enableDeveloperOptions) + } } } diff --git a/ElementX/Sources/Services/Timeline/TimelineController/RoomTimelineController.swift b/ElementX/Sources/Services/Timeline/TimelineController/RoomTimelineController.swift index 5a1679702..97e0b3a23 100644 --- a/ElementX/Sources/Services/Timeline/TimelineController/RoomTimelineController.swift +++ b/ElementX/Sources/Services/Timeline/TimelineController/RoomTimelineController.swift @@ -363,10 +363,6 @@ class RoomTimelineController: RoomTimelineControllerProtocol { } private func isItemCollapsible(_ item: TimelineItemProxy) -> Bool { - if !appSettings.shouldCollapseRoomStateEvents { - return false - } - if case let .event(eventItem) = item { switch eventItem.content.kind() { case .profileChange, .roomMembership, .state: diff --git a/PreviewTests/__Snapshots__/PreviewTests/test_advancedSettingsScreen-iPad-en-GB.1.png b/PreviewTests/__Snapshots__/PreviewTests/test_advancedSettingsScreen-iPad-en-GB.1.png index f87f6030f..34c1a8882 100644 --- a/PreviewTests/__Snapshots__/PreviewTests/test_advancedSettingsScreen-iPad-en-GB.1.png +++ b/PreviewTests/__Snapshots__/PreviewTests/test_advancedSettingsScreen-iPad-en-GB.1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8cd0132d6e6b1accd323b35c4f76194715ec5672e8ebadba2cea0d8b9328acd4 -size 156339 +oid sha256:f85f8897cd79b5d4d2df216679ffcdc45da409e9fc1bce42cbb434512e7d5053 +size 156848 diff --git a/PreviewTests/__Snapshots__/PreviewTests/test_advancedSettingsScreen-iPad-pseudo.1.png b/PreviewTests/__Snapshots__/PreviewTests/test_advancedSettingsScreen-iPad-pseudo.1.png index 1d324e642..4759c3475 100644 --- a/PreviewTests/__Snapshots__/PreviewTests/test_advancedSettingsScreen-iPad-pseudo.1.png +++ b/PreviewTests/__Snapshots__/PreviewTests/test_advancedSettingsScreen-iPad-pseudo.1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b952da8ab3650bd6c62f5fcb2f58f5abbc43abb59a194a67bb5e5b45c6d358c0 -size 217756 +oid sha256:af072c34f22fa7757d3a7f48e318c20f78bfc0b6dda2ca976edea2985d8e4706 +size 218093 diff --git a/PreviewTests/__Snapshots__/PreviewTests/test_advancedSettingsScreen-iPhone-15-en-GB.1.png b/PreviewTests/__Snapshots__/PreviewTests/test_advancedSettingsScreen-iPhone-15-en-GB.1.png index 86d40816c..4e680d940 100644 --- a/PreviewTests/__Snapshots__/PreviewTests/test_advancedSettingsScreen-iPhone-15-en-GB.1.png +++ b/PreviewTests/__Snapshots__/PreviewTests/test_advancedSettingsScreen-iPhone-15-en-GB.1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2cf3303ef793b9062a0971a0af37cc4fb76ac950d2ef5025330cef2e59e619db -size 104184 +oid sha256:4c88a64b71907671ad6ba30275a58efb4c8131533d983c4ad3c341dd1d6d9a74 +size 104849 diff --git a/PreviewTests/__Snapshots__/PreviewTests/test_advancedSettingsScreen-iPhone-15-pseudo.1.png b/PreviewTests/__Snapshots__/PreviewTests/test_advancedSettingsScreen-iPhone-15-pseudo.1.png index 4832cc419..29263a6cd 100644 --- a/PreviewTests/__Snapshots__/PreviewTests/test_advancedSettingsScreen-iPhone-15-pseudo.1.png +++ b/PreviewTests/__Snapshots__/PreviewTests/test_advancedSettingsScreen-iPhone-15-pseudo.1.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c1a257c5c1b5a762cd8454637d6fa378980b930fbeed3ec12c8ccb8cce99f2b9 -size 165685 +oid sha256:dcdf67bedffc6d677cbb292986dfe3270ce04afeb51611fc62bc1d8d77b1c936 +size 166288