reset method

Resets the session now: clears what the policy says, tells the app to go home, and starts the clock again. A clear that fails leaves the kiosk DVKioskState.failed and rethrows -- a half-cleared session presented as fresh is the one outcome worse than a visible failure.

Implementation

Future<DVKioskReset> reset(DVKioskResetReason reason) async {
  _enter(DVKioskState.resetting);
  countdown._set(null);
  try {
    if (policy.clearOnReset.isNotEmpty) await _clear(policy.clearOnReset);
  } catch (_) {
    _enter(DVKioskState.failed);
    rethrow;
  }
  final DVKioskReset result = DVKioskReset(
    cleared: Set<DVKioskClearable>.unmodifiable(policy.clearOnReset),
    home: policy.home,
    reason: reason,
  );
  touch();
  _enter(DVKioskState.active);
  _resets.add(result);
  return result;
}