Skip to content

Commit

Permalink
updated app features
Browse files Browse the repository at this point in the history
  • Loading branch information
liplum committed Sep 9, 2024
1 parent ced6858 commit 1677669
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 22 deletions.
86 changes: 65 additions & 21 deletions lib/feature/feature.dart
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
enum AppFeature {
// mimir
// --- mimir ---
mimirForum("mimir.forum"),
mimirBulletin("mimir.bulletin"),
mimirUser("mimir.user"),
mimirSitRobotGate("mimir.sitRobot.gate"),
// school
update("mimir.update"),
// --- school section ---
// second class
secondClass("school.secondClass"),
secondClassScore("school.secondClass.score"),
secondClassActivity("school.secondClass.activity"),
secondClassAttended("school.secondClass.attended"),
// exam result
examResult("school.examResult"),
examArrangement("school.examArrangement"),
gpa("school.gpa"),
// teacher eval
teacherEval("school.teacherEval"),
// expense records
expenseRecords("school.expenseRecords"),
electricityBalance("school.electricityBalance"),
expenseRecordsStats("school.expenseRecords.stats"),
// electricity balance
electricityBalance("school.electricityBalance"),
// edu email
eduEmail("school.eduEmail"),
// OA announcement
oaAnnouncement("school.oaAnnouncement"),
// SIT YWB
ywb("school.ywb"),
// library
library("school.library"),
librarySearch("school.librarySearch"),
libraryBorrowing("school.borrowing"),
libraryBorrowingHistory("school.History"),
libraryBorrowingHistory("school.borrowing.history"),
// yellow pages
yellowPages("school.yellowPages"),
// course selection
courseSelection("school.courseSelection"),
// student plan
studentPlan("school.studentPlan"),
// SIT Robot
sitRobotOpenDoor("school.sitRobot.OpenDoor"),
// basic
// --- SIT Robot section ---
sitRobotOpenLabDoor("school.sitRobot.openLabDoor"),
// --- basic section ---
timetable("basic.timetable"),
timetableCelStyles("basic.timetable.cellStyles"),
timetableWallpaper("basic.timetable.wallpaper"),
timetableScreenshot("basic.timetable.screenshot"),
timetablePatch("basic.timetable.patch"),
scanner("basic.scanner"),
settings("basic.settings"),
settingsLanguage("basic.settings.language"),
settingsThemeColor("basic.settings.themeColor"),
settingsClearCache("basic.settings.clearCache"),
settingsProxy("basic.settings.proxy"),
settingsNetworkTool("basic.settings.networkTool"),
about("basic.about"),
update("basic.update"),
// game
// --- game section ---
game2048("game.2048"),
gameMinesweeper("game.minesweeper"),
gameSudoku("game.sudoku"),
Expand All @@ -54,4 +54,48 @@ enum AppFeature {
final String id;

const AppFeature(this.id);

static const mimir = {
mimirForum,
mimirBulletin,
mimirUser,
update,
};
static const school = {
secondClass,
secondClassScore,
secondClassActivity,
secondClassAttended,
examResult,
examArrangement,
gpa,
teacherEval,
expenseRecords,
expenseRecordsStats,
electricityBalance,
eduEmail,
oaAnnouncement,
ywb,
library,
librarySearch,
libraryBorrowing,
libraryBorrowingHistory,
yellowPages,
courseSelection,
studentPlan,
};
static const sitRobot = {
sitRobotOpenLabDoor,
};
static const basic = {
timetable,
scanner,
};
static const game = {
game2048,
gameMinesweeper,
gameSudoku,
gameWordle,
gameSuika,
};
}
18 changes: 18 additions & 0 deletions lib/login/page/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ class _LoginPageState extends ConsumerState<LoginPage> {
bool loggingIn = false;
OaUserType? estimatedUserType;
int? admissionYear;
// bool? schoolServerConnected;

@override
void initState() {
super.initState();
$account.addListener(onAccountChange);
// checkSchoolServerConnectivity();
}

@override
Expand All @@ -73,6 +75,14 @@ class _LoginPageState extends ConsumerState<LoginPage> {
super.dispose();
}

// Future<void> checkSchoolServerConnectivity() async {
// final connected = await Init.ssoSession.checkConnectivity();
// if (!mounted) return;
// setState(() {
// schoolServerConnected = connected;
// });
// }

void onAccountChange() {
var account = $account.text;
account = account.toUpperCase();
Expand Down Expand Up @@ -247,6 +257,14 @@ class _LoginPageState extends ConsumerState<LoginPage> {
);
}

// Widget buildConnectivityIcon() {
// return switch (schoolServerConnected) {
// null => const CircularProgressIndicator.adaptive(),
// true => const Icon(Icons.check),
// false => const Icon(Icons.public_off),
// };
// }

Widget buildHeader() {
return widget.isGuarded
? const Icon(
Expand Down
2 changes: 1 addition & 1 deletion lib/platform/quick_action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class QuickAction {

final _actions = [
QuickAction(
type: AppFeature.sitRobotOpenDoor.name,
type: AppFeature.sitRobotOpenLabDoor.name,
action: (ctx) {
sitRobotOpenDoor();
},
Expand Down

0 comments on commit 1677669

Please sign in to comment.