Few doubts in the Moodle Mobile 2 customization presentation

Few doubts in the Moodle Mobile 2 customization presentation

by charles talathoti -
Number of replies: 5

In https://docs.google.com/presentation/d/1HX5h7zwtay4amaY3qyLuCLfI7kQCiD9IoWuDH-lSa_0/edit#slide=id.gb58f8c5e5_0_7,

Page 12 says "create a new empty repo". What should I do with the repo forked from official 'moodlemobile2'?

It also says "add a special config.xml". Should I override the previous config.xml copied from moodlemobile2 and edited (app id etc.)?

Page 20 gives a way to force the app to use my URL? Is this a replacement for presets configuration used in moodlemobile v1 to do the same thing?


Thanks a bunch!

Average of ratings: -
In reply to charles talathoti

Re: Few doubts in the Moodle Mobile 2 customization presentation

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hello Charles,

we use 2 ways of building apps: Ionic CLI (development) and PhoneGap Build (release). Each way have its own configuration and directory structure. The code in 'moodlemobile2' repository is for Ionic CLI, so if you want to build using PhoneGap we recommend creating a new repository or using the moodlemobile-phonegapbuild official repository.

If you look at the code in moodlemobile2 repo you'll that there are several folders and files in the root folder: hooks, resources, scss, www, etc. PhoneGap Build only needs what's inside www, the rest of files are for Ionic CLI, so you need to copy what's inside of moodlemobile2/www into the root folder of your new repository (see moodlemobile-phonegapbuild repo).

PhoneGap Build also needs a some extra configuration to work, that's why the slides tell you to create a config.xml file, copy the icon and splash, and so. moodlemobile2's config.xml is only for building with Ionic CLI, not with PhoneGap Build, so you don't need to copy that file (use this one as an example to build your own).

About page 20, yes it's similar to the presets URL but there's a difference: in MM1 the user could still change the URL, but in here he won't be able to. If you use those steps, then the user will only be able to use your URL.

Regards,

Dani

Average of ratings: Useful (1)
In reply to Dani Palou

Re: Few doubts in the Moodle Mobile 2 customization presentation

by charles talathoti -

Thanks a lot Daniel.

We did everything as you said and it works perfectly except for one thing: main.js modification for skipping URL screen.

Can you have a look at our core/components/login/main.js 

    .state('mm_login.sites', {

        url: '/sites',

        templateUrl: 'core/components/login/templates/sites.html',

        controller: 'mmLoginSitesCtrl',

        onEnter: function($state, $mmSitesManager) {

            // Skip this page if there are no sites yet.

            $mmSitesManager.hasNoSites().then(function() {

                $state.go('mm_login.site');

            });

        }

    })


    .state('mm_login.site', {

        url: '/site',

        templateUrl: 'core/components/login/templates/site.html',

        controller: 'mmLoginSiteCtrl'

onEnter: function($state){

$state.go('mm_login.credentials', {siteurl: 'http://***********.co.in'});

}

    })


and see where we went wrong? We also followed some instructions of yours from https://moodle.org/mod/forum/discuss.php?d=318362 (Here I also would like to mention here that the code you suggested is slightly different from Juan's. His had 4 arguments in the function, yours had 2 only.)

In reply to charles talathoti

Re: Few doubts in the Moodle Mobile 2 customization presentation

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi again Charles,

your code looks good, I guess the problem is that it's not being reflected into the build files.

The JS files inside www/addons and www/core are used for development, but the app uses the files inside www/build to work. We use gulp to generate this build files. I suggest you take a look to:

https://docs.moodle.org/dev/Setting_up_your_development_environment_for_Moodle_Mobile_2

When you use the "gulp" command, the changes made to the development files are reflected in the build files.

Is that your problem?

Cheers,

Dani

In reply to Dani Palou

Re: Few doubts in the Moodle Mobile 2 customization presentation

by charles talathoti -

Hi Dani,

Thanks again.

We were using PhoneGap instead of Ionic. Does it still mean we have to use gulp to build those files?


Or maybe, I can directly edit build/mm.bundle.js to:


.state('mm_login.site', {
url: '/site',
templateUrl: 'core/components/login/templates/site.html',
controller: 'mmLoginSiteCtrl',

onEnter: function($state) {
$state.go('mm_login.credentials', {siteurl: 'http://******************.co.in'});

})


Will this suffice?

In reply to charles talathoti

Re: Few doubts in the Moodle Mobile 2 customization presentation

by Dani Palou -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Charles,

yes, you can also edit build/mm.bundle.js and apply your changes in there. We recommend using development files and gulp because it's better organized and faster, but working on the built file directly works too.

Regards,

Dani