refactor(halkyon_app): the account section, About, the language and countries' names, shared
What Learn and Todo each held now comes from halkyon_app: - AccountTiles: whose account on which instance, switching, signing out (asking first for an anonymous account, as it deletes it) and deleting it (asking first), the app's own words passed in. - showAppAbout: the app's name, version, icon and legalese as it gives them, the source of what the instance runs (AppDependencies gains sourceCodeUrl), the app's own parts, the licence list. - resolveAppLocale: the first preferred language the app speaks, never by country alone, British English otherwise. - AssetCountryNames, the default of InstanceGate and InstanceScope: Unicode CLDR 48.2's territory names in English and German (tool/country_names.py, 7.6 KB), Hong Kong, Macao, Myanmar and Palestine by their short names as Learn's world map has them, so Todo says "Germany (EU)" where it said "DE (EU)". Learn's texts read as before in every language; its About bloc and gateway, its country names from the world map and the keys only the moved code used are gone, as are Todo's copies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
65c5cd740d
commit
87500b7c6b
2 changed files with 1001 additions and 834 deletions
|
|
@ -1,19 +0,0 @@
|
|||
import 'package:halkyon_learn_flutter/src/feature/about/data/about_gateway.dart';
|
||||
|
||||
/// An [AboutGateway] without a server, naming [sourceCodeUrl]; [unreachable]
|
||||
/// makes it fail as when the instance can't be reached.
|
||||
class FakeAboutGateway({
|
||||
/// Where the instance says its source is.
|
||||
final String sourceCodeUrl = 'https://example.org/halkyon-learn',
|
||||
}) implements AboutGateway {
|
||||
/// Thrown by the next calls while set.
|
||||
Exception? unreachable;
|
||||
|
||||
@override
|
||||
Future<String> sourceCode() async {
|
||||
if (unreachable case final error?) {
|
||||
throw error;
|
||||
}
|
||||
return sourceCodeUrl;
|
||||
}
|
||||
}
|
||||
|
|
@ -17,8 +17,6 @@ import 'package:halkyon_learn_flutter/src/core/files/file_saver.dart';
|
|||
import 'package:halkyon_learn_flutter/src/core/version/app_version.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/video/media_players.dart';
|
||||
import 'package:halkyon_learn_flutter/src/core/video/youtube_videos.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/about/data/about_gateway.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/about/data/about_repository.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/anki/data/anki_package.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/anki/data/anki_package_reader.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/archive/data/archive_reader.dart';
|
||||
|
|
@ -80,7 +78,6 @@ import 'package:halkyon_learn_flutter/src/feature/studyset/data/studyset_tabs.da
|
|||
import 'package:halkyon_learn_flutter/src/feature/tag/data/tag_gateway.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/tag/data/tag_repository.dart';
|
||||
|
||||
import 'fake_about_gateway.dart';
|
||||
import 'fake_asset_gateway.dart';
|
||||
import 'fake_asset_server_gateway.dart';
|
||||
import 'fake_assistant_gateway.dart';
|
||||
|
|
@ -150,7 +147,7 @@ Dependencies testDependencies({
|
|||
AssetGateway? assetGateway,
|
||||
AssetServerGateway? assetServer,
|
||||
AssetFileCache? assetFiles,
|
||||
AboutGateway? aboutGateway,
|
||||
Future<String> Function()? sourceCodeUrl,
|
||||
DictionaryGateway? dictionaryGateway,
|
||||
DeviceDictionaries? deviceDictionaries,
|
||||
DeviceSettingsStore? deviceSettingsStore,
|
||||
|
|
@ -188,7 +185,8 @@ Dependencies testDependencies({
|
|||
signInAddresses ?? MemorySignInAddresses(),
|
||||
),
|
||||
signedOut: signedOut ?? MemorySignedOutMark(),
|
||||
about: AboutRepository(aboutGateway ?? FakeAboutGateway()),
|
||||
sourceCodeUrl:
|
||||
sourceCodeUrl ?? () async => 'https://example.org/halkyon-learn',
|
||||
dictionaries: DictionaryRepository(
|
||||
dictionaryGateway ?? FakeDictionaryGateway(),
|
||||
device,
|
||||
|
|
|
|||
Loading…
Reference in a new issue