halkyon/packages/halkyon_app
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Tizian 「ティツィアーン」 af1dbee509
build: Melos, a Dart check and every path for the single repository
- Melos 8.9 as the root's dev dependency, with scripts across the
  workspace (analyze, test:dart, test:flutter, generate, check) and its
  filters (--diff, --include-dependents); cli_util overridden to 0.5.2
  for it, since Learn's flutter_launcher_icons asks for 0.4 and uses only
  its logger, unchanged in 0.5.
- tool/check.dart in place of tool/check.sh: packages, formatting of our
  own files, analysis, the tools' tests, then every package's tests
  through Melos (--changed-since=<commit> for only what changed and what
  depends on it). tool/pre-push is the hook: the signature check, then
  the checks. CI generates every server's code and runs the same check.
- The images build from the root with a workspace narrowed to what they
  need (tool/workspace_only.sh); compose, the deploy's migration test,
  the snap, the release script, the editor's launch files and Learn's
  asset tools (run from apps/learn) follow the new layout.
- The project's source is named as project-halkyon/halkyon (source link,
  snap, F-Droid listing, release uploads); the AGPL packages carry the
  licence's own text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-10-22 18:11:04 +02:00
..
assets halkyon_app: data locations as precise as a country or a state 2026-10-19 18:50:26 +02:00
lib halkyon_app: data locations as precise as a country or a state 2026-10-19 18:50:26 +02:00
test halkyon_app: data locations as precise as a country or a state 2026-10-19 18:50:26 +02:00
tool build: Melos, a Dart check and every path for the single repository 2026-10-22 18:11:04 +02:00
.gitignore halkyon_app: instances, sign-in and sync plumbing for Halkyon's apps 2026-10-19 15:31:40 +02:00
analysis_options.yaml halkyon_app: instances, sign-in and sync plumbing for Halkyon's apps 2026-10-19 15:31:40 +02:00
CHANGELOG.md halkyon_app: instances, sign-in and sync plumbing for Halkyon's apps 2026-10-19 15:31:40 +02:00
l10n.yaml halkyon_app: instances, sign-in and sync plumbing for Halkyon's apps 2026-10-19 15:31:40 +02:00
LICENSE build: Melos, a Dart check and every path for the single repository 2026-10-22 18:11:04 +02:00
pubspec.yaml halkyon_app: data locations as precise as a country or a state 2026-10-19 18:50:26 +02:00
README.md halkyon_app: data locations as precise as a country or a state 2026-10-19 18:50:26 +02:00

halkyon_app

What every Halkyon app (Learn, Todo, Train) is built around, on an instance's halkyon_base module: the instances a device keeps an account on, signing in, each person's data opened and closed, and syncing it. Taken from Halkyon Learn, which it was written for, so it behaves as Learn's own did; the texts are in British English, American English and German, and where they name the app, they name yours.

Written as the apps are: Dart 3.13's primary constructors, Material from package:material_ui, Lucide icons, blocs (flutter_bloc), LeanCode's lints.

What it holds

  • Instances (lib/src/instance/): Instance (an address as people type it), InstanceChoice (those the device keeps an account on, one in use; FileInstanceStore), InstanceStorage (each instance's people's folders and session key), InstanceChecker (does an address answer, where does it keep people's data; ServerpodInstanceChecker asks its instance.basics()), InstanceScope. The screens: FirstStartScreen (the build's instance and another, as tiles, InstanceTile), InstanceStep (an address, checked), showAccountSwitcher and AddAccountScreen, and where an instance keeps people's data, as a flag and words (InstanceLocationBuilder, InstanceFlag, instanceLocationWords): EU, a country or a subdivision (ISO 3166-2, US-CA) as its operator says, "Germany (EU)" for a member of the European Union (europeanUnionMembers) and "California, United States" for a subdivision, with the most specific flag there is (a few subdivisions have their own, such as Scotland; else the country's). Countries are named by the app's CountryNames, subdivisions by Unicode CLDR's names in English and German, which come with the package (AssetSubdivisionNames; the workspace's tool/subdivision_names.py writes them).
  • Gates (lib/src/app/): InstanceGate opens the app's dependencies on the instance in use (AppDependencies, handed down by AppScope), anew on a switch, the previous ones closed first; SessionGate keeps a person signed in, signing in anonymously at a first start and asking how to start once signed out (StartScreen); PersonScope opens each person's own dependencies and closes them when the person goes.
  • Signing in (lib/src/auth/): AuthRepository on an AuthGateway; ServerpodAuthGateway signs in anonymously, with GitHub (the system browser and a loopback address on Linux and Windows, LoopbackWebAuth) and with a code by mail, through the instance's halkyon_base; SessionBloc, GitHubSignInBloc, EmailSignInBloc (with showEmailSignInSheet) and SignInWaysCubit; SignedOutMark, SignInAddresses, PersonFolders.
  • Sync (lib/src/sync/): SyncService (once at start, shortly after local changes, on resume and every few minutes, one sync at a time, counting the changes not on the server yet, PendingChangesStore), AppCompatibility and compatibleSync (the instance's minimum app build, the engine's table check), SyncStatusBloc, syncAndWait, and the widgets: SyncStatusCard, AppMismatchBanner, SyncTroubleBadge.
  • A client of halkyon_base alone (BaseClient): to ask an instance about itself, and to sign in as another person than the app's client holds.
  • Testing (package:halkyon_app/testing.dart): fakes of every boundary (FakeAuthGateway, FakeInstanceChecker, the stores in memory), a frame (testFrame), testApp, and TestAppDependencies.

Using it in an app

  1. The server includes halkyon_base with the nickname base (its README), so the app's generated client has client.modules.base.

  2. Depend on it by git, pinned to a signed commit of halkyon_shared's main, as halkyon_ui (whose README shows the pubspec_overrides.yaml for working on both at once):

    dependencies:
      halkyon_app:
        git:
          url: https://code.halkyon.app/project-halkyon/halkyon_shared.git
          path: packages/halkyon_app
          ref: <signed commit>
    
  3. Texts: add HalkyonAppLocalizations.delegate to every MaterialApp's delegates, beside HalkyonUiLocalizations.delegate and material_ui's GlobalMaterialLocalizations.delegates.

  4. The frame (AppFrame): the app's name and wordmark word, its icon, an example address, its theme, delegates, languages and launch screen, and the two sentences only it can say: what the first start's instance keeps of the person's, and what a switch to another account leaves behind.

  5. The dependencies: the app's composition root implements AppDependencies<P> (serverName, auth, signedOut, openPerson, dispose), its person's dependencies Disposable. Its auth is an AuthRepository on ServerpodAuthGateway(client, base: client.modules.base, callbackScheme: …, appName: …); the scheme is the app's own (app.halkyon.learn), registered with each platform and in the instance's GitHub OAuth app, whose loopback address on Linux and Windows is http://127.0.0.1/github-callback (port 43823 unless given).

  6. The tree:

    InstanceGate(
      frame: frame,
      choice: choice,
      checker: ServerpodInstanceChecker(app: 'todo'),
      countryNames: …,
      readLook: …,           // the device's theme mode and language
      open: Dependencies.create,
      app: SessionGate(
        look: (context) => …,
        app: (person) => PersonApp(person: person), // with PersonScope inside
      ),
    )
    

    A person's widgets find their dependencies with PersonScope.of<PersonDependencies>(context) and the app's with AppScope.of<Dependencies>(context).

  7. Licences: call registerHalkyonAppLicenses() once at startup (the flags' and Unicode CLDR's notices), beside halkyon_ui's registerFontLicenses().

Licence

GNU Affero General Public License 3.0 or later (LICENSE). The flags are lipis' flag-icons, drawn by the flag package, under the MIT licence (assets/flags/LICENSE-flag-icons.txt). The subdivisions' names are Unicode CLDR's (release 48.2), under the Unicode License v3 (assets/subdivisions/LICENSE-CLDR.txt, assets/subdivisions/ATTRIBUTION.md).