halkyon/apps/todo/halkyon_todo_flutter/lib/main.dart
Tizian 「ティツィアーン」 16ad925095
fix(app): http:// and https:// on one host are one account on the device
The reading of the full reading's fixes found that the device keeps
http://host/ and https://host/ in one place (folder, session key, keyring
prefix): someone with a stored http://host/ who added https://host/ and
then removed the first deleted the second's folder, session and keys while
it was in use, losing unsynced changes, and an anonymous account for good.

The places keep the names installs made (InstanceStorage.sharesWith says
which addresses share one): choosing an address the device keeps where a
known one is puts it in that one's place in the list, and removing an
address forgets nothing another known one uses. The build's own instance
keeps its place apart. Learn and Todo pass the storage's rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-10-23 14:13:01 +02:00

39 lines
1.5 KiB
Dart

import 'dart:io';
import 'package:halkyon_app/halkyon_app.dart';
import 'package:halkyon_todo_flutter/src/app/licences.dart';
import 'package:halkyon_todo_flutter/src/app/todo_app.dart';
import 'package:halkyon_todo_flutter/src/app/todo_dependencies.dart';
import 'package:halkyon_ui/halkyon_ui.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();
// Noto Sans' notice (halkyon_ui), the flags' and Unicode CLDR's
// (halkyon_app), and Lucide's for the app's icon.
registerFontLicenses();
registerHalkyonAppLicenses();
registerLucideLicense();
// The instance the build names (`--dart-define=SERVER_URL=…`, or
// `assets/config.json`): the first offered at the first start.
final builtIn = Instance.parse(await getServerUrl())!;
final device = await TodoDevice.create(builtIn: builtIn);
final instances = InstanceChoice(
FileInstanceStore(File(p.join(device.support, 'instances.json'))),
builtIn: builtIn,
forget: device.storage.forget,
sharesStorage: device.storage.sharesWith,
);
await instances.load(usedBefore: device.storage.usedBefore());
runApp(
TodoApp(
choice: instances,
// Only an instance of Halkyon Todo: one of another Halkyon app's
// answers too, but holds nothing of this app's.
checker: ServerpodInstanceChecker(app: 'todo'),
open: (instance) => TodoDependencies.create(instance, device),
),
);
}