import 'school_navigation_policy.dart'; /// Only the authenticated graduate system may advance the service handshake. class SchoolLoginFlow { Uri? _target; bool _requested = false; int _attempts = 0; void begin(Uri target) { _target = target; _requested = false; _attempts = 0; } void reset() { _target = null; _requested = false; _attempts = 0; } Uri? onLoaded(Uri uri, {required bool authenticated}) { if (_target == null || !SchoolNavigationPolicy.isSchoolPage(uri)) { return null; } if (uri.host == 'idas.uestc.edu.cn') { _requested = false; return null; } if (uri.path == _target!.path || _requested || _attempts >= 2 || !authenticated || !SchoolNavigationPolicy.isGraduatePage(uri)) { return null; } _requested = true; _attempts++; return _target; } }