Merge pull request #2118 from matiu/pin

Pin
This commit is contained in:
Gustavo Maximiliano Cortez 2014-12-12 11:50:43 -03:00
commit 376a36b68d
11 changed files with 52 additions and 30 deletions

22
Makefile Normal file
View file

@ -0,0 +1,22 @@
sign:
gpg -u 1112CFA1 --output browser-extensions/chrome/copay-chrome-extension.zip.sig --detach-sig browser-extensions/chrome/copay-chrome-extension.zip
verify:
gpg --verify browser-extensions/chrome/copay-chrome-extension.zip.sig browser-extensions/chrome/copay-chrome-extension.zip
ios:
cordova/build.sh
cd cordova/project && cordova build ios
open cordova/project/platforms/ios/Copay.xcodeproj
ios-debug:
cordova/build.sh --dbgjs
cd cordova/project && cordova build ios
open cordova/project/platforms/ios/Copay.xcodeproj
android:
cordova/build.sh --android
cd cordova/project && cordova run android
chrome:
browser-extensions/chrome/build.sh

View file

@ -73,24 +73,23 @@ var defaultConfig = {
salt: 'jBbYTj8zTrOt6V', salt: 'jBbYTj8zTrOt6V',
}, },
/*
GoogleDrive: { GoogleDrive: {
home: 'copay', home: 'copay',
/*
* This clientId was generated at: // This clientId was generated at:
* https://console.developers.google.com/project // https://console.developers.google.com/project
* To run Copay with Google Drive at your domain you need // To run Copay with Google Drive at your domain you need
* to generata your own Id. // to generata your own Id.
*/
// for localhost:3001 you can use you can: // for localhost:3001 you can use you can:
//
clientId: '232630733383-a35gcnovnkgka94394i88gq60vtjb4af.apps.googleusercontent.com', clientId: '232630733383-a35gcnovnkgka94394i88gq60vtjb4af.apps.googleusercontent.com',
// for copay.io: // for copay.io:
// clientId: '1036948132229-biqm3b8sirik9lt5rtvjo9kjjpotn4ac.apps.googleusercontent.com', // clientId: '1036948132229-biqm3b8sirik9lt5rtvjo9kjjpotn4ac.apps.googleusercontent.com',
}, },
*/
developmentFeatures: false
}; };
if (typeof module !== 'undefined') if (typeof module !== 'undefined')
module.exports = defaultConfig; module.exports = defaultConfig;

View file

@ -8,6 +8,7 @@ var ls = new LS();
// TODO move this to configService ! // TODO move this to configService !
var config = copay.defaultConfig; var config = copay.defaultConfig;
ls.getItem('config', function(err, data) { ls.getItem('config', function(err, data) {
var localConfig; var localConfig;
try { try {

View file

@ -160,6 +160,7 @@ angular.module('copayApp.controllers').controller('CreateProfileController', fun
$scope.error = 'Please enter the required fields'; $scope.error = 'Please enter the required fields';
return; return;
} }
$scope.saveSettings(function(err) { $scope.saveSettings(function(err) {
preconditions.checkState(!err, err); preconditions.checkState(!err, err);

View file

@ -133,8 +133,9 @@ angular.module('copayApp.controllers').controller('HomeController', function($sc
$scope.error = 'Invalid email or password. You are trying to sign in using ' + storage + '. Change it on settings is necessary.'; $scope.error = 'Invalid email or password. You are trying to sign in using ' + storage + '. Change it on settings is necessary.';
}; };
pinService.clear(function() { $rootScope.hasPin = false;
}); pinService.clear(function() {});
} else if ((err.toString() || '').match('Connection')) { } else if ((err.toString() || '').match('Connection')) {
$scope.error = 'Could not connect to Insight Server'; $scope.error = 'Could not connect to Insight Server';
} else if ((err.toString() || '').match('Unable')) { } else if ((err.toString() || '').match('Unable')) {

View file

@ -77,7 +77,6 @@ angular.module('copayApp.controllers').controller('SettingsController', function
configService.set({ configService.set({
network: insightSettings, network: insightSettings,
version: copay.version,
defaultLanguage: $scope.selectedLanguage.isoCode, defaultLanguage: $scope.selectedLanguage.isoCode,
plugins: plugins, plugins: plugins,
logLevel: $scope.selectedLogLevel.name, logLevel: $scope.selectedLogLevel.name,

View file

@ -498,6 +498,7 @@ PublicKeyRing.prototype.getCosigner = function(pubKey) {
PublicKeyRing.prototype.buildAddressCache = function() { PublicKeyRing.prototype.buildAddressCache = function() {
var ret = []; var ret = [];
var self = this; var self = this;
_.each(this.indexes, function(index) { _.each(this.indexes, function(index) {
for (var i = 0; i < index.receiveIndex; i++) { for (var i = 0; i < index.receiveIndex; i++) {
self._getAddress(i, false, index.copayerIndex); self._getAddress(i, false, index.copayerIndex);

View file

@ -350,6 +350,7 @@ Wallet.prototype._onPublicKeyRing = function(senderId, data) {
} }
if (this.publicKeyRing.isComplete()) { if (this.publicKeyRing.isComplete()) {
this._lockIncomming(); this._lockIncomming();
this.subscribeToAddresses();
this.emitAndKeepAlive('ready'); this.emitAndKeepAlive('ready');
} else { } else {
this.emitAndKeepAlive('publicKeyRingUpdated'); this.emitAndKeepAlive('publicKeyRingUpdated');
@ -739,7 +740,7 @@ Wallet.prototype._onData = function(senderId, data, ts) {
this._onSignature(senderId, data); this._onSignature(senderId, data);
break; break;
case 'indexes': case 'indexes':
this._onIndexes(data.indexes); this._onIndexes(senderId, data);
break; break;
case 'addressbook': case 'addressbook':
this._onAddressBook(senderId, data); this._onAddressBook(senderId, data);

View file

@ -1,20 +1,22 @@
'use strict'; 'use strict';
angular.module('copayApp.services').factory('configService', function(localstorageService, gettextCatalog) { angular.module('copayApp.services').factory('configService', function($timeout, localstorageService, gettextCatalog) {
var root = {}; var root = {};
root.set = function(opts, cb) { root.set = function(opts, cb) {
// Options that have runtime effects
if (opts.logLevel) if (opts.logLevel)
copay.logger.setLevel(opts.logLevel); copay.logger.setLevel(opts.logLevel);
if (opts.defaultLanguage) if (opts.defaultLanguage)
gettextCatalog.currentLanguage = opts.defaultLanguage; gettextCatalog.currentLanguage = opts.defaultLanguage;
// Set current version
opts.version = copay.version;
localstorageService.getItem('config', function(err, oldOpsStr) { localstorageService.getItem('config', function(err, oldOpsStr) {
var oldOpts = {}; var oldOpts = {};
try { try {
oldOpts = JSON.parse(oldOpsStr); oldOpts = JSON.parse(oldOpsStr);
} catch (e) {}; } catch (e) {};
@ -22,9 +24,8 @@ angular.module('copayApp.services').factory('configService', function(localstora
var newOpts = {}; var newOpts = {};
_.extend(newOpts, copay.defaultConfig, oldOpts, opts); _.extend(newOpts, copay.defaultConfig, oldOpts, opts);
// TODO remove this gloval variable. // TODO remove this global variable.
config = newOpts; config = newOpts;
localstorageService.setItem('config', JSON.stringify(newOpts), cb); localstorageService.setItem('config', JSON.stringify(newOpts), cb);
}); });
}; };

View file

@ -140,7 +140,7 @@ angular.module('copayApp.services')
}; };
root.notifyTxProposalEvent = function(w, e) { root.notifyTxProposalEvent = function(w, e) {
if (e.cId == w.getMyCopayerId()) if (e.cId == w.getMyCopayerId())
return; return;
var user = w.publicKeyRing.nicknameForCopayer(e.cId); var user = w.publicKeyRing.nicknameForCopayer(e.cId);
@ -184,7 +184,8 @@ angular.module('copayApp.services')
w.on('ready', function() { w.on('ready', function() {
var isFocused = root.isFocused(wid); var isFocused = root.isFocused(wid);
copay.logger.debug('Wallet:' + w.getName() + ' is ready. Focused:', isFocused); copay.logger.debug('Wallet:' + w.getName() +
' is ready. Focused:', isFocused);
balanceService.update(w, function() { balanceService.update(w, function() {
$rootScope.$digest(); $rootScope.$digest();
@ -227,7 +228,7 @@ angular.module('copayApp.services')
// w.on('paymentACK', function(memo) { // w.on('paymentACK', function(memo) {
// notification.success('Payment Acknowledged', memo); // notification.success('Payment Acknowledged', memo);
// }); // });
w.on('txProposalEvent', function(ev) { w.on('txProposalEvent', function(ev) {
if (root.isFocused(wid)) { if (root.isFocused(wid)) {
@ -241,7 +242,7 @@ angular.module('copayApp.services')
}, root.isFocused(wid)); }, root.isFocused(wid));
root.notifyTxProposalEvent(w, ev); root.notifyTxProposalEvent(w, ev);
$timeout(function(){ $timeout(function() {
$rootScope.$digest(); $rootScope.$digest();
}); });
}); });
@ -269,7 +270,8 @@ angular.module('copayApp.services')
root.setupGlobalVariables(iden); root.setupGlobalVariables(iden);
iden.on('newWallet', function(wid) { iden.on('newWallet', function(wid) {
var w = iden.getWalletById(wid); var w = iden.getWalletById(wid);
copay.logger.debug('newWallet:', w.getName(), wid, iden.getLastFocusedWalletId()); copay.logger.debug('newWallet:',
w.getName(), wid, iden.getLastFocusedWalletId());
root.installWalletHandlers(w); root.installWalletHandlers(w);
if (wid == iden.getLastFocusedWalletId()) { if (wid == iden.getLastFocusedWalletId()) {
copay.logger.debug('GOT Focused wallet:', w.getName()); copay.logger.debug('GOT Focused wallet:', w.getName());

View file

@ -36,14 +36,8 @@
"test": "sh test/run.sh", "test": "sh test/run.sh",
"dist": "node shell/scripts/dist.js", "dist": "node shell/scripts/dist.js",
"shell": "node shell/scripts/launch.js", "shell": "node shell/scripts/launch.js",
"chrome": "source browser-extensions/chrome/build.sh",
"setup-shell": "node shell/scripts/download-atom-shell.js", "setup-shell": "node shell/scripts/download-atom-shell.js",
"postinstall": "./node_modules/.bin/grunt", "postinstall": "./node_modules/.bin/grunt"
"sign": "gpg -u 1112CFA1 --output browser-extensions/chrome/copay-chrome-extension.zip.sig --detach-sig browser-extensions/chrome/copay-chrome-extension.zip",
"verify": "gpg --verify browser-extensions/chrome/copay-chrome-extension.zip.sig browser-extensions/chrome/copay-chrome-extension.zip",
"ios": "cordova/build.sh && cd cordova/project && cordova build ios && open platforms/ios/Copay.xcodeproj",
"android": "cordova/build.sh --android && cd cordova/project && cordova run android"
}, },
"devDependencies": { "devDependencies": {
"angular-gravatar": "*", "angular-gravatar": "*",