Files
DodoSSH/src/DodoSSH.Client.Android/DodoSshAndroidApplication.cs
T
jaap-jan 7a3a521c59
ci / build and test (push) Failing after 2s
ci / android head (push) Failing after 1s
Give the phone the rest of its screens, and a way in
All seven screens of the design, plus the two it does not draw because it starts at an
enrolled phone: naming a server, and choosing a passphrase.

The five states docs/android-port.md worried about losing at 360dp are all here and none
of them softened. The changed-key refusal is a full-screen panel rather than a bottom
sheet, because a sheet is swipe-to-dismiss by convention and that screen must have no way
forward. The recovery code raises FLAG_SECURE for its own state and lowers it afterwards,
so the sentence about screenshots is true rather than decorative. The delete
confirmations keep their counts and replace the row in place.

Signing in works, and the seam it needed is worth more than the implementation:
IAuthorizationCallback now sits between OidcClient and the loopback listener, so the two
heads differ in where the response arrives and in nothing else. PKCE, the state check,
discovery, the token exchange and the key binding stay one implementation — a second OIDC
client would be a second place for a security bug to live. The phone registers a
private-use scheme with the system rather than binding a loopback port, which on a shared
device any other app can do first.

The accessory key row needed TerminalWorkspace.SendInputAsync: ordinary typing goes from
the renderer straight down the socket, and there was no way in for the keys a software
keyboard does not have. Ctrl latches, because one thumb cannot chord, and the latch is
drawn — a modifier that is on and does not look on is how somebody sends ^L to a database
prompt believing they typed an l.

597 client tests green, including two new ones for the input path and one for the
terminal surface command. Nothing has run on a device.
2026-07-31 21:43:11 +02:00

52 lines
2.0 KiB
C#

// See the note at the top of MainActivity for why the platform namespaces are reached through `global::`.
using Avalonia;
using Avalonia.Android;
using DodoSSH.Client.Android.Platform;
using global::Android.App;
using global::Android.Runtime;
namespace DodoSSH.Client.Android;
/// <summary>
/// The Android <c>Application</c> object, and where Avalonia is configured.
/// </summary>
/// <remarks>
/// <para>
/// Avalonia 12 moved the <see cref="AppBuilder"/> hooks here from the activity, which is a better fit than
/// it first looks: an activity is destroyed and recreated, and the application object is not. The desktop
/// head's equivalent is <c>Program.BuildAvaloniaApp</c>.
/// </para>
/// <para>
/// Any Avalonia 11 sample will show this on <c>AvaloniaMainActivity&lt;App&gt;</c> instead. That type is
/// still here and is still what the launcher activity derives from — it simply no longer takes the
/// application as a type argument.
/// </para>
/// </remarks>
[Application(Label = "DodoSSH")]
public sealed class DodoSshAndroidApplication : AvaloniaAndroidApplication<DodoSshApp>
{
/// <remarks>
/// The JNI constructor, and the only one Android calls. It exists to hand the managed object its Java
/// peer; there is nothing to do in it and nothing may be done in it, because the application context is
/// not usable until <see cref="OnCreate"/>.
/// </remarks>
public DodoSshAndroidApplication(nint javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer)
{
}
/// <inheritdoc />
public override void OnCreate()
{
// Before Avalonia, and from the application rather than the activity: this is the context whose
// lifetime matches the composition root's, and reading filesDir is the first thing startup does.
PhoneEnvironment.Attach(this);
base.OnCreate();
}
/// <inheritdoc />
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) =>
base.CustomizeAppBuilder(builder).WithInterFont();
}