From 93224313524ac5390bf8944c72f9af06e7ee9265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=B2=D0=B0=D0=BD=20=D0=9D=D1=94=D0=B4=D1=94=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=96=D1=86=D0=B5=D0=B2?= Date: Fri, 14 Jun 2024 15:31:30 +0300 Subject: [PATCH 01/13] docs: [AXM-686] ADR for Offline Mode application --- .../offline_mode/docs/001-offline-mode.rst | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 openedx/features/offline_mode/docs/001-offline-mode.rst diff --git a/openedx/features/offline_mode/docs/001-offline-mode.rst b/openedx/features/offline_mode/docs/001-offline-mode.rst new file mode 100644 index 000000000000..afead26564bf --- /dev/null +++ b/openedx/features/offline_mode/docs/001-offline-mode.rst @@ -0,0 +1,61 @@ +=================================================== +Offline Mode content generation for mobile OeX app +=================================================== + +Status +------ + +Proposed + +Context and Problem Statement +----------------------------- + +The primary goal is to enable offline access to course content in the Open edX mobile application. +This will allow users to download course materials when they have internet access and access them +later without an internet connection. This feature is crucial for learners in areas with unreliable +internet connectivity or those who prefer to study on the go without using mobile data. + +Decision Drivers +---------------- + +* **User Convenience**: Improve the learning experience by allowing access to course materials anytime, anywhere. +* **Accessibility**: Ensure learners in regions with limited or no internet connectivity can still benefit from the educational content. +* **Platform Compatibility**: Maintain compatibility with existing Open edX infrastructure and mobile applications. +* **Performance**: Ensure that the offline mode does not degrade the performance of the mobile application. + +Considered Options +------------------ + +* **Implement of a mechanism for generating and storing on a server or external storage**: The course content should be pre-generated and saved to the storage for later download. + * **Render content**: Generate HTML content of block as it does for LMS. + * **Replace static and media**: Save static and media assets files used in block to temporary directory and replace their static paths with local paths. + * **Archive and store content**: Archive the generated content and store it on the server or external storage. +* **Mechanism for updating the generated data**: When updating course blocks (namely when publishing) the content that has been changed should be re-generated. + * **Track course publishing events on CMS side**: Signal in the CMS that makes request to LMS to update course content. + * **Track course publishing events on LMS side**: API endpoint to receive the signal from CMS and update course content. + * **Update archive**: Check generated archive creation date and update it if less than course publishing date. +* **Implement a Mobile Local Storage Mechanism**: Use the device's local storage to save course content for offline access. + * **Extend blocks API**: Add links to download blocks content and where it is possible. +* **Sync Mechanism**: Periodically synchronize local data with the server when the device is online. + * **Sync on app side**: On course outline screen, check if the course content is up to date and update it if necessary. +* **Selective Download**: Allow users to choose specific content to download for offline use. +* **Full Course Download**: Provide an option to download entire courses for offline access. + +Consequences +------------ + +* Enhanced learner experience with flexible access to course materials. +* Increased accessibility for learners in regions with poor internet connectivity. +* Improved engagement and completion rates due to uninterrupted access to content. +* Potential increase in app size due to locally stored content. +* Increased complexity in managing content synchronization and updates. +* Need for continuous monitoring and updates to handle new content types and formats. + +Rejected Solutions +------------------ + +Store common .js and .css files of blocks in a separate folder: + * This solution was rejected because it is unclear how to track potential changes to these files and re-generate the content of the blocks. + +Generate content on the fly when the user requests it: + * This solution was rejected because it would require a significant amount of processing power and time to generate content for each block when requested. From 0f6d08f02d152a46a9b26f9c2937e4e3427c7ffe Mon Sep 17 00:00:00 2001 From: Glib Glugovskiy Date: Thu, 20 Jun 2024 13:26:50 +0300 Subject: [PATCH 02/13] refactor: rename app for mobile offline --- .../docs/001-mobile-offline-content-support.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename openedx/features/{offline_mode/docs/001-offline-mode.rst => offline_content/docs/001-mobile-offline-content-support.rst} (100%) diff --git a/openedx/features/offline_mode/docs/001-offline-mode.rst b/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst similarity index 100% rename from openedx/features/offline_mode/docs/001-offline-mode.rst rename to openedx/features/offline_content/docs/001-mobile-offline-content-support.rst From 63f8daeab2c19d34d114f78422e9e4ca477651fb Mon Sep 17 00:00:00 2001 From: Glib Glugovskiy Date: Thu, 27 Jun 2024 10:54:15 +0300 Subject: [PATCH 03/13] docs: update draft adr --- .../001-mobile-offline-content-support.rst | 79 +++++++++++++++---- 1 file changed, 64 insertions(+), 15 deletions(-) diff --git a/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst b/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst index afead26564bf..39240366dea1 100644 --- a/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst +++ b/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst @@ -1,30 +1,73 @@ -=================================================== -Offline Mode content generation for mobile OeX app -=================================================== +Offline content generation for mobile OeX app +============================================= Status ------ Proposed -Context and Problem Statement ------------------------------ +Context +------- The primary goal is to enable offline access to course content in the Open edX mobile application. This will allow users to download course materials when they have internet access and access them -later without an internet connection. This feature is crucial for learners in areas with unreliable -internet connectivity or those who prefer to study on the go without using mobile data. +later without an internet connection, also it should support synchronization of the submitted results +with backend service as connection become available again. This feature is crucial for learners +in areas with unreliable internet connectivity or those who prefer to study on the go without using mobile data. +It is possible to provide different kind of content using the Open edX platform, such as read-only materials, +videos, and assessments. Therefore to provide the whole course experience in offline mode it's required to +make all these types of content available offline. Of course it won't be feasible to recreate grading +algorithms in mobile, so it's possible to save submission on the mobile app and execute synchronization +of the user progres as not limited conectivity is back. +From the product perspective the following Figma designs and product requirements should be considered: +* Figma +* Offline mode product pages -Decision Drivers ----------------- -* **User Convenience**: Improve the learning experience by allowing access to course materials anytime, anywhere. -* **Accessibility**: Ensure learners in regions with limited or no internet connectivity can still benefit from the educational content. -* **Platform Compatibility**: Maintain compatibility with existing Open edX infrastructure and mobile applications. -* **Performance**: Ensure that the offline mode does not degrade the performance of the mobile application. +Decision +-------- + +The implementation of the offline content support require addition of the following features to the edx-platform: + +* It's necessary to generate an archive with all necessary HTML and assets for a student view of an xBlock, + so it's possible to display an xBlock using mobile WebView. +* The generated offline content should be provided to mobile device through mobile API. +* To support CAPA problems and other kinds of assessments in offline mode it's necessary to create an additional + JavaScript layer that will allow communication with Mobile applications by sending JSON messages + using Android and IOS Bridge. + + + +Offline content generation +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Generating zip archive with xBlock data for HTML and CAPA problems +When content is published in CMS and offline generation is enabled for the course or entire platform using waffle flags, the content generation task should be started for supported blocks. +Every time block content republished ZIP archive with offline content should be regenerated. +The xBlock should be rendered the same way it’s rendered for a student using /xblock/{locator.id} endpoint in LMS. +HTML should be processed, all related assets files, images and scripts should be included in the generated ZIP archive with offline content +The Generation process should work with local media storage as well as s3. +If error retrieving block happened, the generation task will be scheduled for retry 2 more times, with progressive delay. + +Mobile API extension +~~~~~~~~~~~~~~~~~~~~ + +Extend mobile API endpoint for Course Home, to return information about offline content available for download for supported blocks +{ +... +"offline_download": { + "file_url": "{file_url}" or null, + "last_modified": "{DT}" or null, + "file_size": "" + } +} + +JavaScript Bridge for interaction with mobile applications +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Implement JS Bridge JS script to intercept and send results to mobile device for supported CAPA problems +The submission data should be sent via bridge to IOS and Android devices. +This script should expose markCompleted JS function so mobile can change state of the offline problem after the data was saved into internal database or on initialization of the problem -Considered Options ------------------- * **Implement of a mechanism for generating and storing on a server or external storage**: The course content should be pre-generated and saved to the storage for later download. * **Render content**: Generate HTML content of block as it does for LMS. @@ -41,6 +84,12 @@ Considered Options * **Selective Download**: Allow users to choose specific content to download for offline use. * **Full Course Download**: Provide an option to download entire courses for offline access. +Supported xBlocks in offline mode +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +It was decided to include a fraction of Open edX xBlocks to be supported + + Consequences ------------ From be742121dd5acd6b866aa3accedd3111ccf7976b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=B2=D0=B0=D0=BD=20=D0=9D=D1=94=D0=B4=D1=94=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=96=D1=86=D0=B5=D0=B2?= Date: Mon, 2 Dec 2024 14:00:41 +0200 Subject: [PATCH 04/13] docs: ADR updated --- .../001-mobile-offline-content-support.rst | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst b/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst index 39240366dea1..51ba88d5e597 100644 --- a/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst +++ b/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst @@ -15,9 +15,9 @@ later without an internet connection, also it should support synchronization of with backend service as connection become available again. This feature is crucial for learners in areas with unreliable internet connectivity or those who prefer to study on the go without using mobile data. It is possible to provide different kind of content using the Open edX platform, such as read-only materials, -videos, and assessments. Therefore to provide the whole course experience in offline mode it's required to +videos, and assessments. Therefore to provide the whole course experience in offline mode it's required to make all these types of content available offline. Of course it won't be feasible to recreate grading -algorithms in mobile, so it's possible to save submission on the mobile app and execute synchronization +algorithms in mobile, so it's possible to save submission on the mobile app and execute synchronization of the user progres as not limited conectivity is back. From the product perspective the following Figma designs and product requirements should be considered: * Figma @@ -35,9 +35,9 @@ The implementation of the offline content support require addition of the follow * To support CAPA problems and other kinds of assessments in offline mode it's necessary to create an additional JavaScript layer that will allow communication with Mobile applications by sending JSON messages using Android and IOS Bridge. - - - + + + Offline content generation ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -87,7 +87,26 @@ This script should expose markCompleted JS function so mobile can change state o Supported xBlocks in offline mode ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -It was decided to include a fraction of Open edX xBlocks to be supported +It was decided to include a fraction of Open edX xBlocks to be supported. +The following list of blocks is currently planned to be added to the support: + +* **Common problems**: + * **Checkboxes** - full support + * **Dropdown** - full support + * **Multiple Choice** - full support + * **Numerical Input** - full support + * **Text Input** - full support + * **Checkboxes with Hints and Feedback** - partial support without Hints and Feedback + * **Dropdown with Hints and Feedback** - partial support without Hints and Feedback + * **Multiple Choice with Hints and Feedback** - partial support without Hints and Feedback + * **Numerical Input with Hints and Feedback** - partially supported without Hints and Feedback + * **Text Input with Hints and Feedback** - partially supported without Hints and Feedback +* **Text**: + * **Text** - full support + * **IFrame Tool** - full support + * **Raw HTML** - full support + * **Zooming Image Tool** - full support +* **Video** - already supported Consequences From d330bf6dbebf4e6b9ccaec4857dacc3872593247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=B2=D0=B0=D0=BD=20=D0=9D=D1=94=D0=B4=D1=94=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=96=D1=86=D0=B5=D0=B2?= Date: Mon, 2 Dec 2024 14:01:05 +0200 Subject: [PATCH 05/13] docs: added Mobile Offline Content Generation Process Diagram --- .../docs/001-mobile-offline-content-support.rst | 3 +++ .../docs/_images/mobile_offline_content_generation.svg | 10 ++++++++++ 2 files changed, 13 insertions(+) create mode 100644 openedx/features/offline_content/docs/_images/mobile_offline_content_generation.svg diff --git a/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst b/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst index 51ba88d5e597..ec2c7993c40d 100644 --- a/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst +++ b/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst @@ -49,6 +49,9 @@ HTML should be processed, all related assets files, images and scripts should be The Generation process should work with local media storage as well as s3. If error retrieving block happened, the generation task will be scheduled for retry 2 more times, with progressive delay. + .. image:: _images/mobile_offline_content_generation.svg + :alt: Mobile Offline Content Generation Process Diagram + Mobile API extension ~~~~~~~~~~~~~~~~~~~~ diff --git a/openedx/features/offline_content/docs/_images/mobile_offline_content_generation.svg b/openedx/features/offline_content/docs/_images/mobile_offline_content_generation.svg new file mode 100644 index 000000000000..482f52b849e5 --- /dev/null +++ b/openedx/features/offline_content/docs/_images/mobile_offline_content_generation.svg @@ -0,0 +1,10 @@ + + + + + + + + CMSChange/createcourse contentPublish changesLMSRequest to LMSGenerate course xblock filesExternal media storageOffline content generation handlerOther OeX mediaProblem xblock archiveHTML xblock archive....Courses offline content....Course 1Problem xblock archiveHTML xblock archive....Course 2Rendering xblock HTMLfile via LMS rendererCopy all related staticfiles (js and css) forthe rendered xblockArchive xblock temporarydir, and its deletionCreating a temporary dirto store xblock contentChecking whether thecontent of a specificxblock needs to begenerated (re-generated)Run celery task togenerate xblocks forcourseYesSave xblockarchive tothe storage From 3b7b38e42b8df9791d96132811962bdeba6a063b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=B2=D0=B0=D0=BD=20=D0=9D=D1=94=D0=B4=D1=94=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=96=D1=86=D0=B5=D0=B2?= Date: Fri, 7 Feb 2025 12:50:29 +0200 Subject: [PATCH 06/13] docs: add Figma links --- .../docs/001-mobile-offline-content-support.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst b/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst index ec2c7993c40d..4aa26c4eb271 100644 --- a/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst +++ b/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst @@ -20,9 +20,11 @@ make all these types of content available offline. Of course it won't be feasibl algorithms in mobile, so it's possible to save submission on the mobile app and execute synchronization of the user progres as not limited conectivity is back. From the product perspective the following Figma designs and product requirements should be considered: -* Figma -* Offline mode product pages +* `Download and Delete (Figma)`_ +* `Downloads (Figma)`_ +.. _Download and Delete (Figma): https://www.figma.com/design/iZ56YMjbRMShCCDxqrqRrR/Mobile-App-v2.4-%5BOpen-edX%5D?node-id=18472-187387&t=tMgymS6WIZZJbJHn-0 +.. _Downloads (Figma): https://www.figma.com/design/iZ56YMjbRMShCCDxqrqRrR/Mobile-App-v2.4-%5BOpen-edX%5D Decision -------- From e3675b3b1135ddd5f7075f2914e2bd3469db9e69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=B2=D0=B0=D0=BD=20=D0=9D=D1=94=D0=B4=D1=94=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=96=D1=86=D0=B5=D0=B2?= Date: Mon, 10 Feb 2025 19:53:15 +0200 Subject: [PATCH 07/13] docs: update the description of block generation and user response sync --- .../docs/001-mobile-offline-content-support.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst b/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst index 4aa26c4eb271..6415d78cb53e 100644 --- a/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst +++ b/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst @@ -57,7 +57,8 @@ If error retrieving block happened, the generation task will be scheduled for re Mobile API extension ~~~~~~~~~~~~~~~~~~~~ -Extend mobile API endpoint for Course Home, to return information about offline content available for download for supported blocks +Extend the Course Home mobile API endpoint, and add a new version of the API (url /api/mobile/v4/course_info/blocks/) +to return information about offline content available for download for supported blocks { ... "offline_download": { @@ -79,13 +80,13 @@ This script should expose markCompleted JS function so mobile can change state o * **Replace static and media**: Save static and media assets files used in block to temporary directory and replace their static paths with local paths. * **Archive and store content**: Archive the generated content and store it on the server or external storage. * **Mechanism for updating the generated data**: When updating course blocks (namely when publishing) the content that has been changed should be re-generated. - * **Track course publishing events on CMS side**: Signal in the CMS that makes request to LMS to update course content. - * **Track course publishing events on LMS side**: API endpoint to receive the signal from CMS and update course content. + * **Track course publishing events on LMS side**: Add a new signal `course_cache_updated` to be called after the course structure cache update in `update_course_in_cache_v2`. Add a signal that listens to `course_cache_updated` and starts block generation. * **Update archive**: Check generated archive creation date and update it if less than course publishing date. * **Implement a Mobile Local Storage Mechanism**: Use the device's local storage to save course content for offline access. * **Extend blocks API**: Add links to download blocks content and where it is possible. * **Sync Mechanism**: Periodically synchronize local data with the server when the device is online. * **Sync on app side**: On course outline screen, check if the course content is up to date and update it if necessary. + * **Sync user responses**: When the device is offline, save user responses locally and send them to the server when the device is online. * **Selective Download**: Allow users to choose specific content to download for offline use. * **Full Course Download**: Provide an option to download entire courses for offline access. From 7c2df709daa82a3ebe38308b3987c56c3d6d54d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=B2=D0=B0=D0=BD=20=D0=9D=D1=94=D0=B4=D1=94=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=96=D1=86=D0=B5=D0=B2?= Date: Tue, 8 Apr 2025 18:49:55 +0300 Subject: [PATCH 08/13] docs: changed to use offline_view instead of a separate renderer --- .../001-mobile-offline-content-support.rst | 50 +++++++++++++------ 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst b/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst index 6415d78cb53e..b031573e694f 100644 --- a/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst +++ b/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst @@ -1,4 +1,4 @@ -Offline content generation for mobile OeX app +1. Offline content generation for mobile OeX app ============================================= Status @@ -18,8 +18,10 @@ It is possible to provide different kind of content using the Open edX platform, videos, and assessments. Therefore to provide the whole course experience in offline mode it's required to make all these types of content available offline. Of course it won't be feasible to recreate grading algorithms in mobile, so it's possible to save submission on the mobile app and execute synchronization -of the user progres as not limited conectivity is back. +of the user progres as not limited connectivity is back. + From the product perspective the following Figma designs and product requirements should be considered: + * `Download and Delete (Figma)`_ * `Downloads (Figma)`_ @@ -31,22 +33,22 @@ Decision The implementation of the offline content support require addition of the following features to the edx-platform: -* It's necessary to generate an archive with all necessary HTML and assets for a student view of an xBlock, - so it's possible to display an xBlock using mobile WebView. +* It's necessary to generate an archive with all necessary HTML and assets for a student view of an xBlock, so it's possible to display an xBlock using mobile WebView. +* Implement a new standard XBlock view called `offline_view` which would generate user-agnostic fragments suitable for offline use. This view will avoid any dependence on student-specific state, focusing solely on content and settings. +* XBlock classes can opt into supporting `offline_view`. They can implement this view fully or partially. For example, a block that relies on user-specific randomization or interactive elements that require online connectivity would not be rendered offline. * The generated offline content should be provided to mobile device through mobile API. * To support CAPA problems and other kinds of assessments in offline mode it's necessary to create an additional JavaScript layer that will allow communication with Mobile applications by sending JSON messages using Android and IOS Bridge. - Offline content generation ~~~~~~~~~~~~~~~~~~~~~~~~~~ Generating zip archive with xBlock data for HTML and CAPA problems When content is published in CMS and offline generation is enabled for the course or entire platform using waffle flags, the content generation task should be started for supported blocks. Every time block content republished ZIP archive with offline content should be regenerated. -The xBlock should be rendered the same way it’s rendered for a student using /xblock/{locator.id} endpoint in LMS. +Supported XBlock class should implement `offline_view` method that will be used to generate the content. HTML should be processed, all related assets files, images and scripts should be included in the generated ZIP archive with offline content The Generation process should work with local media storage as well as s3. If error retrieving block happened, the generation task will be scheduled for retry 2 more times, with progressive delay. @@ -54,19 +56,30 @@ If error retrieving block happened, the generation task will be scheduled for re .. image:: _images/mobile_offline_content_generation.svg :alt: Mobile Offline Content Generation Process Diagram + +Offline content deletion +~~~~~~~~~~~~~~~~~~~~~~~~ + +When the course is published and some blocks are removed from the course, related ZIP archive should be deleted. +When some blocks are removed from the course without publishing the course, the related ZIP archive shouldn't be deleted. + + Mobile API extension ~~~~~~~~~~~~~~~~~~~~ Extend the Course Home mobile API endpoint, and add a new version of the API (url /api/mobile/v4/course_info/blocks/) to return information about offline content available for download for supported blocks -{ -... -"offline_download": { - "file_url": "{file_url}" or null, - "last_modified": "{DT}" or null, - "file_size": "" - } -} + +.. code-block:: json + { + ... + "offline_download": { + "file_url": "{file_url}" or null, + "last_modified": "{DT}" or null, + "file_size": "" + } + } + JavaScript Bridge for interaction with mobile applications ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -121,6 +134,8 @@ Consequences * Enhanced learner experience with flexible access to course materials. * Increased accessibility for learners in regions with poor internet connectivity. * Improved engagement and completion rates due to uninterrupted access to content. +* Simplified Maintenance by using a unified rendering view (`offline_view`), the complexity of maintaining separate renderers for online and offline content is significantly reduced. +* The proposed approach not only caters to the current needs of mobile users but also sets a foundation for expanding offline access to other platforms and uses. * Potential increase in app size due to locally stored content. * Increased complexity in managing content synchronization and updates. * Need for continuous monitoring and updates to handle new content types and formats. @@ -128,8 +143,11 @@ Consequences Rejected Solutions ------------------ -Store common .js and .css files of blocks in a separate folder: +* **Store common .js and .css files of blocks in a separate folder:** * This solution was rejected because it is unclear how to track potential changes to these files and re-generate the content of the blocks. -Generate content on the fly when the user requests it: +* **Generate content on the fly when the user requests it:** * This solution was rejected because it would require a significant amount of processing power and time to generate content for each block when requested. + +* **Separate Offline Renderer**: + * The initial proposal of creating a separate renderer for offline content was rejected due to the increased complexity and potential for inconsistent behavior between online and offline content. From 00750b77b62891db784debd0d9057b000dc7c9d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=B2=D0=B0=D0=BD=20=D0=9D=D1=94=D0=B4=D1=94=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=96=D1=86=D0=B5=D0=B2?= Date: Tue, 8 Apr 2025 18:51:14 +0300 Subject: [PATCH 09/13] docs: add ADR for future use and enhancement of offline_view --- .../002-mobile-offline-content-support.rst | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 openedx/features/offline_content/docs/002-mobile-offline-content-support.rst diff --git a/openedx/features/offline_content/docs/002-mobile-offline-content-support.rst b/openedx/features/offline_content/docs/002-mobile-offline-content-support.rst new file mode 100644 index 000000000000..7d1e91e7e882 --- /dev/null +++ b/openedx/features/offline_content/docs/002-mobile-offline-content-support.rst @@ -0,0 +1,55 @@ +2. Offline Mode enhancements +========================= + +Status +------ + +Proposed + +Context +------- + +`offline_view` generalized and can be used for Non-mobile offline mode, Anonymous access or Regular student access. +Static files like JavaScript and CSS will be de-duplicated based on their content hash. + +Decisions +-------- + +1. Efficient resource management +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + - Shared resources like JS and CSS files will be de-duplicated based on their content hash, to prevent duplication for every block. + - All shared content should be stored in the separate ZIP archive. + - This archive will be regenerated 1 time and contains all JS and CSS files related to default Xblocks. + - Xblock specific resources will still be stored in the block ZIP archive. + - This will ensure that the same resource is not duplicated across different blocks, reducing storage and bandwidth usage. + + +2. Anonymous access +~~~~~~~~~~~~~~~~~~~ + + - Re-implement `public_view` on top of `offline_view`. If it is possible to get pre-rendered block without knowing user state, then it is possible to serve that pre-renderable view as the public experience for logged-out users. + - This will allow broader access to educational content without the need for user authentication, potentially increasing user engagement and content reach. + + +3. Non-mobile offline mode +~~~~~~~~~~~~~~~~~~~~~~~~~~ + + - The `offline_view` will be generalized to support non-mobile offline mode. + - This mode will enable users on desktop and other non-mobile platforms to download and access course content without an active internet connection, providing greater flexibility in how content is accessed. + + +4. Regular student access +~~~~~~~~~~~~~~~~~~~~~~~~~ + + - `student_view` will be implemented on top of `offline_view` wherever it is supported. + - For XBlocks compatible with this architecture, offline-ready content will be served by default, and dynamic online features will be engaged only when a user has a reliable connection. + - This setting is intended to improve the learning process by providing constant access to content when the Internet connection is unstable. + + +Consequences +------------ + +* **Resource Efficiency**: The avoidance of duplicating static resources for each block enhances the efficient use of storage and bandwidth. +* **Enhanced Flexibility**: The system can skip rendering blocks that require student-specific interactions, ensuring reliability and reducing the potential for behavior discrepancies between online and offline modes. +* **Broader Accessibility**: The ability to serve pre-rendered views to anonymous users increases the reach of educational content, making it more accessible to a wider audience. From 9663fddd22855504f7881cf6c34a2f7c4af46805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=B2=D0=B0=D0=BD=20=D0=9D=D1=94=D0=B4=D1=94=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=96=D1=86=D0=B5=D0=B2?= Date: Tue, 8 Apr 2025 18:59:07 +0300 Subject: [PATCH 10/13] docs: update the implementation details to take into account the refusal of the renderer --- .../docs/001-mobile-offline-content-support.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst b/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst index b031573e694f..79773c1934bf 100644 --- a/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst +++ b/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst @@ -89,11 +89,11 @@ This script should expose markCompleted JS function so mobile can change state o * **Implement of a mechanism for generating and storing on a server or external storage**: The course content should be pre-generated and saved to the storage for later download. - * **Render content**: Generate HTML content of block as it does for LMS. + * **Render block fragment**: Implement a new standard XBlock view called `offline_view` which would generate user-agnostic fragments suitable for offline use. This view will avoid any dependence on student-specific state, focusing solely on content and settings. * **Replace static and media**: Save static and media assets files used in block to temporary directory and replace their static paths with local paths. * **Archive and store content**: Archive the generated content and store it on the server or external storage. * **Mechanism for updating the generated data**: When updating course blocks (namely when publishing) the content that has been changed should be re-generated. - * **Track course publishing events on LMS side**: Add a new signal `course_cache_updated` to be called after the course structure cache update in `update_course_in_cache_v2`. Add a signal that listens to `course_cache_updated` and starts block generation. + * **Track course publishing events on CMS side**: Add a new signal `course_cache_updated` to be called after the course structure cache update in `update_course_in_cache_v2`. Add a signal that listens to `course_cache_updated` and starts block generation. * **Update archive**: Check generated archive creation date and update it if less than course publishing date. * **Implement a Mobile Local Storage Mechanism**: Use the device's local storage to save course content for offline access. * **Extend blocks API**: Add links to download blocks content and where it is possible. From 34ad4b0ad1894bf8cbeb3bb0299c8fb3e4735351 Mon Sep 17 00:00:00 2001 From: Kyrylo Kholodenko Date: Wed, 16 Jul 2025 17:21:46 +0300 Subject: [PATCH 11/13] docs: extended Mobile Offline Content Generation Process Diagram --- .../_images/mobile_offline_content_generation.svg | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/openedx/features/offline_content/docs/_images/mobile_offline_content_generation.svg b/openedx/features/offline_content/docs/_images/mobile_offline_content_generation.svg index 482f52b849e5..12e6a381d7e5 100644 --- a/openedx/features/offline_content/docs/_images/mobile_offline_content_generation.svg +++ b/openedx/features/offline_content/docs/_images/mobile_offline_content_generation.svg @@ -1,10 +1,4 @@ - - - - - - - - CMSChange/createcourse contentPublish changesLMSRequest to LMSGenerate course xblock filesExternal media storageOffline content generation handlerOther OeX mediaProblem xblock archiveHTML xblock archive....Courses offline content....Course 1Problem xblock archiveHTML xblock archive....Course 2Rendering xblock HTMLfile via LMS rendererCopy all related staticfiles (js and css) forthe rendered xblockArchive xblock temporarydir, and its deletionCreating a temporary dirto store xblock contentChecking whether thecontent of a specificxblock needs to begenerated (re-generated)Run celery task togenerate xblocks forcourseYesSave xblockarchive tothe storage + + +CMSLMSExternal media storageChange/create coursecontentPublish changesGenerate course xblock filesOffline content generation handlerRun celery task togenerate xblocks forcourseChecking whether thecontent of aspecific xblockneeds to begenerated (re-generated)Creating a temporarydir to store xblockcontentCall offline_viewfor xblockRendering xblockHTML file viaLMS rendererCopy allrelated staticfiles (js andcss) for therendered xblockArchive xblocktemporary dir,and itsdeletionCourses offline contentOther OeX mediaCourse 1 folderProblem xblock archiveHTML xblock archive....Course 2 folderProblem xblock archiveHTML xblock archive........Request to LMSYesSave xblockarchive tothe storageСourse cache updates \ No newline at end of file From a641a94ce668370763f9de553af96a5e0a8889a2 Mon Sep 17 00:00:00 2001 From: Kyrylo Kholodenko Date: Thu, 2 Oct 2025 15:22:54 +0300 Subject: [PATCH 12/13] docs: edit diagram, offline content generation on cms side --- .../docs/_images/mobile_offline_content_generation.svg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openedx/features/offline_content/docs/_images/mobile_offline_content_generation.svg b/openedx/features/offline_content/docs/_images/mobile_offline_content_generation.svg index 12e6a381d7e5..ca07617294a9 100644 --- a/openedx/features/offline_content/docs/_images/mobile_offline_content_generation.svg +++ b/openedx/features/offline_content/docs/_images/mobile_offline_content_generation.svg @@ -1,4 +1,4 @@ -CMSLMSExternal media storageChange/create coursecontentPublish changesGenerate course xblock filesOffline content generation handlerRun celery task togenerate xblocks forcourseChecking whether thecontent of aspecific xblockneeds to begenerated (re-generated)Creating a temporarydir to store xblockcontentCall offline_viewfor xblockRendering xblockHTML file viaLMS rendererCopy allrelated staticfiles (js andcss) for therendered xblockArchive xblocktemporary dir,and itsdeletionCourses offline contentOther OeX mediaCourse 1 folderProblem xblock archiveHTML xblock archive....Course 2 folderProblem xblock archiveHTML xblock archive........Request to LMSYesSave xblockarchive tothe storageСourse cache updates \ No newline at end of file +CMSExternal media storageChange/create coursecontentPublish changesGenerate course xblock filesOffline content generation handlerRun celery task togenerate xblocks forcourseChecking whether thecontent of aspecific xblockneeds to begenerated (re-generated)Creating a temporarydir to store xblockcontentCall offline_viewfor xblockRendering xblockHTML file viaCMS rendererCopy allrelated staticfiles (js andcss) for therendered xblockArchive xblocktemporary dir,and itsdeletionCourses offline contentOther OeX mediaCourse 1 folderProblem xblock archiveHTML xblock archive....Course 2 folderProblem xblock archiveHTML xblock archive........YesSave xblockarchive tothe storageСourse cache updates \ No newline at end of file From f589919907811a4d48d14ec554f8e669274149e7 Mon Sep 17 00:00:00 2001 From: Kyrylo Kholodenko Date: Wed, 8 Oct 2025 20:08:15 +0300 Subject: [PATCH 13/13] docs: add details to ADR --- .../docs/001-mobile-offline-content-support.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst b/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst index 79773c1934bf..29ecf7d01efe 100644 --- a/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst +++ b/openedx/features/offline_content/docs/001-mobile-offline-content-support.rst @@ -4,7 +4,7 @@ Status ------ -Proposed +Accepted Context ------- @@ -83,10 +83,12 @@ to return information about offline content available for download for supported JavaScript Bridge for interaction with mobile applications ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Implement JS Bridge JS script to intercept and send results to mobile device for supported CAPA problems -The submission data should be sent via bridge to IOS and Android devices. -This script should expose markCompleted JS function so mobile can change state of the offline problem after the data was saved into internal database or on initialization of the problem +Implement JS Bridge JS script to intercept and send results to mobile device for supported CAPA problems. +The JS bridge will intercept AJAX requests in the mobile application and store the responses locally. If the user submits the response offline he will be shown the message "Your response is accepted" and the Submit button will be disabled as the submission will be sent twice. +When the internet connection is back the mobile client will submit the cached responses one by one through the regular xBlock handler endpoints. +Data from submission should be submitted through bridge on iOS and Android devices. +This script should expose markCompleted JS function so mobile can change state of the offline problem after the data was saved into internal database or on initialization of the problem. * **Implement of a mechanism for generating and storing on a server or external storage**: The course content should be pre-generated and saved to the storage for later download. * **Render block fragment**: Implement a new standard XBlock view called `offline_view` which would generate user-agnostic fragments suitable for offline use. This view will avoid any dependence on student-specific state, focusing solely on content and settings. @@ -120,6 +122,7 @@ The following list of blocks is currently planned to be added to the support: * **Multiple Choice with Hints and Feedback** - partial support without Hints and Feedback * **Numerical Input with Hints and Feedback** - partially supported without Hints and Feedback * **Text Input with Hints and Feedback** - partially supported without Hints and Feedback + * **Blank Advanced Problems** - partially supported, without loncapa/python problems or multi-part problems * **Text**: * **Text** - full support * **IFrame Tool** - full support