Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

iOS: configureCallback never called #73

Closed
mauron85 opened this issue Dec 17, 2015 · 4 comments
Closed

iOS: configureCallback never called #73

mauron85 opened this issue Dec 17, 2015 · 4 comments
Labels
Milestone

Comments

@mauron85
Copy link

Hi

I have disabled auto-download and auto-install in config.xml. And trying to update manually.

In my code I have

chcp.configure(options, configureCallback);

    function configureCallback (error) {
        if (error) {
          console.log('Error during the configuration process');
          console.log(error.description);
          init();
        } else {
          console.log('Plugin configured successfully');
          // from this moment only we control when to download and install new releases
          chcp.fetchUpdate(fetchUpdateCallback);
        }
    }

However configureCallback is never called on iOS

@nikDemyankov
Copy link
Member

Understood, will look into that. What options are you setting? Don't think that problem in them, but still.

@mauron85
Copy link
Author

config.xml

...
  <chcp>
    <auto-download enabled="false"/>
    <auto-install enabled="false"/>
    <config-file url="http://some.url/updates/chcp.json"/>
    <local-development enabled="false"/>
  </chcp>
...

cordova-hcp.json

{
  "update": "now",
  "content_url": "http://some.url/updates"
}

And I do check for updates manually.

function onUpdateReady () {
      console.log('update is ready');
      //this should be called only after chcp.fetchUpdate(fetchUpdateCallback);
   }

    function onDeviceReady () {
        console.log('Device is ready');
        var options = {
          'auto-download': false,
          'auto-install': false
        };

        chcp.configure(options, configureCallback);
    }
    function configureCallback (error) {
        if (error) {
          console.log('Error during the configuration process');
          console.log(error.description);
          init();
        } else {
          console.log('Plugin configured successfully');
          // from this moment only we control when to download and install new releases
          chcp.fetchUpdate(fetchUpdateCallback);
        }
    }

    function fetchUpdateCallback (error, data) {
        if (error) {
            console.log('Failed to load the update with error code: ' + error.code);
            console.log(error.description);
            init();
            return;
        } else {
            console.log('Update is loaded, running the installation');
            chcp.installUpdate(installationCallback);
        }
    }

    function installationCallback (error) {
        if (error) {
            console.log('Failed to install the update with error code: ' + error.code);
            console.log(error.description);
        } else {
            console.log('Update installed!');
        }
        init();
    }

    function init () {
        window.document.location = 'mobile.html';
    }

    document.addEventListener('deviceready', onDeviceReady, false);
    document.addEventListener('chcp_updateIsReadyToInstall', onUpdateReady, false);

@nikDemyankov
Copy link
Member

Thanks for the details.

@nikDemyankov nikDemyankov added this to the v1.2 milestone Dec 18, 2015
@nikDemyankov
Copy link
Member

Should be fixed in v.1.2.0. If not - reopen the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants