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

Locked Content Support #430

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

0x29a
Copy link

@0x29a 0x29a commented Feb 17, 2025

Description

Here is what happens when you try to access any section before completing prerequisites in LMS:
image
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

  1. Setup the latest version of Tutor locally with https://github.com/overhangio/tutor-android. It doesn't matter if it can't build an image. We only need it to create OAuth application.
  2. Create and configure a course like this:
    https://github.com/user-attachments/assets/0e943622-0577-4c98-a538-e407f53a9e96
  3. Launch the app in the Android emulator. Be sure to make this and this local changes to allow it to connect to a local Tutor instance.
  4. Run ./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.
  5. Replicate the behavior from the "after.mp4" video above in the description.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Feb 17, 2025
@openedx-webhooks
Copy link

Thanks for the pull request, @0x29a!

This repository is currently maintained by @openedx/openedx-mobile-maintainers.

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 approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To 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:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If 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:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@0x29a 0x29a force-pushed the 0x29a/BB-9492/locked-content branch from 23797f1 to 58739a1 Compare February 18, 2025 13:24
Adds a "locked" screen when trying to access content that's locked due
to incomplete prerequisites.
@0x29a 0x29a force-pushed the 0x29a/BB-9492/locked-content branch from 58739a1 to 2947fa7 Compare February 18, 2025 13:29
@mphilbrick211 mphilbrick211 requested a review from a team February 19, 2025 21:40
@e0d
Copy link

e0d commented Feb 19, 2025

@marcotuts and @edschema this looks pretty useful, but needs a product eye.

Comment on lines +59 to +69
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
}
}
Copy link
Contributor

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:

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?

Copy link
Author

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.

@edschema
Copy link

edschema commented Feb 21, 2025

This is great..! A couple product notes:

  • We have a pattern for similar screens that shows a large icon, text, and call to action. For the prerequisite lock screen, I'd suggest following that pattern for the sake of consistency.
  • For the button, I'd suggest a minor change from 'Go to Prerequisite Section" to just "Go to Prerequisite".

cc: @marcotuts @sdaitzman, any other product notes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Status: Ready for Review
Development

Successfully merging this pull request may close these issues.

5 participants