Deploy service, progress for download

i implemented the deploy service to my ionic app (i am using ionic 1) and it is working fine, now i want to show the users the time remaining for the download or maybe a progress bar so they do not think that the app is freezing. below is the function of the deploy

var deployFunction = function() {
        $ionicDeploy.check().then(function(snapshotAvailable){

            if (snapshotAvailable) {
            // When snapshotAvailable is true, you can apply the snapshot
                MainService.startSpinner("Downloading Updates");//this shows a loading image indicating that the download started

                //applying the snapshot
                $ionicDeploy.download()
                .then(
                    function() {
                        MainService.stopSpinner();
                        MainService.startSpinner("Extracting");
                        $ionicDeploy.extract()
                        .then(
                            function(){
                                MainService.stopSpinner();
                                $ionicDeploy.load();
                            }, function(error) {
                                console.log("ERROR EXTRACT "+error);
                                // Error extracting
                            }, function(progress) {
                                // progress of extracting
                                console.log('extraction progress '+progress);
                            }
                        );
                    }, function(error){
                        //download error
                        console.log("ERROR Downloading "+error);
                    }, function(progress) {
                        //download progress 
                        console.log('download progress '+progress);
                    }
                );
            }
        });
    }

i’ve read somewhere that the progress function should return an integer… but it is not and i have no idea how to get information about the download beside that it is started or it is finished. any help would be appreciated

for future references this was solved based on This documentation, the code will be

$ionicDeploy.download({
                    onProgress: function(p) {
                        console.log(p);
                    }
                })
                .then(
                    function() {...

i tried it and the console logged numbers from 1 to 100 indicating the download progress.

1 Like