Merge pull request #3497 from bitpay/v1.5

Update v1.6 with changes on v1.5
This commit is contained in:
Matias Alejo Garcia 2015-11-19 16:27:19 -03:00
commit bbec74dcb9
15 changed files with 196 additions and 60 deletions

3
.gitignore vendored
View file

@ -21,6 +21,8 @@ webkitbuilds/*
!webkitbuilds/build-osx.sh !webkitbuilds/build-osx.sh
!webkitbuilds/Background.png !webkitbuilds/Background.png
# chrome extensions # chrome extensions
browser-extensions/chrome/copay-chrome-extension browser-extensions/chrome/copay-chrome-extension
browser-extensions/chrome/copay-chrome-extension.zip browser-extensions/chrome/copay-chrome-extension.zip
@ -51,6 +53,7 @@ build/Release
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules node_modules
bower_components bower_components
angular-bitcore-wallet-client/angular-bitcore-wallet-client.js
# Users Environment Variables # Users Environment Variables
.lock-wscript .lock-wscript

View file

@ -61,8 +61,8 @@ module.exports = function(grunt) {
'bower_components/angular-qrcode/angular-qrcode.js', 'bower_components/angular-qrcode/angular-qrcode.js',
'bower_components/angular-gettext/dist/angular-gettext.js', 'bower_components/angular-gettext/dist/angular-gettext.js',
'bower_components/angular-touch/angular-touch.js', 'bower_components/angular-touch/angular-touch.js',
'bower_components/angular-bitcore-wallet-client/angular-bitcore-wallet-client.js', 'bower_components/angular-ui-switch/angular-ui-switch.js',
'bower_components/angular-ui-switch/angular-ui-switch.js' 'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js'
], ],
dest: 'public/lib/angular.js' dest: 'public/lib/angular.js'
}, },
@ -112,8 +112,8 @@ module.exports = function(grunt) {
pot: { pot: {
files: { files: {
'i18n/po/template.pot': [ 'i18n/po/template.pot': [
'public/index.html', 'public/index.html',
'public/views/*.html', 'public/views/*.html',
'public/views/**/*.html', 'public/views/**/*.html',
'src/js/routes.js', 'src/js/routes.js',
'src/js/services/*.js', 'src/js/services/*.js',
@ -140,10 +140,21 @@ module.exports = function(grunt) {
dest: 'public/icons/' dest: 'public/icons/'
}, },
linux: { linux: {
files: [ files: [{
{expand: true, cwd: 'webkitbuilds/',src: ['.desktop', '../public/img/icons/favicon.ico', '../public/img/icons/icon-256.png'],dest: 'webkitbuilds/copay/linux32/', flatten: true, filter: 'isFile' }, expand: true,
{expand: true, cwd: 'webkitbuilds/',src: ['.desktop', '../public/img/icons/favicon.ico', '../public/img/icons/icon-256.png'],dest: 'webkitbuilds/copay/linux64/', flatten: true, filter: 'isFile' }, cwd: 'webkitbuilds/',
], src: ['.desktop', '../public/img/icons/favicon.ico', '../public/img/icons/icon-256.png'],
dest: 'webkitbuilds/copay/linux32/',
flatten: true,
filter: 'isFile'
}, {
expand: true,
cwd: 'webkitbuilds/',
src: ['.desktop', '../public/img/icons/favicon.ico', '../public/img/icons/icon-256.png'],
dest: 'webkitbuilds/copay/linux64/',
flatten: true,
filter: 'isFile'
}, ],
} }
}, },
karma: { karma: {
@ -166,11 +177,11 @@ module.exports = function(grunt) {
}, },
nodewebkit: { nodewebkit: {
options: { options: {
platforms: ['win','osx','linux'], platforms: ['win', 'osx', 'linux'],
buildDir: './webkitbuilds', buildDir: './webkitbuilds',
version: '0.12.2', version: '0.12.2',
macIcns: './public/img/icons/icon.icns', macIcns: './public/img/icons/icon.icns',
exeIco: './public/img/icons/icon.ico' exeIco: './public/img/icons/icon.ico'
}, },
src: ['./package.json', './public/**/*'] src: ['./package.json', './public/**/*']
}, },
@ -193,6 +204,13 @@ module.exports = function(grunt) {
src: ['**/*'], src: ['**/*'],
dest: 'copay-linux64/' dest: 'copay-linux64/'
} }
},
browserify: {
dist: {
files: {
'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js': ['angular-bitcore-wallet-client/index.js']
},
}
} }
}); });
@ -201,13 +219,14 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-angular-gettext'); grunt.loadNpmTasks('grunt-angular-gettext');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-exec'); grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-karma'); grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-karma-coveralls'); grunt.loadNpmTasks('grunt-karma-coveralls');
grunt.loadNpmTasks('grunt-node-webkit-builder'); grunt.loadNpmTasks('grunt-node-webkit-builder');
grunt.loadNpmTasks('grunt-contrib-compress'); grunt.loadNpmTasks('grunt-contrib-compress');
grunt.registerTask('default', ['nggettext_compile', 'exec:version', 'concat', 'copy:icons']); grunt.registerTask('default', ['nggettext_compile', 'exec:version', 'browserify', 'concat', 'copy:icons']);
grunt.registerTask('prod', ['default', 'uglify']); grunt.registerTask('prod', ['default', 'uglify']);
grunt.registerTask('translate', ['nggettext_extract']); grunt.registerTask('translate', ['nggettext_extract']);
grunt.registerTask('test', ['karma:unit']); grunt.registerTask('test', ['karma:unit']);

62
angular-bitcore-wallet-client/index.js vendored Normal file
View file

@ -0,0 +1,62 @@
var bwcModule = angular.module('bwcModule', []);
var Client = require('../node_modules/bitcore-wallet-client');
bwcModule.constant('MODULE_VERSION', '1.0.0');
bwcModule.provider("bwcService", function() {
var provider = {};
var config = {
baseUrl: 'https://bws.bitpay.com/bws/api',
verbose: null,
transports: null
};
provider.setBaseUrl = function(url) {
config.baseUrl = url;
};
provider.setVerbose = function(v) {
config.verbose = v ? true : false;
};
provider.$get = function() {
var service = {};
service.setBaseUrl = function(url) {
config.baseUrl = url;
};
service.setTransports = function(transports) {
config.transports = transports;
};
service.getBitcore = function() {
return Client.Bitcore;
};
service.getSJCL = function() {
return Client.sjcl;
};
service.buildTx = Client.buildTx;
service.getUtils = function() {
return Client.Utils;
};
service.getClient = function(walletData) {
var bwc = new Client({
baseUrl: config.baseUrl,
verbose: config.verbose,
transports: config.transports
});
if (walletData)
bwc.import(walletData);
return bwc;
};
return service;
};
return provider;
});

View file

@ -8,7 +8,7 @@
<Language code="ja" /> <Language code="ja" />
<Language code="es" /> <Language code="es" />
</Languages> </Languages>
<App Author="Bitpay Inc." BitsPerPixel="32" Description="A multisignature Bitcoin Wallet" Genre="apps.normal" ProductID="{5381aa50-9069-11e4-84cc-293caf9cbdc8}" Publisher="Copay Bitcoin Wallet" PublisherID="{31cdd08b-457c-413d-b440-f6665eec847d}" RuntimeType="Silverlight" Title="Copay Bitcoin Wallet" Version="1.5.1.0" xmlns="" SDOptOut="true" NotificationService="MPN"> <App Author="Bitpay Inc." BitsPerPixel="32" Description="A multisignature Bitcoin Wallet" Genre="apps.normal" ProductID="{5381aa50-9069-11e4-84cc-293caf9cbdc8}" Publisher="Copay Bitcoin Wallet" PublisherID="{31cdd08b-457c-413d-b440-f6665eec847d}" RuntimeType="Silverlight" Title="Copay Bitcoin Wallet" Version="1.5.1.0" xmlns="" NotificationService="MPN">
<IconPath IsRelative="true" IsResource="false">Assets\icon@2.png</IconPath> <IconPath IsRelative="true" IsResource="false">Assets\icon@2.png</IconPath>
<Capabilities> <Capabilities>
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" /> <Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />

View file

@ -40,10 +40,12 @@
"url": "https://github.com/bitpay/copay/issues" "url": "https://github.com/bitpay/copay/issues"
}, },
"dependencies": { "dependencies": {
"bitcore-wallet-client": "1.1.9",
"express": "^4.11.2", "express": "^4.11.2",
"fs": "0.0.2", "fs": "0.0.2",
"grunt": "^0.4.5", "grunt": "^0.4.5",
"grunt-angular-gettext": "^0.2.15", "grunt-angular-gettext": "^0.2.15",
"grunt-browserify": "^4.0.1",
"grunt-cli": "^0.1.13", "grunt-cli": "^0.1.13",
"grunt-contrib-compress": "^0.13.0", "grunt-contrib-compress": "^0.13.0",
"grunt-contrib-concat": "^0.5.1", "grunt-contrib-concat": "^0.5.1",

View file

@ -156,7 +156,7 @@
</div> </div>
</div> </div>
<div class="columns text-center m20t" ng-if="tx.canBeRemoved"> <div class="columns text-center m20t" ng-if="tx.canBeRemoved && isShared">
<div class="text-gray size-12 m20b" ng-if="!tx.isGlidera" translate> <div class="text-gray size-12 m20b" ng-if="!tx.isGlidera" translate>
* A payment proposal can be deleted if 1) you are the creator, and no other copayer has signed, or 2) 24 hours have passed since the proposal was created. * A payment proposal can be deleted if 1) you are the creator, and no other copayer has signed, or 2) 24 hours have passed since the proposal was created.
</div> </div>

View file

@ -316,7 +316,7 @@
<div class="addressbook-input" ng-show="!sendForm.address.$invalid && _address"> <div class="addressbook-input" ng-show="!sendForm.address.$invalid && _address">
{{index.addressbook[_address] || _address}} {{index.addressbook[_address] || _address}}
</div> </div>
<a class="postfix size-12 m0 text-gray" <a class="postfix size-12 m0 text-gray"
ng-click="openDestinationAddressModal(index.otherWallets, _address)"> ng-click="openDestinationAddressModal(index.otherWallets, _address)">
<i class="icon-wallet size-18"></i> <i class="icon-wallet size-18"></i>
</a> </a>
@ -449,23 +449,29 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row m20t text-center" ng-show="index.updatingTxHistory[index.walletId]"> <div ng-show="index.updatingTxHistory[index.walletId]">
<div class="columns large-12 medium-12 small-12"> <div ng-show="index.txProgress > 6" class="row m20t text-center">
<div class="spinner"> <div class="circle-icon">
<div class="rect1"></div> <img src="/img/icon-sync.svg" alt="sync" width="70">
<div class="rect2"></div> </div>
<div class="rect3"></div> <div translate class="size-12 text-gray m20t small-10 small-centered columns">
<div class="rect4"></div> Initial transaction history synchronization can take some minutes for wallets with many transactions.
<div class="rect5"></div> <b> Please stand by.</b>
</div>
<div class="small-8 small-centered columns line-b p10 m20b"></div>
<div class="columns large-12 medium-12 small-12 m10b">
<div class="spinner">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div>
</div>
<div class="size-14 text-gray m20t">
<b>{{index.txProgress}}</b> <br>
<span translate>Transactions Downloaded</span>
</div> </div>
</div>
<div ng-show="index.txProgress > 6" translate class="size-12 text-gray m20t">
Initial transaction history synchronization can take some minutes for wallets with many transactions.</br>
Please stand by.
</div>
<div ng-show="index.txProgress > 6" class="size-14 text-gray m20t">
<b>{{index.txProgress}}</b>
<span translate>Transactions<br> Downloaded</span>
</div> </div>
</div> </div>
@ -506,9 +512,9 @@
<i class="icon-arrow-right3 size-18"></i> <i class="icon-arrow-right3 size-18"></i>
</div> </div>
<div class="size-14 text-gray columns m5t" ng-if="btx.message || btx.addressTo"> <div class="size-14 text-gray columns m5t" ng-if="btx.message || btx.addressTo">
<div ng-show="btx.message"><span translate>Note</span>: {{btx.message}}</div> <div ng-show="btx.message">{{btx.message}}</div>
<div ng-show="!btx.message"> <div ng-show="!btx.message">
<span translate>To</span>: {{index.addressbook[btx.addressTo] || btx.addressTo}} {{index.addressbook[btx.addressTo] || btx.addressTo}}
</div> </div>
</div> </div>
</div> </div>
@ -524,7 +530,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row m20t"> <div class="row m20t">
<div class="large-6 medium-6 small-6 columns"> <div class="large-6 medium-6 small-6 columns">
<button type="submit" class="button black round expand" ng-show="index.historyShowShowAll" ng-click="index.showAllHistory()" ng-style="{'background-color':index.backgroundColor}" translate> <button type="submit" class="button black round expand" ng-show="index.historyShowShowAll" ng-click="index.showAllHistory()" ng-style="{'background-color':index.backgroundColor}" translate>

View file

@ -358,6 +358,15 @@ ul.tx-copayers {
background-color: #C0392B; background-color: #C0392B;
} }
.circle-icon {
background: #F1F3F5;
border-radius: 100%;
padding: 1.5rem;
width: 80px;
height: 80px;
margin: 0 auto;
}
.date-message { .date-message {
background-color: #213140; background-color: #213140;
border-radius: 3px; border-radius: 3px;

View file

@ -170,11 +170,6 @@ angular.module('copayApp.controllers').controller('createController',
return; return;
} }
if (opts.mnemonic || opts.externalSource || opts.extendedPrivateKey) {
if (opts.n == 1) {
$rootScope.$emit('Local/WalletImported', walletId);
}
}
}); });
}, 100); }, 100);
} }

View file

@ -786,11 +786,32 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.updateLocalTxHistory = function(client, cb) { self.updateLocalTxHistory = function(client, cb) {
var requestLimit = 6; var requestLimit = 6;
var walletId = client.credentials.walletId; var walletId = client.credentials.walletId;
var config = configService.getSync().wallet.settings;
var fixTxsUnit = function(txs) {
if (!txs || !txs[0]) return;
var cacheUnit = txs[0].amountStr.split(' ')[1];
if (cacheUnit == config.unitName)
return;
var name = ' ' + config.unitName;
$log.debug('Fixing Tx Cache Unit to:' + name)
lodash.each(txs, function(tx) {
tx.amountStr = profileService.formatAmount(tx.amount, config.unitName) + name;
tx.feeStr = profileService.formatAmount(tx.fees, config.unitName) + name;
});
};
self.getConfirmedTxs(walletId, function(err, txsFromLocal) { self.getConfirmedTxs(walletId, function(err, txsFromLocal) {
if (err) return cb(err); if (err) return cb(err);
var endingTxid = txsFromLocal[0] ? txsFromLocal[0].txid : null; var endingTxid = txsFromLocal[0] ? txsFromLocal[0].txid : null;
fixTxsUnit(txsFromLocal);
function getNewTxs(newTxs, skip, i_cb) { function getNewTxs(newTxs, skip, i_cb) {
self.getTxsFromServer(client, skip, endingTxid, requestLimit, function(err, res, shouldContinue) { self.getTxsFromServer(client, skip, endingTxid, requestLimit, function(err, res, shouldContinue) {
@ -924,9 +945,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
} }
profileService.setWalletClients(); profileService.setWalletClients();
$timeout(function() { self.startScan(self.walletId);
$rootScope.$emit('Local/WalletImported', self.walletId);
}, 100);
}); });
}; };
@ -1140,8 +1159,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
}); });
$rootScope.$on('Local/UnitSettingUpdated', function(event) { $rootScope.$on('Local/UnitSettingUpdated', function(event) {
self.updateAll(); self.updateAll({
self.updateTxHistory(); triggerTxUpdate: true,
});
self.updateRemotePreferences({ self.updateRemotePreferences({
saveAll: true saveAll: true
}, function() { }, function() {
@ -1177,10 +1197,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.debouncedUpdate(); self.debouncedUpdate();
}); });
$rootScope.$on('Local/BackupDone', function(event) { $rootScope.$on('Local/BackupDone', function(event, walletId) {
self.needsBackup = false; self.needsBackup = false;
$log.debug('Backup done'); $log.debug('Backup done');
storageService.setBackupFlag(self.walletId, function(err) { storageService.setBackupFlag(walletId || self.walletId, function(err) {
$log.debug('Backup done stored'); $log.debug('Backup done stored');
}); });
}); });

View file

@ -129,11 +129,6 @@ angular.module('copayApp.controllers').controller('joinController',
return; return;
} }
$timeout(function() {
var fc = profileService.focusedClient;
if (fc.isComplete() && (opts.mnemonic || opts.externalSource || opts.extendedPrivateKey))
$rootScope.$emit('Local/WalletImported', fc.credentials.walletId);
}, 2000);
}); });
}, 100); }, 100);
}; };

View file

@ -28,8 +28,7 @@ angular.module('copayApp.controllers').controller('sidebarController',
self.switchWallet = function(selectedWalletId, currentWalletId) { self.switchWallet = function(selectedWalletId, currentWalletId) {
if (selectedWalletId == currentWalletId) return; if (selectedWalletId == currentWalletId) return;
self.walletSelection = false; self.walletSelection = false;
profileService.setAndStoreFocus(selectedWalletId, function() { profileService.setAndStoreFocus(selectedWalletId, function() {});
});
}; };
self.toggleWalletSelection = function() { self.toggleWalletSelection = function() {
@ -40,10 +39,14 @@ angular.module('copayApp.controllers').controller('sidebarController',
self.setWallets = function() { self.setWallets = function() {
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 || {}; config.aliasFor = config.aliasFor || {};
var ret = lodash.map(profileService.profile.credentials, function(c) {
// Sanitize empty wallets (fixed in BWC 1.8.1, and auto fixed when wallets completes)
var credentials = lodash.filter(profileService.profile.credentials, 'walletName');
var ret = lodash.map(credentials, function(c) {
return { return {
m: c.m, m: c.m,
n: c.n, n: c.n,
@ -52,6 +55,7 @@ angular.module('copayApp.controllers').controller('sidebarController',
color: config.colorFor[c.walletId] || '#4A90E2', color: config.colorFor[c.walletId] || '#4A90E2',
}; };
}); });
self.wallets = lodash.sortBy(ret, 'name'); self.wallets = lodash.sortBy(ret, 'name');
}; };

View file

@ -271,6 +271,7 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
$scope.canSign = fc.canSign() || fc.isPrivKeyExternal(); $scope.canSign = fc.canSign() || fc.isPrivKeyExternal();
$scope.loading = null; $scope.loading = null;
$scope.color = fc.backgroundColor; $scope.color = fc.backgroundColor;
$scope.isShared = fc.credentials.n > 1;
// ToDo: use tx.customData instead of tx.message // ToDo: use tx.customData instead of tx.message
if (tx.message === 'Glidera transaction' && isGlidera) { if (tx.message === 'Glidera transaction' && isGlidera) {
@ -951,6 +952,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
profileService.signTxProposal(txp, function(err, signedTx) { profileService.signTxProposal(txp, function(err, signedTx) {
self.setOngoingProcess(); self.setOngoingProcess();
if (err) { if (err) {
if (!lodash.isObject(err)) {
err = { message: err};
}
err.message = bwsError.msg(err, gettextCatalog.getString('The payment was created but could not be signed. Please try again from home screen')); err.message = bwsError.msg(err, gettextCatalog.getString('The payment was created but could not be signed. Please try again from home screen'));
return cb(err); return cb(err);
} }

View file

@ -20,7 +20,7 @@ angular
$urlRouterProvider.otherwise('/'); $urlRouterProvider.otherwise('/');
$logProvider.debugEnabled(true); $logProvider.debugEnabled(true);
$provide.decorator('$log', ['$delegate', $provide.decorator('$log', ['$delegate', 'isDevel',
function($delegate, isDevel) { function($delegate, isDevel) {
var historicLog = historicLogProvider.$get(); var historicLog = historicLogProvider.$get();

View file

@ -373,9 +373,26 @@ angular.module('copayApp.services')
root.profile.credentials.push(JSON.parse(walletClient.export())); root.profile.credentials.push(JSON.parse(walletClient.export()));
root.setWalletClients(); root.setWalletClients();
root.setAndStoreFocus(walletId, function() {
storageService.storeProfile(root.profile, function(err) { var handleImport = function(cb) {
return cb(err, walletId); var isImport = opts.mnemonic || opts.externalSource || opts.extendedPrivateKey;
if (!isImport)
return cb();
$rootScope.$emit('Local/BackupDone', walletId);
if (!walletClient.isComplete())
return cb();
storageService.setCleanAndScanAddresses(walletId, cb);
};
handleImport(function() {
root.setAndStoreFocus(walletId, function() {
storageService.storeProfile(root.profile, function(err) {
return cb(err, walletId);
});
}); });
}); });
}); });