Add a Developer Options button to the AuthenticationStartScreen on Nightly builds. (#5472)

* Add a Developer Options button to the AuthenticationStartScreen on Nightly builds.

* Make sure the Developer Options are actually shown in the settings screen on Nightlies.
This commit is contained in:
Doug
2026-04-23 15:52:47 +01:00
committed by GitHub
parent 5e2210f1e8
commit 95c32225a8
12 changed files with 122 additions and 29 deletions
@@ -22,6 +22,7 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
private let navigationStackCoordinator: NavigationStackCoordinator
private let appMediator: AppMediatorProtocol
private let appSettings: AppSettings
private let appHooks: AppHooks
private let analytics: AnalyticsService
private let userIndicatorController: UserIndicatorControllerProtocol
@@ -46,6 +47,8 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
/// The screen to report an error.
case bugReportFlow
/// The screen to toggle feature flags.
case developerOptions
/// The flow is complete.
case complete
@@ -62,8 +65,6 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
case loginWithQR
/// Show the server confirmation screen.
case confirmServer(AuthenticationFlow)
/// The user encountered a problem.
case reportProblem
/// The QR login flow was aborted.
case cancelledLoginWithQR
@@ -84,9 +85,16 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
/// The password login was aborted.
case cancelledPasswordLogin(previousState: State)
/// The user encountered a problem.
case reportProblem
/// The user has finished reporting a problem (or viewing the logs).
case bugReportFlowComplete
/// The user wants to toggle a feature flag.
case developerOptions
/// The user finished toggling feature flags.
case dismissedDeveloperOptions
/// The user has successfully signed in. The new session can be found in the `userInfo`.
case signedIn
}
@@ -106,6 +114,7 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
navigationRootCoordinator: NavigationRootCoordinator,
appMediator: AppMediatorProtocol,
appSettings: AppSettings,
appHooks: AppHooks,
analytics: AnalyticsService,
userIndicatorController: UserIndicatorControllerProtocol) {
self.authenticationService = authenticationService
@@ -113,6 +122,7 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
self.navigationRootCoordinator = navigationRootCoordinator
self.appMediator = appMediator
self.appSettings = appSettings
self.appHooks = appHooks
self.analytics = analytics
self.userIndicatorController = userIndicatorController
@@ -163,6 +173,8 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
navigationStackCoordinator.popToRoot(animated: animated)
case .bugReportFlow:
navigationStackCoordinator.setSheetCoordinator(nil)
case .developerOptions:
navigationStackCoordinator.setSheetCoordinator(nil)
case .complete:
fatalError()
}
@@ -231,6 +243,13 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
}
stateMachine.addRoutes(event: .bugReportFlowComplete, transitions: [.bugReportFlow => .startScreen])
// Developer Options
stateMachine.addRoutes(event: .developerOptions, transitions: [.startScreen => .developerOptions]) { [weak self] _ in
self?.showDeveloperOptionsScreen()
}
stateMachine.addRoutes(event: .dismissedDeveloperOptions, transitions: [.developerOptions => .startScreen])
// Completion
stateMachine.addRoutes(event: .signedIn, transitions: [.qrCodeLoginScreen => .complete,
@@ -285,13 +304,16 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
stateMachine.tryEvent(.confirmServer(.login))
case .register:
stateMachine.tryEvent(.confirmServer(.register))
case .reportProblem:
stateMachine.tryEvent(.reportProblem)
case .loginDirectlyWithOIDC(let oidcData, let window):
stateMachine.tryEvent(.continueWithOIDC, userInfo: (oidcData, window))
case .loginDirectlyWithPassword(let loginHint):
stateMachine.tryEvent(.continueWithPassword, userInfo: loginHint)
case .reportProblem:
stateMachine.tryEvent(.reportProblem)
case .developerOptions:
stateMachine.tryEvent(.developerOptions)
}
}
.store(in: &cancellables)
@@ -465,6 +487,28 @@ class AuthenticationFlowCoordinator: FlowCoordinatorProtocol {
coordinator.start()
}
// MARK: - Developer Options
private func showDeveloperOptionsScreen() {
let stackCoordinator = NavigationStackCoordinator()
let coordinator = DeveloperOptionsScreenCoordinator(appSettings: appSettings,
appHooks: appHooks,
clientProxy: nil)
coordinator.actions
.sink { action in
switch action {
case .clearCache:
break // Not sent when clientProxy == nil
}
}
.store(in: &cancellables)
stackCoordinator.setRootCoordinator(coordinator)
navigationStackCoordinator.setSheetCoordinator(stackCoordinator) { [weak self] in
self?.stateMachine.tryEvent(.dismissedDeveloperOptions)
}
}
// MARK: - Completion
private func userHasSignedIn(userSession: UserSessionProtocol) {