I added a few core-file components to my mustache template. I can download these files when I press them or the download arrow.
However when I click on download the full course these files are not automatically marked downloaded/downloaded.
I tried to add a an array of file objects into the files attribut of the return value of the mobile.php function (similar format to the one demo in the certificate - but I doubt it works as the certificate doesn't seem to download).
Is "course download" supposed to automatically download the core-files? If yes do you have a code example?
we don't parse templates searching for core-files or similar. Like you said, you need to add the files to the "files" array that is returned by the function. Each file must contain:
- url or fileurl: Required. The URL of the file.
- filename: Required. The name of the file.
- timemodified: Optional, to detect if the file has changed and needs to be re-downloaded.
- isexternalfile: Optional, whether it's an external file (like Google Drive).
- repositorytype: Optional, the type of repository the file belongs to (like Google Drive, Dropbox, etc.)
Also, you need to add that function to "offlinefunctions" in mobile.php.
I can not make it work. Both the android mobile app and the https://mobileapp.moodledemo.net/ do not automatically (full course download) download core-file even though it seems I have fileurl and filename correctly set. Manually downloading core-file works well.
Here are my files (I suppose as the new plugin support is new it is probably a good idea to help the first plugin mobile 3.5 devs - not only saying that because it will help me :P):
PS: the mobile_course_view() logic may seem a bit complicated because this plugin generate sMoodle form placeholders (the plugin allows to create Moodle form template - it is pretty cool) so I have to rebuild the data from the template. But I guess you can skip that part my problem likely come from somewhere around that logic.
I was finally able to test the plugin and there's a bug in the Mobile app, I opened an issue to fix it:
With the fix applied I was able to download the activity and its files were downloaded. Also, the plugin looks really good in the app, good job!
great news and thank you for your work on this new plugin mobile support.
For my use case, It was much faster to develop the mobile support this way than learning Angular (even as it was my first time with this new tech).