-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
28 changed files
with
42 additions
and
944 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,22 @@ | ||
import 'package:easy_localization/easy_localization.dart'; | ||
import 'package:mimir/feature/feature.dart'; | ||
import 'package:mimir/storage/hive/type_id.dart'; | ||
|
||
part 'user_type.g.dart'; | ||
|
||
@HiveType(typeId: CoreHiveType.oaUserType) | ||
enum OaUserType { | ||
@HiveField(0) | ||
undergraduate(allowed: { | ||
AppFeature.mimirForum, | ||
AppFeature.mimirBulletin, | ||
AppFeature.timetable, | ||
AppFeature.secondClass$, | ||
AppFeature.examResultUg, | ||
AppFeature.examArrangement, | ||
AppFeature.teacherEval, | ||
AppFeature.ywb, | ||
AppFeature.gpaUg, | ||
AppFeature.yellowPages, | ||
AppFeature.expenseRecords$, | ||
AppFeature.electricityBalance, | ||
AppFeature.library$, | ||
AppFeature.eduEmail$, | ||
AppFeature.oaAnnouncement, | ||
AppFeature.game$, | ||
AppFeature.mimirUpdate, | ||
}), | ||
undergraduate(), | ||
@HiveField(1) | ||
postgraduate(allowed: { | ||
AppFeature.mimirForum, | ||
AppFeature.mimirBulletin, | ||
AppFeature.timetable, | ||
AppFeature.examResultPg, | ||
AppFeature.ywb, | ||
AppFeature.expenseRecords$, | ||
AppFeature.electricityBalance, | ||
AppFeature.library$, | ||
AppFeature.yellowPages, | ||
AppFeature.eduEmail$, | ||
AppFeature.oaAnnouncement, | ||
AppFeature.game$, | ||
AppFeature.mimirUpdate, | ||
}), | ||
postgraduate(), | ||
@HiveField(2) | ||
freshman(allowed: { | ||
AppFeature.timetable, | ||
AppFeature.mimirForum, | ||
AppFeature.mimirBulletin, | ||
AppFeature.yellowPages, | ||
AppFeature.librarySearch, | ||
AppFeature.oaAnnouncement, | ||
AppFeature.freshman, | ||
AppFeature.game$, | ||
AppFeature.mimirUpdate, | ||
}), | ||
freshman(), | ||
@HiveField(3) | ||
worker(allowed: { | ||
AppFeature.mimirForum, | ||
AppFeature.mimirBulletin, | ||
AppFeature.ywb, | ||
AppFeature.expenseRecords$, | ||
AppFeature.electricityBalance, | ||
AppFeature.yellowPages, | ||
AppFeature.library$, | ||
AppFeature.oaAnnouncement, | ||
AppFeature.game$, | ||
AppFeature.mimirUpdate, | ||
}), | ||
worker(), | ||
@HiveField(4) | ||
none(allowed: { | ||
AppFeature.mimirForum, | ||
AppFeature.mimirBulletin, | ||
AppFeature.timetable, | ||
AppFeature.electricityBalance, | ||
AppFeature.librarySearch, | ||
AppFeature.eduEmail$, | ||
AppFeature.yellowPages, | ||
AppFeature.mimirUpdate, | ||
}); | ||
none(); | ||
|
||
final Set<String> allowed; | ||
|
||
const OaUserType({ | ||
required this.allowed, | ||
}); | ||
const OaUserType(); | ||
|
||
String l10n() => "OaUserType.$name".tr(); | ||
|
||
static final _type2Filter = Map.fromEntries(OaUserType.values.map( | ||
(v) => MapEntry(v, AppFeatureFilter.build(allow: v.allowed, prohibit: {})), | ||
)); | ||
|
||
AppFeatureFilter get featureFilter => _type2Filter[this]!; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,17 @@ | ||
import 'package:easy_localization/easy_localization.dart'; | ||
import 'package:mimir/feature/feature.dart'; | ||
import 'package:mimir/storage/hive/type_id.dart'; | ||
|
||
part 'campus.g.dart'; | ||
|
||
@HiveType(typeId: CoreHiveType.campus) | ||
enum Campus { | ||
@HiveField(0) | ||
fengxian(prohibited: {}), | ||
fengxian(), | ||
@HiveField(1) | ||
xuhui(prohibited: { | ||
"school.electricityBalance", | ||
}); | ||
xuhui(); | ||
|
||
final Set<String> prohibited; | ||
|
||
const Campus({ | ||
required this.prohibited, | ||
}); | ||
const Campus(); | ||
|
||
String l10n() => "campus.$name".tr(); | ||
|
||
static final _type2Filter = Map.fromEntries(Campus.values.map( | ||
(v) => MapEntry(v, AppFeatureFilter.build(allow: {}, prohibit: v.prohibited)), | ||
)); | ||
|
||
AppFeatureFilter get featureFilter => _type2Filter[this]!; | ||
} |
Oops, something went wrong.