Skip to content

Commit

Permalink
[demo mode] more delay
Browse files Browse the repository at this point in the history
  • Loading branch information
liplum committed Sep 19, 2024
1 parent df7a2df commit 2d95ea6
Show file tree
Hide file tree
Showing 15 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions lib/life/electricity/service/electricity.demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions lib/life/expense_records/service/fetch.demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/me/edu_email/service/email.demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions lib/school/class2nd/service/activity.demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class DemoClass2ndActivityService implements Class2ndActivityService {
);
}

await Future.delayed(const Duration(milliseconds: 1650));
return switch (cat) {
Class2ndActivityCat.lecture => [gen("小应生活开发者讲座")],
Class2ndActivityCat.thematicEdu => [gen("生活主题教育")],
Expand Down
2 changes: 2 additions & 0 deletions lib/school/class2nd/service/application.demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ class DemoClass2ndApplicationService implements Class2ndApplicationService {

@override
Future<bool> apply(int activityId) async {
await Future.delayed(const Duration(milliseconds: 1350));
return true;
}

@override
Future<bool> withdraw(int applicationId) async {
await Future.delayed(const Duration(milliseconds: 1400));
return true;
}
}
8 changes: 3 additions & 5 deletions lib/school/class2nd/service/points.demo.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'package:flutter/cupertino.dart';

import '../entity/activity.dart';
import '../entity/application.dart';
import '../entity/attended.dart';
Expand All @@ -10,7 +8,7 @@ class DemoClass2ndPointsService implements Class2ndPointsService {

@override
Future<Class2ndPointsSummary> fetchScoreSummary() async {
debugPrint("fetchScoreSummary");
await Future.delayed(const Duration(milliseconds: 1350));
return const Class2ndPointsSummary(
thematicReport: 1.5,
practice: 2.0,
Expand All @@ -25,7 +23,7 @@ class DemoClass2ndPointsService implements Class2ndPointsService {

@override
Future<List<Class2ndPointItem>> fetchScoreItemList() async {
debugPrint("fetchScoreItemList");
await Future.delayed(const Duration(milliseconds: 1350));
return [
Class2ndPointItem(
name: "小应生活茶话会",
Expand All @@ -40,7 +38,7 @@ class DemoClass2ndPointsService implements Class2ndPointsService {

@override
Future<List<Class2ndActivityApplication>> fetchActivityApplicationList() async {
debugPrint("fetchActivityApplicationList");
await Future.delayed(const Duration(milliseconds: 1350));
return [
Class2ndActivityApplication(
applicationId: 10001,
Expand Down
1 change: 1 addition & 0 deletions lib/school/exam_arrange/service/exam.demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class DemoExamArrangeService implements ExamArrangeService {
@override
Future<List<ExamEntry>> fetchExamList(SemesterInfo info) async {
final now = DateTime.now();
await Future.delayed(const Duration(milliseconds: 1450));
return [
ExamEntry(
courseName: "小应生活设计实训",
Expand Down
1 change: 1 addition & 0 deletions lib/school/exam_result/service/result.pg.demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class DemoExamResultPgService implements ExamResultPgService {
Future<List<ExamResultPg>> 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(
Expand Down
1 change: 1 addition & 0 deletions lib/school/exam_result/service/result.ug.demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions lib/school/library/service/trends.demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class DemoLibraryTrendsService implements LibraryTrendsService {

@override
Future<LibraryTrends> getTrends() async {
await Future.delayed(const Duration(milliseconds: 200));
return const LibraryTrends(
recent30days: [
LibraryTrendsItem(keyword: '小应生活', count: 500),
Expand Down
2 changes: 2 additions & 0 deletions lib/school/oa_announce/service/announce.demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class DemoOaAnnounceService implements OaAnnounceService {

@override
Future<OaAnnounceDetails> fetchAnnounceDetails(String catalogId, String uuid) async {
await Future.delayed(const Duration(milliseconds: 1350));
return OaAnnounceDetails(
title: "title",
dateTime: DateTime.now(),
Expand All @@ -25,6 +26,7 @@ class DemoOaAnnounceService implements OaAnnounceService {

@override
Future<OaAnnounceListPayload> getAnnounceList(OaAnnounceCat cat, int pageIndex) async {
await Future.delayed(const Duration(milliseconds: 1350));
if (pageIndex == 1) {
final now = DateTime.now();
final rand = Random();
Expand Down
1 change: 1 addition & 0 deletions lib/school/ywb/service/application.demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions lib/school/ywb/service/service.demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ class DemoYwbServiceService implements YwbServiceService {

@override
Future<YwbServiceDetails> getServiceDetails(String functionId) async {
await Future.delayed(const Duration(milliseconds: 1300));
return const YwbServiceDetails(id: "0", sections: []);
}

@override
Future<List<YwbService>> getServices() async {
await Future.delayed(const Duration(milliseconds: 1180));
return [
const YwbService(
id: "1",
Expand Down
1 change: 1 addition & 0 deletions lib/timetable/service/school.demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class DemoTimetableService implements TimetableService {
@override
Future<Timetable> fetchUgTimetable(SemesterInfo info) async {
var key = 0;
await Future.delayed(const Duration(milliseconds: 1400));
return Timetable(
name: "小应生活的课程表",
uuid: "9cb2c4fe-d8e8-410b-b472-c1b4c13ecf16",
Expand Down

0 comments on commit 2d95ea6

Please sign in to comment.