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:
Stefan Ceriu
2024-06-11 17:17:46 +03:00
committed by Stefan Ceriu
parent f11a610f46
commit a2faae20c2
17 changed files with 28 additions and 63 deletions
@@ -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
@@ -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) {
@@ -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)