mirror of https://github.com/BTCPrivate/copay.git
add wallet alias
This commit is contained in:
parent
63a488e630
commit
d851f62c7f
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
<section class="middle tab-bar-section">
|
<section class="middle tab-bar-section">
|
||||||
<h1 class="title ellipsis" ng-style="{'color': noColor ? '#7A8C9E' : index.backgroundColor}">
|
<h1 class="title ellipsis" ng-style="{'color': noColor ? '#7A8C9E' : index.backgroundColor}">
|
||||||
{{(titleSection|translate) || index.walletName}}
|
{{(titleSection|translate) || (index.alias || index.walletName)}}
|
||||||
</h1>
|
</h1>
|
||||||
</section>
|
</section>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
@ -9,7 +9,16 @@
|
||||||
<div class="content preferences" ng-controller="preferencesController as preferences">
|
<div class="content preferences" ng-controller="preferencesController as preferences">
|
||||||
|
|
||||||
<ul class="no-bullet m0 size-14" ng-show="!index.noFocusedWallet">
|
<ul class="no-bullet m0 size-14" ng-show="!index.noFocusedWallet">
|
||||||
<h4 class="title m0" translate>{{index.walletName}} settings</h4>
|
<h4 class="title m0">{{index.alias}} [{{index.walletName}}] <span translate>settings</span></h4>
|
||||||
|
|
||||||
|
|
||||||
|
<li class="line-b p20" ng-click="$root.go('preferencesAlias')">
|
||||||
|
<span translate>Wallet Alias</span>
|
||||||
|
<span class="right text-gray">
|
||||||
|
<i class="icon-arrow-right3 size-24 right"></i>
|
||||||
|
{{index.alias||index.walletName}}
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
|
||||||
<li class="line-b p20" ng-click="$root.go('preferencesColor')">
|
<li class="line-b p20" ng-click="$root.go('preferencesColor')">
|
||||||
<span translate>Color</span>
|
<span translate>Color</span>
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
<div
|
||||||
|
class="topbar-container"
|
||||||
|
ng-include="'views/includes/topbar.html'"
|
||||||
|
ng-init="titleSection='Wallet Alias'; goBackToState = 'preferences'">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="content preferences p20v" ng-controller="preferencesAliasController as prefAlias">
|
||||||
|
<form name="settingsAliasForm" ng-submit="prefAlias.save()" class="columns">
|
||||||
|
<label>Alias for <i>{{index.walletName}}</i></label>
|
||||||
|
<input type="text" id="alias2" type="text" name="alias2" ng-model="prefAlias.alias">
|
||||||
|
<input type="submit" class="button expand black radius" value="{{'Save'|translate}}"
|
||||||
|
ng-style="{'background-color':index.backgroundColor}">
|
||||||
|
</form>
|
||||||
|
<p class="text-gray text-center columns size-14"> Changing wallet alias only afects the local wallet name.
|
||||||
|
</div>
|
||||||
|
<div class="extra-margin-bottom"></div>
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('backupController',
|
angular.module('copayApp.controllers').controller('backupController',
|
||||||
|
@ -45,6 +44,9 @@ angular.module('copayApp.controllers').controller('backupController',
|
||||||
}
|
}
|
||||||
window.plugins.toast.showShortCenter('Preparing backup...');
|
window.plugins.toast.showShortCenter('Preparing backup...');
|
||||||
var name = (fc.credentials.walletName || fc.credentials.walletId);
|
var name = (fc.credentials.walletName || fc.credentials.walletId);
|
||||||
|
if (fc.alias) {
|
||||||
|
name = fc.alias + ' [' + name + ']';
|
||||||
|
}
|
||||||
var ew = this.getBackup();
|
var ew = this.getBackup();
|
||||||
var properties = {
|
var properties = {
|
||||||
subject: 'Copay Wallet Backup: ' + name,
|
subject: 'Copay Wallet Backup: ' + name,
|
||||||
|
|
|
@ -102,6 +102,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
self.txps = [];
|
self.txps = [];
|
||||||
self.copayers = [];
|
self.copayers = [];
|
||||||
self.updateColor();
|
self.updateColor();
|
||||||
|
self.updateAlias();
|
||||||
|
|
||||||
storageService.getBackupFlag(self.walletId, function(err, val) {
|
storageService.getBackupFlag(self.walletId, function(err, val) {
|
||||||
self.needsBackup = self.network == 'testnet' ? false : !val;
|
self.needsBackup = self.network == 'testnet' ? false : !val;
|
||||||
|
@ -344,6 +345,14 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.updateAlias = function() {
|
||||||
|
var config = configService.getSync();
|
||||||
|
config.aliasFor = config.aliasFor || {};
|
||||||
|
self.alias = config.aliasFor[self.walletId];
|
||||||
|
var fc = profileService.focusedClient;
|
||||||
|
fc.alias = self.alias;
|
||||||
|
};
|
||||||
|
|
||||||
self.updateColor = function() {
|
self.updateColor = function() {
|
||||||
var config = configService.getSync();
|
var config = configService.getSync();
|
||||||
config.colorFor = config.colorFor || {};
|
config.colorFor = config.colorFor || {};
|
||||||
|
@ -552,6 +561,14 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$rootScope.$on('Local/AliasUpdated', function(event) {
|
||||||
|
self.updateAlias();
|
||||||
|
$timeout(function() {
|
||||||
|
$rootScope.$apply();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$rootScope.$on('Local/UnitSettingUpdated', function(event) {
|
$rootScope.$on('Local/UnitSettingUpdated', function(event) {
|
||||||
self.updateAll();
|
self.updateAll();
|
||||||
self.updateTxHistory();
|
self.updateTxHistory();
|
||||||
|
|
|
@ -39,11 +39,12 @@ angular.module('copayApp.controllers').controller('paymentUriController',
|
||||||
if (!profileService.profile) return;
|
if (!profileService.profile) return;
|
||||||
var config = configService.getSync();
|
var config = configService.getSync();
|
||||||
config.colorFor = config.colorFor || {};
|
config.colorFor = config.colorFor || {};
|
||||||
|
config.aliasFor = config.aliasFor || {};
|
||||||
var ret = lodash.map(profileService.profile.credentials, function(c) {
|
var ret = lodash.map(profileService.profile.credentials, function(c) {
|
||||||
return {
|
return {
|
||||||
m: c.m,
|
m: c.m,
|
||||||
n: c.n,
|
n: c.n,
|
||||||
name: c.walletName,
|
name: config.aliasFor[c.walletId] || c.walletName,
|
||||||
id: c.walletId,
|
id: c.walletId,
|
||||||
network: c.network,
|
network: c.network,
|
||||||
color: config.colorFor[c.walletId] || '#2C3E50'
|
color: config.colorFor[c.walletId] || '#2C3E50'
|
||||||
|
@ -52,7 +53,7 @@ angular.module('copayApp.controllers').controller('paymentUriController',
|
||||||
ret = lodash.filter(ret, function(w) {
|
ret = lodash.filter(ret, function(w) {
|
||||||
return (w.network == network);
|
return (w.network == network);
|
||||||
});
|
});
|
||||||
return lodash.sortBy(ret, 'walletName');
|
return lodash.sortBy(ret, 'name');
|
||||||
};
|
};
|
||||||
|
|
||||||
this.selectWallet = function(wid) {
|
this.selectWallet = function(wid) {
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('copayApp.controllers').controller('preferencesAliasController',
|
||||||
|
function($scope, $timeout, configService, profileService, go) {
|
||||||
|
var config = configService.getSync();
|
||||||
|
var fc = profileService.focusedClient;
|
||||||
|
var walletId = fc.credentials.walletId;
|
||||||
|
|
||||||
|
var config = configService.getSync();
|
||||||
|
config.aliasFor = config.aliasFor || {};
|
||||||
|
this.alias = config.aliasFor[walletId] || fc.credentials.walletName;
|
||||||
|
|
||||||
|
this.save = function() {
|
||||||
|
var self = this;
|
||||||
|
var opts = {
|
||||||
|
aliasFor: {}
|
||||||
|
};
|
||||||
|
opts.aliasFor[walletId] = self.alias;
|
||||||
|
|
||||||
|
configService.set(opts, function(err) {
|
||||||
|
if (err) {
|
||||||
|
$scope.$emit('Local/DeviceError', err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$scope.$emit('Local/AliasUpdated');
|
||||||
|
$timeout(function(){
|
||||||
|
go.path('preferences');
|
||||||
|
}, 50);
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
});
|
|
@ -34,14 +34,15 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
|
||||||
|
|
||||||
var _deleteWallet = function() {
|
var _deleteWallet = function() {
|
||||||
var fc = profileService.focusedClient;
|
var fc = profileService.focusedClient;
|
||||||
var walletName = fc.credentials.walletName;
|
var name = fc.credentials.walletName;
|
||||||
|
var walletName = (fc.alias||'') + ' [' + name + ']';
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
profileService.deleteWalletFC({}, function(err) {
|
profileService.deleteWalletFC({}, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
self.error = err.message || err;
|
self.error = err.message || err;
|
||||||
} else {
|
} else {
|
||||||
notification.success(gettext('Success'), gettextCatalog.getString('The wallet "{{walletName}}" was deleted', {walletName: walletName}));
|
notification.success(gettext('Success'), gettextCatalog.getString('The wallet "{{walletName}}" was deleted', {walletName: name}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,6 +15,11 @@ angular.module('copayApp.controllers').controller('sidebarController',
|
||||||
self.setWallets();
|
self.setWallets();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$rootScope.$on('Local/AliasUpdated', function(event) {
|
||||||
|
self.setWallets();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
self.signout = function() {
|
self.signout = function() {
|
||||||
profileService.signout();
|
profileService.signout();
|
||||||
};
|
};
|
||||||
|
@ -35,16 +40,17 @@ angular.module('copayApp.controllers').controller('sidebarController',
|
||||||
if (!profileService.profile) return;
|
if (!profileService.profile) return;
|
||||||
var config = configService.getSync();
|
var config = configService.getSync();
|
||||||
config.colorFor = config.colorFor || {};
|
config.colorFor = config.colorFor || {};
|
||||||
|
config.aliasFor = config.aliasFor || {};
|
||||||
var ret = lodash.map(profileService.profile.credentials, function(c) {
|
var ret = lodash.map(profileService.profile.credentials, function(c) {
|
||||||
return {
|
return {
|
||||||
m: c.m,
|
m: c.m,
|
||||||
n: c.n,
|
n: c.n,
|
||||||
name: c.walletName,
|
name: config.aliasFor[c.walletId] || c.walletName,
|
||||||
id: c.walletId,
|
id: c.walletId,
|
||||||
color: config.colorFor[c.walletId] || '#7A8C9E',
|
color: config.colorFor[c.walletId] || '#7A8C9E',
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
self.wallets = lodash.sortBy(ret, 'walletName');
|
self.wallets = lodash.sortBy(ret, 'name');
|
||||||
};
|
};
|
||||||
|
|
||||||
self.setWallets();
|
self.setWallets();
|
||||||
|
|
|
@ -245,6 +245,19 @@ angular
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.state('preferencesAlias', {
|
||||||
|
url: '/preferencesAlias',
|
||||||
|
templateUrl: 'views/preferencesAlias.html',
|
||||||
|
walletShouldBeComplete: true,
|
||||||
|
needProfile: true,
|
||||||
|
views: {
|
||||||
|
'main': {
|
||||||
|
templateUrl: 'views/preferencesAlias.html'
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
.state('preferencesBwsUrl', {
|
.state('preferencesBwsUrl', {
|
||||||
url: '/preferencesBwsUrl',
|
url: '/preferencesBwsUrl',
|
||||||
templateUrl: 'views/preferencesBwsUrl.html',
|
templateUrl: 'views/preferencesBwsUrl.html',
|
||||||
|
@ -378,6 +391,7 @@ angular
|
||||||
preferencesUnit: 12,
|
preferencesUnit: 12,
|
||||||
preferencesAltCurrency: 12,
|
preferencesAltCurrency: 12,
|
||||||
preferencesBwsUrl: 12,
|
preferencesBwsUrl: 12,
|
||||||
|
preferencesAlias: 12,
|
||||||
about: 12,
|
about: 12,
|
||||||
logs: 13,
|
logs: 13,
|
||||||
add: 11,
|
add: 11,
|
||||||
|
|
|
@ -75,7 +75,7 @@ angular.module('copayApp.services')
|
||||||
var ew = root.walletExport(password);
|
var ew = root.walletExport(password);
|
||||||
if (!ew) return cb('Could not create backup');
|
if (!ew) return cb('Could not create backup');
|
||||||
|
|
||||||
var walletName = fc.credentials.walletName;
|
var walletName = (fc.alias || '') + (fc.alias ? '-' : '') + fc.credentials.walletName;
|
||||||
var filename = walletName + '-Copaybackup.aes.json';
|
var filename = walletName + '-Copaybackup.aes.json';
|
||||||
_download(ew, filename, cb)
|
_download(ew, filename, cb)
|
||||||
};
|
};
|
||||||
|
|
|
@ -53,35 +53,36 @@ angular.module('copayApp.services')
|
||||||
var config = configService.getSync();
|
var config = configService.getSync();
|
||||||
config.colorFor = config.colorFor || {};
|
config.colorFor = config.colorFor || {};
|
||||||
var color = config.colorFor[walletId] || '#2C3E50';
|
var color = config.colorFor[walletId] || '#2C3E50';
|
||||||
|
var name = config.aliasFor[walletId] || walletName;
|
||||||
|
|
||||||
switch (notificationData.type) {
|
switch (notificationData.type) {
|
||||||
case 'NewTxProposal':
|
case 'NewTxProposal':
|
||||||
notification.new(gettext('New Transaction'),
|
notification.new(gettext('New Transaction'),
|
||||||
walletName, {color: color} );
|
name, {color: color} );
|
||||||
break;
|
break;
|
||||||
case 'TxProposalAcceptedBy':
|
case 'TxProposalAcceptedBy':
|
||||||
notification.success(gettext('Transaction Signed'),
|
notification.success(gettext('Transaction Signed'),
|
||||||
walletName, {color: color} );
|
name, {color: color} );
|
||||||
break;
|
break;
|
||||||
case 'TxProposalRejectedBy':
|
case 'TxProposalRejectedBy':
|
||||||
notification.error(gettext('Transaction Rejected'),
|
notification.error(gettext('Transaction Rejected'),
|
||||||
walletName, {color: color} );
|
name, {color: color} );
|
||||||
break;
|
break;
|
||||||
case 'TxProposalFinallyRejected':
|
case 'TxProposalFinallyRejected':
|
||||||
notification.error(gettext('A transaction was finally rejected'),
|
notification.error(gettext('A transaction was finally rejected'),
|
||||||
walletName, {color: color} );
|
name, {color: color} );
|
||||||
break;
|
break;
|
||||||
case 'NewOutgoingTx':
|
case 'NewOutgoingTx':
|
||||||
notification.sent(gettext('Transaction Sent'),
|
notification.sent(gettext('Transaction Sent'),
|
||||||
walletName, {color: color} );
|
name, {color: color} );
|
||||||
break;
|
break;
|
||||||
case 'NewIncomingTx':
|
case 'NewIncomingTx':
|
||||||
notification.funds(gettext('Funds received'),
|
notification.funds(gettext('Funds received'),
|
||||||
walletName, {color: color} );
|
name, {color: color} );
|
||||||
break;
|
break;
|
||||||
case 'ScanFinished':
|
case 'ScanFinished':
|
||||||
notification.success(gettext('Scan Finished'),
|
notification.success(gettext('Scan Finished'),
|
||||||
walletName, {color: color} );
|
name, {color: color} );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'NewCopayer':
|
case 'NewCopayer':
|
||||||
|
|
Loading…
Reference in New Issue