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

Commit

Permalink
Merge pull request #2 from driftyco/droid-fix
Browse files Browse the repository at this point in the history
Onload fix, mergin'
  • Loading branch information
Fuiste committed May 5, 2015
2 parents db15cd9 + 62804ed commit bc9a177
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
4 changes: 3 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"version": "0.0.1",
"homepage": "http://ionic.io",
"authors": [
"Joel Weirauch <[email protected]>"
"Joel Weirauch <[email protected]>",
"William Pelrine <[email protected]>",
"Eric Bobbitt <[email protected]>"
],
"description": "Ionic Mobile Platform Deploy client",
"main": "ionic-deploy.js",
Expand Down
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 bc9a177

Please sign in to comment.