-
Notifications
You must be signed in to change notification settings - Fork 45
feat: 为添加课程页面提供更自由的时间选项 #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hazuki-keatsu
wants to merge
19
commits into
main
Choose a base branch
from
feat/improveAddingCourse
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
d752d63
feat: Implement custom class management functionality
hazuki-keatsu 7d3cfee
fix: Repair notification service initialization error when app start …
hazuki-keatsu 661adb6
feat: Add delete functionality to date selector component
hazuki-keatsu 2ec619a
feat: Integrate CustomCourseData into CourseReminder
hazuki-keatsu d65964d
feat: add i18n for date picker and adjust the layout of class add window
hazuki-keatsu 9d928bb
refactor: refactor the way of generating CourseID to avoid conflicts
hazuki-keatsu 934c51a
fix: update the id generator to the new one
hazuki-keatsu f3f7739
fix: avoid that the start time is equal to the end and change snackBa…
hazuki-keatsu 5bcd78c
Merge branch 'main' into feat/improveAddingCourse
hazuki-keatsu f1a5965
refactor: refactor custom class handling and remove user-defined clas…
hazuki-keatsu fb0cde9
Merge branch 'main' into feat/improveAddingCourse
hazuki-keatsu 61c5cc6
fix: align Reminder logics and modify log content
hazuki-keatsu a18b7dc
refactor: style fine-tuning for DateSelectorFree
hazuki-keatsu 4046bf7
Merge branch 'main' into feat/improveAddingCourse
hazuki-keatsu 7c67974
refactor: extract file I/O into CustomClassRepository
hazuki-keatsu f324b0c
fix: clear residual code
hazuki-keatsu 6975ecc
fix: align the icon of class_add_window
hazuki-keatsu 61ba75a
feat: add more time ranges in custom_class_card
hazuki-keatsu cd4280f
Merge branch 'main' into feat/improveAddingCourse
hazuki-keatsu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,10 +15,10 @@ import java.time.LocalDateTime | |
|
|
||
| object ClassTableConstants { | ||
| const val CLASS_FILE_NAME = "ClassTable.json" | ||
| const val USER_CLASS_FILE_NAME = "UserClass.json" | ||
| const val EXAM_FILE_NAME = "exam.json" | ||
| const val PHYSICS_EXPERIMENT_FILE_NAME = "PhysicsExperiment.json" | ||
| const val OTHER_EXPERIMENT_FILE_NAME = "OtherExperiment.json" | ||
| const val CUSTOM_CLASS_FILE_NAME = "CustomClassesV2.json" | ||
|
|
||
| // In SharedPreferencesPlugin, SHARED_PREFERENCES_NAME is private. | ||
| // Be attention to the changes of SharedPreferencesPlugin.SHARED_PREFERENCES_NAME. | ||
|
|
@@ -80,18 +80,6 @@ data class TimeLineItem( | |
| } | ||
| } | ||
|
|
||
| @Serializable | ||
| data class UserDefinedClassData( | ||
| val userDefinedDetail: List<ClassDetail>, | ||
| val timeArrangement: List<TimeArrangement>, | ||
| ) { | ||
| companion object { | ||
| val EMPTY = UserDefinedClassData( | ||
| emptyList(), emptyList() | ||
| ) | ||
| } | ||
| } | ||
|
|
||
| @OptIn(ExperimentalSerializationApi::class) | ||
| @Serializable | ||
| @JsonIgnoreUnknownKeys | ||
|
|
@@ -100,25 +88,24 @@ data class ClassTableData( | |
| val semesterCode: String, | ||
| val termStartDay: String, | ||
| val classDetail: List<ClassDetail>, | ||
| val userDefinedDetail: List<ClassDetail>, | ||
| val timeArrangement: List<TimeArrangement>, | ||
| // ClassChanges has been omitted here since calculated in time main app. | ||
| // NotArrangedClassDetail has been omitted here since useless. | ||
| ) { | ||
| companion object { | ||
| val EMPTY = ClassTableData( | ||
| 0, "", "2024-01-01", | ||
| emptyList(), emptyList(), emptyList(), | ||
| emptyList(), emptyList(), | ||
| ) | ||
| } | ||
|
|
||
| // Should never go wrong. | ||
| fun getClassName(arrangement: TimeArrangement): String = when (arrangement.source) { | ||
| Source.SCHOOL -> classDetail[arrangement.index].name | ||
| Source.USER -> userDefinedDetail[arrangement.index].name | ||
| Source.EXAM -> "Unknown Exam" | ||
| Source.EXPERIMENT -> "Unknown Experiment" | ||
| Source.EMPTY -> "Unknown Empty" | ||
| Source.USER -> "Unknown Custom Class" | ||
|
hazuki-keatsu marked this conversation as resolved.
|
||
| } | ||
| } | ||
|
|
||
|
|
@@ -212,3 +199,24 @@ val ExperimentData.timeRanges: List<Pair<LocalDateTime, LocalDateTime>> | |
| } | ||
| } | ||
|
|
||
| @Serializable | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 记得 Kotlin 要想解析 Dart 的 Record 对象要这么搞?需要核实下面的代码。
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这块的映射应该是没问题的,虽然我不太懂kotlin代码,但是这个映射应该是没问题的:p |
||
| data class CustomClassTimeRange( | ||
| val id: String, | ||
| @SerialName("start_time") | ||
| @Serializable(with = LocalDateTimeSerializer::class) | ||
| val startTime: LocalDateTime, | ||
| @SerialName("end_time") | ||
| @Serializable(with = LocalDateTimeSerializer::class) | ||
| val endTime: LocalDateTime, | ||
| ) | ||
|
|
||
| @Serializable | ||
| data class CustomClass( | ||
| val id: String, | ||
| val name: String, | ||
| val teacher: String? = null, | ||
| val classroom: String? = null, | ||
| @SerialName("time_ranges") | ||
| val timeRanges: List<CustomClassTimeRange>, | ||
| ) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.