-
Improvement
-
Resolution: Fixed
-
Minor
-
3.8.2
-
-
MOODLE_38_STABLE
-
MOODLE_39_STABLE
-
Moodle App 3.9.0
The issue:
For activity plugins image (and video) files included on a page using the core-external-content directive are being downloaded, stored and are viewable but the size menu item in the context menu (top right more icon) is not being displayed until the page is refreshed. For core activity plugins image files are always downloaded before the activity page displays (check the image url) and the size menu item displays the stored file size without the need for a refresh.
To replicate:
- From an existing moodle plugin activity (e.g. ouwiki) add the three files that enable moodle app functionality (db/mobile.php, classes/mobile.php and templates/main_view.mustache - see attached sample files). Keep the app functionality to the minimum, but add an image (a core-external-content element) in the template with a dynamic src.
- On the website, run notifications, add a course, add a student and enroll on course, enable mobile, add the activity and add one image for display to the activity. This image src should then be used as the fixed image url to be passed to the template in the app code above (ensuring the image will be served properly as a plugin file).
- On the app sign in as student, navigate to the course, select the activity, check the image appears.
- On the activity page in the app view the top right menu (three vertical dots), check the image size menu item does not appear (without a refresh: but do not refresh for the moment). Also check the src of the image on the page - it is still showing as an external file ([https://|https:]...), where after a refresh it is served locally (filesystem:....).
Comment:
At this point the image is actually downloaded to the app and appears in the database (in filepool_files - view in chrome developer tools - Application > Storage > WebSQL). The file was downloaded by a call to addToQueueIfNeeded() (in filepoolProvider) that completed after the context menu items were refreshed. The activity is not downloaded completely so the download menu item displays (correct, because there could be other pages with files that may need downloading). Even though the file exists the size menu item does not appear. This is because the file queued for download completed after the context menu was last updated with an onContentLoaded() (core/siteplugins/components/module-index/module-index.ts) which would have refreshed the context menu.
So now if the user navigates back to the course, and then to the activity for a second time (alternatively just press the refresh menu icon), the menu now displays a downloaded file that could be deleted.
Our user testing indicates that it would be nice if the context menu would just update itself (like it does on a refresh) as it gives users more confidence over the size of local file storage on their devices. (Yes we have video and image heavy plugins, and users with concerns over storage capacity on their mobiles).
In the images attached we can see the core activity plugin shows the size menu item displayed. And the other image is what displays for a core activity plugin if the file is deleted. This is the same menu as for a plugin activity - the size menu item is missing - yet the file has been downloaded as is taking space in the database on the device.