Skip to content

Commit

Permalink
新增彩蛋开关
Browse files Browse the repository at this point in the history
  • Loading branch information
lollipopkit committed Apr 1, 2023
1 parent a8ab735 commit 1ddbb0d
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
6 changes: 3 additions & 3 deletions lib/config/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ final cetAvatarPage = AppRoute(
page: CetAvatarPage(),
);

final jwWebPage = AppRoute(
title: '教务系统',
page: WebviewBrowser('$custccBase/go/jwgl'),
final portalPage = AppRoute(
title: '长理门户',
page: WebviewBrowser('https://portal.cust.edu.cn'),
);

final tikuPage = AppRoute(
Expand Down
5 changes: 4 additions & 1 deletion lib/data/providers/grade_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:custed2/core/util/utils.dart';
import 'package:custed2/data/models/grade.dart';
import 'package:custed2/data/providers/app_provider.dart';
import 'package:custed2/data/store/grade_store.dart';
import 'package:custed2/data/store/setting_store.dart';
import 'package:custed2/locator.dart';

class GradeProvider extends BusyProvider {
Expand All @@ -28,7 +29,9 @@ class GradeProvider extends BusyProvider {
int standardMark = 90;
final now = DateTime.now();

if (now.month == 4 && now.day == 1) {
if (now.month == 4 &&
now.day == 1 &&
locator<SettingStore>().foolDay.fetch()) {
showSnackBar(locator<AppProvider>().ctx, '叮~触发彩蛋:愚人节快乐');
print("[GRADE] Happy fools' day!");
print('''
Expand Down
3 changes: 3 additions & 0 deletions lib/data/store/setting_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,7 @@ class SettingStore with PersistentStore {

// 是否展示过寻找新maintainer的弹窗
StoreProperty<bool> get hire => property('hire', defaultValue: false);

// 是否开启愚人节彩蛋
StoreProperty<bool> get foolDay => property('foolDay', defaultValue: true);
}
6 changes: 3 additions & 3 deletions lib/res/build_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

class BuildData {
static const String name = "CustedNG";
static const int build = 746;
static const int build = 747;
static const String engine = "2.10.5";
static const String buildAt = "2023-02-06 14:50:53.979635";
static const int modifications = 5;
static const String buildAt = "2023-04-01 13:34:58.677541";
static const int modifications = 4;
}
4 changes: 2 additions & 2 deletions lib/ui/home_tab/home_entries.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ class _HomeEntriesState extends State<HomeEntries> {
content: Table(children: [
TableRow(children: [
HomeEntry(
name: Text('我的教务', style: style),
name: Text('教务门户', style: style),
icon: Image(image: ImageRes.manageIcon),
action: () => jwWebPage.go(context),
action: () => portalPage.go(context),
),
HomeEntry(
name: Text('空教室', style: style),
Expand Down
12 changes: 10 additions & 2 deletions lib/ui/user_tab/user_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,16 @@ class _UseTabState extends State<UserTab> with AutomaticKeepAliveClientMixin {
SettingItem(
title: '推送上课通知',
showArrow: false,
rightBtn: buildSwitch(context, setting.pushNotification,
func: (v) => sendSetting2Backend(v)),
rightBtn: buildSwitch(
context,
setting.pushNotification,
func: (v) => sendSetting2Backend(v),
),
),
SettingItem(
title: '开启彩蛋',
showArrow: false,
rightBtn: buildSwitch(context, setting.foolDay),
),
SizedBox(height: 10.0),
Text('主题'),
Expand Down

0 comments on commit 1ddbb0d

Please sign in to comment.