feat: extend optional HTML feedback to graduate imports in 0.7.8
This commit is contained in:
@@ -7,6 +7,7 @@ import '../../data/json_schedule_import.dart';
|
||||
import '../../domain/exam_schedule.dart';
|
||||
import '../../domain/school_term.dart';
|
||||
import '../../services/diagnostic_log.dart';
|
||||
import '../../services/school_page_diagnostic.dart';
|
||||
import 'school_navigation_policy.dart';
|
||||
import 'school_page_adapter.dart';
|
||||
import 'school_exam_adapter.dart';
|
||||
@@ -257,6 +258,7 @@ class SchoolSession extends ChangeNotifier {
|
||||
final closing = _logoutFuture;
|
||||
if (closing != null) await closing;
|
||||
if (serial != _openSerial) return;
|
||||
SchoolPageDiagnostic.instance.clear();
|
||||
_timeout?.cancel();
|
||||
_poll?.cancel();
|
||||
_manualRead = false;
|
||||
@@ -303,6 +305,7 @@ class SchoolSession extends ChangeNotifier {
|
||||
return;
|
||||
}
|
||||
final serial = ++_openSerial;
|
||||
SchoolPageDiagnostic.instance.clear();
|
||||
_poll?.cancel();
|
||||
_timeout?.cancel();
|
||||
_pageGeneration++;
|
||||
@@ -460,9 +463,8 @@ class SchoolSession extends ChangeNotifier {
|
||||
'term': selectedTerm?.id,
|
||||
},
|
||||
);
|
||||
if (!hasOpened ||
|
||||
generation != _pageGeneration ||
|
||||
await web.currentUrl() != url) {
|
||||
final liveUrl = await web.currentUrl();
|
||||
if (!hasOpened || generation != _pageGeneration || liveUrl != url) {
|
||||
return;
|
||||
}
|
||||
if (evidence.terms.isNotEmpty) _liveTerms = evidence.terms;
|
||||
@@ -480,6 +482,7 @@ class SchoolSession extends ChangeNotifier {
|
||||
}
|
||||
for (final page in evidence.pages) {
|
||||
if (page.kind != (requestingExams ? 'exams' : 'timetable')) continue;
|
||||
SchoolPageDiagnostic.instance.remember(page.html, page.url);
|
||||
try {
|
||||
if (requestingExams) {
|
||||
final draft = SchoolExamAdapter.extract(page.html);
|
||||
@@ -586,17 +589,23 @@ class SchoolSession extends ChangeNotifier {
|
||||
throw UnsupportedSchoolLayout();
|
||||
}
|
||||
final evidence = await _evidence(uri);
|
||||
if (generation != _pageGeneration ||
|
||||
await web.currentUrl() != uri.toString()) {
|
||||
final liveUrl = await web.currentUrl();
|
||||
if (!hasOpened ||
|
||||
generation != _pageGeneration ||
|
||||
liveUrl != uri.toString()) {
|
||||
throw UnsupportedSchoolLayout();
|
||||
}
|
||||
for (final page in evidence.pages) {
|
||||
if (page.kind != 'timetable') continue;
|
||||
SchoolPageDiagnostic.instance.remember(page.html, page.url);
|
||||
try {
|
||||
final draft = await _reader.read(
|
||||
selectedTerm!.timetableUri,
|
||||
() async => page.html,
|
||||
);
|
||||
if (!hasOpened || generation != _pageGeneration) {
|
||||
throw UnsupportedSchoolLayout();
|
||||
}
|
||||
if (draft.schoolTerm != selectedTerm) continue;
|
||||
return draft;
|
||||
} on UnsupportedSchoolLayout {
|
||||
@@ -648,6 +657,7 @@ class SchoolSession extends ChangeNotifier {
|
||||
}
|
||||
|
||||
void invalidateAuthentication() {
|
||||
SchoolPageDiagnostic.instance.clear();
|
||||
_openSerial++;
|
||||
_pageGeneration++;
|
||||
_reader.invalidate();
|
||||
@@ -667,6 +677,7 @@ class SchoolSession extends ChangeNotifier {
|
||||
}
|
||||
|
||||
Future<void> _performLogout() async {
|
||||
SchoolPageDiagnostic.instance.clear();
|
||||
_openSerial++;
|
||||
_pageGeneration++;
|
||||
_reader.invalidate();
|
||||
@@ -697,6 +708,7 @@ class SchoolSession extends ChangeNotifier {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
SchoolPageDiagnostic.instance.clear();
|
||||
hasOpened = false;
|
||||
_pageGeneration++;
|
||||
_reader.invalidate();
|
||||
|
||||
Reference in New Issue
Block a user