fix(app): a recovery phrase's and codes' files name the instance

Saved from several apps or instances, they differed by " (1)" alone. They
name the instance now, without the app's word, as an operator's apps share
one account: halkyon.eu-recovery-phrase.txt, localhost-8280-recovery-codes.txt.

Whats-New: A saved recovery phrase or recovery codes file now names its instance.
Whats-New-De: Gespeicherte Wiederherstellungsphrasen und -codes nennen jetzt ihre Instanz im Dateinamen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-11-05 15:26:43 +01:00
commit 2535da15de
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64
2 changed files with 72 additions and 19 deletions

View file

@ -32,17 +32,23 @@ void main() {
);
}
late TestAppDependencies dependencies;
Future<void> pumpView(WidgetTester tester, Widget view) async {
tester.view.physicalSize = const Size(412, 1400);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
dependencies = TestAppDependencies(gateway: FakeAuthGateway());
await tester.pumpWidget(
AppScope(
dependencies: TestAppDependencies(gateway: FakeAuthGateway()),
child: MaterialApp(
localizationsDelegates: testLocalizationsDelegates,
supportedLocales: HalkyonAppLocalizations.supportedLocales,
home: Scaffold(body: SingleChildScrollView(child: view)),
AppFrameScope(
frame: testFrame(),
child: AppScope(
dependencies: dependencies,
child: MaterialApp(
localizationsDelegates: testLocalizationsDelegates,
supportedLocales: HalkyonAppLocalizations.supportedLocales,
home: Scaffold(body: SingleChildScrollView(child: view)),
),
),
),
);
@ -83,6 +89,36 @@ void main() {
expect(clipboard, isNull);
});
test("a secret's file names the instance, without the app's word, whose "
'account it belongs to whichever app showed it (5 Nov 2026)', () {
const label = instanceFileLabel;
expect(label('learn.halkyon.eu', product: 'Learn'), 'halkyon.eu');
expect(label('todo.halkyon.eu', product: 'Todo'), 'halkyon.eu');
expect(label('notes.example.org', product: 'Learn'), 'notes.example.org');
expect(label('learn.example.org', product: 'Todo'), 'learn.example.org');
expect(label('localhost:8280', product: 'Meditate'), 'localhost-8280');
});
testWidgets("a saved phrase's file names the instance", (tester) async {
await pumpView(tester, const RecoveryPhraseView(phrase: 'one two'));
await tester.tap(find.text('Save as a file'));
await tester.pump();
expect(dependencies.fileSaver.saved.map((file) => file.name), [
'example.org-recovery-phrase.txt',
]);
});
testWidgets("saved recovery codes' file names the instance too", (
tester,
) async {
await pumpView(tester, const RecoveryCodesView(codes: ['AAAA-BBBB']));
await tester.tap(find.text('Save as a file'));
await tester.pump();
expect(dependencies.fileSaver.saved.map((file) => file.name), [
'example.org-recovery-codes.txt',
]);
});
group("an authenticator's key, for a device without a camera, is copied "
'and emptied again a minute later; never selectable (decided 3 Nov '
'2026)', () {

View file

@ -111,13 +111,9 @@ void main() {
),
]) {
await tester.pumpWidget(
AppScope(
testApp(
Scaffold(body: SingleChildScrollView(child: view)),
dependencies: TestAppDependencies(gateway: FakeAuthGateway()),
child: MaterialApp(
localizationsDelegates: testLocalizationsDelegates,
supportedLocales: HalkyonAppLocalizations.supportedLocales,
home: Scaffold(body: SingleChildScrollView(child: view)),
),
),
);
expect(find.byType(SecretScreen), findsOneWidget, reason: '$view');