refactor(halkyon_app): the app says where GitHub is added later
The start screen's sentence after a GitHub account nobody here signs in
with named Learn's Profile screen. The package now says only that no
account signs in with it; the app's frame adds the rest as a sentence
of its own (thenAddGitHub), since the place takes its language's
grammar ("im Profil"). Learn's reads as before, which a test now pins.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
bf20134819
commit
38770569ea
16 changed files with 59 additions and 18 deletions
|
|
@ -577,7 +577,7 @@
|
|||
"startSignedOut": "Abgemeldet",
|
||||
"startOn": "Starte auf {instance}:",
|
||||
"startWithoutAccount": "Ohne Konto starten",
|
||||
"startNoGitHubAccount": "Noch kein Konto hier meldet sich mit diesem GitHub-Konto an. Starte ohne Konto und füge GitHub dann im Profil hinzu.",
|
||||
"startThenAddGitHub": "Starte ohne Konto und füge GitHub dann im Profil hinzu.",
|
||||
"startOtherInstance": "Andere Instanz verwenden",
|
||||
"instanceFirstStartSubtitle": "Wähle die Instanz, auf der deine Lernsets liegen sollen. Jede betreibt jemand; weitere kannst du später hinzufügen.",
|
||||
"instanceAddress": "Adresse der Instanz",
|
||||
|
|
|
|||
|
|
@ -653,7 +653,7 @@
|
|||
"startOn": "Start on {instance}:",
|
||||
"@startOn": {"placeholders": {"instance": {"type": "String"}}},
|
||||
"startWithoutAccount": "Start without an account",
|
||||
"startNoGitHubAccount": "No account here signs in with this GitHub account yet. Start without an account, then add GitHub in Profile.",
|
||||
"startThenAddGitHub": "Start without an account, then add GitHub in Profile.",
|
||||
"startOtherInstance": "Use another instance",
|
||||
"instanceFirstStartSubtitle": "Choose the instance to keep your studysets on. Someone runs each one; you can add others later.",
|
||||
"instanceAddress": "Instance address",
|
||||
|
|
|
|||
|
|
@ -3454,11 +3454,11 @@ abstract class AppLocalizations {
|
|||
/// **'Start without an account'**
|
||||
String get startWithoutAccount;
|
||||
|
||||
/// No description provided for @startNoGitHubAccount.
|
||||
/// No description provided for @startThenAddGitHub.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'No account here signs in with this GitHub account yet. Start without an account, then add GitHub in Profile.'**
|
||||
String get startNoGitHubAccount;
|
||||
/// **'Start without an account, then add GitHub in Profile.'**
|
||||
String get startThenAddGitHub;
|
||||
|
||||
/// No description provided for @startOtherInstance.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -2088,8 +2088,8 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||
String get startWithoutAccount => 'Ohne Konto starten';
|
||||
|
||||
@override
|
||||
String get startNoGitHubAccount =>
|
||||
'Noch kein Konto hier meldet sich mit diesem GitHub-Konto an. Starte ohne Konto und füge GitHub dann im Profil hinzu.';
|
||||
String get startThenAddGitHub =>
|
||||
'Starte ohne Konto und füge GitHub dann im Profil hinzu.';
|
||||
|
||||
@override
|
||||
String get startOtherInstance => 'Andere Instanz verwenden';
|
||||
|
|
|
|||
|
|
@ -2068,8 +2068,8 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||
String get startWithoutAccount => 'Start without an account';
|
||||
|
||||
@override
|
||||
String get startNoGitHubAccount =>
|
||||
'No account here signs in with this GitHub account yet. Start without an account, then add GitHub in Profile.';
|
||||
String get startThenAddGitHub =>
|
||||
'Start without an account, then add GitHub in Profile.';
|
||||
|
||||
@override
|
||||
String get startOtherInstance => 'Use another instance';
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import 'package:material_ui/material_ui.dart';
|
|||
|
||||
/// Halkyon Learn as halkyon_app's own screens know it (the first start, the
|
||||
/// start screen, the account switcher, signing in): its name and word, its
|
||||
/// kingfisher, its look and languages, and the two sentences only it can
|
||||
/// kingfisher, its look and languages, and the three sentences only it can
|
||||
/// say, in its own words, so every text reads as it did before they moved.
|
||||
const learnFrame = AppFrame(
|
||||
name: _name,
|
||||
|
|
@ -16,6 +16,7 @@ const learnFrame = AppFrame(
|
|||
exampleAddress: 'learn.example.org',
|
||||
firstStartSubtitle: _firstStartSubtitle,
|
||||
switchLeavesBehind: _switchLeavesBehind,
|
||||
thenAddGitHub: _thenAddGitHub,
|
||||
theme: learnTheme,
|
||||
localizationsDelegates: appLocalizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
|
|
@ -33,3 +34,6 @@ String _firstStartSubtitle(BuildContext context) =>
|
|||
|
||||
String _switchLeavesBehind(BuildContext context) =>
|
||||
AppLocalizations.of(context).emailSignInSwitchMessage;
|
||||
|
||||
String _thenAddGitHub(BuildContext context) =>
|
||||
AppLocalizations.of(context).startThenAddGitHub;
|
||||
|
|
|
|||
|
|
@ -152,6 +152,30 @@ void main() {
|
|||
expect(gateway.signIns, 1);
|
||||
});
|
||||
|
||||
testWidgets('from there, a GitHub account nobody here signs in with is said '
|
||||
'so, with where Learn adds GitHub', (tester) async {
|
||||
await openSettings(tester);
|
||||
await tester.tap(find.text('Sign out'));
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.text('Sign out').last);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
gateway.gitHubError = const GitHubSignInFailed(
|
||||
GitHubSignInProblem.unknownAccount,
|
||||
);
|
||||
await tester.tap(find.text('Sign in with GitHub'));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(
|
||||
find.text(
|
||||
'No account here signs in with this GitHub account yet. Start '
|
||||
'without an account, then add GitHub in Profile.',
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(gateway.status, const SignedOut());
|
||||
});
|
||||
|
||||
testWidgets('from there, an email address starts without an account and '
|
||||
'asks for the address on Profile', (tester) async {
|
||||
await openSettings(tester);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
"startWithoutAccount": "Ohne Konto starten",
|
||||
"startAnonymous": "Dein Fortschritt wird auf diesem Gerät gespeichert. Melde dich an, um ihn zu behalten.",
|
||||
"startGitHubFailed": "Anmeldung mit GitHub fehlgeschlagen.",
|
||||
"startNoGitHubAccount": "Noch kein Konto hier meldet sich mit diesem GitHub-Konto an. Starte ohne Konto und füge GitHub dann im Profil hinzu.",
|
||||
"startNoGitHubAccount": "Noch kein Konto hier meldet sich mit diesem GitHub-Konto an.",
|
||||
"startOtherInstance": "Andere Instanz verwenden",
|
||||
"emailSignInTitle": "Mit E-Mail fortfahren",
|
||||
"emailSignInIntro": "Wir schicken dir einen Code zum Anmelden. Diese Instanz behält nur einen Fingerabdruck deiner Adresse, nie die Adresse selbst, und schreibt ihr nur, wenn du einen Code anforderst.",
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@
|
|||
"startWithoutAccount": "Start without an account",
|
||||
"startAnonymous": "Progress is saved on this device. Sign in to keep it.",
|
||||
"startGitHubFailed": "Couldn't sign in with GitHub.",
|
||||
"startNoGitHubAccount": "No account here signs in with this GitHub account yet. Start without an account, then add GitHub in Profile.",
|
||||
"startNoGitHubAccount": "No account here signs in with this GitHub account yet.",
|
||||
"startOtherInstance": "Use another instance",
|
||||
"emailSignInTitle": "Continue with email",
|
||||
"emailSignInIntro": "We mail you a code to sign in. This instance keeps only a fingerprint of your address, never the address itself, and writes to it only when you ask for a code.",
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ abstract class HalkyonAppLocalizations {
|
|||
/// No description provided for @startNoGitHubAccount.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'No account here signs in with this GitHub account yet. Start without an account, then add GitHub in Profile.'**
|
||||
/// **'No account here signs in with this GitHub account yet.'**
|
||||
String get startNoGitHubAccount;
|
||||
|
||||
/// No description provided for @startOtherInstance.
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ class HalkyonAppLocalizationsDe extends HalkyonAppLocalizations {
|
|||
|
||||
@override
|
||||
String get startNoGitHubAccount =>
|
||||
'Noch kein Konto hier meldet sich mit diesem GitHub-Konto an. Starte ohne Konto und füge GitHub dann im Profil hinzu.';
|
||||
'Noch kein Konto hier meldet sich mit diesem GitHub-Konto an.';
|
||||
|
||||
@override
|
||||
String get startOtherInstance => 'Andere Instanz verwenden';
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ class HalkyonAppLocalizationsEn extends HalkyonAppLocalizations {
|
|||
|
||||
@override
|
||||
String get startNoGitHubAccount =>
|
||||
'No account here signs in with this GitHub account yet. Start without an account, then add GitHub in Profile.';
|
||||
'No account here signs in with this GitHub account yet.';
|
||||
|
||||
@override
|
||||
String get startOtherInstance => 'Use another instance';
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import 'package:material_ui/material_ui.dart';
|
|||
typedef LookSettings = ({ThemeMode themeMode, Locale? locale});
|
||||
|
||||
/// What this package's own screens need to know of the app they are part
|
||||
/// of: its name and look, and the few words only it can say. `InstanceGate`
|
||||
/// of: its name and look, and the few sentences only it can say. `InstanceGate`
|
||||
/// hands it down ([AppFrameScope]) to every screen beneath, the person's
|
||||
/// app included.
|
||||
final class const AppFrame({
|
||||
|
|
@ -35,6 +35,13 @@ final class const AppFrame({
|
|||
/// can't be combined with it yet: if you switch, they are deleted.").
|
||||
required final String Function(BuildContext context) switchLeavesBehind,
|
||||
|
||||
/// What the start screen says after a GitHub account nobody here signs in
|
||||
/// with: how to have it anyway, naming where the app adds a way to sign in
|
||||
/// ("Start without an account, then add GitHub in Profile."). A sentence of
|
||||
/// its own, as the place takes the grammar of the app's language ("im
|
||||
/// Profil").
|
||||
required final String Function(BuildContext context) thenAddGitHub,
|
||||
|
||||
/// The app's theme in a [Brightness].
|
||||
required final ThemeData Function(Brightness brightness) theme,
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:halkyon_app/l10n/halkyon_app_localizations.dart';
|
||||
import 'package:halkyon_app/src/app/app_frame.dart';
|
||||
import 'package:halkyon_app/src/app/app_scope.dart';
|
||||
import 'package:halkyon_app/src/auth/bloc/session_bloc.dart';
|
||||
import 'package:halkyon_app/src/instance/instance_scope.dart';
|
||||
|
|
@ -105,8 +106,10 @@ class _StartScreenState() extends State<StartScreen> {
|
|||
const SizedBox(height: 16),
|
||||
Text(
|
||||
switch (problem) {
|
||||
// Whole sentences: the app's names where.
|
||||
SignedOutProblem.noGitHubAccount =>
|
||||
l10n.startNoGitHubAccount,
|
||||
'${l10n.startNoGitHubAccount} '
|
||||
'${AppFrameScope.of(context).thenAddGitHub(context)}',
|
||||
SignedOutProblem.failed => l10n.startGitHubFailed,
|
||||
},
|
||||
textAlign: TextAlign.center,
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ AppFrame testFrame() => AppFrame(
|
|||
switchLeavesBehind: (context) =>
|
||||
"The notes on this device can't be combined with it yet: if you "
|
||||
'switch, they are deleted.',
|
||||
thenAddGitHub: (context) =>
|
||||
'Start without an account, then add GitHub in Settings.',
|
||||
theme: appTheme,
|
||||
localizationsDelegates: testLocalizationsDelegates,
|
||||
supportedLocales: HalkyonAppLocalizations.supportedLocales,
|
||||
|
|
|
|||
|
|
@ -113,8 +113,9 @@ void main() {
|
|||
await tester.pumpAndSettle();
|
||||
expect(
|
||||
find.text(
|
||||
// The package's sentence, then the app's on where GitHub is added.
|
||||
'No account here signs in with this GitHub account yet. Start '
|
||||
'without an account, then add GitHub in Profile.',
|
||||
'without an account, then add GitHub in Settings.',
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue