added guardian login with views for their assigned childs
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import '../../../state/app/modules/capabilities/bloc/capabilities_state.dart';
|
||||
import '../../../state/app/modules/nextcloud_capabilities/bloc/nextcloud_capabilities_state.dart';
|
||||
import '../../marianumconnect/queries/get_capabilities/guardian_child.dart';
|
||||
import '../demo_persona.dart';
|
||||
|
||||
/// Demo fixtures for the mobile capability flags — everything granted so the
|
||||
/// demo persona sees every feature (incl. push) as available and the timetable
|
||||
@@ -17,6 +19,27 @@ class DemoCapabilities {
|
||||
userType: 'STUDENT',
|
||||
loaded: true,
|
||||
);
|
||||
|
||||
/// Guardian persona with two children, so the child switcher is visible.
|
||||
static CapabilitiesState guardianState() => const CapabilitiesState(
|
||||
pushNotifications: true,
|
||||
userType: 'PARENT',
|
||||
children: [
|
||||
GuardianChild(
|
||||
id: 'demo-child-1',
|
||||
firstName: DemoPersona.studentFirstName,
|
||||
lastName: 'Hoffmann',
|
||||
className: DemoPersona.className,
|
||||
),
|
||||
GuardianChild(
|
||||
id: 'demo-child-2',
|
||||
firstName: 'Jonas',
|
||||
lastName: 'Hoffmann',
|
||||
className: '6a',
|
||||
),
|
||||
],
|
||||
loaded: true,
|
||||
);
|
||||
}
|
||||
|
||||
/// Demo fixtures for the Nextcloud `files_sharing` capabilities — a permissive
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import '../../../model/account_data.dart';
|
||||
import '../../../session/session_manager.dart';
|
||||
import '../../marianumcloud/talk/chat/get_chat_response.dart';
|
||||
import '../../marianumcloud/talk/room/get_room_response.dart';
|
||||
import '../demo_persona.dart';
|
||||
@@ -204,7 +204,8 @@ class DemoTalk {
|
||||
id: base + 2,
|
||||
token: token,
|
||||
ago: const Duration(days: 1, hours: 6),
|
||||
message: 'Danke! Können wir Aufgabe 5 nächste Stunde nochmal besprechen?',
|
||||
message:
|
||||
'Danke! Können wir Aufgabe 5 nächste Stunde nochmal besprechen?',
|
||||
),
|
||||
_msg(
|
||||
id: base + 3,
|
||||
@@ -366,7 +367,7 @@ class DemoTalk {
|
||||
}) => _msg(
|
||||
id: id,
|
||||
token: token,
|
||||
actor: AccountData().getUsername(),
|
||||
actor: SessionManager().requireNextcloud().username,
|
||||
display: DemoPersona.studentName,
|
||||
ago: ago,
|
||||
message: message,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import '../../model/account_data.dart';
|
||||
import '../../session/session_manager.dart';
|
||||
|
||||
/// Central switch for the client-side demo mode.
|
||||
///
|
||||
@@ -8,7 +8,7 @@ import '../../model/account_data.dart';
|
||||
/// Play reviewers and automated screenshot runs see a fully populated app
|
||||
/// without a real account and without any network dependency.
|
||||
///
|
||||
/// The flag is persisted through [AccountData.isDemo], so a demo session
|
||||
/// The flag is persisted through [Session.isDemo], so a demo session
|
||||
/// survives cold starts exactly like a normal login. It works in release builds
|
||||
/// too — reviewers run the shipped release build.
|
||||
class DemoMode {
|
||||
@@ -22,6 +22,14 @@ class DemoMode {
|
||||
static bool matches(String username) =>
|
||||
username.trim().toLowerCase().startsWith(usernamePrefix);
|
||||
|
||||
/// Guardian logins are passwordless, so reviewers need a fixed address that
|
||||
/// skips the mail round-trip. Deliberately not the `demo@` prefix, which a
|
||||
/// real e-mail address could start with.
|
||||
static const String guardianEmail = 'demo-eltern@marianum-fulda.de';
|
||||
|
||||
static bool matchesGuardian(String email) =>
|
||||
email.trim().toLowerCase() == guardianEmail;
|
||||
|
||||
/// True while the active session is a demo session.
|
||||
static bool get active => AccountData().isDemo;
|
||||
static bool get active => SessionManager().isDemo;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user