Merge pull request #3309 from cmgustavo/bug/ui-preferences

Bug/ui preferences
This commit is contained in:
Matias Alejo Garcia 2015-10-23 12:13:17 -03:00
commit bc1ff3f6ff
5 changed files with 158 additions and 138 deletions

View file

@ -608,7 +608,6 @@ input[type=number]::-webkit-outer-spin-button {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding-top: 3px;
}
ul.pagination li.current a {

View file

@ -1,47 +1,57 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesInformation',
function($scope, $log, $timeout, lodash, profileService) {
var fc = profileService.focusedClient;
var c = fc.credentials;
function($scope, $log, $timeout, isMobile, gettextCatalog, lodash, profileService) {
var base = 'xpub';
var basePath = profileService.getUtils().PATHS.BASE_ADDRESS_DERIVATION[c.derivationStrategy][c.network];
$scope.walletName = c.walletName;
$scope.walletId = c.walletId;
$scope.network = c.network;
$scope.addressType = c.addressType || 'P2SH';
$scope.derivationStrategy = c.derivationStrategy || 'BIP45';
$scope.basePath = basePath;
$scope.M = c.m;
$scope.N = c.n;
$scope.pubKeys = lodash.pluck(c.publicKeyRing, 'xPubKey');
$scope.addrs = null;
this.init = function() {
var fc = profileService.focusedClient;
var c = fc.credentials;
var basePath = profileService.getUtils().getBaseAddressDerivationPath(c.derivationStrategy, c.network, 0);
fc.getMainAddresses({
doNotVerify: true
}, function(err, addrs) {
if (err) {
$log.warn(err);
return;
};
var last10 = [],
$scope.walletName = c.walletName;
$scope.walletId = c.walletId;
$scope.network = c.network;
$scope.addressType = c.addressType || 'P2SH';
$scope.derivationStrategy = c.derivationStrategy || 'BIP45';
$scope.basePath = basePath;
$scope.M = c.m;
$scope.N = c.n;
$scope.pubKeys = lodash.pluck(c.publicKeyRing, 'xPubKey');
$scope.addrs = null;
fc.getMainAddresses({
doNotVerify: true
}, function(err, addrs) {
if (err) {
$log.warn(err);
return;
};
var last10 = [],
i = 0,
e = addrs.pop();
while (i++ < 10 && e) {
e.path = base + e.path.substring(1);
last10.push(e);
e = addrs.pop();
}
$scope.addrs = last10;
$timeout(function() {
$scope.$apply();
});
while (i++ < 10 && e) {
e.path = base + e.path.substring(1);
last10.push(e);
e = addrs.pop();
}
$scope.addrs = last10;
$timeout(function() {
$scope.$apply();
});
});
});
};
this.sendAddrs = function() {
var self = this;
var fc = profileService.focusedClient;
if (isMobile.Android() || isMobile.Windows()) {
window.ignoreMobilePause = true;
}
self.loading = true;
function formatDate(ts) {
var dateObj = new Date(ts * 1000);
@ -55,26 +65,33 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
return dateObj.toJSON();
};
fc.getMainAddresses({
doNotVerify: true
}, function(err, addrs) {
if (err) {
$log.warn(err);
return;
};
$timeout(function() {
fc.getMainAddresses({
doNotVerify: true
}, function(err, addrs) {
self.loading = false;
if (err) {
$log.warn(err);
return;
};
var body = 'Copay Wallet' + fc.walletName + ' Addresses\n Only Main Addresses are shown.\n\n';
body += '\n\n';
body += addrs.map(function(v) {
return addrs.address, base + addrs.path.substring(1), formatDate(addrs.createdOn);
}).join('\n');
var body = 'Copay Wallet "' + $scope.walletName + '" Addresses\n Only Main Addresses are shown.\n\n';
body += "\n";
body += addrs.map(function(v) {
return ('* ' + v.address + ' ' + base + v.path.substring(1) + ' ' + formatDate(v.createdOn));
}).join("\n");
var properties = {
subject: 'Copay Addresses',
body: body,
isHtml: false
};
window.plugin.email.open(properties);
});
var properties = {
subject: 'Copay Addresses',
body: body,
isHtml: false
};
window.plugin.email.open(properties);
$timeout(function() {
$scope.$apply();
}, 1000);
});
}, 100);
};
});