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/Background.png
# chrome extensions
browser-extensions/chrome/copay-chrome-extension
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-
node_modules
bower_components
angular-bitcore-wallet-client/angular-bitcore-wallet-client.js
# Users Environment Variables
.lock-wscript

View file

@ -61,8 +61,8 @@ module.exports = function(grunt) {
'bower_components/angular-qrcode/angular-qrcode.js',
'bower_components/angular-gettext/dist/angular-gettext.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'
},
@ -112,8 +112,8 @@ module.exports = function(grunt) {
pot: {
files: {
'i18n/po/template.pot': [
'public/index.html',
'public/views/*.html',
'public/index.html',
'public/views/*.html',
'public/views/**/*.html',
'src/js/routes.js',
'src/js/services/*.js',
@ -140,10 +140,21 @@ module.exports = function(grunt) {
dest: 'public/icons/'
},
linux: {
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, cwd: 'webkitbuilds/',src: ['.desktop', '../public/img/icons/favicon.ico', '../public/img/icons/icon-256.png'],dest: 'webkitbuilds/copay/linux64/', flatten: true, filter: 'isFile' },
],
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,
cwd: 'webkitbuilds/',
src: ['.desktop', '../public/img/icons/favicon.ico', '../public/img/icons/icon-256.png'],
dest: 'webkitbuilds/copay/linux64/',
flatten: true,
filter: 'isFile'
}, ],
}
},
karma: {
@ -166,11 +177,11 @@ module.exports = function(grunt) {
},
nodewebkit: {
options: {
platforms: ['win','osx','linux'],
buildDir: './webkitbuilds',
version: '0.12.2',
macIcns: './public/img/icons/icon.icns',
exeIco: './public/img/icons/icon.ico'
platforms: ['win', 'osx', 'linux'],
buildDir: './webkitbuilds',
version: '0.12.2',
macIcns: './public/img/icons/icon.icns',
exeIco: './public/img/icons/icon.ico'
},
src: ['./package.json', './public/**/*']
},
@ -193,6 +204,13 @@ module.exports = function(grunt) {
src: ['**/*'],
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-uglify');
grunt.loadNpmTasks('grunt-angular-gettext');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-karma-coveralls');
grunt.loadNpmTasks('grunt-node-webkit-builder');
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('translate', ['nggettext_extract']);
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="es" />
</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>
<Capabilities>
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />

View file

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

View file

@ -156,7 +156,7 @@
</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>
* 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>

View file

@ -316,7 +316,7 @@
<div class="addressbook-input" ng-show="!sendForm.address.$invalid && _address">
{{index.addressbook[_address] || _address}}
</div>
<a class="postfix size-12 m0 text-gray"
<a class="postfix size-12 m0 text-gray"
ng-click="openDestinationAddressModal(index.otherWallets, _address)">
<i class="icon-wallet size-18"></i>
</a>
@ -449,23 +449,29 @@
</div>
</div>
</div>
<div class="row m20t text-center" ng-show="index.updatingTxHistory[index.walletId]">
<div class="columns large-12 medium-12 small-12">
<div class="spinner">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
<div ng-show="index.updatingTxHistory[index.walletId]">
<div ng-show="index.txProgress > 6" class="row m20t text-center">
<div class="circle-icon">
<img src="/img/icon-sync.svg" alt="sync" width="70">
</div>
<div translate class="size-12 text-gray m20t small-10 small-centered columns">
Initial transaction history synchronization can take some minutes for wallets with many transactions.
<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 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>
@ -506,9 +512,9 @@
<i class="icon-arrow-right3 size-18"></i>
</div>
<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">
<span translate>To</span>: {{index.addressbook[btx.addressTo] || btx.addressTo}}
{{index.addressbook[btx.addressTo] || btx.addressTo}}
</div>
</div>
</div>
@ -524,7 +530,7 @@
</div>
</div>
</div>
<div class="row m20t">
<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>

View file

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

View file

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

View file

@ -786,11 +786,32 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.updateLocalTxHistory = function(client, cb) {
var requestLimit = 6;
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) {
if (err) return cb(err);
var endingTxid = txsFromLocal[0] ? txsFromLocal[0].txid : null;
fixTxsUnit(txsFromLocal);
function getNewTxs(newTxs, skip, i_cb) {
self.getTxsFromServer(client, skip, endingTxid, requestLimit, function(err, res, shouldContinue) {
@ -924,9 +945,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
}
profileService.setWalletClients();
$timeout(function() {
$rootScope.$emit('Local/WalletImported', self.walletId);
}, 100);
self.startScan(self.walletId);
});
};
@ -1140,8 +1159,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
$rootScope.$on('Local/UnitSettingUpdated', function(event) {
self.updateAll();
self.updateTxHistory();
self.updateAll({
triggerTxUpdate: true,
});
self.updateRemotePreferences({
saveAll: true
}, function() {
@ -1177,10 +1197,10 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.debouncedUpdate();
});
$rootScope.$on('Local/BackupDone', function(event) {
$rootScope.$on('Local/BackupDone', function(event, walletId) {
self.needsBackup = false;
$log.debug('Backup done');
storageService.setBackupFlag(self.walletId, function(err) {
storageService.setBackupFlag(walletId || self.walletId, function(err) {
$log.debug('Backup done stored');
});
});

View file

@ -129,11 +129,6 @@ angular.module('copayApp.controllers').controller('joinController',
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);
};

View file

@ -28,8 +28,7 @@ angular.module('copayApp.controllers').controller('sidebarController',
self.switchWallet = function(selectedWalletId, currentWalletId) {
if (selectedWalletId == currentWalletId) return;
self.walletSelection = false;
profileService.setAndStoreFocus(selectedWalletId, function() {
});
profileService.setAndStoreFocus(selectedWalletId, function() {});
};
self.toggleWalletSelection = function() {
@ -40,10 +39,14 @@ angular.module('copayApp.controllers').controller('sidebarController',
self.setWallets = function() {
if (!profileService.profile) return;
var config = configService.getSync();
config.colorFor = config.colorFor || {};
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 {
m: c.m,
n: c.n,
@ -52,6 +55,7 @@ angular.module('copayApp.controllers').controller('sidebarController',
color: config.colorFor[c.walletId] || '#4A90E2',
};
});
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.loading = null;
$scope.color = fc.backgroundColor;
$scope.isShared = fc.credentials.n > 1;
// ToDo: use tx.customData instead of tx.message
if (tx.message === 'Glidera transaction' && isGlidera) {
@ -951,6 +952,9 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
profileService.signTxProposal(txp, function(err, signedTx) {
self.setOngoingProcess();
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'));
return cb(err);
}

View file

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

View file

@ -373,9 +373,26 @@ angular.module('copayApp.services')
root.profile.credentials.push(JSON.parse(walletClient.export()));
root.setWalletClients();
root.setAndStoreFocus(walletId, function() {
storageService.storeProfile(root.profile, function(err) {
return cb(err, walletId);
var handleImport = function(cb) {
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);
});
});
});
});