Skip to content
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

fix: Update resume course navigation #151

Merged
merged 4 commits into from
Dec 12, 2023

Conversation

omerhabib26
Copy link
Contributor

@omerhabib26 omerhabib26 commented Dec 6, 2023

Description:

  • Update navigation for the resume component
  • Code improvement & optimization
Current implementation New Implementation
When the user taps on the resume course, it navigates to the subSection screen. The user will navigate to the last visited component
Prev_resume_course.mp4
Resume_course.mp4

Copy link
Contributor

@HamzaIsrar12 HamzaIsrar12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits only.

Comment on lines 29 to 34
fun List<Block>.getVerticalBlocks(): List<Block> {
return this.filter { it.type == BlockType.VERTICAL }
}

fun List<Block>.getSequentialBlocks(): List<Block> {
return this.filter { it.type == BlockType.SEQUENTIAL }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move it to ListExt.

val currentBlockIndex = viewModel.getUnitBlocks().indexOfFirst {
viewModel.getCurrentBlock().id == it.id
}
if (currentBlockIndex != -1) {
binding.viewPager.currentItem = currentBlockIndex
}
}
if (componentId.isEmpty().not()) {
Handler(Looper.getMainLooper()).post {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use Coroutines instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

k1rill
k1rill previously approved these changes Dec 12, 2023
Copy link
Contributor

@k1rill k1rill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, minor nits only

) {
replaceFragmentWithBackStack(
fm,
CourseSectionFragment.newInstance(courseId, blockId, mode, descendantId)
CourseSectionFragment.newInstance(courseId, subSectionId, mode, unitId, componentId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please use named arguments here, because there are a lot of arguments with the same type here:

CourseSectionFragment.newInstance(
    courseId = courseId, 
    subSectionId = subSectionId, 
    mode = mode, 
    unitId = unitId, 
    componentId = componentId,
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated for the all the methods

mode: CourseViewMode,
descendantId: String? = ""
subSectionId: String,
unitId: String? = "",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not very clear why there is nullable argument with the default empty string value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed nullable

@volodymyr-chekyrta volodymyr-chekyrta merged commit cd27754 into openedx:develop Dec 12, 2023
3 checks passed
@omerhabib26 omerhabib26 deleted the omer/LEARNER-9703 branch December 12, 2023 12:00
@moiz994 moiz994 linked an issue Dec 14, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

[Android] Remove Sequence units level from Resume action
4 participants