feat(app): phone onboarding (server, then password) kept across launches; a known server opens straight into the app; a refused session asks for the password

This commit is contained in:
2026-10-23 23:52:34 +01:00
parent 57504b73d4
commit 636115bb22
12 changed files with 650 additions and 33 deletions
+16 -6
View File
@@ -4,14 +4,15 @@ import 'package:flutter/widgets.dart';
import 'app_url_strategy.dart';
import 'pipelines_app.dart';
import 'pipelines_root.dart';
import 'server_endpoint.dart';
import '../features/settings/settings_store.dart';
/// Native builds must supply their server explicitly; there is no baked host.
const configuredServerUrl = String.fromEnvironment('PIPELINES_SERVER_URL');
/// Resolves the launch endpoint, loading the last saved native endpoint only
/// when no build-time endpoint was supplied.
/// Resolves the launch endpoint: on a phone the server saved at onboarding,
/// else the build's default (which only pre-fills onboarding until saved).
Future<ServerEndpoint> resolveLaunchServer({
Uri? base,
String configured = configuredServerUrl,
@@ -20,14 +21,15 @@ Future<ServerEndpoint> resolveLaunchServer({
}) async {
WidgetsFlutterBinding.ensureInitialized();
var endpoint = configured;
if (!web && endpoint.trim().isEmpty) {
if (!web) {
try {
endpoint =
final saved =
(await (settingsStore ?? const SharedPreferencesSettingsStore())
.load())
.serverUrl;
if (saved.trim().isNotEmpty) endpoint = saved;
} catch (_) {
endpoint = '';
// Keep the build's default.
}
}
return ServerEndpoint.resolve(
@@ -52,5 +54,13 @@ Future<void> runPipelinesApp({
configured: configured,
settingsStore: settingsStore,
);
runApp(PipelinesApp(server: server));
runApp(
kIsWeb
? PipelinesApp(server: server)
: PipelinesRoot(
server: server,
buildDefault: configured,
signedIn: ServerSession.cookie != null,
),
);
}