feat: add two-tab timetable UI and glass dock
This commit is contained in:
@@ -18,8 +18,9 @@ class ImportDraft {
|
||||
class JsonScheduleImport {
|
||||
static ImportDraft parse(String text) {
|
||||
try {
|
||||
if (utf8.encode(text).length > 2 * 1024 * 1024)
|
||||
if (utf8.encode(text).length > 2 * 1024 * 1024) {
|
||||
throw const FormatException('文件不能超过 2 MB');
|
||||
}
|
||||
final json = jsonDecode(text);
|
||||
if (json is! Map ||
|
||||
json['schemaVersion'] != 1 ||
|
||||
@@ -40,8 +41,9 @@ class JsonScheduleImport {
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
if (courses.map((c) => c.id).toSet().length != courses.length)
|
||||
if (courses.map((c) => c.id).toSet().length != courses.length) {
|
||||
throw const FormatException('课程标识重复');
|
||||
}
|
||||
return ImportDraft(
|
||||
courses: List.unmodifiable(courses),
|
||||
explicitlyEmpty: json['explicitlyEmpty'] == true,
|
||||
|
||||
Reference in New Issue
Block a user