dvClearKioskSession function
Future<void>
dvClearKioskSession(
- Set<
DVKioskClearable> what, { - DVKioskScope scope = DVKioskScope.device,
- String? namespace,
Clears what from the framework's own state.
scope decides how far a shared-store clear reaches, and the difference
is the point of the specification's table. In device scope the whole store
is the kiosk's. In display scope only namespace is -- kiosk.<name> --
because a customer display timing out must not empty the store the
cashier's window is working out of. A display-scope clear with no
namespace touches the store not at all: the only alternative to clearing
one window's keys is clearing everybody's.
Anything that throws is left to throw. The runtime turns a failed clear into DVKioskState.failed, and a session half-cleared and presented as fresh is the one outcome worse than a kiosk that visibly stopped.
Implementation
Future<void> dvClearKioskSession(
Set<DVKioskClearable> what, {
DVKioskScope scope = DVKioskScope.device,
String? namespace,
}) async {
if (what.contains(DVKioskClearable.clientCache)) {
await const DVCache().delete(DVCache.all);
}
if (what.contains(DVKioskClearable.auth)) {
// Display scope never reaches here: a policy listing auth in display
// scope is refused by the parser, because the session is the staff
// window's.
await const DVAuth().signOut();
}
if (what.contains(DVKioskClearable.sharedStore)) {
if (scope == DVKioskScope.device) {
await _clearStore(DVWindowManager.shared, prefix: null);
} else if (namespace != null) {
await _clearStore(DVWindowManager.shared, prefix: '$namespace.');
}
}
// signals and forms: see the library comment. The application's own
// callback is what reaches them, and DV.global registrations are
// deliberately not touched -- an application registers its API client
// there at boot, and a kiosk that dropped it on every idle timeout would
// stop working after ninety seconds.
}