From 2d95ea6e5bb0f75af060cf70aaf550b7e54d0e96 Mon Sep 17 00:00:00 2001 From: Liplum Date: Thu, 19 Sep 2024 23:56:32 +0800 Subject: [PATCH] [demo mode] more delay --- CHANGELOG.md | 1 + lib/life/electricity/service/electricity.demo.dart | 1 + lib/life/expense_records/service/fetch.demo.dart | 1 + lib/me/edu_email/service/email.demo.dart | 2 +- lib/school/class2nd/service/activity.demo.dart | 1 + lib/school/class2nd/service/application.demo.dart | 2 ++ lib/school/class2nd/service/points.demo.dart | 8 +++----- lib/school/exam_arrange/service/exam.demo.dart | 1 + lib/school/exam_result/service/result.pg.demo.dart | 1 + lib/school/exam_result/service/result.ug.demo.dart | 1 + lib/school/library/service/trends.demo.dart | 1 + lib/school/oa_announce/service/announce.demo.dart | 2 ++ lib/school/ywb/service/application.demo.dart | 1 + lib/school/ywb/service/service.demo.dart | 2 ++ lib/timetable/service/school.demo.dart | 1 + 15 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32551b395..162b7d211 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 2.6.4 - Redesigned edu email inbox page and mail details page. +- [Demo mode] Demo mode is supported on edu email. ## 2.6.3 - Migration of new storage structure of timetable and palette. diff --git a/lib/life/electricity/service/electricity.demo.dart b/lib/life/electricity/service/electricity.demo.dart index f9241a0ba..880a57e95 100644 --- a/lib/life/electricity/service/electricity.demo.dart +++ b/lib/life/electricity/service/electricity.demo.dart @@ -11,6 +11,7 @@ class DemoElectricityService implements ElectricityService { final rand = Random(room.hashCode); final rand2 = Random(); final base = rand.nextInt(10000) / 100; + await Future.delayed(const Duration(milliseconds: 1400)); return ElectricityBalance.all( roomNumber: room, balance: base + rand2.nextInt(100) / 10 - 5, diff --git a/lib/life/expense_records/service/fetch.demo.dart b/lib/life/expense_records/service/fetch.demo.dart index f2eda44ba..9db88f460 100644 --- a/lib/life/expense_records/service/fetch.demo.dart +++ b/lib/life/expense_records/service/fetch.demo.dart @@ -16,6 +16,7 @@ class DemoExpenseService implements ExpenseService { required DateTime from, required DateTime to, }) async { + await Future.delayed(const Duration(milliseconds: 1350)); final rand = Random(CredentialsInit.storage.oa.credentials?.account.hashCode); return _generate(300, rand); } diff --git a/lib/me/edu_email/service/email.demo.dart b/lib/me/edu_email/service/email.demo.dart index 528e7dbd5..9c394d5d8 100644 --- a/lib/me/edu_email/service/email.demo.dart +++ b/lib/me/edu_email/service/email.demo.dart @@ -38,7 +38,7 @@ class DemoMailService implements MailService { ); } - await Future.delayed(const Duration(milliseconds: 300)); + await Future.delayed(const Duration(milliseconds: 1300)); return [ gen( dayDelta: -5, diff --git a/lib/school/class2nd/service/activity.demo.dart b/lib/school/class2nd/service/activity.demo.dart index ac01a8a15..8ea2afbfe 100644 --- a/lib/school/class2nd/service/activity.demo.dart +++ b/lib/school/class2nd/service/activity.demo.dart @@ -22,6 +22,7 @@ class DemoClass2ndActivityService implements Class2ndActivityService { ); } + await Future.delayed(const Duration(milliseconds: 1650)); return switch (cat) { Class2ndActivityCat.lecture => [gen("小应生活开发者讲座")], Class2ndActivityCat.thematicEdu => [gen("生活主题教育")], diff --git a/lib/school/class2nd/service/application.demo.dart b/lib/school/class2nd/service/application.demo.dart index 09ff94181..dba929a17 100644 --- a/lib/school/class2nd/service/application.demo.dart +++ b/lib/school/class2nd/service/application.demo.dart @@ -10,11 +10,13 @@ class DemoClass2ndApplicationService implements Class2ndApplicationService { @override Future apply(int activityId) async { + await Future.delayed(const Duration(milliseconds: 1350)); return true; } @override Future withdraw(int applicationId) async { + await Future.delayed(const Duration(milliseconds: 1400)); return true; } } diff --git a/lib/school/class2nd/service/points.demo.dart b/lib/school/class2nd/service/points.demo.dart index e08ee9a56..ea9098da5 100644 --- a/lib/school/class2nd/service/points.demo.dart +++ b/lib/school/class2nd/service/points.demo.dart @@ -1,5 +1,3 @@ -import 'package:flutter/cupertino.dart'; - import '../entity/activity.dart'; import '../entity/application.dart'; import '../entity/attended.dart'; @@ -10,7 +8,7 @@ class DemoClass2ndPointsService implements Class2ndPointsService { @override Future fetchScoreSummary() async { - debugPrint("fetchScoreSummary"); + await Future.delayed(const Duration(milliseconds: 1350)); return const Class2ndPointsSummary( thematicReport: 1.5, practice: 2.0, @@ -25,7 +23,7 @@ class DemoClass2ndPointsService implements Class2ndPointsService { @override Future> fetchScoreItemList() async { - debugPrint("fetchScoreItemList"); + await Future.delayed(const Duration(milliseconds: 1350)); return [ Class2ndPointItem( name: "小应生活茶话会", @@ -40,7 +38,7 @@ class DemoClass2ndPointsService implements Class2ndPointsService { @override Future> fetchActivityApplicationList() async { - debugPrint("fetchActivityApplicationList"); + await Future.delayed(const Duration(milliseconds: 1350)); return [ Class2ndActivityApplication( applicationId: 10001, diff --git a/lib/school/exam_arrange/service/exam.demo.dart b/lib/school/exam_arrange/service/exam.demo.dart index d415452d5..ce1239455 100644 --- a/lib/school/exam_arrange/service/exam.demo.dart +++ b/lib/school/exam_arrange/service/exam.demo.dart @@ -9,6 +9,7 @@ class DemoExamArrangeService implements ExamArrangeService { @override Future> fetchExamList(SemesterInfo info) async { final now = DateTime.now(); + await Future.delayed(const Duration(milliseconds: 1450)); return [ ExamEntry( courseName: "小应生活设计实训", diff --git a/lib/school/exam_result/service/result.pg.demo.dart b/lib/school/exam_result/service/result.pg.demo.dart index 5e9b4af32..655df3982 100644 --- a/lib/school/exam_result/service/result.pg.demo.dart +++ b/lib/school/exam_result/service/result.pg.demo.dart @@ -15,6 +15,7 @@ class DemoExamResultPgService implements ExamResultPgService { Future> fetchResultList() async { final now = DateTime.now(); final rand = Random(); + await Future.delayed(const Duration(milliseconds: 1500)); return List.generate(15, (index) { final score = (rand.nextInt(50) + 50).toDouble(); return ExamResultPg( diff --git a/lib/school/exam_result/service/result.ug.demo.dart b/lib/school/exam_result/service/result.ug.demo.dart index 1a06f4734..e11209e4e 100644 --- a/lib/school/exam_result/service/result.ug.demo.dart +++ b/lib/school/exam_result/service/result.ug.demo.dart @@ -21,6 +21,7 @@ class DemoExamResultUgService implements ExamResultUgService { final now = DateTime.now(); final SemesterInfo(:exactYear, :semester) = estimateSemesterInfo(); final rand = Random(); + await Future.delayed(const Duration(milliseconds: 1560)); return List.generate(15, (index) { final score = (rand.nextInt(50) + 50).toDouble(); return ExamResultUg( diff --git a/lib/school/library/service/trends.demo.dart b/lib/school/library/service/trends.demo.dart index 0ef17583a..c99713a67 100644 --- a/lib/school/library/service/trends.demo.dart +++ b/lib/school/library/service/trends.demo.dart @@ -6,6 +6,7 @@ class DemoLibraryTrendsService implements LibraryTrendsService { @override Future getTrends() async { + await Future.delayed(const Duration(milliseconds: 200)); return const LibraryTrends( recent30days: [ LibraryTrendsItem(keyword: '小应生活', count: 500), diff --git a/lib/school/oa_announce/service/announce.demo.dart b/lib/school/oa_announce/service/announce.demo.dart index adcf11e32..a19ee2ee5 100644 --- a/lib/school/oa_announce/service/announce.demo.dart +++ b/lib/school/oa_announce/service/announce.demo.dart @@ -12,6 +12,7 @@ class DemoOaAnnounceService implements OaAnnounceService { @override Future fetchAnnounceDetails(String catalogId, String uuid) async { + await Future.delayed(const Duration(milliseconds: 1350)); return OaAnnounceDetails( title: "title", dateTime: DateTime.now(), @@ -25,6 +26,7 @@ class DemoOaAnnounceService implements OaAnnounceService { @override Future getAnnounceList(OaAnnounceCat cat, int pageIndex) async { + await Future.delayed(const Duration(milliseconds: 1350)); if (pageIndex == 1) { final now = DateTime.now(); final rand = Random(); diff --git a/lib/school/ywb/service/application.demo.dart b/lib/school/ywb/service/application.demo.dart index d2d55bd50..3a704b6a8 100644 --- a/lib/school/ywb/service/application.demo.dart +++ b/lib/school/ywb/service/application.demo.dart @@ -11,6 +11,7 @@ class DemoYwbApplicationService implements YwbApplicationService { }) async { onProgress?.call(1); final now = DateTime.now(); + await Future.delayed(const Duration(milliseconds: 1400)); return [ YwbApplication( workId: 9999, diff --git a/lib/school/ywb/service/service.demo.dart b/lib/school/ywb/service/service.demo.dart index e5a9eb5c2..dfe3b73d4 100644 --- a/lib/school/ywb/service/service.demo.dart +++ b/lib/school/ywb/service/service.demo.dart @@ -7,11 +7,13 @@ class DemoYwbServiceService implements YwbServiceService { @override Future getServiceDetails(String functionId) async { + await Future.delayed(const Duration(milliseconds: 1300)); return const YwbServiceDetails(id: "0", sections: []); } @override Future> getServices() async { + await Future.delayed(const Duration(milliseconds: 1180)); return [ const YwbService( id: "1", diff --git a/lib/timetable/service/school.demo.dart b/lib/timetable/service/school.demo.dart index 82e159fda..5318e23c8 100644 --- a/lib/timetable/service/school.demo.dart +++ b/lib/timetable/service/school.demo.dart @@ -17,6 +17,7 @@ class DemoTimetableService implements TimetableService { @override Future fetchUgTimetable(SemesterInfo info) async { var key = 0; + await Future.delayed(const Duration(milliseconds: 1400)); return Timetable( name: "小应生活的课程表", uuid: "9cb2c4fe-d8e8-410b-b472-c1b4c13ecf16",