mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Allow showing the developer options on any build type by tapping the settings screen version footer 7 times (a la android)
This commit is contained in:
committed by
Stefan Ceriu
parent
f11a610f46
commit
a2faae20c2
+2
-6
@@ -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<AuthenticationStartScreenCoordinatorAction, Never> = .init()
|
||||
@@ -30,8 +26,8 @@ final class AuthenticationStartScreenCoordinator: CoordinatorProtocol {
|
||||
actionsSubject.eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
init(parameters: AuthenticationStartScreenCoordinatorParameters) {
|
||||
viewModel = AuthenticationStartScreenViewModel(appSettings: parameters.appSettings)
|
||||
init() {
|
||||
viewModel = AuthenticationStartScreenViewModel()
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
+2
-10
@@ -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) {
|
||||
|
||||
+1
-4
@@ -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)
|
||||
|
||||
@@ -120,7 +120,7 @@ class RoomScreenInteractionHandler {
|
||||
}
|
||||
|
||||
var debugActions: [TimelineItemMenuAction] = []
|
||||
if appSettings.isDevelopmentBuild || appSettings.viewSourceEnabled {
|
||||
if appSettings.viewSourceEnabled {
|
||||
debugActions.append(.viewSource)
|
||||
}
|
||||
|
||||
|
||||
-2
@@ -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 { }
|
||||
|
||||
+1
-13
@@ -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)
|
||||
|
||||
@@ -64,6 +64,7 @@ enum SettingsScreenViewAction {
|
||||
case secureBackup
|
||||
case manageAccount(url: URL)
|
||||
case notifications
|
||||
case enableDeveloperOptions
|
||||
case developerOptions
|
||||
case advancedSettings
|
||||
case logout
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -196,6 +196,9 @@ struct SettingsScreen: View {
|
||||
.compoundListSectionFooter()
|
||||
.textSelection(.enabled)
|
||||
.padding(.top, 24)
|
||||
.onTapGesture(count: 7) {
|
||||
context.send(viewAction: .enableDeveloperOptions)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user