Files
TPSchedule/mobile/lib/features/school/school_login_flow.dart
T

35 lines
780 B
Dart

import 'school_navigation_policy.dart';
/// Only the authenticated graduate system may advance the service handshake.
class SchoolLoginFlow {
Uri? _target;
bool _requested = false;
void begin(Uri target) {
_target = target;
_requested = false;
}
void reset() {
_target = null;
_requested = false;
}
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 ||
!authenticated ||
!uri.path.startsWith('/pyxx/')) {
return null;
}
_requested = true;
return _target;
}
}