feat(app)!: no anonymous accounts on the device (ADR 0020, D4, D25)

Every account has a way in, so the apps make no anonymous account any
more. The start screen shows whenever nobody is signed in, a first
start included, and offers SimpleLogin, a password and GitHub for those
who have it, with no start without an account. An instance out of reach
is said so, with Try again, and one offering no way to create an account
too. An anonymous account's session left from before is deleted as the
app starts (D25), falling back to signing out on the device.

What only anonymous accounts needed goes: signing in anonymously, the
signed-out mark, adding GitHub to an account and switching to a GitHub
account from the Profile tab (with its Cancel, the only one), an
anonymous device's own keys, the warning that signing out deletes the
account, and the texts about keeping progress. Settings says on which
instance the account is signed in. Learn's publishing, reports and
suggestions and its learner count no longer ask whether the person has
an identity: everyone signed in has one.

The server still offers anonymous sign-in until the next commit, so
older apps keep working until v0.20.0 raises the minimum build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-24 14:50:55 +02:00
commit 5b9df73756
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -44,7 +44,8 @@ void main() {
/// Starts the app on a device that [usedBefore] the choice existed, with
/// [answering] instances answering a check, saying where they keep data
/// as [locations] has it, and the account on each [signedOut].
/// as [locations] has it, and nobody signed in on each where [signedOut]
/// (a device starting there).
Future<InstanceChoice> start(
WidgetTester tester, {
bool usedBefore = false,
@ -77,8 +78,12 @@ void main() {
readLook: () async => (themeMode: ThemeMode.light, locale: null),
open: (instance) async {
opened.add(instance);
final opening = TestAppDependencies(serverName: instance.name);
await opening.signedOut.write(signedOut: signedOut);
final opening = TestAppDependencies(
serverName: instance.name,
gateway: FakeAuthGateway(
status: signedOut ? const SignedOut() : FakeAuthGateway.person,
),
);
dependencies.add(opening);
return opening;
},
@ -97,9 +102,9 @@ void main() {
await tester.pumpAndSettle();
}
testWidgets('a new install asks for the instance first, and opens the '
"build's in one tap", (tester) async {
await start(tester);
testWidgets('a new install asks for the instance first, opens the '
"build's in one tap, and asks how to start there", (tester) async {
await start(tester, signedOut: true);
// The wordmark says it to screen readers, naming the app.
expect(find.bySemanticsLabel('Welcome to Halkyon Test'), findsOneWidget);
@ -115,7 +120,7 @@ void main() {
await tester.pumpAndSettle();
expect(opened, [builtIn]);
expect(find.text('Home of anonymous-1'), findsOneWidget);
expect(find.text('Start on learn.halkyon.eu:'), findsOneWidget);
});
testWidgets("the build's instance shows where it keeps people's data, "
@ -254,7 +259,7 @@ void main() {
await start(tester, usedBefore: true);
expect(opened, [builtIn]);
expect(find.text('Home of anonymous-1'), findsOneWidget);
expect(find.text('Home of person-1'), findsOneWidget);
});
testWidgets('Switch account moves between the accounts on the device, '
@ -276,12 +281,12 @@ void main() {
// Each account with where its instance says it keeps people's data.
expect(find.text('Data: Switzerland\nNo backups'), findsOne);
expect(find.byType(Flag), findsOne);
expect(find.text('Anonymous'), findsOne, reason: 'the account in use');
expect(find.text('Signed in'), findsOne, reason: 'the account in use');
await tester.tap(find.text('learn.example.org'));
await tester.pumpAndSettle();
expect(opened, [builtIn, other]);
expect(dependencies.first.disposed, isTrue);
expect(find.text('Home of anonymous-1'), findsOneWidget);
expect(find.text('Home of person-1'), findsOneWidget);
await openSwitcher(tester);
await tester.tap(find.byTooltip('Remove account'));