execute method

  1. @override
Future<void> execute({
  1. void onSubProgress(
    1. double subFraction
    )?,
})
override

Performs the startup work for this task.

Called by StartupOrchestrator exactly once per startup. Must complete without error for the orchestrator to proceed to the next task.

The optional onSubProgress callback lets a task report intra-task progress as a fraction in the range [0.0, 1.0]. The orchestrator maps this to a global progress fraction and forwards it to StartupCubit so the splash screen can animate continuously during long-running tasks. Tasks that do not have meaningful sub-steps can ignore this parameter.

Implementation

@override
Future<void> execute({void Function(double subFraction)? onSubProgress}) async {
  _logger.info('JailbreakCheckTask: Running security check');

  if (skipInDebug) {
    _logger.info('JailbreakCheckTask: Skipping security check in debug mode');
    return;
  }

  try {
    await _securityChecker.checkForSecurityIssues();
    _logger.info('JailbreakCheckTask: All security checks passed');
    Sentry.metrics.count('security.jailbreak.passed', 1);
  } on SingleJailbreakException catch (e) {
    _logger.warn('JailbreakCheckTask: Security issue detected — ${e.checkName}', error: e);
    Sentry.metrics.count('security.jailbreak.detected', 1);
    rethrow;
  } on MultiJailbreakException catch (e) {
    _logger.warn(
      'JailbreakCheckTask: Multiple security issues detected — '
      '${e.jailBreakIssues.map((JailbreakIssue i) => i.toString().split('.').last).join(', ')}',
      error: e,
    );
    Sentry.metrics.count('security.jailbreak.detected', 1);
    rethrow;
  }
}