add "advanced > wallet information"

This commit is contained in:
Matias Alejo Garcia 2015-09-12 10:44:01 -03:00
commit 9d9717ff08
4 changed files with 196 additions and 1 deletions

View file

@ -7,6 +7,12 @@
<div class="content preferences" ng-controller="preferencesAdvancedController as preferences">
<ul class="no-bullet m0 size-14">
<li class="line-b p20" ng-click="$root.go('information')">
<i class="icon-arrow-right3 size-24 right text-gray"></i>
<span translate>Wallet Information</span>
</li>
<li class="line-b p20" ng-click="index.retryScan(); $root.go('walletHome'); ">
<span translate>Scan addresses for funds</span>
</li>

View file

@ -0,0 +1,105 @@
<div
class="topbar-container"
ng-include="'views/includes/topbar.html'"
ng-init="titleSection='Wallet Information'; goBackToState = 'preferencesAdvanced'">
</div>
<div class="content preferences p20v" ng-controller="preferencesInformation as info">
<h4 class="title m0" translate>Wallet Information</h4>
<ul class="no-bullet m0 size-14">
<li class="line-b p20">
<span translate>Wallet Name (at creation)</span>
<span class="right text-gray">
{{walletName}}
</span>
</li>
<li class="line-b p20">
<span translate>Wallet Id</span>
<span class="right text-gray">
{{walletId}}
</span>
</li>
<li class="line-b p20">
<span translate>Wallet Configuration (m-n)</span>
<span class="right text-gray">
{{M}}-{{N}}
</span>
</li>
<li class="line-b p20">
<span translate>Wallet Network</span>
<span class="right text-gray">
{{network}}
</span>
</li>
<li class="line-b p20">
<span translate>Address Type</span>
<span class="right text-gray">
{{addressType}}
</span>
</li>
<li class="line-b p20">
<span translate>Derivation Strategy</span>
<span class="right text-gray">
{{derivationStrategy}}
</span>
</li>
<h4 class="title m0" translate>Extended Public Keys</h4>
<li class="line-b p10" ng-repeat="pk in pubKeys">
<div class="row">
<div class="small-3 columns" translate>Copayer</span> {{$index}}
</div>
<div class="small-9 columns oh enable_text_select text-gray" style="text-overflow:ellipsis">
{{pk}}
</div>
</div>
</li>
<h4 class="title m0" translate>Last Wallet Addresses</h4>
<li class="line-b p20" ng-repeat="a in addrs">
<div class="enable_text_select" style="text-overflow:ellipsis">
{{a.address}}
</div>
<div class="enable_text_select text-gray size-12" style="text-overflow:ellipsis">
<span class="right">
{{a.path}} &middot; {{a.createdOn *1000 | amDateFormat:'MMMM Do YYYY, h:mm a' }}
</span>
</div>
</li>
<li class="line-b p10 text-centered text-gray size-12">
<span translate>Only Main (not change) addresses are shown. The addresses on this list were not verified locally at this time.</span>
</li>
<li class="line-b p20" ng-hide="!index.isCordova">
<button class="black round small expand" ng-style="{'background-color':index.backgroundColor}" ng-click="info.sendAddrs()"><i class="fi-mail"></i>
<span translate>Send all by email</span>
</button>
</li>
<h4 class="title m0" translate>Balance By Address</h4>
<li class="line-b p20 enable_text_select" ng-repeat="a in index.balanceByAddress">
{{a.address}}
<div class="text-gray text-right">
{{(a.amount/1e8).toFixed(8)}} BTC
</div>
</li>
</ul>
</div>

View 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);
});
};
});

View file

@ -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,