Its operator sets DATA_LOCATION and BACKUP_LOCATION in deploy/.env (a
country's code or EU, the backups also none), and instance.info() hands
them on. The first start's tile and Switch account show the flag of
where the data is and the words, as labels ("Data: European Union",
"Backups: Switzerland"), the countries by the world map's CLDR names:
where the disks are, never which law governs. The flags come from the
flag package, which draws flag-icons; its MIT notice joins the licence
list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
52 lines
2.4 KiB
Dart
52 lines
2.4 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:halkyon_learn_flutter/src/app/instance_gate.dart';
|
|
import 'package:halkyon_learn_flutter/src/app/person_app.dart';
|
|
import 'package:halkyon_learn_flutter/src/core/bloc/app_bloc_observer.dart';
|
|
import 'package:halkyon_learn_flutter/src/core/country/country_names.dart';
|
|
import 'package:halkyon_learn_flutter/src/core/dependencies/dependencies.dart';
|
|
import 'package:halkyon_learn_flutter/src/core/instance/instance.dart';
|
|
import 'package:halkyon_learn_flutter/src/core/instance/instance_checker.dart';
|
|
import 'package:halkyon_learn_flutter/src/core/instance/instance_choice.dart';
|
|
import 'package:halkyon_learn_flutter/src/core/instance/instance_store.dart';
|
|
import 'package:halkyon_learn_flutter/src/core/theme/app_fonts.dart';
|
|
import 'package:halkyon_learn_flutter/src/feature/auth/widget/session_gate.dart';
|
|
import 'package:halkyon_learn_flutter/src/feature/dictionary/data/mecab_license.dart';
|
|
import 'package:halkyon_learn_flutter/src/feature/geo_map/data/cldr_license.dart';
|
|
import 'package:halkyon_learn_flutter/src/feature/instance/data/flag_icons_license.dart';
|
|
import 'package:halkyon_learn_flutter/src/feature/kanji/data/kanjivg_license.dart';
|
|
import 'package:material_ui/material_ui.dart';
|
|
import 'package:path/path.dart' as p;
|
|
import 'package:serverpod_flutter/serverpod_flutter.dart';
|
|
|
|
Future<void> main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
Bloc.observer = const AppBlocObserver();
|
|
registerAppFontLicenses();
|
|
registerKanjiVgLicense();
|
|
registerFlagIconsLicense();
|
|
registerCldrLicense();
|
|
registerMecabLicenses();
|
|
// The instance the build names (`--dart-define=SERVER_URL=…`, or
|
|
// `assets/config.json`): the first offered, and the one installs from
|
|
// before the choice go on with.
|
|
final builtIn = Instance.parse(await getServerUrl())!;
|
|
final device = await DeviceParts.create(builtIn: builtIn);
|
|
final instances = InstanceChoice(
|
|
FileInstanceStore(File(p.join(device.support, 'instances.json'))),
|
|
builtIn: builtIn,
|
|
forget: device.storage.forget,
|
|
);
|
|
await instances.load(usedBefore: device.storage.usedBefore());
|
|
runApp(
|
|
InstanceGate(
|
|
choice: instances,
|
|
checker: ServerpodInstanceChecker(),
|
|
countryNames: AssetCountryNames(),
|
|
open: (instance) => Dependencies.create(instance, device),
|
|
deviceSettings: device.deviceSettingsStore,
|
|
app: SessionGate(app: (person) => PersonApp(person: person)),
|
|
),
|
|
);
|
|
}
|