Skip to content

Commit

Permalink
Merge pull request #36 from NKUST-ITC/develop
Browse files Browse the repository at this point in the history
Update to v3.0.4
  • Loading branch information
abc873693 authored Mar 9, 2019
2 parents bc76bf5 + 62e383d commit 35f8d60
Show file tree
Hide file tree
Showing 16 changed files with 104 additions and 61 deletions.
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright (c) 2018 RainVisitor

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 7 additions & 1 deletion ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../.symlinks/flutter/ios-release/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework",
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework",
"${BUILT_PRODUCTS_DIR}/Protobuf/Protobuf.framework",
"${BUILT_PRODUCTS_DIR}/Reachability/Reachability.framework",
Expand All @@ -258,12 +259,15 @@
"${BUILT_PRODUCTS_DIR}/fluttertoast/fluttertoast.framework",
"${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework",
"${BUILT_PRODUCTS_DIR}/package_info/package_info.framework",
"${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework",
"${BUILT_PRODUCTS_DIR}/share/share.framework",
"${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework",
"${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework",
"${BUILT_PRODUCTS_DIR}/url_launcher/url_launcher.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FMDB.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Protobuf.framework",
Expand All @@ -274,8 +278,10 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/fluttertoast.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/package_info.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/share.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher.framework",
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
13 changes: 12 additions & 1 deletion lib/pages/home/about/open_source_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,18 @@ class OpenSourcePageState extends State<OpenSourcePage>
"Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n" +
"THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."),
_item('add_2_calendar',
'MIT License\n\nCopyright (c) 2018 Javi Hurtado\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.')
'MIT License\n\nCopyright (c) 2018 Javi Hurtado\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.'),
_item(
'flutter_cached_network_image',
"The MIT License (MIT)\n" +
"\n" +
"Copyright (c) 2018 Rene Floor\n" +
"\n" +
"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n" +
"\n" +
"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n" +
"\n" +
"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.")
],
),
);
Expand Down
4 changes: 3 additions & 1 deletion lib/pages/home/bus/bus_reserve_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class BusReservePageState extends State<BusReservePage> {
child: Calendar(
isExpandable: false,
showTodayAction: false,
showCalendarPickerIcon: false,
showCalendarPickerIcon: true,
showChevronsToChangeRange: true,
onDateSelected: (DateTime datetime) {
dateTime = datetime;
Expand Down Expand Up @@ -252,6 +252,8 @@ class BusReservePageState extends State<BusReservePage> {
child: ConstrainedBox(
constraints: BoxConstraints(minWidth: double.infinity),
child: CupertinoSegmentedControl(
selectedColor: Resource.Colors.blue,
borderColor: Resource.Colors.blue,
groupValue: selectStartStation,
children: {
Station.janGong: Container(
Expand Down
32 changes: 18 additions & 14 deletions lib/pages/home/course_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,13 @@ class CoursePageState extends State<CoursePage>
Helper.instance.getSemester().then((semesterData) {
this.semesterData = semesterData;
CacheUtils.saveSemesterData(semesterData);
setState(() {
selectSemester = semesterData.defaultSemester;
selectSemesterIndex = semesterData.defaultIndex;
_getCourseTables();
});
if (mounted) {
setState(() {
selectSemester = semesterData.defaultSemester;
selectSemesterIndex = semesterData.defaultIndex;
_getCourseTables();
});
}
}).catchError((e) {
if (e is DioError) {
switch (e.type) {
Expand Down Expand Up @@ -274,15 +276,17 @@ class CoursePageState extends State<CoursePage>
courseData = await CacheUtils.loadCourseData(value);
if (this.courseData == null) return;
isOffline = true;
setState(() {
if (courseData.status == 204) {
state = _State.empty;
} else if (courseData.status == 200) {
state = _State.finish;
} else {
state = _State.error;
}
});
if (mounted) {
setState(() {
if (courseData.status == 204) {
state = _State.empty;
} else if (courseData.status == 200) {
state = _State.finish;
} else {
state = _State.error;
}
});
}
}

void _selectSemester() {
Expand Down
12 changes: 7 additions & 5 deletions lib/pages/home/leaves/leave_record_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,13 @@ class LeaveRecordPageState extends State<LeaveRecordPage>
void _getSemester() {
_loadSemesterData();
Helper.instance.getSemester().then((semesterData) {
setState(() {
this.semesterData = semesterData;
selectSemester = semesterData.defaultSemester;
selectSemesterIndex = semesterData.defaultIndex;
});
if (mounted) {
setState(() {
this.semesterData = semesterData;
selectSemester = semesterData.defaultSemester;
selectSemesterIndex = semesterData.defaultIndex;
});
}
CacheUtils.saveSemesterData(semesterData);
_getSemesterLeaveRecord();
}).catchError((e) {
Expand Down
8 changes: 6 additions & 2 deletions lib/pages/home/news_content_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:nkust_ap/models/models.dart';
import 'package:nkust_ap/res/resource.dart' as Resource;
Expand Down Expand Up @@ -94,7 +95,10 @@ class NewsContentPageState extends State<NewsContentPage>
List<Widget> list = <Widget>[
AspectRatio(
aspectRatio: orientation == Orientation.portrait ? 4 / 3 : 9 / 16,
child: Image.network(news.image),
child: CachedNetworkImage(
imageUrl: news.image,
errorWidget: (context, url, error) => Icon(Icons.error),
),
),
SizedBox(
height: orientation == Orientation.portrait ? 16.0 : 0.0,
Expand Down Expand Up @@ -136,7 +140,7 @@ class NewsContentPageState extends State<NewsContentPage>
),
),
onPressed: () {
Utils.launchUrl(news.url);
if (news.url.isNotEmpty) Utils.launchUrl(news.url);
},
padding: EdgeInsets.symmetric(vertical: 12.0, horizontal: 0.0),
color: Resource.Colors.yellow,
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/home/score_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,12 @@ class ScorePageState extends State<ScorePage>
void _getSemester() {
_loadSemesterData();
Helper.instance.getSemester().then((semesterData) {
_getSemesterScore();
setState(() {
this.semesterData = semesterData;
selectSemester = semesterData.defaultSemester;
selectSemesterIndex = semesterData.defaultIndex;
});
_getSemesterScore();
CacheUtils.saveSemesterData(semesterData);
}).catchError((e) {
if (e is DioError) {
Expand Down
12 changes: 6 additions & 6 deletions lib/pages/home/setting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,15 @@ class SettingPageState extends State<SettingPage>
}
if (courseData.status != 200) {
setState(() {
busNotify = false;
prefs.setBool(Constants.PREF_BUS_NOTIFY, busNotify);
courseNotify = false;
prefs.setBool(Constants.PREF_COURSE_NOTIFY, courseNotify);
});
}
if (Navigator.canPop(context)) Navigator.pop(context, 'dialog');
}).catchError((e) {
setState(() {
busNotify = false;
prefs.setBool(Constants.PREF_BUS_NOTIFY, busNotify);
courseNotify = false;
prefs.setBool(Constants.PREF_COURSE_NOTIFY, courseNotify);
});
if (e is DioError) {
switch (e.type) {
Expand All @@ -241,8 +241,8 @@ class SettingPageState extends State<SettingPage>
}
}).catchError((e) {
setState(() {
busNotify = false;
prefs.setBool(Constants.PREF_BUS_NOTIFY, busNotify);
courseNotify = false;
prefs.setBool(Constants.PREF_COURSE_NOTIFY, courseNotify);
});
if (e is DioError) {
switch (e.type) {
Expand Down
7 changes: 5 additions & 2 deletions lib/pages/home/user_info_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:nkust_ap/res/colors.dart' as Resource;
Expand Down Expand Up @@ -59,8 +60,10 @@ class UserInfoPageState extends State<UserInfoPage>
child: pictureUrl != ""
? Hero(
tag: Constants.TAG_STUDENT_PICTURE,
child: Image.network(
pictureUrl,
child: CachedNetworkImage(
imageUrl: pictureUrl,
errorWidget: (context, url, error) =>
Icon(Icons.error),
),
)
: null,
Expand Down
6 changes: 5 additions & 1 deletion lib/pages/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:io';

import 'package:cached_network_image/cached_network_image.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -59,7 +60,10 @@ class HomePageState extends State<HomePage> {
onTap: () {
Navigator.of(context).push(NewsContentPageRoute(news));
},
child: Image.network(news.image),
child: CachedNetworkImage(
imageUrl: news.image,
errorWidget: (context, url, error) => Icon(Icons.error),
),
),
);
}
Expand Down
34 changes: 15 additions & 19 deletions lib/pages/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -282,27 +282,23 @@ class LoginPageState extends State<LoginPage>
isRememberPassword =
prefs.getBool(Constants.PREF_REMEMBER_PASSWORD) ?? true;
isAutoLogin = prefs.getBool(Constants.PREF_AUTO_LOGIN) ?? false;
var username = prefs.getString(Constants.PREF_USERNAME) ?? "";
var password = "";
if (isRememberPassword) {
final encrypter =
Encrypter(AES(Constants.key, Constants.iv, mode: AESMode.cbc));
var encryptPassword = prefs.getString(Constants.PREF_PASSWORD) ?? "";
if (encryptPassword != "")
password = encrypter.decrypt64(encryptPassword);
}
setState(() {
_username.text = prefs.getString(Constants.PREF_USERNAME) ?? "";
if (isRememberPassword) {
final encrypter =
Encrypter(AES(Constants.key, Constants.iv, mode: AESMode.cbc));
String password = prefs.getString(Constants.PREF_PASSWORD) ?? "";
var currentVersion =
prefs.getString(Constants.PREF_CURRENT_VERSION) ?? "";
//if build number below 604
if (int.parse(currentVersion) < 604) {
password = prefs.getString(Constants.PREF_PASSWORD) ?? "";
} else {
var encryptPassword = prefs.getString(Constants.PREF_PASSWORD) ?? "";
password = encrypter.decrypt64(encryptPassword);
}
_password.text = password;
}
if (isAutoLogin) {
_login();
}
_username.text = username;
_password.text = password;
});
await Future.delayed(Duration(microseconds: 50));
if (isAutoLogin) {
_login();
}
}

_login() async {
Expand Down
10 changes: 4 additions & 6 deletions lib/utils/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class AppLocalizations {
'en': {
'app_name': 'NKUST AP',
'update_note_title': 'Update Notes',
'update_note_content':
'1.Release absent system.\n2.Add offline access of feature semester course.\n3.Calendar can add schedule to calendar app.\n4.Fix some crash.',
'update_note_content': '1.Fix some crash.',
'splash_content': '我們全都包了\n只剩下學校不包我們',
'share': 'Share',
'teacher_confirm_title': 'Are you a teacher?',
Expand Down Expand Up @@ -186,7 +185,7 @@ class AppLocalizations {
'The best KUAS Campus App\nKUAS AP\n\nAre you afreshman?\nDon\'t know about school info, telephone numbers, or up coming events?\nBeenhere a few years?\nHave checking class schedule, report card and reserving bus seatsdrove you crazy?\n\nNo more, no more worries, anymore!\n\nKUAS AP lets no matter old or newfellow\nhave control over your life in KUAS!\n\nFrom checking class schedule, report card toyour absence records!\nPlus reserving/canceling bus seats with newest school feeds!\n\n\n\nMuch Simple, Many Convenient, Very instinct, wow!\n\n☆FABULOUS☆',
'about_author_title': 'Made by',
'about_author_content':
'呂紹榕(Louie Lu), 姜尚德(JohnThunder), \nregisterAutumn, 詹濬鍵(Evans), \n陳建霖(HearSilent), \n房志剛(Rainvisitor),林義翔(buluni.ha)',
'呂紹榕(Louie Lu), 姜尚德(JohnThunder), \nregisterAutumn, 詹濬鍵(Evans), \n陳建霖(HearSilent), \n房志剛(Rainvisitor),林義翔(takidog)',
'about_us':
'“Ask not why nobody is doing this. You are \'nobody\'.”\n\nWe did this cause no one did it.\nWe created KUAS Wifi Login, KUASAP and KUAS Gourmet, Course Selection Sim, etc&#8230;\nTo bring convenience to everyone\'s on campus!',
'about_recruit_title': 'We Need You !',
Expand Down Expand Up @@ -269,8 +268,7 @@ class AppLocalizations {
'zh': {
'app_name': '高科校務通',
'update_note_title': '更新日誌',
'update_note_content':
'1.推出缺曠系統\n2.新增學期課表可透過先前紀錄離線存取\n3.行事曆現在可加入行程到手機行事曆了\n4.修正部分崩潰',
'update_note_content': '1.修正部分崩潰',
'splash_content': '我們全都包了\n只剩下學校不包我們',
'share': '分享',
'teacher_confirm_title': '您是老師嗎?',
Expand Down Expand Up @@ -416,7 +414,7 @@ class AppLocalizations {
'app_version': 'App 版本',
'about_author_title': '作者群',
'about_author_content':
'呂紹榕(Louie Lu), 姜尚德(JohnThunder), \nregisterAutumn, 詹濬鍵(Evans), \n陳建霖(HearSilent), \n房志剛(Rainvisitor),林義翔(buluni.ha)',
'呂紹榕(Louie Lu), 姜尚德(JohnThunder), \nregisterAutumn, 詹濬鍵(Evans), \n陳建霖(HearSilent), \n房志剛(Rainvisitor),林義翔(takidog)',
'about_us':
'「不要問為何沒有人做這個,\n先承認你就是『沒有人』」。\n因為,「沒有人」是萬能的。\n\n因為沒有人做這些,所以我們跳下來做。\n先後完成了高應無線通、高應校務通,到後來的高應美食通、模擬選課等等.......\n無非是希望帶給大家更便利的校園生活!',
'about_recruit_title': 'We Need You !',
Expand Down
Loading

0 comments on commit 35f8d60

Please sign in to comment.