iOS: avoid onboarding modal when gateway already configured

This commit is contained in:
Mariano Belinky
2026-02-15 16:35:10 +00:00
committed by Mariano Belinky
parent b0f7428c29
commit 7843ab5e45
2 changed files with 12 additions and 1 deletions

View File

@@ -25,6 +25,9 @@ enum OnboardingStateStore {
@MainActor
static func shouldPresentOnLaunch(appModel: NodeAppModel, defaults: UserDefaults = .standard) -> Bool {
if defaults.bool(forKey: Self.completedDefaultsKey) { return false }
// If we have a last-known connection config, don't force onboarding on launch. Auto-connect
// should handle reconnecting, and users can always open onboarding manually if needed.
if GatewaySettingsStore.loadLastGatewayConnection() != nil { return false }
return appModel.gatewayServerName == nil
}

View File

@@ -67,7 +67,9 @@ struct RootCanvas: View {
SettingsTab()
case .chat:
ChatSheet(
gateway: self.appModel.operatorSession,
// Mobile chat UI should use the node role RPC surface (chat.* / sessions.*)
// to avoid requiring operator scopes like operator.read.
gateway: self.appModel.gatewaySession,
sessionKey: self.appModel.mainSessionKey,
agentName: self.appModel.activeAgentName,
userAccent: self.appModel.seamColor)
@@ -109,6 +111,7 @@ struct RootCanvas: View {
if newValue != nil {
self.onboardingComplete = true
self.hasConnectedOnce = true
OnboardingStateStore.markCompleted(mode: nil)
}
self.maybeAutoOpenSettings()
}
@@ -176,6 +179,11 @@ struct RootCanvas: View {
guard !self.didEvaluateOnboarding else { return }
self.didEvaluateOnboarding = true
// If we've connected before or have a saved connection config, don't force onboarding on launch.
// Auto-connect + Settings cover recovery without blocking the UI behind onboarding.
if self.hasConnectedOnce || self.onboardingComplete || self.hasExistingGatewayConfig() {
return
}
guard OnboardingStateStore.shouldPresentOnLaunch(appModel: self.appModel) else { return }
self.onboardingAllowSkip = true
self.showOnboarding = true