Merge branch 'master' into bugs/ui-07

This commit is contained in:
bechi 2014-10-30 16:51:38 -03:00
commit efab427de1
13 changed files with 111 additions and 68 deletions

View file

@ -1,14 +1,12 @@
'use strict';
var bitcore = require('bitcore');
angular.module('copayApp.controllers').controller('TransactionsController',
angular.module('copayApp.controllers').controller('HistoryController',
function($scope, $rootScope, $timeout, controllerUtils, notification, rateService) {
controllerUtils.redirIfNotComplete();
var w = $rootScope.wallet;
$rootScope.title = 'History';
$scope.loading = false;
$scope.lastShowed = false;
@ -19,6 +17,7 @@ angular.module('copayApp.controllers').controller('TransactionsController',
var satToUnit = 1 / w.settings.unitToSatoshi;
$scope.update = function() {
$scope.loading = true;
var from = ($scope.txpCurrentPage - 1) * $scope.txpItemsPerPage;
@ -32,6 +31,8 @@ angular.module('copayApp.controllers').controller('TransactionsController',
}, 0);
};
$scope.show = function() {
$scope.loading = true;
setTimeout(function() {
@ -39,20 +40,15 @@ angular.module('copayApp.controllers').controller('TransactionsController',
}, 10);
};
$scope.toogleLast = function() {
$scope.lastShowed = !$scope.lastShowed;
if ($scope.lastShowed) {
$scope.getTransactions();
}
};
$scope.getTransactions = function() {
var self = this;
var w = $rootScope.wallet;
if (!w) return;
$scope.blockchain_txs = w.cached_txs || [];
$scope.loading = true;
w.getTransactionHistory(function(err, res) {
if (err) throw err;
@ -81,13 +77,6 @@ angular.module('copayApp.controllers').controller('TransactionsController',
$scope.getShortNetworkName = function() {
return w.getNetworkName().substring(0, 4);
};
// Autoload transactions on 1-of-1
if ($rootScope.wallet && $rootScope.wallet.totalCopayers == 1) {
$scope.lastShowed = true;
$scope.getTransactions();
}
$scope.amountAlternative = function(amount, txIndex, cb) {
var w = $rootScope.wallet;
rateService.whenAvailable(function() {
@ -96,4 +85,7 @@ angular.module('copayApp.controllers').controller('TransactionsController',
return cb ? cb() : null;
});
};
// Autoload transactions
$scope.getTransactions();
});

View file

@ -5,7 +5,7 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
$scope.retreiving = true;
identityService.check($scope);
$scope.confirmedEmail = getParam('confirmed');
$scope.openProfile = function(form) {
if (form && form.$invalid) {
notification.error('Error', 'Please enter the required fields');
@ -14,4 +14,18 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
$scope.loading = true;
identityService.open($scope, form);
}
function getParam(sname) {
var params = location.search.substr(location.search.indexOf("?") + 1);
var sval = "";
params = params.split("&");
// split param and value into individual pieces
for (var i = 0; i < params.length; i++) {
var temp = params[i].split("=");
if ([temp[0]] == sname) {
sval = temp[1];
}
}
return sval;
}
});

View file

@ -54,6 +54,18 @@ angular.module('copayApp.controllers').controller('MoreController',
}
}
$scope.hideAdv = true;
$scope.hidePriv = true;
$scope.hideSecret = true;
if (w) {
$scope.priv = w.privateKey.toObj().extendedPrivateKeyString;
$scope.secret = w.getSecret();
}
setTimeout(function() {
$scope.$digest();
}, 1);
$scope.save = function() {
w.changeSettings({
unitName: $scope.selectedUnit.shortName,
@ -66,15 +78,6 @@ angular.module('copayApp.controllers').controller('MoreController',
controllerUtils.updateBalance();
};
$scope.hideAdv = true;
$scope.hidePriv = true;
$scope.hideSecret = true;
if (w) {
$scope.priv = w.privateKey.toObj().extendedPrivateKeyString;
$scope.secret = w.getSecret();
}
$scope.downloadBackup = function() {
backupService.walletDownload(w);
}

View file

@ -1,11 +1,9 @@
'use strict';
angular.module('copayApp.controllers').controller('AddressesController',
angular.module('copayApp.controllers').controller('ReceiveController',
function($scope, $rootScope, $timeout, $modal, controllerUtils) {
controllerUtils.redirIfNotComplete();
$rootScope.title = 'Addresses';
$scope.loading = false;
$scope.showAll = false;

View file

@ -8,6 +8,23 @@ angular.module('copayApp.controllers').controller('SettingsController', function
$scope.insightLivenet = config.network.livenet.url;
$scope.insightTestnet = config.network.testnet.url;
$scope.availableStorages = [{
name: 'Insight',
pluginName: 'EncryptedInsightStorage',
}, {
name: 'Localstorage',
pluginName: 'EncryptedLocalStorage',
},
// {
// name: 'GoogleDrive',
// pluginName: 'GoogleDrive',
// }
];
_.each($scope.availableStorages, function(v){
if (config.plugins[v.pluginName])
$scope.selectedStorage = v;
});
$scope.availableLanguages = [{
name: 'English',
@ -39,11 +56,14 @@ angular.module('copayApp.controllers').controller('SettingsController', function
},
}
var plugins = {};
plugins[$scope.selectedStorage.pluginName] = true;
localStorage.setItem('config', JSON.stringify({
network: insightSettings,
version: copay.version,
defaultLanguage: $scope.selectedLanguage.isoCode
defaultLanguage: $scope.selectedLanguage.isoCode,
plugins: plugins,
}));
// Go home reloading the application