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",
|
"startSignedOut": "Abgemeldet",
|
||||||
"startOn": "Starte auf {instance}:",
|
"startOn": "Starte auf {instance}:",
|
||||||
"startWithoutAccount": "Ohne Konto starten",
|
"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",
|
"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.",
|
"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",
|
"instanceAddress": "Adresse der Instanz",
|
||||||
|
|
|
||||||
|
|
@ -653,7 +653,7 @@
|
||||||
"startOn": "Start on {instance}:",
|
"startOn": "Start on {instance}:",
|
||||||
"@startOn": {"placeholders": {"instance": {"type": "String"}}},
|
"@startOn": {"placeholders": {"instance": {"type": "String"}}},
|
||||||
"startWithoutAccount": "Start without an account",
|
"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",
|
"startOtherInstance": "Use another instance",
|
||||||
"instanceFirstStartSubtitle": "Choose the instance to keep your studysets on. Someone runs each one; you can add others later.",
|
"instanceFirstStartSubtitle": "Choose the instance to keep your studysets on. Someone runs each one; you can add others later.",
|
||||||
"instanceAddress": "Instance address",
|
"instanceAddress": "Instance address",
|
||||||
|
|
|
||||||
|
|
@ -3454,11 +3454,11 @@ abstract class AppLocalizations {
|
||||||
/// **'Start without an account'**
|
/// **'Start without an account'**
|
||||||
String get startWithoutAccount;
|
String get startWithoutAccount;
|
||||||
|
|
||||||
/// No description provided for @startNoGitHubAccount.
|
/// No description provided for @startThenAddGitHub.
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// 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.'**
|
/// **'Start without an account, then add GitHub in Profile.'**
|
||||||
String get startNoGitHubAccount;
|
String get startThenAddGitHub;
|
||||||
|
|
||||||
/// No description provided for @startOtherInstance.
|
/// No description provided for @startOtherInstance.
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -2088,8 +2088,8 @@ class AppLocalizationsDe extends AppLocalizations {
|
||||||
String get startWithoutAccount => 'Ohne Konto starten';
|
String get startWithoutAccount => 'Ohne Konto starten';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get startNoGitHubAccount =>
|
String get startThenAddGitHub =>
|
||||||
'Noch kein Konto hier meldet sich mit diesem GitHub-Konto an. Starte ohne Konto und füge GitHub dann im Profil hinzu.';
|
'Starte ohne Konto und füge GitHub dann im Profil hinzu.';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get startOtherInstance => 'Andere Instanz verwenden';
|
String get startOtherInstance => 'Andere Instanz verwenden';
|
||||||
|
|
|
||||||
|
|
@ -2068,8 +2068,8 @@ class AppLocalizationsEn extends AppLocalizations {
|
||||||
String get startWithoutAccount => 'Start without an account';
|
String get startWithoutAccount => 'Start without an account';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get startNoGitHubAccount =>
|
String get startThenAddGitHub =>
|
||||||
'No account here signs in with this GitHub account yet. Start without an account, then add GitHub in Profile.';
|
'Start without an account, then add GitHub in Profile.';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get startOtherInstance => 'Use another instance';
|
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
|
/// 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
|
/// 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.
|
/// say, in its own words, so every text reads as it did before they moved.
|
||||||
const learnFrame = AppFrame(
|
const learnFrame = AppFrame(
|
||||||
name: _name,
|
name: _name,
|
||||||
|
|
@ -16,6 +16,7 @@ const learnFrame = AppFrame(
|
||||||
exampleAddress: 'learn.example.org',
|
exampleAddress: 'learn.example.org',
|
||||||
firstStartSubtitle: _firstStartSubtitle,
|
firstStartSubtitle: _firstStartSubtitle,
|
||||||
switchLeavesBehind: _switchLeavesBehind,
|
switchLeavesBehind: _switchLeavesBehind,
|
||||||
|
thenAddGitHub: _thenAddGitHub,
|
||||||
theme: learnTheme,
|
theme: learnTheme,
|
||||||
localizationsDelegates: appLocalizationsDelegates,
|
localizationsDelegates: appLocalizationsDelegates,
|
||||||
supportedLocales: AppLocalizations.supportedLocales,
|
supportedLocales: AppLocalizations.supportedLocales,
|
||||||
|
|
@ -33,3 +34,6 @@ String _firstStartSubtitle(BuildContext context) =>
|
||||||
|
|
||||||
String _switchLeavesBehind(BuildContext context) =>
|
String _switchLeavesBehind(BuildContext context) =>
|
||||||
AppLocalizations.of(context).emailSignInSwitchMessage;
|
AppLocalizations.of(context).emailSignInSwitchMessage;
|
||||||
|
|
||||||
|
String _thenAddGitHub(BuildContext context) =>
|
||||||
|
AppLocalizations.of(context).startThenAddGitHub;
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,30 @@ void main() {
|
||||||
expect(gateway.signIns, 1);
|
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 '
|
testWidgets('from there, an email address starts without an account and '
|
||||||
'asks for the address on Profile', (tester) async {
|
'asks for the address on Profile', (tester) async {
|
||||||
await openSettings(tester);
|
await openSettings(tester);
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
"startWithoutAccount": "Ohne Konto starten",
|
"startWithoutAccount": "Ohne Konto starten",
|
||||||
"startAnonymous": "Dein Fortschritt wird auf diesem Gerät gespeichert. Melde dich an, um ihn zu behalten.",
|
"startAnonymous": "Dein Fortschritt wird auf diesem Gerät gespeichert. Melde dich an, um ihn zu behalten.",
|
||||||
"startGitHubFailed": "Anmeldung mit GitHub fehlgeschlagen.",
|
"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",
|
"startOtherInstance": "Andere Instanz verwenden",
|
||||||
"emailSignInTitle": "Mit E-Mail fortfahren",
|
"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.",
|
"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",
|
"startWithoutAccount": "Start without an account",
|
||||||
"startAnonymous": "Progress is saved on this device. Sign in to keep it.",
|
"startAnonymous": "Progress is saved on this device. Sign in to keep it.",
|
||||||
"startGitHubFailed": "Couldn't sign in with GitHub.",
|
"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",
|
"startOtherInstance": "Use another instance",
|
||||||
"emailSignInTitle": "Continue with email",
|
"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.",
|
"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.
|
/// No description provided for @startNoGitHubAccount.
|
||||||
///
|
///
|
||||||
/// In en, this message translates to:
|
/// 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;
|
String get startNoGitHubAccount;
|
||||||
|
|
||||||
/// No description provided for @startOtherInstance.
|
/// No description provided for @startOtherInstance.
|
||||||
|
|
|
||||||
|
|
@ -147,7 +147,7 @@ class HalkyonAppLocalizationsDe extends HalkyonAppLocalizations {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get startNoGitHubAccount =>
|
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
|
@override
|
||||||
String get startOtherInstance => 'Andere Instanz verwenden';
|
String get startOtherInstance => 'Andere Instanz verwenden';
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ class HalkyonAppLocalizationsEn extends HalkyonAppLocalizations {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get startNoGitHubAccount =>
|
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
|
@override
|
||||||
String get startOtherInstance => 'Use another instance';
|
String get startOtherInstance => 'Use another instance';
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import 'package:material_ui/material_ui.dart';
|
||||||
typedef LookSettings = ({ThemeMode themeMode, Locale? locale});
|
typedef LookSettings = ({ThemeMode themeMode, Locale? locale});
|
||||||
|
|
||||||
/// What this package's own screens need to know of the app they are part
|
/// 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
|
/// hands it down ([AppFrameScope]) to every screen beneath, the person's
|
||||||
/// app included.
|
/// app included.
|
||||||
final class const AppFrame({
|
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.").
|
/// can't be combined with it yet: if you switch, they are deleted.").
|
||||||
required final String Function(BuildContext context) switchLeavesBehind,
|
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].
|
/// The app's theme in a [Brightness].
|
||||||
required final ThemeData Function(Brightness brightness) theme,
|
required final ThemeData Function(Brightness brightness) theme,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:halkyon_app/l10n/halkyon_app_localizations.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/app/app_scope.dart';
|
||||||
import 'package:halkyon_app/src/auth/bloc/session_bloc.dart';
|
import 'package:halkyon_app/src/auth/bloc/session_bloc.dart';
|
||||||
import 'package:halkyon_app/src/instance/instance_scope.dart';
|
import 'package:halkyon_app/src/instance/instance_scope.dart';
|
||||||
|
|
@ -105,8 +106,10 @@ class _StartScreenState() extends State<StartScreen> {
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Text(
|
Text(
|
||||||
switch (problem) {
|
switch (problem) {
|
||||||
|
// Whole sentences: the app's names where.
|
||||||
SignedOutProblem.noGitHubAccount =>
|
SignedOutProblem.noGitHubAccount =>
|
||||||
l10n.startNoGitHubAccount,
|
'${l10n.startNoGitHubAccount} '
|
||||||
|
'${AppFrameScope.of(context).thenAddGitHub(context)}',
|
||||||
SignedOutProblem.failed => l10n.startGitHubFailed,
|
SignedOutProblem.failed => l10n.startGitHubFailed,
|
||||||
},
|
},
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ AppFrame testFrame() => AppFrame(
|
||||||
switchLeavesBehind: (context) =>
|
switchLeavesBehind: (context) =>
|
||||||
"The notes on this device can't be combined with it yet: if you "
|
"The notes on this device can't be combined with it yet: if you "
|
||||||
'switch, they are deleted.',
|
'switch, they are deleted.',
|
||||||
|
thenAddGitHub: (context) =>
|
||||||
|
'Start without an account, then add GitHub in Settings.',
|
||||||
theme: appTheme,
|
theme: appTheme,
|
||||||
localizationsDelegates: testLocalizationsDelegates,
|
localizationsDelegates: testLocalizationsDelegates,
|
||||||
supportedLocales: HalkyonAppLocalizations.supportedLocales,
|
supportedLocales: HalkyonAppLocalizations.supportedLocales,
|
||||||
|
|
|
||||||
|
|
@ -113,8 +113,9 @@ void main() {
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(
|
expect(
|
||||||
find.text(
|
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 '
|
'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,
|
findsOneWidget,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue