openedx / openedx-app-ios

The mobile app for iOS for the Open EdX Platform.
Apache License 2.0
20 stars 15 forks source link

feat: [FC-0047] xBlock offline mode #474

Open IvanStepanok opened 3 months ago

IvanStepanok commented 3 months ago

🛜 Offline mode – Quick Preview

Downloading

https://github.com/openedx/openedx-app-ios/assets/128456094/5e5b0b89-3c1e-4c3f-a1fa-b5cbea7a1036

Working with blocks without an internet connection

https://github.com/openedx/openedx-app-ios/assets/128456094/58d1e162-10cb-477a-ab0a-b9d0616ff4e5

Offline content is synchronized immediately after connecting to the network

https://github.com/openedx/openedx-app-ios/assets/128456094/b79bcc58-d551-474a-8a53-39ed001913e3

Environment for testing:

API_HOST_URL: 'https://axim-mobile.raccoongang.net'
ENVIRONMENT_DISPLAY_NAME: 'lms-axim-stage'
FEEDBACK_EMAIL_ADDRESS: 'support@example.com'
OAUTH_CLIENT_ID: 'zP3vPz00c8fTRpYjNbVSlA1fxt9LnCxTM4JK1KQ0'
DISCOVERY:
    TYPE: "native"

FIREBASE:
    ENABLED: false

UI_COMPONENTS:
    COURSE_UNIT_PROGRESS_ENABLED: false
    COURSE_NESTED_LIST_ENABLED: false
openedx-webhooks commented 3 months ago

Thanks for the pull request, @IvanStepanok!

What's next?

Please work through the following steps to get your changes ready for engineering review:

:radio_button: Get product approval

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

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

:radio_button: 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.

:radio_button: Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently maintained by @openedx/openedx-mobile-maintainers. Tag them in a comment and let them know that your changes are ready for review.

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:

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

rnr commented 3 weeks ago

@IvanStepanok Thank you for your work on this feature - looks cool! I have a few comments on the UI - will place here

rnr commented 3 weeks ago

1) While the app is downloading for offline, the user stops the app and starts it again; after navigating to the course -> offline user sees the ‘Download All’ button, but the download continues.

https://github.com/user-attachments/assets/980da3e1-49b4-4db5-b44e-3c2be83a165c

rnr commented 3 weeks ago

2) All content in course is loaded. User deletes only one block. After tap on "Download all" button it shows like user will get whole course again.

https://github.com/user-attachments/assets/996b52cd-feff-4b3c-a832-9b3d0234bd52

rnr commented 3 weeks ago

3) All content in course is loaded. Some chapter contains youtube videos only (which are not downloadable). When goes to Videos Tab and try to remove such chapter it shows "Removing this content will free up 0MB" - do we need to show 'downloaded' state for chapters in Videos which don't contain downloaded videos?

rnr commented 3 weeks ago

4) A user has downloaded a course. The user answered a few questions offline, went online, the answers were synchronised, and now we see them in the online version. (it's working right) When the user goes to that test again offline, he don't see the answers - it looks like the user is seeing the downloaded version BEFORE he gave the answers.

https://github.com/user-attachments/assets/9cb337ac-5146-4f3a-a52d-ce5b43c9c2b7

rnr commented 3 weeks ago

5) The user can't select a previously selected option in an offline quiz. For example: select option 3 - submit - change your mind and select option 4 - submit - change your mind again and try to select option 3 - unable to select option 3 again

https://github.com/user-attachments/assets/161278c2-8c6c-4a34-98b6-cb0a8a3dbd90

IvanStepanok commented 3 weeks ago

Hi @rnr, and thank you for the review! It is very valuable to me to get a view from another angle. I appreciate it.

  1. ✅ Fixed

https://github.com/user-attachments/assets/a2deac8f-b047-4e6f-bad4-97f0abf4a105

  1. ✅Fixed (Pay attention. We don't show download notification, less than 100 MB when connected to Wi-Fi)

https://github.com/user-attachments/assets/e6fd90a6-535d-4fad-a576-c3e978ca7e34

  1. ✅ Fixed

https://github.com/user-attachments/assets/12b5fb70-daad-4859-a101-d0fcf32fae48

I also noticed that if we delete one file, when downloading, the dialog box shows us the size of the entire group instead of a single undownloaded file. This is also fixed.

  1. 🤷‍♂️ This is a known issue, the Open EDX team plans to improve this flow in the future. Currently, the backend has IOSBridge only for offline mode. As soon as they finalize the backend, it will work for us immediately.

  2. 🤷‍♂️ This is also the behavior that was set on the backend side, on our side we cannot influence it in any way.

rnr commented 2 weeks ago

@IvanStepanok Thank you for the fixes and clarifications Looks like we have issue for video:

  1. It seems that the video file is not counted in the total size, even though the dialogue says that this space will be freed up.

https://github.com/user-attachments/assets/09aac20f-8e1a-4f9c-ad26-630a48391aaf

IvanStepanok commented 2 weeks ago

Hi, @rnr, and thanks for the question. In this case, we don't know the size of a video until we download it because the server returns 0 megabytes. We can measure the actual size of the videos only after downloading. To prevent this behavior, we need to receive the actual video size in the server response.

IvanStepanok commented 1 week ago

@rnr Thanks for review! All feedback addressed.