Skip to content

Commit

Permalink
Merge pull request #22 from liplum-dev/v2.1.x
Browse files Browse the repository at this point in the history
V2.1.2+17
  • Loading branch information
liplum authored Dec 18, 2023
2 parents 51f630e + cc1ffec commit 7794bfd
Show file tree
Hide file tree
Showing 31 changed files with 309 additions and 213 deletions.
File renamed without changes.
20 changes: 18 additions & 2 deletions assets/l10n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,15 @@ class2nd:
noActivities: No activities
noAttendedActivities: No attended activities
viewDetails: View details
noDetails: No details given
details: Activity details
apply:
btn: Apply
replyTip: Reply from school
applyRequest: Apply
applyRequestDesc: Confirm to apply this activity?
applySuccessTip: Successful application for this activity
applyFailureTip: Failed to apply for this activity
info:
activityId: Activity ID
applicationId: Application ID
Expand Down Expand Up @@ -241,6 +245,7 @@ class2nd:
conference: Conf
schoolCultureCompetition: Culture COMP
paperAndPatent: Paper&Patent
unknown: Unknown
scoreType:
all: All
thematicReport:
Expand All @@ -261,8 +266,16 @@ class2nd:
schoolSafetyCivilization:
full: Safety&Civil.
short: Civil.
noDetails: No details given
details: Activity eetails
applicationResponse:
successfulCheck: Successful check
incompleteApplicantInfo: Your info is incomplete, please complete it
alreadyApplied: You have already applied for this activity
applicationReachLimitToday: You have reached your max number of applications today
activityReachParticipantLimit: The activity has reached its max number of applicants
activityExpired: This activity has expired and is no longer accepting applications
applicantOccupiedWithinActivity: You have already applied for other activities in that time period
applicantNotPermitted: You cannot apply for this activity
applicantNotIncluding: You are not among those who can apply for the activity
ywb:
title: SIT YWB
info: |
Expand Down Expand Up @@ -605,6 +618,8 @@ settings:
title: About
version: Version
icpLicense: ICP License
termsOfUse: Term of use
privacyPolicy: Privacy policy
oaAnnounce:
title: OA announcement
tab:
Expand Down Expand Up @@ -724,3 +739,4 @@ pick: Pick
duplicate: Duplicate
copyTip: "{} was copied"
done: Done
openInBrowser: Open in browser
26 changes: 21 additions & 5 deletions assets/l10n/zh-Hans.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,15 @@ class2nd:
noActivities: 没有活动
noAttendedActivities: 没有参加过的活动
viewDetails: 查看详情
noDetails: 暂无资料
details: 活动资料
apply:
btn: 报名
btn: 申请
replyTip: 校方回复
applyRequest: 报名
applyRequestDesc: 确认报名这个活动吗?
applyRequest: 申请
applyRequestDesc: 确认申请这个活动吗?
applySuccessTip: 申请活动成功
applyFailureTip: 申请活动失败
info:
activityId: 活动编号
applicationId: 申请编号
Expand Down Expand Up @@ -238,6 +242,7 @@ class2nd:
conference: 会议
schoolCultureCompetition: 校园文化竞赛
paperAndPatent: 论文专利
unknown: 未知
scoreType:
all: 全部
thematicReport:
Expand All @@ -258,8 +263,16 @@ class2nd:
schoolSafetyCivilization:
full: 校园安全文明
short: 文明
noDetails: 暂无资料
details: 活动资料
applicationResponse:
successfulCheck: 检查成功
incompleteApplicantInfo: 您的个人信息不全,请补全您的信息
alreadyApplied: 您已申请过该活动
applicationReachLimitToday: 您今天的申请次数已达上限
activityReachParticipantLimit: 该活动的申请人数已达上限
activityExpired: 该活动已过期并停止接受申请
applicantOccupiedWithinActivity: 您已申请过该时间段的其他活动
applicantNotPermitted: 您不能申请该活动
applicantNotIncluding: 您不属于该活动的可申请人员范围内
ywb:
title: 应网办
info: |
Expand Down Expand Up @@ -605,6 +618,8 @@ settings:
title: 关于
version: 版本
icpLicense: ICP 备案号
termsOfUse: 使用条款
privacyPolicy: 隐私政策
oaAnnounce:
title: OA 公告
tab:
Expand Down Expand Up @@ -724,3 +739,4 @@ pick: 选择
duplicate: 创建副本
copyTip: "已复制 {} 到剪贴板了"
done: 完成
openInBrowser: 在浏览器中打开
20 changes: 18 additions & 2 deletions assets/l10n/zh-Hant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,15 @@ class2nd:
noActivities: 無活動
noAttendedActivities: 無參加過的活動
viewDetails: 檢視詳細資料
noDetails: 暫無資訊
details: 詳細資料
apply:
btn: 申請
replyTip: 校方回信
applyRequest: 申請
applyRequestDesc: 確認要申請這個活動嗎?
applySuccessTip: 申請活動成功
applyFailureTip: 申請活動失敗
info:
activityId: 活動 ID
applicationId: 申請 ID
Expand Down Expand Up @@ -238,6 +242,7 @@ class2nd:
conference: 會議
schoolCultureCompetition: 校園文化競賽
paperAndPatent: 論文專利
unknown: 未知
scoreType:
all: 全部
thematicReport:
Expand All @@ -258,8 +263,16 @@ class2nd:
schoolSafetyCivilization:
full: 校園安全文明
short: 安全
noDetails: 暫無資訊
details: 詳細資料
applicationResponse:
successfulCheck: 檢查成功
incompleteApplicantInfo: 您的資訊不完整,請填寫
alreadyApplied: 您已經申請參加此活動
applicationReachLimitToday: 您今天已達到申請數量上限
activityReachParticipantLimit: 活動報名人數已達上限
activityExpired: 此活動已過期,不再接受申請
applicantOccupiedWithinActivity: 您在該時間內已經申請了其他活動
applicantNotPermitted: 您不能申請此活動
applicantNotIncluding: 您不屬於可以申請活動的人之一
ywb:
title: 應網辦
info: |
Expand Down Expand Up @@ -605,6 +618,8 @@ settings:
title: 關於
version: 版本
icpLicense: ICP 許可證
termsOfUse: 使用條款
privacyPolicy: 隱私權政策
oaAnnounce:
title: OA 公告
tab:
Expand Down Expand Up @@ -724,3 +739,4 @@ pick: 選取
duplicate: 創建副本
copyTip: "{} 被複製到剪貼板了"
done: 完成
openInBrowser: 在瀏覽器中開啟
12 changes: 9 additions & 3 deletions lib/entity/version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,18 @@ class AppMeta {
Future<AppMeta> getCurrentVersion() async {
final info = await PackageInfo.fromPlatform();
var versionText = info.version;
final String? buildNumber;
if (info.buildNumber.isNotEmpty) {
if (UniversalPlatform.isIOS && info.buildNumber != info.version) {
// do nothing
if (UniversalPlatform.isIOS && info.buildNumber == info.version) {
buildNumber = null;
} else {
versionText = "${info.version}+${info.buildNumber}";
buildNumber = info.buildNumber;
}
} else {
buildNumber = null;
}
if (buildNumber != null) {
versionText = "${info.version}+$buildNumber";
}

final AppPlatform platform;
Expand Down
2 changes: 2 additions & 0 deletions lib/l10n/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ mixin class CommonI18nMixin {
String copyTipOf(String item) => "copyTip".tr(args: [item]);

String get done => "done".tr();

String get openInBrowser => "openInBrowser".tr();
}

class CommonI18n with CommonI18nMixin {
Expand Down
104 changes: 53 additions & 51 deletions lib/me/edu_email/page/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,60 +72,62 @@ class _EduEmailLoginPageState extends State<EduEmailLoginPage> {
return Form(
autovalidateMode: AutovalidateMode.always,
key: _formKey,
child: Column(
children: [
TextFormField(
controller: $username,
textInputAction: TextInputAction.next,
autofocus: true,
readOnly: !kDebugMode && initialAccount != null,
autocorrect: false,
enableSuggestions: false,
validator: (username) {
if (username == null) return null;
if (EmailValidator.validate(R.formatEduEmail(username: username))) return null;
return i18n.login.invalidEmailAddressFormatTip;
},
decoration: InputDecoration(
labelText: i18n.info.emailAddress,
hintText: i18n.login.addressHint,
suffixText: "@${R.eduEmailDomain}",
icon: const Icon(Icons.alternate_email_outlined),
child: AutofillGroup(
child: Column(
children: [
TextFormField(
controller: $username,
textInputAction: TextInputAction.next,
autofocus: true,
readOnly: !kDebugMode && initialAccount != null,
autocorrect: false,
enableSuggestions: false,
validator: (username) {
if (username == null) return null;
if (EmailValidator.validate(R.formatEduEmail(username: username))) return null;
return i18n.login.invalidEmailAddressFormatTip;
},
decoration: InputDecoration(
labelText: i18n.info.emailAddress,
hintText: i18n.login.addressHint,
suffixText: "@${R.eduEmailDomain}",
icon: const Icon(Icons.alternate_email_outlined),
),
),
),
TextFormField(
controller: $password,
autofocus: true,
keyboardType: isPasswordClear ? TextInputType.visiblePassword : null,
textInputAction: TextInputAction.send,
contextMenuBuilder: (ctx, state) {
return AdaptiveTextSelectionToolbar.editableText(
editableTextState: state,
);
},
autocorrect: false,
enableSuggestions: false,
obscureText: !isPasswordClear,
onFieldSubmitted: (inputted) async {
if (!isLoggingIn) {
await onLogin();
}
},
decoration: InputDecoration(
labelText: i18n.login.credentials.password,
icon: const Icon(Icons.lock),
hintText: i18n.login.passwordHint,
suffixIcon: IconButton(
icon: Icon(isPasswordClear ? Icons.visibility : Icons.visibility_off),
onPressed: () {
setState(() {
isPasswordClear = !isPasswordClear;
});
},
TextFormField(
controller: $password,
autofocus: true,
keyboardType: isPasswordClear ? TextInputType.visiblePassword : null,
textInputAction: TextInputAction.send,
contextMenuBuilder: (ctx, state) {
return AdaptiveTextSelectionToolbar.editableText(
editableTextState: state,
);
},
autocorrect: false,
enableSuggestions: false,
obscureText: !isPasswordClear,
onFieldSubmitted: (inputted) async {
if (!isLoggingIn) {
await onLogin();
}
},
decoration: InputDecoration(
labelText: i18n.login.credentials.password,
icon: const Icon(Icons.lock),
hintText: i18n.login.passwordHint,
suffixIcon: IconButton(
icon: Icon(isPasswordClear ? Icons.visibility : Icons.visibility_off),
onPressed: () {
setState(() {
isPasswordClear = !isPasswordClear;
});
},
),
),
),
),
],
],
),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:sit/storage/hive/type_id.dart';

import 'attended.dart';

part 'list.g.dart';
part 'activity.g.dart';

@HiveType(typeId: CacheHiveType.activityCat)
enum Class2ndActivityCat {
Expand Down Expand Up @@ -77,11 +77,15 @@ enum Class2ndActivityCat {
paperAndPatent(
"8ab17f533ff05c27013ff06d10bf0001",
Class2ndPointType.creation,
);
),
@HiveField(11)
unknown(null);

final String id;
final String? id;
final Class2ndPointType? pointType;

bool get canFetchData => id != null;

const Class2ndActivityCat(this.id, [this.pointType]);

String l10nName() => "class2nd.activityCat.$name".tr();
Expand All @@ -90,29 +94,30 @@ enum Class2ndActivityCat {

/// Don't Change this.
/// Strings from school API
static Class2ndActivityCat? parse(String catName) {
if (catName == "讲座报告") {
static Class2ndActivityCat? parse(String name) {
// To prevent ellipsis
name = name.replaceAll(".", "");
if (name == "讲座报告") {
return Class2ndActivityCat.lecture;
} else if (catName == "主题教育") {
} else if (name == "主题教育") {
return Class2ndActivityCat.lecture;
} else if (catName == "校园文化活动") {
} else if (name == "校园文化活动") {
return Class2ndActivityCat.schoolCultureActivity;
} else if (catName == "校园文化竞赛活动") {
} else if (name == "校园文化竞赛活动") {
return Class2ndActivityCat.schoolCultureCompetition;
} else if (catName == "创新创业创意") {
} else if (name == "创新创业创意") {
return Class2ndActivityCat.creation;
} else if (catName == "论文专利") {
} else if (name == "论文专利") {
return Class2ndActivityCat.paperAndPatent;
} else if (catName == "社会实践") {
} else if (name == "社会实践") {
return Class2ndActivityCat.practice;
} else if (catName == "志愿公益") {
} else if (name == "志愿公益") {
return Class2ndActivityCat.voluntary;
} else if (catName.contains("安全教育网络教学")) {
// To prevent ellipsis
} else if (name == "安全教育网络教学") {
return Class2ndActivityCat.onlineSafetyEdu;
} else if (catName == "校园文明") {
} else if (name == "校园文明") {
return Class2ndActivityCat.schoolCivilization;
} else if (catName.contains("会议")) {
} else if (name.contains("会议")) {
return Class2ndActivityCat.conference;
}
return null;
Expand Down
Loading

0 comments on commit 7794bfd

Please sign in to comment.