-
Notifications
You must be signed in to change notification settings - Fork 38
feat: [FC-0047] Course progress and collapsing sections #323
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
feat: [FC-0047] Course progress and collapsing sections #323
Conversation
Thanks for the pull request, @PavloNetrebchuk! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
e853ad8
to
dd56b78
Compare
Hi @PavloNetrebchuk! Is this for an FC project with Axim? |
dd56b78
to
ff0bfd1
Compare
Hello @mphilbrick211 |
…edx#262) chore: enhance app theme capability for prod edX theme/branding - Integrate Program config updates - theming/branding code improvements for light and dark modes - Force dark mode for the WebView (beta version) - No major change in the Open edX theme fixes: LEARNER-9783
* feat: Created calendar setting screen * feat: CalendarAccessDialog * feat: NewCalendarDialog * fix: Fixes according to PR feedback
* feat: Created Learn screen. Added course/program navigation. Added endpoint for UserCourses screen. * feat: Added primary course card * feat: Added start/resume course button * feat: Added alignment items * feat: Fix future assignment date, add courses list, add onSearch and onCourse clicks * feat: Add feature flag for enabling new/old dashboard screen, add UserCoursesScreen onClick methods * feat: Create AllEnrolledCoursesFragment. Add endpoint parameters * feat: AllEnrolledCoursesFragment UI * feat: Minor code refactoring, show cached data if no internet connection * feat: UserCourses screen data caching * feat: Dashboard * refactor: Dashboard type flag change, start course button change * feat: Added programs fragment to LearnFragment viewPager * feat: Empty states and settings button * fix: Number of courses * fix: Minor UI changes * fix: Fixes according to designer feedback * fix: Fixes after demo * refactor: Move CourseContainerTab * fix: Fixes according to PR feedback * fix: Fixes according to PR feedback * feat: added a patch from Omer Habib * fix: Fixes according to PR feedback
a9ef278
to
b72fc59
Compare
…and_sections_ui # Conflicts: # core/src/main/java/org/openedx/core/domain/model/Progress.kt # core/src/openedx/org/openedx/core/ui/theme/Colors.kt # course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineScreen.kt # course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineViewModel.kt # course/src/main/java/org/openedx/course/presentation/section/CourseSectionFragment.kt # course/src/main/java/org/openedx/course/presentation/ui/CourseUI.kt # course/src/main/java/org/openedx/course/presentation/ui/CourseVideosUI.kt # dashboard/src/main/java/org/openedx/courses/presentation/DashboardGalleryView.kt # dashboard/src/main/res/values/strings.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good overall 👍 , please address the following issues:
@SerializedName("num_points_possible") | ||
val numPointsPossible: Float?, | ||
) { | ||
fun mapToDomain() = org.openedx.core.domain.model.AssignmentProgress( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move it to the imports section
@SerializedName("assignment_progress") | ||
val assignmentProgress: AssignmentProgress?, | ||
@SerializedName("due") | ||
val due: String? | ||
) { | ||
fun mapToDomain(blockData: Map<String, org.openedx.core.data.model.Block>): Block { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move it to the imports section
@ColumnInfo("num_points_possible") | ||
val numPointsPossible: Float?, | ||
) { | ||
fun mapToDomain() = org.openedx.core.domain.model.AssignmentProgress( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move it to the imports section
fun getProgress(): Float = try { | ||
assignmentsCompleted.toFloat() / totalAssignmentsCount.toFloat() | ||
} catch (_: ArithmeticException) { | ||
0f | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about replacing it with a computed property, let's say value
, so we can call progress like this progress.value
instead of progress.getProgress()
?
core/src/main/res/values/strings.xml
Outdated
@@ -96,6 +96,12 @@ | |||
<string name="core_date_format_tomorrow" tools:ignore="MissingTranslation">Tomorrow</string> | |||
<string name="core_date_format_yesterday" tools:ignore="MissingTranslation">Yesterday</string> | |||
<string name="core_date_format_days_ago" tools:ignore="MissingTranslation">%1$s days ago</string> | |||
<string name="core_date_format_past_due_assignment" tools:ignore="MissingTranslation">Past due assignment</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused resource core_date_format_past_due_assignment
core/src/main/res/values/strings.xml
Outdated
<string name="core_date_format_assignment_due_in" tools:ignore="MissingTranslation">Due in %1$s days</string> | ||
<string name="core_date_format_assignment_due_days_ago" tools:ignore="MissingTranslation">Due %1$s days ago</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use plurals here for correct translation into other languages
Column(Modifier | ||
.clickable { onClick(block) } | ||
.background(if (block.isCompleted()) MaterialTheme.appColors.surface else Color.Transparent) | ||
val due = block.due?.let { TimeUtils.getAssignmentFormattedDate(LocalContext.current, it) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken, it's better to use remember
when you transform dates in compose because it creates a calendar instance on each recomposition.
viewModel.courseRouter.navigateToDownloadQueue( | ||
fm = fragmentManager, | ||
viewModel.getDownloadableChildren(blockId) | ||
?: arrayListOf() | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we transform it to the one line viewModel.getDownloadableChildren(blockId) ?: arrayListOf()
for better readability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use a vector here instead of PNG?
(We can address it in the Offline/Downloading task)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, we'll figure it out in the next PRs related to downloading
Can we remove this odd ripple effect or at least limit it to the section heading where the user taps? Screen_recording_20240531_125624.mp4 |
@@ -62,5 +62,7 @@ | |||
<string name="course_delete_while_downloading_confirmation_text" formatted="false">Turning off the switch will stop downloading and delete all downloaded videos for \"%s\"?</string> | |||
<string name="course_delete_downloads_confirmation_text" formatted="false">Are you sure you want to delete all video(s) for \"%s\"?</string> | |||
<string name="course_delete_download_confirmation_text" formatted="false">Are you sure you want to delete video(s) for \"%s\"?</string> | |||
<string name="course_assignments_complete">%1$s of %2$s assignments complete</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use plurals
for the word assignments
@@ -88,7 +88,7 @@ android: | |||
- **PRE_LOGIN_EXPERIENCE_ENABLED:** Enables the pre login courses discovery experience. | |||
- **WHATS_NEW_ENABLED:** Enables the "What's New" feature to present the latest changes to the user. | |||
- **SOCIAL_AUTH_ENABLED:** Enables SSO buttons on the SignIn and SignUp screens. | |||
- **COURSE_NESTED_LIST_ENABLED:** Enables an alternative visual representation for the course structure. | |||
- **COURSE_DROPDOWN_NAVIGATION_ENABLED:** Enables an alternative visual representation for the course structure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enables an alternative visual representation for the course structure.
-> Enables an alternative navigation through units.
@PavloNetrebchuk please update the config structure according to the #319 |
…and_sections_ui # Conflicts: # core/src/main/java/org/openedx/core/config/Config.kt # course/src/main/java/org/openedx/course/presentation/dates/CourseDatesViewModel.kt # course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineViewModel.kt # course/src/main/java/org/openedx/course/presentation/ui/CourseUI.kt # course/src/main/java/org/openedx/course/presentation/unit/container/CourseUnitContainerViewModel.kt # course/src/main/java/org/openedx/course/presentation/videos/CourseVideoViewModel.kt # course/src/test/java/org/openedx/course/presentation/outline/CourseOutlineViewModelTest.kt # course/src/test/java/org/openedx/course/presentation/videos/CourseVideoViewModelTest.kt # default_config/dev/config.yaml # default_config/prod/config.yaml # default_config/stage/config.yaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
PR is ready for product/design review.
Hi @PavloNetrebchuk, this looks great overall! A couple of design questions/feedback I wanted to check on:
|
Hello @sdaitzman,
|
Thanks, @PavloNetrebchuk! Everything else looks great to me from a design standpoint. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just nits, they can be ignored
viewModel.saveDownloadModels( | ||
FileUtil(context).getExternalAppDir().path, it.id | ||
) | ||
onDownloadClick = { blocksIds -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Maybe it's better to move all this to the separate method in the viewModel
val subsectionsDownloadedStates = downloadedStateMap.filterKeys { key -> | ||
key in (courseSubSections?.map { it.id } ?: emptyList()) | ||
}.values.toList() | ||
val downloadedState = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it's better to use when here
@PavloNetrebchuk 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
Hey @PavloNetrebchuk, I pulled this branch and noticed that the download button seems a bit buggy. Could you please take a look? Screenrecorder-2024-06-07-14-45-26-461.mp4 |
Hello, @HamzaIsrar12 |
https://www.figma.com/design/iZ56YMjbRMShCCDxqrqRrR/Open-edX-Mobile-App-All-Screens-v2.1?node-id=9146-62028&t=9uhsH3nbuxmXNajx-4
Downloading icon
Completion