From 760b600fae1c2bd8a3450e383ab7ea33fd310bdc Mon Sep 17 00:00:00 2001 From: RainVisitor Date: Tue, 19 Mar 2019 14:33:27 +0800 Subject: [PATCH 1/6] Add policy --- POLICY.md | 44 +++++++++++++++++++ .../project.pbxproj | 10 ++--- .../contents.xcworkspacedata | 0 .../xcshareddata/xcschemes/Runner.xcscheme | 8 ++-- .../contents.xcworkspacedata | 2 +- 5 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 POLICY.md rename ios/{Runner.xcodeproj => .xcodeproj}/project.pbxproj (99%) rename ios/{Runner.xcodeproj => .xcodeproj}/project.xcworkspace/contents.xcworkspacedata (100%) rename ios/{Runner.xcodeproj => .xcodeproj}/xcshareddata/xcschemes/Runner.xcscheme (92%) diff --git a/POLICY.md b/POLICY.md new file mode 100644 index 00000000..c8003971 --- /dev/null +++ b/POLICY.md @@ -0,0 +1,44 @@ +高科校務通由國立高雄科技大學資訊研習社團隊(以下稱「團隊」)所提供。我們十分重視您的隱私權保護, +將依個人資料保護法及本隱私權政策蒐集、處理及利用您的個人資料,並且提供您對個人資料權利之行使與保護。 +若您不同意本隱私權政策之全部或部份者,請您停止使用本APP服務。 + +1. 本隱私權政策適用範圍 +=== +請您在於使用高科校務通服務前,確認您已審閱並同意本隱私權政策所列全部條款,若您不同意全部或部分者,則請勿使用本高科校務通服務。 + +本隱私權政策僅適用於本高科校務通對您個人資料所為蒐集、處理與利用,不及於其他非本團隊所有或控制之其他團隊或個人。您可能經由本高科校務通連結至第三人所經營之活動,各該活動為之個人資料蒐集係依其活動之隱私權政策規定處理,與本團隊無涉。 + +2.個人資料保護法應告知事項 +=== +1. 蒐集機關名稱:高科校務通團隊。 +2. 蒐集之目的:提供相關校務查詢服務,校車訂閱服務,缺曠課服務等。 +3. 個人資料類別: + * 識別類 (學號) + * 其他類 (使用偏好,系統自動紀錄之軌跡資訊等) + + +依據個人資料保護法第三條,您就您的個人資料享有以下權力: + * 查詢或請求閱覽。 + * 請求制給副本。 + * 請求補正或更正。 + * 請求停止蒐集、處理或利用。 + * 請求刪除。 + + + +3. 個人資料蒐集、處理及利用說明 +=== +高科校務通服務將利用您的國立高雄科技大學學號與密碼,登入校務系統、請假系統、與校車系統。 + +資料的處理將不會儲存在我們伺服器上,將直接轉發到使用者客戶端上。 + + +4. 隱私權政策之修改 +=== + +隱私權政策如經修改,將於本文公告。若您不同意該等變更或修改,請停止繼續使用本服務,並依本隱私權政策規定通知本團隊停止蒐集、處理及利用您的個人資料。 + +問題和建議 +=== + +如果您有任何問題或建議,請與我們聯繫。 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/ .xcodeproj/project.pbxproj similarity index 99% rename from ios/Runner.xcodeproj/project.pbxproj rename to ios/ .xcodeproj/project.pbxproj index 7e65b279..39b6785e 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/ .xcodeproj/project.pbxproj @@ -194,7 +194,7 @@ TargetAttributes = { 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; - DevelopmentTeam = 75S866VSMR; + DevelopmentTeam = R7BC26UNC9; LastSwiftMigration = 0910; ProvisioningStyle = Automatic; SystemCapabilities = { @@ -205,7 +205,7 @@ }; }; }; - buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject " " */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; @@ -513,7 +513,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = 75S866VSMR; + DEVELOPMENT_TEAM = R7BC26UNC9; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -547,7 +547,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = 75S866VSMR; + DEVELOPMENT_TEAM = R7BC26UNC9; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -573,7 +573,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject " " */ = { isa = XCConfigurationList; buildConfigurations = ( 97C147031CF9000F007C117D /* Debug */, diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/ .xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to ios/ .xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/ .xcodeproj/xcshareddata/xcschemes/Runner.xcscheme similarity index 92% rename from ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme rename to ios/ .xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index ba1a9822..e9e56ef2 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/ .xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -17,7 +17,7 @@ BlueprintIdentifier = "97C146ED1CF9000F007C117D" BuildableName = "Runner.app" BlueprintName = "Runner" - ReferencedContainer = "container:Runner.xcodeproj"> + ReferencedContainer = "container: .xcodeproj"> @@ -35,7 +35,7 @@ BlueprintIdentifier = "97C146ED1CF9000F007C117D" BuildableName = "Runner.app" BlueprintName = "Runner" - ReferencedContainer = "container:Runner.xcodeproj"> + ReferencedContainer = "container: .xcodeproj"> @@ -58,7 +58,7 @@ BlueprintIdentifier = "97C146ED1CF9000F007C117D" BuildableName = "Runner.app" BlueprintName = "Runner" - ReferencedContainer = "container:Runner.xcodeproj"> + ReferencedContainer = "container: .xcodeproj"> @@ -77,7 +77,7 @@ BlueprintIdentifier = "97C146ED1CF9000F007C117D" BuildableName = "Runner.app" BlueprintName = "Runner" - ReferencedContainer = "container:Runner.xcodeproj"> + ReferencedContainer = "container: .xcodeproj"> diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata index 21a3cc14..efa0b68a 100644 --- a/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -2,7 +2,7 @@ + location = "group:/Users/rainvisitor/Documents/GitHub/NKUST-AP-Flutter/ios/ .xcodeproj"> From 64fbb6b57c6b1437f69d6976dc9aa6f7af10a0a0 Mon Sep 17 00:00:00 2001 From: RainVisitor Date: Tue, 19 Mar 2019 22:03:10 +0800 Subject: [PATCH 2/6] Fix ios project name error --- ios/{ .xcodeproj => Runner.xcodeproj}/project.pbxproj | 4 ++-- .../project.xcworkspace/contents.xcworkspacedata | 0 .../xcshareddata/xcschemes/Runner.xcscheme | 8 ++++---- ios/Runner.xcworkspace/contents.xcworkspacedata | 5 ++++- 4 files changed, 10 insertions(+), 7 deletions(-) rename ios/{ .xcodeproj => Runner.xcodeproj}/project.pbxproj (99%) rename ios/{ .xcodeproj => Runner.xcodeproj}/project.xcworkspace/contents.xcworkspacedata (100%) rename ios/{ .xcodeproj => Runner.xcodeproj}/xcshareddata/xcschemes/Runner.xcscheme (92%) diff --git a/ios/ .xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj similarity index 99% rename from ios/ .xcodeproj/project.pbxproj rename to ios/Runner.xcodeproj/project.pbxproj index 39b6785e..6524077d 100644 --- a/ios/ .xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -205,7 +205,7 @@ }; }; }; - buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject " " */; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; @@ -573,7 +573,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 97C146E91CF9000F007C117D /* Build configuration list for PBXProject " " */ = { + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { isa = XCConfigurationList; buildConfigurations = ( 97C147031CF9000F007C117D /* Debug */, diff --git a/ios/ .xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from ios/ .xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/ios/ .xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme similarity index 92% rename from ios/ .xcodeproj/xcshareddata/xcschemes/Runner.xcscheme rename to ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index e9e56ef2..ba1a9822 100644 --- a/ios/ .xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -17,7 +17,7 @@ BlueprintIdentifier = "97C146ED1CF9000F007C117D" BuildableName = "Runner.app" BlueprintName = "Runner" - ReferencedContainer = "container: .xcodeproj"> + ReferencedContainer = "container:Runner.xcodeproj"> @@ -35,7 +35,7 @@ BlueprintIdentifier = "97C146ED1CF9000F007C117D" BuildableName = "Runner.app" BlueprintName = "Runner" - ReferencedContainer = "container: .xcodeproj"> + ReferencedContainer = "container:Runner.xcodeproj"> @@ -58,7 +58,7 @@ BlueprintIdentifier = "97C146ED1CF9000F007C117D" BuildableName = "Runner.app" BlueprintName = "Runner" - ReferencedContainer = "container: .xcodeproj"> + ReferencedContainer = "container:Runner.xcodeproj"> @@ -77,7 +77,7 @@ BlueprintIdentifier = "97C146ED1CF9000F007C117D" BuildableName = "Runner.app" BlueprintName = "Runner" - ReferencedContainer = "container: .xcodeproj"> + ReferencedContainer = "container:Runner.xcodeproj"> diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata index efa0b68a..3a29dcb5 100644 --- a/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -2,9 +2,12 @@ + location = "group:/Users/rainvisitor/Documents/GitHub/NKUST-AP-Flutter/ios/Runner.xcodeproj"> + + From 52d2a43129ada9ed14b9650520babcdd9af04fae Mon Sep 17 00:00:00 2001 From: RainVisitor Date: Wed, 20 Mar 2019 00:24:16 +0800 Subject: [PATCH 3/6] Update get userInfo method and fix firebase log event error Update: carousel_slider get by pub --- ios/Runner.xcodeproj/project.pbxproj | 2 +- lib/models/user_info.dart | 25 ++++++++--- lib/pages/home/bus/bus_reserve_page.dart | 2 +- lib/pages/home/user_info_page.dart | 54 +++++++++--------------- lib/pages/home_page.dart | 28 +++++++++++- lib/pages/login_page.dart | 1 - lib/utils/firebase_analytics_utils.dart | 4 +- lib/widgets/drawer_body.dart | 49 +++++++-------------- pubspec.yaml | 3 +- 9 files changed, 84 insertions(+), 84 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 6524077d..98a53bab 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -249,7 +249,7 @@ inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", "${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework", - "${PODS_ROOT}/../.symlinks/flutter/ios-release/Flutter.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", diff --git a/lib/models/user_info.dart b/lib/models/user_info.dart index 2c0ebcd4..e296b294 100644 --- a/lib/models/user_info.dart +++ b/lib/models/user_info.dart @@ -9,14 +9,14 @@ class UserInfo { String message; UserInfo( - {this.educationSystem, - this.department, - this.className, - this.studentId, - this.studentNameCht, - this.studentNameEng, + {this.educationSystem = "", + this.department = "", + this.className = "", + this.studentId = "", + this.studentNameCht = "", + this.studentNameEng = "", this.status, - this.message}); + this.message = ""}); UserInfo.fromJson(Map json) { educationSystem = json['education_system']; @@ -41,4 +41,15 @@ class UserInfo { data['message'] = this.message; return data; } + + void setData(UserInfo userInfo) { + educationSystem = userInfo.educationSystem; + department = userInfo.department; + className = userInfo.className; + studentId = userInfo.studentId; + studentNameCht = userInfo.studentNameCht; + studentNameEng = userInfo.studentNameEng; + status = userInfo.status; + message = userInfo.message; + } } diff --git a/lib/pages/home/bus/bus_reserve_page.dart b/lib/pages/home/bus/bus_reserve_page.dart index 2a43f625..79f8a2ea 100644 --- a/lib/pages/home/bus/bus_reserve_page.dart +++ b/lib/pages/home/bus/bus_reserve_page.dart @@ -225,7 +225,7 @@ class BusReservePageState extends State SliverAppBar( leading: Container(), expandedHeight: orientation == Orientation.portrait - ? MediaQuery.of(context).size.height * 0.19 + ? MediaQuery.of(context).size.height * 0.20 : MediaQuery.of(context).size.width * 0.19, floating: true, backgroundColor: Colors.transparent, diff --git a/lib/pages/home/user_info_page.dart b/lib/pages/home/user_info_page.dart index 484a0617..093c25a3 100644 --- a/lib/pages/home/user_info_page.dart +++ b/lib/pages/home/user_info_page.dart @@ -1,6 +1,7 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; +import 'package:nkust_ap/models/user_info.dart'; import 'package:nkust_ap/res/colors.dart' as Resource; import 'package:nkust_ap/utils/global.dart'; import 'package:nkust_ap/widgets/drawer_body.dart'; @@ -8,18 +9,26 @@ import 'package:nkust_ap/widgets/drawer_body.dart'; enum _Status { loading, finish, error, empty } class UserInfoPageRoute extends MaterialPageRoute { - UserInfoPageRoute() - : super(builder: (BuildContext context) => new UserInfoPage()); + final UserInfo userInfo; + + UserInfoPageRoute(this.userInfo) + : super( + builder: (BuildContext context) => + new UserInfoPage(userInfo: userInfo)); @override Widget buildPage(BuildContext context, Animation animation, Animation secondaryAnimation) { - return new FadeTransition(opacity: animation, child: new UserInfoPage()); + return new FadeTransition( + opacity: animation, child: new UserInfoPage(userInfo: userInfo)); } } class UserInfoPage extends StatefulWidget { - static const String routerName = "/userInfo"; + static const String routerName = "/widget.userInfo"; + final UserInfo userInfo; + + const UserInfoPage({Key key, this.userInfo}) : super(key: key); @override UserInfoPageState createState() => new UserInfoPageState(); @@ -34,7 +43,7 @@ class UserInfoPageState extends State void initState() { super.initState(); FA.setCurrentScreen("UserInfoPage", "user_info_page.dart"); - if (userInfo == null) _getUserInfo(); + if (pictureUrl == null || pictureUrl.isEmpty) _getUserPicture(); } @override @@ -79,27 +88,27 @@ class UserInfoPageState extends State children: [ ListTile( title: Text(app.studentNameCht), - subtitle: Text(userInfo.studentNameCht), + subtitle: Text(widget.userInfo.studentNameCht), ), Divider(height: 1.0), ListTile( title: Text(app.educationSystem), - subtitle: Text(userInfo.educationSystem), + subtitle: Text(widget.userInfo.educationSystem), ), Divider(height: 1.0), ListTile( title: Text(app.department), - subtitle: Text(userInfo.department), + subtitle: Text(widget.userInfo.department), ), Divider(height: 1.0), ListTile( title: Text(app.studentClass), - subtitle: Text(userInfo.className), + subtitle: Text(widget.userInfo.className), ), Divider(height: 1.0), ListTile( title: Text(app.studentId), - subtitle: Text(userInfo.studentId), + subtitle: Text(widget.userInfo.studentId), ), ], ), @@ -145,29 +154,4 @@ class UserInfoPageState extends State } }); } - - _getUserInfo() { - setState(() { - state = _Status.loading; - }); - Helper.instance.getUsersInfo().then((response) { - if (this.mounted) { - setState(() { - userInfo = response; - _getUserPicture(); - state = _Status.finish; - }); - } - }).catchError((e) { - assert(e is DioError); - DioError dioError = e as DioError; - switch (dioError.type) { - case DioErrorType.RESPONSE: - Utils.handleResponseError(context, 'getUserInfo', mounted, e); - break; - default: - break; - } - }); - } } diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index e336f6d0..900261a7 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -36,6 +36,7 @@ class HomePageState extends State { int _currentTabIndex = 0; int _currentNewsIndex = 0; + UserInfo userInfo = UserInfo(); List newsWidgets = []; List newsList = []; @@ -47,6 +48,7 @@ class HomePageState extends State { super.initState(); FA.setCurrentScreen("HomePage", "home_page.dart"); _getAllNews(); + _getUserInfo(); } @override @@ -156,7 +158,7 @@ class HomePageState extends State { ) ], ), - drawer: DrawerBody(), + drawer: DrawerBody(userInfo: userInfo), body: OrientationBuilder(builder: (_, orientation) { return Container( padding: EdgeInsets.symmetric( @@ -272,6 +274,30 @@ class HomePageState extends State { }); } + _getUserInfo() { + Helper.instance.getUsersInfo().then((response) { + if (this.mounted) { + setState(() { + userInfo = response; + }); + FA.setUserProperty('department', userInfo.department); + FA.setUserId(userInfo.studentId); + } + }).catchError((e) { + if (e is DioError) { + switch (e.type) { + case DioErrorType.RESPONSE: + Utils.handleResponseError(context, 'getUserInfo', mounted, e); + break; + default: + break; + } + } else { + throw e; + } + }); + } + void _showLogoutDialog() { showDialog( context: context, diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index af6f60e3..ead17e18 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -436,7 +436,6 @@ class LoginPageState extends State setState(() { isAutoLogin = false; pictureUrl = ""; - userInfo = null; }); } } diff --git a/lib/utils/firebase_analytics_utils.dart b/lib/utils/firebase_analytics_utils.dart index 8c43e27e..0a8d66f9 100644 --- a/lib/utils/firebase_analytics_utils.dart +++ b/lib/utils/firebase_analytics_utils.dart @@ -31,7 +31,7 @@ class FA { static Future logApiEvent(String type, int status) async { PackageInfo packageInfo = await PackageInfo.fromPlatform(); await analytics.logEvent( - name: 'ap-api', + name: 'ap_api', parameters: { 'type': type, 'status': status, @@ -45,7 +45,7 @@ class FA { static Future logAESErrorEvent(String encryptPassword) async { PackageInfo packageInfo = await PackageInfo.fromPlatform(); await analytics.logEvent( - name: 'aes-error', + name: 'aes_error', parameters: { 'type': encryptPassword, 'version': packageInfo.version, diff --git a/lib/widgets/drawer_body.dart b/lib/widgets/drawer_body.dart index fb101682..271f4c6d 100644 --- a/lib/widgets/drawer_body.dart +++ b/lib/widgets/drawer_body.dart @@ -7,14 +7,16 @@ import 'package:nkust_ap/models/models.dart'; import 'package:nkust_ap/pages/page.dart'; import 'package:nkust_ap/res/resource.dart' as Resource; import 'package:nkust_ap/utils/app_localizations.dart'; -import 'package:nkust_ap/utils/firebase_analytics_utils.dart'; import 'package:nkust_ap/utils/utils.dart'; import 'package:shared_preferences/shared_preferences.dart'; var pictureUrl = ""; -UserInfo userInfo; class DrawerBody extends StatefulWidget { + final UserInfo userInfo; + + const DrawerBody({Key key, this.userInfo}) : super(key: key); + @override DrawerBodyState createState() => new DrawerBodyState(); } @@ -34,7 +36,6 @@ class DrawerBodyState extends State { super.initState(); _getPreference(); _getUserPicture(); - _getUserInfo(); } @override @@ -56,11 +57,15 @@ class DrawerBodyState extends State { width: double.infinity, child: GestureDetector( onTap: () { - if (userInfo == null) return; - if ((userInfo.status == null ? 200 : userInfo.status) == 200) - Navigator.of(context).push(UserInfoPageRoute()); + if (widget.userInfo == null) return; + if ((widget.userInfo.status == null + ? 200 + : widget.userInfo.status) == + 200) + Navigator.of(context) + .push(UserInfoPageRoute(widget.userInfo)); else - Utils.showToast(userInfo.message); + Utils.showToast(widget.userInfo.message); }, child: Stack( children: [ @@ -111,10 +116,10 @@ class DrawerBodyState extends State { SizedBox( height: 32.0, child: Text( - userInfo == null + widget.userInfo == null ? " \n " - : "${userInfo.studentNameCht}\n" - "${userInfo.studentId}", + : "${widget.userInfo.studentNameCht}\n" + "${widget.userInfo.studentId}", style: TextStyle(color: Colors.white), ), ), @@ -270,30 +275,6 @@ class DrawerBodyState extends State { }); } - _getUserInfo() { - Helper.instance.getUsersInfo().then((response) { - if (this.mounted) { - setState(() { - userInfo = response; - FA.setUserProperty('department', userInfo.department); - FA.setUserId(userInfo.studentId); - }); - } - }).catchError((e) { - if (e is DioError) { - switch (e.type) { - case DioErrorType.RESPONSE: - Utils.handleResponseError(context, 'getUserInfo', mounted, e); - break; - default: - break; - } - } else { - throw e; - } - }); - } - _getPreference() async { prefs = await SharedPreferences.getInstance(); setState(() { diff --git a/pubspec.yaml b/pubspec.yaml index 6cb4f7a4..73720313 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -24,8 +24,7 @@ dependencies: dio: 2.0.11 fluttertoast: ^2.2.11 tuple: ^1.0.1 - carousel_slider: - path: ../flutter_carousel_slider + carousel_slider: ^1.2.0 flutter_crashlytics: 0.1.1 encrypt: ^2.0.0 flutter_local_notifications: ^0.4.5 From d0afae2c5cd157e06f7959ae4130009e49b97890 Mon Sep 17 00:00:00 2001 From: RainVisitor Date: Wed, 20 Mar 2019 00:44:12 +0800 Subject: [PATCH 4/6] Add refreshIndicator for feature bus Fix: dialog null crash mounted error --- ios/Runner.xcodeproj/project.pbxproj | 2 +- lib/pages/home/bus/bus_reservations_page.dart | 7 +++++-- lib/pages/home/bus/bus_reserve_page.dart | 9 ++++++--- lib/pages/home/info/schedule_page.dart | 14 ++++++++------ lib/widgets/default_dialog.dart | 2 +- lib/widgets/yes_no_dialog.dart | 4 ++-- 6 files changed, 23 insertions(+), 15 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 98a53bab..6524077d 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -249,7 +249,7 @@ inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", "${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework", - "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", + "${PODS_ROOT}/../.symlinks/flutter/ios-release/Flutter.framework", "${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework", "${BUILT_PRODUCTS_DIR}/Protobuf/Protobuf.framework", "${BUILT_PRODUCTS_DIR}/Reachability/Reachability.framework", diff --git a/lib/pages/home/bus/bus_reservations_page.dart b/lib/pages/home/bus/bus_reservations_page.dart index 90b944fa..b3d5e9e2 100644 --- a/lib/pages/home/bus/bus_reservations_page.dart +++ b/lib/pages/home/bus/bus_reservations_page.dart @@ -76,8 +76,11 @@ class BusReservationsPageState extends State ), ); default: - return ListView( - children: busReservationWeights, + return RefreshIndicator( + onRefresh: () => _getBusReservations(), + child: ListView( + children: busReservationWeights, + ), ); } } diff --git a/lib/pages/home/bus/bus_reserve_page.dart b/lib/pages/home/bus/bus_reserve_page.dart index 79f8a2ea..70a8aa62 100644 --- a/lib/pages/home/bus/bus_reserve_page.dart +++ b/lib/pages/home/bus/bus_reserve_page.dart @@ -78,9 +78,12 @@ class BusReservePageState extends State ), ); default: - return ListView( - physics: const NeverScrollableScrollPhysics(), - children: _renderBusTimeWidgets(), + return RefreshIndicator( + onRefresh: () => _getBusTimeTables(), + child: ListView( + physics: const NeverScrollableScrollPhysics(), + children: _renderBusTimeWidgets(), + ), ); } } diff --git a/lib/pages/home/info/schedule_page.dart b/lib/pages/home/info/schedule_page.dart index 986d4dd5..ade8f7aa 100644 --- a/lib/pages/home/info/schedule_page.dart +++ b/lib/pages/home/info/schedule_page.dart @@ -114,12 +114,14 @@ class SchedulePageState extends State scheduleList = ScheduleData.toList(jsonArray); scheduleWeights.clear(); for (var i in scheduleList) scheduleWeights.addAll(_scheduleItem(i)); - setState(() { - if (scheduleList.length == 0) - state = _State.empty; - else - state = _State.finish; - }); + if (mounted) { + setState(() { + if (scheduleList.length == 0) + state = _State.empty; + else + state = _State.finish; + }); + } } } diff --git a/lib/widgets/default_dialog.dart b/lib/widgets/default_dialog.dart index 26e7e3c1..a1d52b8e 100644 --- a/lib/widgets/default_dialog.dart +++ b/lib/widgets/default_dialog.dart @@ -12,7 +12,7 @@ class DefaultDialog extends StatelessWidget { this.title, this.contentWidget, this.actionText, - this.actionFunction}) + @required this.actionFunction}) : super(key: key); static showSample(BuildContext context) => showDialog( diff --git a/lib/widgets/yes_no_dialog.dart b/lib/widgets/yes_no_dialog.dart index 94761baf..5fbb6cc9 100644 --- a/lib/widgets/yes_no_dialog.dart +++ b/lib/widgets/yes_no_dialog.dart @@ -95,7 +95,7 @@ class YesNoDialog extends StatelessWidget { ), onTap: () { Navigator.of(context, rootNavigator: true).pop('dialog'); - leftActionFunction(); + if (leftActionFunction != null) leftActionFunction(); }, ), ), @@ -117,7 +117,7 @@ class YesNoDialog extends StatelessWidget { ), onTap: () { Navigator.of(context, rootNavigator: true).pop('dialog'); - rightActionFunction(); + if (rightActionFunction != null) rightActionFunction(); }, ), ), From 019fb82002bf66199f2d9bad3a244bc7200f72da Mon Sep 17 00:00:00 2001 From: RainVisitor Date: Wed, 20 Mar 2019 00:44:41 +0800 Subject: [PATCH 5/6] Update to v3.1.2 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 73720313..d107be22 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: nkust_ap description: A new Flutter application. -version: 3.1.1+30101 +version: 3.1.2+30102 environment: sdk: ">=2.1.0 <3.0.0" From 645cf1c7e8ec19ca35cfbef4513e704245013292 Mon Sep 17 00:00:00 2001 From: RainVisitor Date: Wed, 20 Mar 2019 01:06:41 +0800 Subject: [PATCH 6/6] Revert "Add policy" This reverts commit 760b600fae1c2bd8a3450e383ab7ea33fd310bdc. --- ios/Runner.xcworkspace/contents.xcworkspacedata | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata index 3a29dcb5..6a624c49 100644 --- a/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -2,7 +2,7 @@ + location = "group:Runner.xcodeproj">