added guardian login with views for their assigned childs
This commit is contained in:
+10
-5
@@ -2,8 +2,8 @@ import 'dart:developer';
|
||||
|
||||
import 'package:localstore/localstore.dart';
|
||||
|
||||
import '../../../../model/account_data.dart';
|
||||
import '../../../demo/demo_mode.dart';
|
||||
import '../../../../session/session.dart';
|
||||
import '../../../../session/session_manager.dart';
|
||||
import '../../../mhsl/custom_timetable_event/get/get_custom_timetable_event.dart';
|
||||
import '../../../mhsl/custom_timetable_event/get/get_custom_timetable_event_params.dart';
|
||||
import '../../../mhsl/custom_timetable_event/remove/remove_custom_timetable_event.dart';
|
||||
@@ -28,12 +28,15 @@ class CustomEventsMigration {
|
||||
const CustomEventsMigration._();
|
||||
|
||||
static Future<void> runOnce() async {
|
||||
if (DemoMode.active) return;
|
||||
// Guardians never had MHSL events; only password accounts can derive the
|
||||
// legacy identity.
|
||||
final session = SessionManager().current;
|
||||
if (session is! CredentialSession || session.isDemo) return;
|
||||
if (await _isDone()) return;
|
||||
|
||||
try {
|
||||
final response = await GetCustomTimetableEvent(
|
||||
GetCustomTimetableEventParams(AccountData().getUserSecret()),
|
||||
GetCustomTimetableEventParams(session.legacyUserSecret),
|
||||
).run();
|
||||
|
||||
for (final event in response.events) {
|
||||
@@ -44,7 +47,9 @@ class CustomEventsMigration {
|
||||
}
|
||||
|
||||
await _markDone();
|
||||
log('Custom events migration: moved ${response.events.length} event(s) to Marianum-Connect.');
|
||||
log(
|
||||
'Custom events migration: moved ${response.events.length} event(s) to Marianum-Connect.',
|
||||
);
|
||||
} catch (e) {
|
||||
// Leave the flag unset so the next launch retries; the delete-after-post
|
||||
// above keeps a partial run duplicate-free.
|
||||
|
||||
Reference in New Issue
Block a user