add change storage to settings
This commit is contained in:
parent
505ac5b5c6
commit
d2f09291cf
7 changed files with 63 additions and 43 deletions
|
|
@ -5,7 +5,6 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
|||
function($scope, $rootScope, $timeout, controllerUtils, notification, rateService) {
|
||||
controllerUtils.redirIfNotComplete();
|
||||
|
||||
|
||||
var w = $rootScope.wallet;
|
||||
|
||||
$scope.loading = false;
|
||||
|
|
@ -18,6 +17,7 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
|||
|
||||
var satToUnit = 1 / w.settings.unitToSatoshi;
|
||||
|
||||
|
||||
$scope.update = function() {
|
||||
$scope.loading = true;
|
||||
var from = ($scope.txpCurrentPage - 1) * $scope.txpItemsPerPage;
|
||||
|
|
@ -31,6 +31,8 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
|||
}, 0);
|
||||
};
|
||||
|
||||
|
||||
|
||||
$scope.show = function() {
|
||||
$scope.loading = true;
|
||||
setTimeout(function() {
|
||||
|
|
@ -38,20 +40,15 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
|||
}, 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;
|
||||
|
||||
|
|
@ -77,13 +74,6 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
|||
$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() {
|
||||
|
|
@ -92,4 +82,7 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
|||
return cb ? cb() : null;
|
||||
});
|
||||
};
|
||||
|
||||
// Autoload transactions
|
||||
$scope.getTransactions();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue