From 0e6bdb75db28a85ee599d0b67740c1e79d3727b3 Mon Sep 17 00:00:00 2001 From: Laurens Bezemer | DodoTech Date: Tue, 20 Oct 2026 17:26:14 +0200 Subject: [PATCH] Android: split the Spelunk sign-in and the phone's own sign-in out of ComposeShell, which MA0051 found too long The sign-in rework added the SpelunkAccounts argument to ComposeShell and took it to 67 lines, over the analyzer's 60, which failed the android head job of df64012. The two delegates' construction moves into helpers of their own, with the comments that explained them; nothing they do changes. Co-Authored-By: Claude Opus 5.5 --- src/DodoSSH.Client.Android/App.axaml.cs | 32 +++++++++++++++---------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/DodoSSH.Client.Android/App.axaml.cs b/src/DodoSSH.Client.Android/App.axaml.cs index 38a93f1..9b23117 100644 --- a/src/DodoSSH.Client.Android/App.axaml.cs +++ b/src/DodoSSH.Client.Android/App.axaml.cs @@ -246,11 +246,7 @@ public sealed partial class DodoSshApp : Avalonia.Application knownHosts, deviceKeys, - // Difference 4: the system browser by intent, and the response by intent too rather than on a - // loopback socket. See AndroidAuthorization for why the desktop's listener is not reused. - async (url, cancellationToken) => await ServerConnection - .SignInAsync(url, browser, TimeProvider.System, cancellationToken, ConfigureAndroidOidc) - .ConfigureAwait(false), + SignInThroughBrowser(browser), TimeProvider.System, connections, @@ -273,14 +269,7 @@ public sealed partial class DodoSshApp : Avalonia.Application updates: updates, - // Signing in to Spelunk comes back the way signing in to DodoSSH does — by intent, to the same - // registered scheme, at the dev.dodotech.dodossh:/callback Spelunk allows — and names this phone as - // the account's device list does, for difference 5's reason. - spelunkAccounts: new SpelunkAccounts( - browser, - path => new AndroidRedirectCallback(path), - TimeProvider.System, - PhoneEnvironment.DeviceName)); + spelunkAccounts: PhoneSpelunkAccounts(browser)); // Started rather than awaited: framework initialisation must not block on a schema migration. The // view model shows its own progress and handles its own failures. @@ -289,6 +278,23 @@ public sealed partial class DodoSshApp : Avalonia.Application return viewModel; } + /// + /// Difference 4: the system browser by intent, and the response by intent too rather than on a loopback + /// socket. See AndroidAuthorization for why the desktop's listener is not reused. + /// + private static MainWindowViewModel.SignInHandler SignInThroughBrowser(AndroidBrowserLauncher browser) => + async (url, cancellationToken) => await ServerConnection + .SignInAsync(url, browser, TimeProvider.System, cancellationToken, ConfigureAndroidOidc) + .ConfigureAwait(false); + + /// + /// Signing in to Spelunk comes back the way signing in to DodoSSH does — by intent, to the same registered + /// scheme, at the dev.dodotech.dodossh:/callback Spelunk allows — and names this phone as the account's + /// device list does, for difference 5's reason. + /// + private static SpelunkAccounts PhoneSpelunkAccounts(AndroidBrowserLauncher browser) => + new(browser, path => new AndroidRedirectCallback(path), TimeProvider.System, PhoneEnvironment.DeviceName); + /// /// Difference 4: where the authorization response comes back to. ///