Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuiste committed May 13, 2015
2 parents 9c7d581 + bc9a177 commit 41e4016
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions ionic-deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ angular.module('ionic.service.deploy', ['ionic.service.core'])
'INITIAL_DELAY',
function($q, $timeout, $rootScope, $ionicApp, WATCH_INTERVAL, INITIAL_DELAY) {
return {

/**
* Watch constantly checks for updates, and triggers an
* Watch constantly checks for updates, and triggers an
* event when one is ready.
*/
watch: function(options) {
Expand Down Expand Up @@ -125,6 +125,7 @@ angular.module('ionic.service.deploy', ['ionic.service.core'])

if (typeof IonicDeploy != "undefined") {
IonicDeploy.check($ionicApp.getApp().app_id, function(result) {
console.log("DEBUG DEPLOY: " + result);
deferred.resolve(result === 'true');
}, function(error) {
deferred.reject(error);
Expand Down Expand Up @@ -224,12 +225,14 @@ angular.module('ionic.service.deploy', ['ionic.service.core'])
deferred.notify(progress);
} else {
// Download complete, now extract
console.log("Download complete");
IonicDeploy.extract($ionicApp.getApp().app_id, function(result) {
if (result !== 'done') {
// Extract is only half of the reported progress
progress = progress + (result / 2);
deferred.notify(progress);
} else {
console.log("Extract complete");
// Extraction complete, now redirect
IonicDeploy.redirect($ionicApp.getApp().app_id);
}
Expand Down Expand Up @@ -258,3 +261,18 @@ angular.module('ionic.service.deploy', ['ionic.service.core'])
}
}
}])

.run(['$ionicApp', function($ionicApp) {

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady() {
console.log("Ionid Deploy: Init");
if (typeof IonicDeploy != "undefined") {
if (ionic.Platform.isAndroid()) {
IonicDeploy.init($ionicApp.getApp().app_id);
}
IonicDeploy.redirect($ionicApp.getApp().app_id);
}
};
}]);

0 comments on commit 41e4016

Please sign in to comment.