From b265e8128b8e334da87cfd7a7f7720305d5bd6fc Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Sun, 7 Jan 2024 00:18:59 +0800 Subject: [PATCH 01/13] feat: bump `ap_common` to v0.23.1 --- pubspec.lock | 8 ++++---- pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 970ea114..e86355a7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -21,10 +21,10 @@ packages: dependency: transitive description: name: add_2_calendar - sha256: "7153285bb68321a0e0733d4cbc86336a808ac25efcddce74f5194eda6c5a4906" + sha256: dbcd0bf296fbbe00861a6f101af8cdb3c163a8c3ff5d3c99a4b081c2f37c724f url: "https://pub.dev" source: hosted - version: "2.2.4" + version: "2.2.5" analyzer: dependency: transitive description: @@ -37,10 +37,10 @@ packages: dependency: "direct main" description: name: ap_common - sha256: bdb19f11ca8c389efcbf5d54b23d0a6a00dfdc4b56fb95f22fb244e7b768e952 + sha256: "1a3f04987febc557146b8ee9ae1bc13a3a571fcdc0abd95712d3d2a340dfaa6e" url: "https://pub.dev" source: hosted - version: "0.23.0-dev.2" + version: "0.23.1" ap_common_firebase: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index e49327f3..b4b912fe 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ dependencies: intl: ">=0.17.0 <1.0.0" multiple_localization: ^0.4.0 - ap_common: ^0.23.0-dev.2 + ap_common: ^0.23.1 ap_common_firebase: ^0.16.0-dev.0 ap_common_plugin: ^0.4.0 #official plugin From b4f3c502d0973fa60da1a01b923f32a9e864f965 Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Sun, 7 Jan 2024 00:28:48 +0800 Subject: [PATCH 02/13] fix: login parser condition for password error --- lib/api/parser/ap_parser.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/api/parser/ap_parser.dart b/lib/api/parser/ap_parser.dart index 3c397ec8..15ef43a0 100644 --- a/lib/api/parser/ap_parser.dart +++ b/lib/api/parser/ap_parser.dart @@ -83,7 +83,8 @@ class WebApParser { if (rawHtml.contains(";top.location.href='index.html'")) { final RegExp regex = RegExp(r"alert\('(.*)'\);"); // log(rawHtml); - final String? match = regex.firstMatch(rawHtml)?.group(1); + final String? match = regex.allMatches(rawHtml).elementAt(1).group(1); + log('match $match'); if (match == null) { return 999; } else if (match.contains('無此帳號或密碼不正確')) { From e6b472cddf97d588b657224ee58c349bbdd6c4cc Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Sun, 7 Jan 2024 00:31:44 +0800 Subject: [PATCH 03/13] feat: improve password error when enable auto login --- lib/pages/home_page.dart | 53 ++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index 33ae1ce8..fbe2bd31 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -606,32 +606,37 @@ class HomePageState extends State { ApUtils.showToast(context, ap.loadOfflineData); isLogin = true; }, - onError: (GeneralResponse response) { + onError: (GeneralResponse response) async { String message = ''; - switch (response.statusCode) { - case ApStatusCode.schoolServerError: - message = ap.schoolServerError; - break; - case ApStatusCode.apiServerError: - message = ap.apiServerError; - break; - case ApStatusCode.unknownError: - case ApStatusCode.userDataError: - case ApStatusCode.cancel: - message = ap.loginFail; - break; - default: - message = ap.somethingError; - break; + if (response.statusCode == ApStatusCode.userDataError) { + Toast.show(ap.passwordError, context); + await Preferences.setBool(Constants.prefAutoLogin, false); + checkLogin(); + } else { + switch (response.statusCode) { + case ApStatusCode.schoolServerError: + message = ap.schoolServerError; + break; + case ApStatusCode.apiServerError: + message = ap.apiServerError; + break; + case ApStatusCode.unknownError: + case ApStatusCode.cancel: + message = ap.loginFail; + break; + default: + message = ap.somethingError; + break; + } + _homeKey.currentState!.showSnackBar( + text: message, + actionText: ap.retry, + onSnackBarTapped: _login, + ); + Preferences.setBool(Constants.prefIsOfflineLogin, true); + ApUtils.showToast(context, ap.loadOfflineData); + isLogin = true; } - _homeKey.currentState!.showSnackBar( - text: message, - actionText: ap.retry, - onSnackBarTapped: _login, - ); - Preferences.setBool(Constants.prefIsOfflineLogin, true); - ApUtils.showToast(context, ap.loadOfflineData); - isLogin = true; }, ), ); From 82d2f323bbcd88740829dbce68c88c23a45f2669 Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Sun, 7 Jan 2024 00:37:18 +0800 Subject: [PATCH 04/13] feat: `password error five times` in login error hanlde --- lib/api/ap_helper.dart | 5 +++++ lib/api/ap_status_code.dart | 1 + lib/api/parser/ap_parser.dart | 2 ++ lib/pages/home_page.dart | 3 ++- lib/pages/login_page.dart | 4 ++++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/api/ap_helper.dart b/lib/api/ap_helper.dart index 918f5187..7b249ef9 100644 --- a/lib/api/ap_helper.dart +++ b/lib/api/ap_helper.dart @@ -163,6 +163,11 @@ class WebApHelper { statusCode: ApStatusCode.userDataError, message: 'username or password error', ); + case 5: + throw GeneralResponse( + statusCode: ApStatusCode.passwordFiveTimesError, + message: 'username or password error', + ); case 500: throw GeneralResponse( statusCode: ApStatusCode.schoolServerError, diff --git a/lib/api/ap_status_code.dart b/lib/api/ap_status_code.dart index b8e31d06..9b39d7fb 100644 --- a/lib/api/ap_status_code.dart +++ b/lib/api/ap_status_code.dart @@ -6,6 +6,7 @@ class ApStatusCode { static const int cancel = 100; static const int userDataError = 1401; static const int unknownError = 1402; + static const int passwordFiveTimesError = 1405; //Common static const int apiExpire = 401; diff --git a/lib/api/parser/ap_parser.dart b/lib/api/parser/ap_parser.dart index 15ef43a0..0af04c59 100644 --- a/lib/api/parser/ap_parser.dart +++ b/lib/api/parser/ap_parser.dart @@ -89,6 +89,8 @@ class WebApParser { return 999; } else if (match.contains('無此帳號或密碼不正確')) { return 1; + } else if (match.contains('您先前已登入')) { + return 5; } else if (match.contains('繁忙')) { return 500; } diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index fbe2bd31..240dffe7 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -608,7 +608,8 @@ class HomePageState extends State { }, onError: (GeneralResponse response) async { String message = ''; - if (response.statusCode == ApStatusCode.userDataError) { + if (response.statusCode == ApStatusCode.userDataError || + response.statusCode == ApStatusCode.passwordFiveTimesError) { Toast.show(ap.passwordError, context); await Preferences.setBool(Constants.prefAutoLogin, false); checkLogin(); diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index e76cc467..d80beece 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -207,6 +207,10 @@ class LoginPageState extends State { case ApStatusCode.userDataError: message = ap.loginFail; break; + case ApStatusCode.passwordFiveTimesError: + //TODO i18n + message = '您先前已登入失敗達5次!!請30分鐘後再嘗試登入!!'; + break; case ApStatusCode.cancel: message = null; break; From cb0c1e3f67b66a28f857c9cc3ef5c5c474ee88b2 Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Sun, 7 Jan 2024 00:47:26 +0800 Subject: [PATCH 05/13] Revert "fix: remove iOS widget extension for Xcode 15 temporary" This reverts commit a140c4d6144868ae3e7a67a67099ba7e396aea8e. --- ios/Runner.xcodeproj/project.pbxproj | 161 +++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index b62f0bab..0afaa40e 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -17,9 +17,26 @@ A4465982221FF258008B8826 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = A4465984221FF258008B8826 /* InfoPlist.strings */; }; A45559A0217B2AE100687009 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = A455599F217B2AE100687009 /* GoogleService-Info.plist */; }; A461B7E4222AE0E20080F604 /* AdSupport.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A461B7E3222AE0E20080F604 /* AdSupport.framework */; }; + A4E3F874252644D700343570 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A4E3F873252644D700343570 /* WidgetKit.framework */; }; + A4E3F876252644D700343570 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A4E3F875252644D700343570 /* SwiftUI.framework */; }; + A4E3F879252644D700343570 /* CourseAppWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4E3F878252644D700343570 /* CourseAppWidget.swift */; }; + A4E3F87C252644D800343570 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A4E3F87B252644D800343570 /* Assets.xcassets */; }; + A4E3F87E252644D800343570 /* CourseAppWidget.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = A4E3F87A252644D700343570 /* CourseAppWidget.intentdefinition */; }; A4E3F87F252644D800343570 /* CourseAppWidget.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = A4E3F87A252644D700343570 /* CourseAppWidget.intentdefinition */; }; + A4E3F883252644D800343570 /* CourseAppWidgetExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = A4E3F872252644D700343570 /* CourseAppWidgetExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; + A4E3F91C2526499D00343570 /* CourseData.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4E3F91B2526499D00343570 /* CourseData.swift */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + A4E3F880252644D800343570 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = A4E3F871252644D700343570; + remoteInfo = CourseAppWidgetExtension; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXCopyFilesBuildPhase section */ 9705A1C41CF9048500538489 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; @@ -37,6 +54,7 @@ dstPath = ""; dstSubfolderSpec = 13; files = ( + A4E3F883252644D800343570 /* CourseAppWidgetExtension.appex in Embed App Extensions */, ); name = "Embed App Extensions"; runOnlyForDeploymentPostprocessing = 0; @@ -67,6 +85,7 @@ A455599F217B2AE100687009 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; A45559A5217C871600687009 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = ""; }; A461B7E3222AE0E20080F604 /* AdSupport.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AdSupport.framework; path = System/Library/Frameworks/AdSupport.framework; sourceTree = SDKROOT; }; + A4E3F872252644D700343570 /* CourseAppWidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = CourseAppWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; A4E3F873252644D700343570 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; }; A4E3F875252644D700343570 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; }; A4E3F878252644D700343570 /* CourseAppWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseAppWidget.swift; sourceTree = ""; }; @@ -87,6 +106,15 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + A4E3F86F252644D700343570 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A4E3F876252644D700343570 /* SwiftUI.framework in Frameworks */, + A4E3F874252644D700343570 /* WidgetKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -138,6 +166,7 @@ isa = PBXGroup; children = ( 97C146EE1CF9000F007C117D /* Runner.app */, + A4E3F872252644D700343570 /* CourseAppWidgetExtension.appex */, ); name = Products; sourceTree = ""; @@ -202,12 +231,30 @@ buildRules = ( ); dependencies = ( + A4E3F881252644D800343570 /* PBXTargetDependency */, ); name = Runner; productName = Runner; productReference = 97C146EE1CF9000F007C117D /* Runner.app */; productType = "com.apple.product-type.application"; }; + A4E3F871252644D700343570 /* CourseAppWidgetExtension */ = { + isa = PBXNativeTarget; + buildConfigurationList = A4E3F886252644D800343570 /* Build configuration list for PBXNativeTarget "CourseAppWidgetExtension" */; + buildPhases = ( + A4E3F86E252644D700343570 /* Sources */, + A4E3F86F252644D700343570 /* Frameworks */, + A4E3F870252644D700343570 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CourseAppWidgetExtension; + productName = CourseAppWidgetExtension; + productReference = A4E3F872252644D700343570 /* CourseAppWidgetExtension.appex */; + productType = "com.apple.product-type.app-extension"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -229,6 +276,11 @@ }; }; }; + A4E3F871252644D700343570 = { + CreatedOnToolsVersion = 12.0; + DevelopmentTeam = 5SP52F6F2C; + ProvisioningStyle = Automatic; + }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; @@ -247,6 +299,7 @@ projectRoot = ""; targets = ( 97C146ED1CF9000F007C117D /* Runner */, + A4E3F871252644D700343570 /* CourseAppWidgetExtension */, ); }; /* End PBXProject section */ @@ -265,6 +318,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + A4E3F870252644D700343570 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A4E3F87C252644D800343570 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -455,8 +516,26 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + A4E3F86E252644D700343570 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A4E3F87E252644D800343570 /* CourseAppWidget.intentdefinition in Sources */, + A4E3F879252644D700343570 /* CourseAppWidget.swift in Sources */, + A4E3F91C2526499D00343570 /* CourseData.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + A4E3F881252644D800343570 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = A4E3F871252644D700343570 /* CourseAppWidgetExtension */; + targetProxy = A4E3F880252644D800343570 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ 97C146FA1CF9000F007C117D /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -684,6 +763,79 @@ }; name = Release; }; + A4E3F884252644D800343570 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = CourseAppWidgetExtension.entitlements; + CODE_SIGN_IDENTITY = "Apple Development"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 30602; + DEVELOPMENT_TEAM = 5SP52F6F2C; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = CourseAppWidget/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + MARKETING_VERSION = 3.6.2; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.nkust.ap.flutter.CourseAppWidget; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + A4E3F885252644D800343570 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CODE_SIGN_ENTITLEMENTS = CourseAppWidgetExtension.entitlements; + CODE_SIGN_IDENTITY = "iPhone Distribution"; + CODE_SIGN_STYLE = Manual; + CURRENT_PROJECT_VERSION = 30602; + DEVELOPMENT_TEAM = 5SP52F6F2C; + GCC_C_LANGUAGE_STANDARD = gnu11; + INFOPLIST_FILE = CourseAppWidget/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 14.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@executable_path/../../Frameworks", + ); + MARKETING_VERSION = 3.6.2; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.nkust.ap.flutter.CourseAppWidget; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = "match AppStore com.nkust.ap.flutter.CourseAppWidget"; + SKIP_INSTALL = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -705,6 +857,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + A4E3F886252644D800343570 /* Build configuration list for PBXNativeTarget "CourseAppWidgetExtension" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A4E3F884252644D800343570 /* Debug */, + A4E3F885252644D800343570 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; From 5e05f2da58b9e4a1789521e3456015d8c2372c2a Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Sun, 7 Jan 2024 01:14:51 +0800 Subject: [PATCH 06/13] fix: iOS widget in Xocde 15 error --- ios/Runner.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 0afaa40e..bb5b2134 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -217,6 +217,8 @@ buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( 3BB8511C87A2DDE3F5418E48 /* [CP] Check Pods Manifest.lock */, + A4E3F882252644D800343570 /* Embed App Extensions */, + A4B0643825C7EC38006D4AAB /* ShellScript */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, @@ -225,8 +227,6 @@ 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 206ACDB7DFB38C569AEBD820 /* [CP] Embed Pods Frameworks */, A45559A6217D5F9D00687009 /* ShellScript */, - A4E3F882252644D800343570 /* Embed App Extensions */, - A4B0643825C7EC38006D4AAB /* ShellScript */, ); buildRules = ( ); From 5e2106f3ba04e023040e78dd113c7925c544ef08 Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Sun, 7 Jan 2024 01:15:31 +0800 Subject: [PATCH 07/13] feat: update iOS home widget for iOS 17 API --- ios/CourseAppWidget/CourseAppWidget.swift | 25 ++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/ios/CourseAppWidget/CourseAppWidget.swift b/ios/CourseAppWidget/CourseAppWidget.swift index f0fe2565..34ab4ae6 100644 --- a/ios/CourseAppWidget/CourseAppWidget.swift +++ b/ios/CourseAppWidget/CourseAppWidget.swift @@ -119,7 +119,7 @@ struct CourseAppWidgetEntryView: View { .padding([.trailing, .leading], 8) .multilineTextAlignment(.center) } - .background(getContentBackgroudColor()) + .widgetBackground(getContentBackgroudColor()) } } } @@ -134,6 +134,7 @@ struct CourseAppWidget: Widget { } .configurationDisplayName("上課提醒") .description("提醒本日下一堂課") + .disableContentMarginsIfNeeded() } } @@ -143,3 +144,25 @@ struct CourseAppWidget_Previews: PreviewProvider { .previewContext(WidgetPreviewContext(family: .systemSmall)) } } + +extension View { + func widgetBackground(_ backgroundView: some View) -> some View { + if #available(iOSApplicationExtension 17.0, *) { + return containerBackground(for: .widget) { + backgroundView + } + } else { + return background(backgroundView) + } + } +} + +extension WidgetConfiguration { + func disableContentMarginsIfNeeded() -> some WidgetConfiguration { + if #available(iOSApplicationExtension 17.0, *) { + return self.contentMarginsDisabled() + } else { + return self + } + } +} From 954835442cfd4befab0ae9f35d7d6726a138b1bd Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Sun, 7 Jan 2024 01:15:45 +0800 Subject: [PATCH 08/13] chore: code tune --- lib/api/ap_helper.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/api/ap_helper.dart b/lib/api/ap_helper.dart index 7b249ef9..008bac96 100644 --- a/lib/api/ap_helper.dart +++ b/lib/api/ap_helper.dart @@ -145,7 +145,7 @@ class WebApHelper { Helper.username = username; Helper.password = password; final int code = WebApParser.instance.apLoginParser(res.data); - switch (WebApParser.instance.apLoginParser(res.data)) { + switch (code) { case -1: //Captcha error, go retry. break; From 94944cfe58e0426c1874d93498e6894e2706ade1 Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Sun, 7 Jan 2024 01:16:10 +0800 Subject: [PATCH 09/13] chore: password error five times source HTML --- assets_test/login/password_error_five.html | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 assets_test/login/password_error_five.html diff --git a/assets_test/login/password_error_five.html b/assets_test/login/password_error_five.html new file mode 100644 index 00000000..410eafd4 --- /dev/null +++ b/assets_test/login/password_error_five.html @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 4eb7b87bdb7d7a3cd1e4fb17c703eb71179766b2 Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Sun, 7 Jan 2024 01:33:24 +0800 Subject: [PATCH 10/13] chore: code tune for dart 2.19 lint --- lib/api/ap_helper.dart | 6 +-- lib/api/bus_helper.dart | 8 +-- lib/api/leave_helper.dart | 2 +- lib/api/mobile_nkust_helper.dart | 12 +++-- lib/api/nkust_helper.dart | 2 +- lib/api/parser/ap_parser.dart | 53 ++++++++++--------- lib/api/parser/bus_parser.dart | 2 +- lib/api/parser/leave_parser.dart | 4 +- lib/api/parser/mobile_nkust_parser.dart | 2 +- lib/pages/bus/bus_page.dart | 4 +- lib/pages/bus/bus_reservations_page.dart | 4 +- lib/pages/bus/bus_reserve_page.dart | 4 +- lib/pages/bus/bus_violation_records_page.dart | 2 +- lib/pages/info/schedule_page.dart | 2 +- lib/pages/leave/leave_apply_page.dart | 2 +- lib/pages/leave/leave_record_page.dart | 4 +- lib/pages/login_page.dart | 2 +- lib/pages/search_student_id_page.dart | 2 +- lib/pages/study/calculate_units_page.dart | 2 +- lib/utils/date_utils.dart | 2 +- lib/widgets/flutter_calendar.dart | 2 +- lib/widgets/semester_picker.dart | 6 ++- 22 files changed, 68 insertions(+), 61 deletions(-) diff --git a/lib/api/ap_helper.dart b/lib/api/ap_helper.dart index 008bac96..b8bd1e49 100644 --- a/lib/api/ap_helper.dart +++ b/lib/api/ap_helper.dart @@ -138,7 +138,7 @@ class WebApHelper { data: { 'uid': username, 'pwd': password, - 'etxt_code': captchaCode + 'etxt_code': captchaCode, }, options: Options(contentType: 'application/x-www-form-urlencoded'), ); @@ -273,7 +273,7 @@ class WebApHelper { 'https://leave.nkust.edu.tw/SkyDir.aspx', queryParameters: { 'u': skyDirectData['uid'], - 'r': skyDirectData['ls_randnum'] + 'r': skyDirectData['ls_randnum'], }, options: Options( followRedirects: false, @@ -546,7 +546,7 @@ class WebApHelper { 'ag302_01', { 'yms_yms': '$years#$semesterValue', - 'cmp_area_id': cmpAreaId + 'cmp_area_id': cmpAreaId, }, ); diff --git a/lib/api/bus_helper.dart b/lib/api/bus_helper.dart index 70c2eeee..e65b84aa 100644 --- a/lib/api/bus_helper.dart +++ b/lib/api/bus_helper.dart @@ -96,7 +96,7 @@ class BusEncrypt { 'c': i, 'd': j, 'e': k, - 'f': passwordMD5 + 'f': passwordMD5, }, ); } @@ -222,7 +222,7 @@ class BusHelper { 'n': busEncryptObject.loginEncrypt( Helper.username!, Helper.password!, - ) + ), }, options: Options(contentType: Headers.formUrlEncodedContentType), ); @@ -262,7 +262,7 @@ class BusHelper { 'operation': '全部', 'page': 1, 'start': 0, - 'limit': 90 + 'limit': 90, }; options = Options(contentType: Headers.formUrlEncodedContentType); } else { @@ -277,7 +277,7 @@ class BusHelper { 'operation': '全部', 'page': 1, 'start': 0, - 'limit': 90 + 'limit': 90, }, ); options = buildCacheOptions( diff --git a/lib/api/leave_helper.dart b/lib/api/leave_helper.dart index e995ae72..af4b716b 100644 --- a/lib/api/leave_helper.dart +++ b/lib/api/leave_helper.dart @@ -73,7 +73,7 @@ class LeaveHelper { 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', 'Referer': 'https://leave.nkust.edu.tw/LogOn.aspx', 'Accept-Encoding': 'gzip, deflate', - 'Accept-Language': 'zh-TW,zh;q=0.9,en-US;q=0.8,en;q=0.7,ja;q=0.6' + 'Accept-Language': 'zh-TW,zh;q=0.9,en-US;q=0.8,en;q=0.7,ja;q=0.6', }); dio.options.headers['Connection'] = 'close'; diff --git a/lib/api/mobile_nkust_helper.dart b/lib/api/mobile_nkust_helper.dart index f2400711..01d2183c 100644 --- a/lib/api/mobile_nkust_helper.dart +++ b/lib/api/mobile_nkust_helper.dart @@ -91,7 +91,7 @@ class MobileNkustHelper { 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1623.0 Safari/537.36', 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/44.0.2403.155 Safari/537.36', 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36', - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36' + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36', ]; String? get userAgent => dio.options.headers['user-agent'] as String?; @@ -167,7 +167,9 @@ class MobileNkustHelper { if (data != null) { if (otherRequestUrl != null) { final Map requestData = { - '__RequestVerificationToken': MobileNkustParser.getCSRF(response.data) + '__RequestVerificationToken': MobileNkustParser.getCSRF( + response.data, + ), }; requestData.addAll(data); @@ -369,7 +371,7 @@ class MobileNkustHelper { 'driveDate': '$year/$month/$day', 'beginStation': requestData[0], 'endStation': requestData[1], - '__RequestVerificationToken': MobileNkustParser.getCSRF(request.data) + '__RequestVerificationToken': MobileNkustParser.getCSRF(request.data), }, options: Options( contentType: Headers.formUrlEncodedContentType, @@ -469,7 +471,7 @@ class MobileNkustHelper { 'endStation': requestData[1], 'pageNum': 1, 'pageSize': 99, - '__RequestVerificationToken': MobileNkustParser.getCSRF(request.data) + '__RequestVerificationToken': MobileNkustParser.getCSRF(request.data), }, options: Options( contentType: Headers.formUrlEncodedContentType, @@ -514,7 +516,7 @@ class MobileNkustHelper { 'Referer': homeUrl, }, otherRequestHeader: { - 'Referer': busViolationRecordsPageUrl + 'Referer': busViolationRecordsPageUrl, }, ); // not pay request diff --git a/lib/api/nkust_helper.dart b/lib/api/nkust_helper.dart index ed68312a..532420e6 100644 --- a/lib/api/nkust_helper.dart +++ b/lib/api/nkust_helper.dart @@ -106,7 +106,7 @@ class NKUSTHelper { 'data': { 'page': page + 1, 'notification': acadData, - } + }, }); } } diff --git a/lib/api/parser/ap_parser.dart b/lib/api/parser/ap_parser.dart index 0af04c59..d6187149 100644 --- a/lib/api/parser/ap_parser.dart +++ b/lib/api/parser/ap_parser.dart @@ -9,6 +9,9 @@ import 'package:html/dom.dart'; import 'package:html/parser.dart' show parse; import 'package:nkust_ap/api/helper.dart'; +//TODO confirm this rule +//ignore_for_file: unreachable_from_main + final String specialSpace = String.fromCharCode(160); class WebApParser { @@ -111,7 +114,7 @@ class WebApParser { 'className': null, 'id': null, 'name': null, - 'pictureUrl': null + 'pictureUrl': null, }; final Document document = parse(html); final List tdElements = document.getElementsByTagName('td'); @@ -165,8 +168,8 @@ class WebApParser { 'default': { 'year': '108', 'value': '2', - 'text': '108學年第二學期(Parse失敗)' - } + 'text': '108學年第二學期(Parse失敗)', + }, }; final Document document = parse(html); @@ -181,7 +184,7 @@ class WebApParser { { 'year': ymsElements[i].attributes['value']!.split('#')[0], 'value': ymsElements[i].attributes['value']!.split('#')[1], - 'text': ymsElements[i].text + 'text': ymsElements[i].text, }, ); if (ymsElements[i].attributes['selected'] != null) { @@ -189,7 +192,7 @@ class WebApParser { data['default'] = { 'year': ymsElements[i].attributes['value']!.split('#')[0], 'value': ymsElements[i].attributes['value']!.split('#')[1], - 'text': ymsElements[i].text + 'text': ymsElements[i].text, }; } } @@ -205,8 +208,8 @@ class WebApParser { 'conduct': null, 'classRank': null, 'departmentRank': null, - 'average': null - } + 'average': null, + }, }; //detail part try { @@ -223,7 +226,7 @@ class WebApParser { 'departmentRank': matches.elementAt(3).group(1), 'average': (matches.elementAt(1).group(1) != '') ? double.parse(matches.elementAt(1).group(1)!) - : 0.0 + : 0.0, }; } catch (_) {} //scores part @@ -290,7 +293,7 @@ class WebApParser { 'location': { 'building': '', 'room': td[10].text, - } + }, }, ); } @@ -369,7 +372,7 @@ class WebApParser { 'Thursday', 'Friday', 'Saturday', - 'Sunday' + 'Sunday', ]; try { for (int weekdayIndex = 0; @@ -428,7 +431,7 @@ class WebApParser { Map midtermAlertsParser(String? html) { final Map data = { - 'courses': >[] + 'courses': >[], }; final Document document = parse(html); @@ -450,7 +453,7 @@ class WebApParser { 'group': tdData[3].text, 'instructors': tdData[4].text, 'reason': tdData[6].text, - 'remark': tdData[7].text + 'remark': tdData[7].text, }, ); } @@ -464,7 +467,7 @@ class WebApParser { Map rewardAndPenaltyParser(String? html) { final Map data = { - 'data': >[] + 'data': >[], }; final Document document = parse(html); @@ -489,7 +492,7 @@ class WebApParser { 'date': tdData[2].text, 'type': tdData[3].text, 'counts': tdData[4].text, - 'reason': tdData[5].text + 'reason': tdData[5].text, }, ); } @@ -501,7 +504,7 @@ class WebApParser { Map roomListParser(String? html) { final Map data = { - 'data': >[] + 'data': >[], }; final Document document = parse(html); @@ -512,7 +515,7 @@ class WebApParser { (data['data'] as List>).add( { 'roomName': table[i].text, - 'roomId': table[i].attributes['value'] ?? '0035' + 'roomId': table[i].attributes['value'] ?? '0035', }, ); } @@ -543,10 +546,10 @@ class WebApParser { 'Thursday': >[], 'Friday': >[], 'Saturday': >[], - 'Sunday': >[] + 'Sunday': >[], }, '_temp_time': >{}, - 'timeCodes': >[] + 'timeCodes': >[], }; final Map courseTable = @@ -584,8 +587,8 @@ class WebApParser { 'sectionTimes': >[], 'location': null, 'instructors': - td[10].text.replaceAll(specialSpace, '').split(',') - } + td[10].text.replaceAll(specialSpace, '').split(','), + }, }, ); } @@ -620,7 +623,7 @@ class WebApParser { 'Thursday', 'Friday', 'Saturday', - 'Sunday' + 'Sunday', ]; String tmpCourseName = ''; try { @@ -665,8 +668,8 @@ class WebApParser { 'endTime': //ignore: lines_longer_than_80_chars "${courseTime[1].split('-')[1].substring(0, 2)}:${courseTime[1].split('-')[1].substring(2, 4)}", - 'section': tempSection - } + 'section': tempSection, + }, }); if (splitData.length <= 1) { @@ -691,7 +694,7 @@ class WebApParser { 'endTime': //ignore: lines_longer_than_80_chars "${courseTime[1].split('-')[1].substring(0, 2)}:${courseTime[1].split('-')[1].substring(2, 4)}", - 'section': tempSection + 'section': tempSection, }, 'rawInstructors': splitData[1] .replaceAll(specialSpace, '') @@ -740,7 +743,7 @@ class WebApParser { //ignore: avoid_dynamic_calls 'startTime': data['_temp_time'][timeCodeIndex]['startTime'], //ignore: avoid_dynamic_calls - 'endTime': data['_temp_time'][timeCodeIndex]['endTime'] + 'endTime': data['_temp_time'][timeCodeIndex]['endTime'], }); } data.remove('_temp_time'); diff --git a/lib/api/parser/bus_parser.dart b/lib/api/parser/bus_parser.dart index 474030c0..05e53126 100644 --- a/lib/api/parser/bus_parser.dart +++ b/lib/api/parser/bus_parser.dart @@ -41,7 +41,7 @@ Map busTimeTableParser( 'specialTrain': data['data'][i]['SpecialTrain'], 'description': data['data'][i]['SpecialTrainRemark'], 'homeCharteredBus': false, - 'cancelKey': '' + 'cancelKey': '', }; if (temp['SpecialTrain'] == '1') { temp['homeCharteredBus'] = true; diff --git a/lib/api/parser/leave_parser.dart b/lib/api/parser/leave_parser.dart index d6d59d79..84e5be23 100644 --- a/lib/api/parser/leave_parser.dart +++ b/lib/api/parser/leave_parser.dart @@ -52,7 +52,7 @@ Map leaveQueryParser(String? html) { if (tableDom.isEmpty) { return { 'data': >[], - 'timeCodes': [] + 'timeCodes': [], }; } final List trDom = tableDom[0].getElementsByTagName('tr'); @@ -123,7 +123,7 @@ Map? leaveSubmitInfoParser(String? html) { '10', '11', '12', - '13' + '13', ]; } //LeaveType generate part. diff --git a/lib/api/parser/mobile_nkust_parser.dart b/lib/api/parser/mobile_nkust_parser.dart index db4474c8..569b7f87 100644 --- a/lib/api/parser/mobile_nkust_parser.dart +++ b/lib/api/parser/mobile_nkust_parser.dart @@ -108,7 +108,7 @@ class MobileNkustParser { 'location': { 'building': '', 'room': course['CourseRoom'] ?? '', - } + }, }; final bool hasMorning = periodTimeJson[0]['PeriodName'] == 'M'; final List courseWeekPeriod = diff --git a/lib/pages/bus/bus_page.dart b/lib/pages/bus/bus_page.dart index 88833ec5..8ca704d5 100644 --- a/lib/pages/bus/bus_page.dart +++ b/lib/pages/bus/bus_page.dart @@ -35,7 +35,7 @@ class BusPageState extends State with SingleTickerProviderStateMixin { final List _children = [ BusReservePage(), BusReservationsPage(), - BusViolationRecordsPage() + BusViolationRecordsPage(), ]; Future? _login; @@ -73,7 +73,7 @@ class BusPageState extends State with SingleTickerProviderStateMixin { const BusRulePage(), ); }, - ) + ), ], elevation: (_currentIndex == 2) ? 0.0 : null, ), diff --git a/lib/pages/bus/bus_reservations_page.dart b/lib/pages/bus/bus_reservations_page.dart index 85213c47..ccbaf7ac 100644 --- a/lib/pages/bus/bus_reservations_page.dart +++ b/lib/pages/bus/bus_reservations_page.dart @@ -196,7 +196,7 @@ class BusReservationsPageState extends State ? null : () => _showCancelDialog(busReservation), ), - ) + ), ], ), ), @@ -206,7 +206,7 @@ class BusReservationsPageState extends State color: ApTheme.of(context).grey, indent: 4.0, ), - ) + ), ], ); diff --git a/lib/pages/bus/bus_reserve_page.dart b/lib/pages/bus/bus_reserve_page.dart index 76d8e04e..ff59e347 100644 --- a/lib/pages/bus/bus_reserve_page.dart +++ b/lib/pages/bus/bus_reserve_page.dart @@ -313,7 +313,7 @@ class BusReservePageState extends State textAlign: TextAlign.center, style: _textStyle(busTime), ), - ) + ), ], ), ), @@ -321,7 +321,7 @@ class BusReservePageState extends State Container( padding: const EdgeInsets.symmetric(horizontal: 16.0), child: Divider(color: ApTheme.of(context).grey, height: 0.0), - ) + ), ], ); diff --git a/lib/pages/bus/bus_violation_records_page.dart b/lib/pages/bus/bus_violation_records_page.dart index dd06b5d2..351ea2f9 100644 --- a/lib/pages/bus/bus_violation_records_page.dart +++ b/lib/pages/bus/bus_violation_records_page.dart @@ -206,7 +206,7 @@ class _BusViolationRecordsPageState extends State { }, childCount: violationData?.reservations.length ?? 0, ), - ) + ), ], ), ); diff --git a/lib/pages/info/schedule_page.dart b/lib/pages/info/schedule_page.dart index 32417d90..d8cf3f68 100644 --- a/lib/pages/info/schedule_page.dart +++ b/lib/pages/info/schedule_page.dart @@ -101,7 +101,7 @@ class SchedulePageState extends State default: return CustomScrollView( slivers: [ - for (ScheduleData value in scheduleDataList) + for (final ScheduleData value in scheduleDataList) ..._scheduleItem(value), ], ); diff --git a/lib/pages/leave/leave_apply_page.dart b/lib/pages/leave/leave_apply_page.dart index 2d0cdf85..925d0c3b 100644 --- a/lib/pages/leave/leave_apply_page.dart +++ b/lib/pages/leave/leave_apply_page.dart @@ -718,7 +718,7 @@ class LeaveApplyPageState extends State text: '${ap.leaveDateAndSection}:\n', style: const TextStyle(fontWeight: FontWeight.bold), ), - for (Day day in days) TextSpan(text: '$day\n'), + for (final Day day in days) TextSpan(text: '$day\n'), TextSpan( text: '${ap.leaveProof}:' '${image == null ? ap.none : ''}\n', diff --git a/lib/pages/leave/leave_record_page.dart b/lib/pages/leave/leave_record_page.dart index 6b789d2e..89b26b71 100644 --- a/lib/pages/leave/leave_record_page.dart +++ b/lib/pages/leave/leave_record_page.dart @@ -203,8 +203,8 @@ class LeaveRecordPageState extends State ), children: [ leaveTitle, - for (Leave leave in leaveData!.leaves) - _leaveBorder(leave, leaveData!.timeCodes) + for (final Leave leave in leaveData!.leaves) + _leaveBorder(leave, leaveData!.timeCodes), ], ), ), diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index d80beece..4eb5108a 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -120,7 +120,7 @@ class LoginPageState extends State { ApUtils.showToast(context, ap.firstLoginHint); } }, - ) + ), ], ); } diff --git a/lib/pages/search_student_id_page.dart b/lib/pages/search_student_id_page.dart index 2a8830d6..39bc5ba6 100644 --- a/lib/pages/search_student_id_page.dart +++ b/lib/pages/search_student_id_page.dart @@ -106,7 +106,7 @@ class SearchStudentIdPageState extends State { FirebaseAnalyticsUtils.instance.logEvent('search_username_click'); _search(); }, - ) + ), ], ); } diff --git a/lib/pages/study/calculate_units_page.dart b/lib/pages/study/calculate_units_page.dart index ef8ccdc0..f4d9dbac 100644 --- a/lib/pages/study/calculate_units_page.dart +++ b/lib/pages/study/calculate_units_page.dart @@ -167,7 +167,7 @@ class CalculateUnitsPageState extends State children: [ const CircularProgressIndicator(), const SizedBox(height: 16.0), - Text(ap.calculating, style: _textBlueStyle()) + Text(ap.calculating, style: _textBlueStyle()), ], ), ); diff --git a/lib/utils/date_utils.dart b/lib/utils/date_utils.dart index df4e565d..b44ab1df 100644 --- a/lib/utils/date_utils.dart +++ b/lib/utils/date_utils.dart @@ -42,7 +42,7 @@ class CalendarDateUtils { 'Wed', 'Thu', 'Fri', - 'Sat' + 'Sat', ]; /// The list of days in a given month diff --git a/lib/widgets/flutter_calendar.dart b/lib/widgets/flutter_calendar.dart index 6628e215..083eec0b 100644 --- a/lib/widgets/flutter_calendar.dart +++ b/lib/widgets/flutter_calendar.dart @@ -245,7 +245,7 @@ class _CalendarState extends State { expanded: calendarGridView, isExpanded: isExpanded, ), - expansionButtonRow + expansionButtonRow, ], ); } diff --git a/lib/widgets/semester_picker.dart b/lib/widgets/semester_picker.dart index 4ce38303..6e672223 100644 --- a/lib/widgets/semester_picker.dart +++ b/lib/widgets/semester_picker.dart @@ -69,7 +69,7 @@ class SemesterPickerState extends State { Icon( ApIcon.keyboardArrowDown, color: ApTheme.of(context).semesterText, - ) + ), ], ), ), @@ -156,7 +156,9 @@ class SemesterPickerState extends State { context: context, builder: (BuildContext context) => SimpleOptionDialog( title: ApLocalizations.of(context).pickSemester, - items: [for (Semester item in semesterData.data) item.text], + items: [ + for (final Semester item in semesterData.data) item.text, + ], index: currentIndex, onSelected: (int index) { currentIndex = index; From 73c977139f15b65cc4c157df0ecc9217906da94e Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Sun, 7 Jan 2024 02:18:31 +0800 Subject: [PATCH 11/13] feat: upgrade CI action android JAVA version to `17` --- .github/workflows/workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index fcaa93db..9accb5f2 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -38,7 +38,7 @@ jobs: - name: Setup Java uses: actions/setup-java@v1 with: - java-version: '11.0' + java-version: '17.0' - name: Decrypt Android keys run: sh ./.github/scripts/decrypt_android_keys.sh env: From 5bc43dca0eba74aaf2abd4db048bc86d635865d0 Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Sun, 7 Jan 2024 03:10:26 +0800 Subject: [PATCH 12/13] fix: iOS swift compile error --- .github/workflows/workflow.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 9accb5f2..8e2ff1e9 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -53,8 +53,14 @@ jobs: build_ios: name: Build iOS App - runs-on: macOS-latest + runs-on: macos-13 steps: + # Ensure the xcode version is available + - name: List Xcode installations + run: sudo ls -1 /Applications | grep "Xcode" + # Select your required version + - name: Select Xcode 15.0 + run: sudo xcode-select -s /Applications/Xcode_15.0.app/Contents/Developer - name: Checkout code uses: actions/checkout@v2 - name: Decrypt iOS keys From ad2bdc921abe932dec53b7e44eb3488e396b540b Mon Sep 17 00:00:00 2001 From: Rainvisitor Date: Sun, 7 Jan 2024 03:28:28 +0800 Subject: [PATCH 13/13] feat: update CD android and iOS setting --- .github/workflows/cd.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index a4d0e28c..56997947 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -16,7 +16,7 @@ jobs: - name: Setup Java uses: actions/setup-java@v1 with: - java-version: '11.0' + java-version: '17.0' - name: Decrypt Android keys run: sh ./.github/scripts/decrypt_android_keys.sh env: @@ -50,8 +50,14 @@ jobs: deploy_ios: name: iOS Deploy TestFlight - runs-on: macOS-latest + runs-on: macos-13 steps: + # Ensure the xcode version is available + - name: List Xcode installations + run: sudo ls -1 /Applications | grep "Xcode" + # Select your required version + - name: Select Xcode 15.0 + run: sudo xcode-select -s /Applications/Xcode_15.0.app/Contents/Developer - name: Checkout code uses: actions/checkout@v2 with: