Merge pull request #3162 from matiu/feat/walletInfo
add "advanced > wallet information"
This commit is contained in:
commit
df9e50043a
4 changed files with 196 additions and 1 deletions
72
src/js/controllers/preferencesInformation.js
Normal file
72
src/js/controllers/preferencesInformation.js
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesInformation',
|
||||
function($scope, $log, lodash, profileService) {
|
||||
|
||||
var fc = profileService.focusedClient;
|
||||
var c = fc.credentials;
|
||||
|
||||
$scope.walletName = c.walletName;
|
||||
$scope.walletId = c.walletId;
|
||||
$scope.network = c.network;
|
||||
$scope.addressType = c.addressType || 'P2SH';
|
||||
$scope.derivationStrategy = c.derivationStrategy || 'BIP45';
|
||||
$scope.M = c.m;
|
||||
$scope.N = c.n;
|
||||
$scope.pubKeys = lodash.pluck(c.publicKeyRing, 'xPubKey');
|
||||
|
||||
fc.getMainAddresses({
|
||||
doNotVerify: true
|
||||
}, function(err, addrs) {
|
||||
if (err) {
|
||||
$log.warn(err);
|
||||
return;
|
||||
};
|
||||
|
||||
var last10 = [],
|
||||
i = 0,
|
||||
e = addrs.pop();
|
||||
while (i++ < 10 && e) {
|
||||
last10.push(e);
|
||||
e = addrs.pop();
|
||||
}
|
||||
$scope.addrs = last10;
|
||||
});
|
||||
|
||||
this.sendAddrs = function() {
|
||||
|
||||
function formatDate(ts) {
|
||||
var dateObj = new Date(ts * 1000);
|
||||
if (!dateObj) {
|
||||
$log.debug('Error formating a date');
|
||||
return 'DateError';
|
||||
}
|
||||
if (!dateObj.toJSON()) {
|
||||
return '';
|
||||
}
|
||||
return dateObj.toJSON();
|
||||
};
|
||||
|
||||
fc.getMainAddresses({
|
||||
doNotVerify: true
|
||||
}, function(err, addrs) {
|
||||
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, addrs.path, formatDate(addrs.createdOn);
|
||||
}).join('\n');
|
||||
|
||||
var properties = {
|
||||
subject: 'Copay Addresses',
|
||||
body: body,
|
||||
isHtml: false
|
||||
};
|
||||
window.plugin.email.open(properties);
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
@ -420,6 +420,17 @@ angular
|
|||
},
|
||||
}
|
||||
})
|
||||
.state('information', {
|
||||
url: '/information',
|
||||
walletShouldBeComplete: true,
|
||||
needProfile: true,
|
||||
views: {
|
||||
'main': {
|
||||
templateUrl: 'views/preferencesInformation.html'
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
.state('about', {
|
||||
url: '/about',
|
||||
templateUrl: 'views/preferencesAbout.html',
|
||||
|
|
@ -546,6 +557,7 @@ angular
|
|||
buyGlidera: 12,
|
||||
sellGlidera: 12,
|
||||
preferencesGlidera: 12,
|
||||
about: 12,
|
||||
delete: 13,
|
||||
preferencesLanguage: 12,
|
||||
preferencesUnit: 12,
|
||||
|
|
@ -554,8 +566,8 @@ angular
|
|||
preferencesBwsUrl: 12,
|
||||
preferencesAlias: 12,
|
||||
preferencesEmail: 12,
|
||||
about: 12,
|
||||
logs: 13,
|
||||
information: 13,
|
||||
translators: 13,
|
||||
disclaimer: 13,
|
||||
add: 11,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue