Skip to content

Commit 618d7ac

Browse files
author
jbavari
committed
Fix(push/upload): Fix to get new login system with push and upload. Pass in the argv object. Closes ionic-team#482
1 parent cce18bb commit 618d7ac

4 files changed

Lines changed: 22 additions & 10 deletions

File tree

lib/ionic/push.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,33 @@ var fs = require('fs'),
99
IonicTask = require('./task').IonicTask,
1010
IonicStats = require('./stats').IonicStats;
1111
Task = require('./task').Task,
12-
IonicLoginTask = require('./login').IonicTask;
12+
IonicAppLib = require('ionic-app-lib'),
13+
Login = IonicAppLib.login,
14+
LoginTask = require('./login');
15+
// IonicLoginTask = require('./login').IonicTask;
1316

1417
var IonicTask = function() {};
1518

1619
IonicTask.prototype = new Task();
1720

18-
IonicTask.prototype.run = function(ionic) {
21+
IonicTask.prototype.run = function(ionic, argv) {
1922
var self = this;
20-
2123
self.ionic = ionic;
2224
self.inputValues = {};
2325
self.inputFiles = {};
2426
self.useCmdArgs = false;
2527

2628
this.getCmdLineOptions();
2729

28-
var login = new IonicLoginTask();
29-
login.get(ionic, function(jar) {
30+
Login.retrieveLogin()
31+
.then(function(jar){
32+
if (!jar) {
33+
console.log('No previous login existed. Attempting to log in now.');
34+
return LoginTask.login(argv);
35+
}
36+
return jar;
37+
})
38+
.then(function(jar) {
3039
self.jar = jar;
3140

3241
if (argv._[1] && argv._[1].trim() == 'webhook_url') {
@@ -49,8 +58,11 @@ IonicTask.prototype.run = function(ionic) {
4958
// where y will put into live and n will put into dev
5059
self.set_production_mode(self);
5160
}
52-
53-
});
61+
})
62+
.catch(function(ex) {
63+
console.log('An error occurred', ex);
64+
})
65+
5466
};
5567

5668
IonicTask.prototype.set_webhook_url = function(self, webhook_url) {

lib/ionic/upload.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ IonicTask.prototype.run = function run(ionic, argv) {
2020
.then(function(jar){
2121
if (!jar) {
2222
console.log('No previous login existed. Attempting to log in now.');
23-
return LoginTask.login();
23+
return LoginTask.login(argv);
2424
}
2525
return jar;
2626
})

npm-shrinkwrap.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ionic",
3-
"version": "1.5.1",
3+
"version": "1.5.2",
44
"preferGlobal": true,
55
"description": "A tool for creating and developing Ionic Framework mobile apps.",
66
"homepage": "http://ionicframework.com/",

0 commit comments

Comments
 (0)