-
Notifications
You must be signed in to change notification settings - Fork 31
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
Locked Content Support #430
base: main
Are you sure you want to change the base?
Conversation
Thanks for the pull request, @0x29a! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
23797f1
to
58739a1
Compare
Adds a "locked" screen when trying to access content that's locked due to incomplete prerequisites.
58739a1
to
2947fa7
Compare
@marcotuts and @edschema this looks pretty useful, but needs a product eye. |
if (networkConnection.isOnline()) { | ||
val sectionData = interactor.getSubsection(blockId) | ||
if (sectionData.gatedContent.gated) { | ||
_uiState.value = CourseSectionUIState.Gated( | ||
prereqId = sectionData.gatedContent.prereqId, | ||
prereqSubsectionName = sectionData.gatedContent.prereqSubsectionName, | ||
gatedSubsectionName = sectionData.gatedContent.gatedSubsectionName, | ||
) | ||
return@launch | ||
} | ||
} |
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.
@0x29a, thanks for the contribution; it's a great improvement.
A few architectural concerns:
- The
CourseSubsection
screen is optional, it's ignored ifCOURSE_DROPDOWN_NAVIGATION_ENABLED
is enabled.Line 111 in 18c50f5
if (viewModel.isCourseDropdownNavigationEnabled) { - The current implementation works only if the internet is available, which leads to inconsistent behavior in offline mode.
To address both issues, we must rely on the /api/mobile/{api_version}/course_info/blocks/
endpoint that we use to work with course structure and related data. If that endpoint doesn't provide us with that information, I would consider starting by adding that data to the endpoint.
@e0d @marcotuts wdyt?
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.
Thank you for the review, @volodymyr-chekyrta!
We've tried to add the locked content information to that endpoint, but it proved to be really hard, so we had to resort to this "online-only" half-measure, which solves the problem for us. Once locked content data is available in the /api/mobile/{api_version}/course_info/blocks/
endpoint, it should be very trivial to update the implementation of this feature to use it.
This is great..! A couple product notes:
cc: @marcotuts @sdaitzman, any other product notes? |
Description
Here is what happens when you try to access any section before completing prerequisites in LMS:

Here is what happens when you try to access any unit in a gated subsection using the mobile app (the first subsection on the video is a prerequisite to the second):
before.mp4
With the fix from this PR:
after.mp4
Testing instructions
https://github.com/user-attachments/assets/0e943622-0577-4c98-a538-e407f53a9e96
./adb reverse tcp:8000 tcp:8000
from~/Android/Sdk/platform-tools
(if you're on Linux) directory to allow your virtual device communicate with the Tutor instance.