mirror of https://github.com/BTCPrivate/copay.git
remove console.logs
This commit is contained in:
parent
5e3b1e94e2
commit
7798e38253
2
API.js
2
API.js
|
@ -12,7 +12,7 @@ API.prototype._init = function(opts) {
|
||||||
|
|
||||||
var WalletFactory = require('soop').load('./js/models/core/WalletFactory', {
|
var WalletFactory = require('soop').load('./js/models/core/WalletFactory', {
|
||||||
Storage: opts.Storage || require('./test/mocks/FakeStorage'),
|
Storage: opts.Storage || require('./test/mocks/FakeStorage'),
|
||||||
Network: opts.Network || require('./js/models/network/Base'),
|
Network: opts.Network || require('./js/models/network/WebRTC'),
|
||||||
Blockchain: opts.Blockchain || require('./js/models/blockchain/Insight')
|
Blockchain: opts.Blockchain || require('./js/models/blockchain/Insight')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
//alert(JSON.stringify(qrcode.process(context)));
|
//alert(JSON.stringify(qrcode.process(context)));
|
||||||
qrcode.decode();
|
qrcode.decode();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('error decoding QR: '+e);
|
// error decoding QR
|
||||||
}
|
}
|
||||||
}, 1500);
|
}, 1500);
|
||||||
};
|
};
|
||||||
|
@ -135,7 +135,6 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
};
|
};
|
||||||
|
|
||||||
var _videoError = function(err) {
|
var _videoError = function(err) {
|
||||||
console.log('Video Error: ' + JSON.stringify(err));
|
|
||||||
_scanStop();
|
_scanStop();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -143,7 +142,6 @@ angular.module('copayApp.controllers').controller('SendController',
|
||||||
_scanStop();
|
_scanStop();
|
||||||
|
|
||||||
var str = (data.indexOf('bitcoin:') === 0) ? data.substring(8) : data;
|
var str = (data.indexOf('bitcoin:') === 0) ? data.substring(8) : data;
|
||||||
console.log('QR code detected: ' + str);
|
|
||||||
$scope.$apply(function() {
|
$scope.$apply(function() {
|
||||||
$scope.address = str;
|
$scope.address = str;
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,16 +21,13 @@ angular.module('copayApp.controllers').controller('SigninController',
|
||||||
$scope.loading = true;
|
$scope.loading = true;
|
||||||
var password = form.openPassword.$modelValue;
|
var password = form.openPassword.$modelValue;
|
||||||
|
|
||||||
console.log('## Obtaining passphrase...');
|
|
||||||
Passphrase.getBase64Async(password, function(passphrase){
|
Passphrase.getBase64Async(password, function(passphrase){
|
||||||
console.log('## Passphrase obtained');
|
|
||||||
var w, errMsg;
|
var w, errMsg;
|
||||||
try{
|
try{
|
||||||
var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase});
|
var w = walletFactory.open($scope.selectedWalletId, { passphrase: passphrase});
|
||||||
} catch (e){
|
} catch (e){
|
||||||
errMsg = e.message;
|
errMsg = e.message;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!w) {
|
if (!w) {
|
||||||
$scope.loading = $scope.failure = false;
|
$scope.loading = $scope.failure = false;
|
||||||
$rootScope.$flashMessage = { message: errMsg || 'Wrong password', type: 'error'};
|
$rootScope.$flashMessage = { message: errMsg || 'Wrong password', type: 'error'};
|
||||||
|
|
|
@ -54,7 +54,6 @@ angular.module('copayApp.controllers').controller('TransactionsController',
|
||||||
$rootScope.txAlertCount = 0;
|
$rootScope.txAlertCount = 0;
|
||||||
var w = $rootScope.wallet;
|
var w = $rootScope.wallet;
|
||||||
w.sendTx(ntxid, function(txid) {
|
w.sendTx(ntxid, function(txid) {
|
||||||
console.log('[transactions.js.68:txid:] SENTTX CALLBACK',txid); //TODO
|
|
||||||
$rootScope.$flashMessage = txid
|
$rootScope.$flashMessage = txid
|
||||||
? {type:'success', message: 'Transaction broadcasted. txid: ' + txid}
|
? {type:'success', message: 'Transaction broadcasted. txid: ' + txid}
|
||||||
: {type:'error', message: 'There was an error sending the Transaction'}
|
: {type:'error', message: 'There was an error sending the Transaction'}
|
||||||
|
@ -90,7 +89,6 @@ angular.module('copayApp.controllers').controller('TransactionsController',
|
||||||
$scope.getTransactions = function(cb) {
|
$scope.getTransactions = function(cb) {
|
||||||
var w =$rootScope.wallet;
|
var w =$rootScope.wallet;
|
||||||
if (w) {
|
if (w) {
|
||||||
console.log('### Querying last transactions...'); //TODO
|
|
||||||
var addresses = w.getAddressesStr();
|
var addresses = w.getAddressesStr();
|
||||||
if (addresses.length > 0) {
|
if (addresses.length > 0) {
|
||||||
return w.blockchain.getTransactions(addresses, cb);
|
return w.blockchain.getTransactions(addresses, cb);
|
||||||
|
|
|
@ -150,10 +150,8 @@ Insight.prototype.sendRawTransaction = function(rawtx, cb) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this._request(options, function(err, res) {
|
this._request(options, function(err, res) {
|
||||||
console.log('[Insight.js.73:err:]', err); //TODO
|
|
||||||
if (err) return cb();
|
if (err) return cb();
|
||||||
|
|
||||||
console.log('[Insight.js.74]', res); //TODO
|
|
||||||
return cb(res.txid);
|
return cb(res.txid);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,10 +13,6 @@ var coinUtil = bitcore.util;
|
||||||
var Transaction = bitcore.Transaction
|
var Transaction = bitcore.Transaction
|
||||||
var util = bitcore.util;
|
var util = bitcore.util;
|
||||||
|
|
||||||
var Storage = imports.Storage || require('../storage/Base.js');
|
|
||||||
var storage = Storage.default();
|
|
||||||
|
|
||||||
|
|
||||||
function PublicKeyRing(opts) {
|
function PublicKeyRing(opts) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
|
||||||
|
@ -165,8 +161,7 @@ PublicKeyRing.prototype.getPubKeys = function(index, isChange) {
|
||||||
PublicKeyRing.prototype._checkIndexRange = function (index, isChange) {
|
PublicKeyRing.prototype._checkIndexRange = function (index, isChange) {
|
||||||
if ( (isChange && index > this.changeAddressIndex) ||
|
if ( (isChange && index > this.changeAddressIndex) ||
|
||||||
(!isChange && index > this.addressIndex)) {
|
(!isChange && index > this.addressIndex)) {
|
||||||
console.log('Out of bounds at getAddress: Index %d isChange: %d', index, isChange);
|
throw new Error('Out of bounds at getAddress: Index %d isChange: %d', index, isChange);
|
||||||
throw new Error('index out of bound');
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,9 +10,6 @@ var Builder = bitcore.TransactionBuilder;
|
||||||
var Script = bitcore.Script;
|
var Script = bitcore.Script;
|
||||||
var buffertools = bitcore.buffertools;
|
var buffertools = bitcore.buffertools;
|
||||||
|
|
||||||
var Storage = imports.Storage || require('../storage/Base');
|
|
||||||
var storage = Storage.default();
|
|
||||||
|
|
||||||
function TxProposal(opts) {
|
function TxProposal(opts) {
|
||||||
this.creator = opts.creator;
|
this.creator = opts.creator;
|
||||||
this.createdTs = opts.createdTs;
|
this.createdTs = opts.createdTs;
|
||||||
|
|
|
@ -245,11 +245,8 @@ Wallet.prototype.netStart = function() {
|
||||||
self.emit('ready', net.getPeer());
|
self.emit('ready', net.getPeer());
|
||||||
self.token = net.peer.options.token;
|
self.token = net.peer.options.token;
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
console.log('[EMIT publicKeyRingUpdated:]'); //TODO
|
|
||||||
self.emit('publicKeyRingUpdated', true);
|
self.emit('publicKeyRingUpdated', true);
|
||||||
console.log('[CONNECT:]'); //TODO
|
|
||||||
self.scheduleConnect();
|
self.scheduleConnect();
|
||||||
console.log('[EMIT TxProposal]'); //TODO
|
|
||||||
self.emit('txProposalsUpdated');
|
self.emit('txProposalsUpdated');
|
||||||
self.store();
|
self.store();
|
||||||
}, 10);
|
}, 10);
|
||||||
|
|
|
@ -31,8 +31,9 @@ function WalletFactory(config, version) {
|
||||||
|
|
||||||
WalletFactory.prototype.log = function(){
|
WalletFactory.prototype.log = function(){
|
||||||
if (!this.verbose) return;
|
if (!this.verbose) return;
|
||||||
if (console)
|
if (console) {
|
||||||
console.log.apply(console, arguments);
|
console.log.apply(console, arguments);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,10 +48,8 @@ WalletFactory.prototype._checkRead = function(walletId) {
|
||||||
};
|
};
|
||||||
|
|
||||||
WalletFactory.prototype.fromObj = function(obj) {
|
WalletFactory.prototype.fromObj = function(obj) {
|
||||||
console.log('## Decrypting'); //TODO
|
|
||||||
var w = Wallet.fromObj(obj, this.storage, this.network, this.blockchain);
|
var w = Wallet.fromObj(obj, this.storage, this.network, this.blockchain);
|
||||||
w.verbose = this.verbose;
|
w.verbose = this.verbose;
|
||||||
this.log('### WALLET OPENED:', w.id);
|
|
||||||
return w;
|
return w;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
var imports = require('soop').imports();
|
|
||||||
var EventEmitter = imports.EventEmitter || require('events').EventEmitter;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Emits
|
|
||||||
* 'networkChange'
|
|
||||||
* when network layout has change (new/lost peers, etc)
|
|
||||||
*
|
|
||||||
* 'data'
|
|
||||||
* when an unknown data type arrives
|
|
||||||
*
|
|
||||||
* Provides
|
|
||||||
* send(toPeerIds, {data}, cb?)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
function Network(opts) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
Network.parent = EventEmitter;
|
|
||||||
// Allows subscribing to the following events:
|
|
||||||
// Network#on('networkChange', listener);
|
|
||||||
// Network#on('data', listener);
|
|
||||||
Network.prototype.start = function(callback) {
|
|
||||||
// TODO
|
|
||||||
};
|
|
||||||
|
|
||||||
Network.prototype.send = function(peerIds, data, cb) {
|
|
||||||
// TODO
|
|
||||||
};
|
|
||||||
|
|
||||||
Network.prototype.connectTo = function(peerId, openCallback, closeCallback) {
|
|
||||||
// TODO
|
|
||||||
};
|
|
||||||
|
|
||||||
Network.prototype.disconnect = function(peerId, cb) {
|
|
||||||
// TODO
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = require('soop')(Network);
|
|
|
@ -50,7 +50,6 @@ Network.prototype.cleanUp = function() {
|
||||||
this.copayerForPeer={};
|
this.copayerForPeer={};
|
||||||
this.connections={};
|
this.connections={};
|
||||||
if (this.peer) {
|
if (this.peer) {
|
||||||
console.log('## DESTROYING PEER INSTANCE'); //TODO
|
|
||||||
this.peer.disconnect();
|
this.peer.disconnect();
|
||||||
this.peer.destroy();
|
this.peer.destroy();
|
||||||
this.peer = null;
|
this.peer = null;
|
||||||
|
@ -104,7 +103,6 @@ Network.prototype.connectedCopayers = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
Network.prototype._deletePeer = function(peerId) {
|
Network.prototype._deletePeer = function(peerId) {
|
||||||
console.log('### Deleting connection from peer:', peerId);
|
|
||||||
|
|
||||||
delete this.isInboundPeerAuth[peerId];
|
delete this.isInboundPeerAuth[peerId];
|
||||||
delete this.copayerForPeer[peerId];
|
delete this.copayerForPeer[peerId];
|
||||||
|
@ -127,17 +125,14 @@ Network.prototype.connectToCopayers = function(copayerIds) {
|
||||||
|
|
||||||
arrayDiff.forEach(function(copayerId) {
|
arrayDiff.forEach(function(copayerId) {
|
||||||
if (this.allowedCopayerIds && !this.allowedCopayerIds[copayerId]) {
|
if (this.allowedCopayerIds && !this.allowedCopayerIds[copayerId]) {
|
||||||
console.log('### IGNORING STRANGE COPAYER:', copayerId);
|
|
||||||
this._deletePeer(this.peerFromCopayer(copayerId));
|
this._deletePeer(this.peerFromCopayer(copayerId));
|
||||||
} else {
|
} else {
|
||||||
console.log('### CONNECTING TO:', copayerId);
|
|
||||||
self.connectTo(copayerId);
|
self.connectTo(copayerId);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Network.prototype._sendHello = function(copayerId) {
|
Network.prototype._sendHello = function(copayerId) {
|
||||||
console.log('### SENDING HELLO TO ', copayerId);
|
|
||||||
this.send(copayerId, {
|
this.send(copayerId, {
|
||||||
type: 'hello',
|
type: 'hello',
|
||||||
copayerId: this.copayerId,
|
copayerId: this.copayerId,
|
||||||
|
@ -158,25 +153,18 @@ Network.prototype._onData = function(encStr, isInbound, peerId) {
|
||||||
var data = this._decrypt(encStr);
|
var data = this._decrypt(encStr);
|
||||||
payload= JSON.parse(data);
|
payload= JSON.parse(data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('### ERROR IN DATA: "%s" ', data, isInbound, e);
|
|
||||||
this._deletePeer(peerId);
|
this._deletePeer(peerId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('### RECEIVED INBOUND?:%s TYPE: %s FROM %s',
|
|
||||||
isInbound, payload.type, peerId, payload);
|
|
||||||
|
|
||||||
if(isInbound && payload.type === 'hello') {
|
if(isInbound && payload.type === 'hello') {
|
||||||
var payloadStr = JSON.stringify(payload);
|
var payloadStr = JSON.stringify(payload);
|
||||||
|
|
||||||
if (this.allowedCopayerIds && !this.allowedCopayerIds[payload.copayerId]) {
|
if (this.allowedCopayerIds && !this.allowedCopayerIds[payload.copayerId]) {
|
||||||
console.log('#### Peer sent HELLO but it is not on the allowedCopayerIds. Closing connection',
|
|
||||||
this.allowedCopayerIds, payload.copayerId);
|
|
||||||
this._deletePeer(peerId);
|
this._deletePeer(peerId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('#### Peer sent hello. Setting it up.'); //TODO
|
|
||||||
this._addConnectedCopayer(payload.copayerId, isInbound);
|
this._addConnectedCopayer(payload.copayerId, isInbound);
|
||||||
this._setInboundPeerAuth(peerId, true);
|
this._setInboundPeerAuth(peerId, true);
|
||||||
return;
|
return;
|
||||||
|
@ -199,7 +187,6 @@ Network.prototype._onData = function(encStr, isInbound, peerId) {
|
||||||
|
|
||||||
Network.prototype._checkAnyPeer = function() {
|
Network.prototype._checkAnyPeer = function() {
|
||||||
if (!this.connectedPeers.length) {
|
if (!this.connectedPeers.length) {
|
||||||
console.log('EMIT openError: no more peers, not even you!');
|
|
||||||
this.cleanUp();
|
this.cleanUp();
|
||||||
this.emit('openError');
|
this.emit('openError');
|
||||||
}
|
}
|
||||||
|
@ -219,9 +206,6 @@ Network.prototype._setupConnectionHandlers = function(dataConn, toCopayerId) {
|
||||||
|
|
||||||
self.connections[dataConn.peer] = dataConn;
|
self.connections[dataConn.peer] = dataConn;
|
||||||
|
|
||||||
console.log('### DATA CONNECTION READY: %s (inbound: %s) AUTHENTICATING...',
|
|
||||||
dataConn.peer, isInbound);
|
|
||||||
|
|
||||||
// The connecting peer send hello
|
// The connecting peer send hello
|
||||||
if(toCopayerId) {
|
if(toCopayerId) {
|
||||||
self.emit('connected');
|
self.emit('connected');
|
||||||
|
@ -236,7 +220,6 @@ Network.prototype._setupConnectionHandlers = function(dataConn, toCopayerId) {
|
||||||
});
|
});
|
||||||
|
|
||||||
dataConn.on('error', function(e) {
|
dataConn.on('error', function(e) {
|
||||||
console.log('### DATA ERROR', e); //TODO
|
|
||||||
self._onClose(dataConn.peer);
|
self._onClose(dataConn.peer);
|
||||||
self._checkAnyPeer();
|
self._checkAnyPeer();
|
||||||
self.emit('dataError');
|
self.emit('dataError');
|
||||||
|
@ -245,7 +228,6 @@ Network.prototype._setupConnectionHandlers = function(dataConn, toCopayerId) {
|
||||||
dataConn.on('close', function() {
|
dataConn.on('close', function() {
|
||||||
if (self.closing) return;
|
if (self.closing) return;
|
||||||
|
|
||||||
console.log('### CLOSE RECV FROM:', dataConn.peer);
|
|
||||||
self._onClose(dataConn.peer);
|
self._onClose(dataConn.peer);
|
||||||
self._checkAnyPeer();
|
self._checkAnyPeer();
|
||||||
});
|
});
|
||||||
|
@ -263,18 +245,14 @@ Network.prototype._setupPeerHandlers = function(openCallback) {
|
||||||
|
|
||||||
p.on('error', function(err) {
|
p.on('error', function(err) {
|
||||||
if (!err.message.match(/Could\snot\sconnect\sto peer/)) {
|
if (!err.message.match(/Could\snot\sconnect\sto peer/)) {
|
||||||
console.log('### PEER ERROR:', err);
|
|
||||||
self.emit('error', err);
|
self.emit('error', err);
|
||||||
}
|
}
|
||||||
self._checkAnyPeer();
|
self._checkAnyPeer();
|
||||||
});
|
});
|
||||||
|
|
||||||
p.on('connection', function(dataConn) {
|
p.on('connection', function(dataConn) {
|
||||||
console.log('### NEW INBOUND CONNECTION %d/%d', self.connectedPeers.length, self.maxPeers);
|
|
||||||
if (self.connectedPeers.length >= self.maxPeers) {
|
if (self.connectedPeers.length >= self.maxPeers) {
|
||||||
console.log('### PEER REJECTED. PEER MAX LIMIT REACHED');
|
|
||||||
dataConn.on('open', function() {
|
dataConn.on('open', function() {
|
||||||
console.log('### CLOSING CONN FROM:' + dataConn.peer);
|
|
||||||
dataConn.close();
|
dataConn.close();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -288,11 +266,9 @@ Network.prototype._setupPeerHandlers = function(openCallback) {
|
||||||
Network.prototype._addCopayerMap = function(peerId, copayerId) {
|
Network.prototype._addCopayerMap = function(peerId, copayerId) {
|
||||||
if (!this.copayerForPeer[peerId]) {
|
if (!this.copayerForPeer[peerId]) {
|
||||||
if(Object.keys(this.copayerForPeer).length < this.maxPeers) {
|
if(Object.keys(this.copayerForPeer).length < this.maxPeers) {
|
||||||
console.log('Adding peer/copayer', peerId, copayerId); //TODO
|
|
||||||
this.copayerForPeer[peerId]=copayerId;
|
this.copayerForPeer[peerId]=copayerId;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log('### maxPeerLimit of %d reached. Refusing to add more copayers.', this.maxPeers); //TODO
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -333,7 +309,6 @@ Network.prototype.start = function(opts, openCallback) {
|
||||||
if (!this.copayerId)
|
if (!this.copayerId)
|
||||||
this.setCopayerId(opts.copayerId);
|
this.setCopayerId(opts.copayerId);
|
||||||
|
|
||||||
console.log('CREATING PEER INSTANCE:', this.peerId); //TODO
|
|
||||||
this.peer = new Peer(this.peerId, this.opts);
|
this.peer = new Peer(this.peerId, this.opts);
|
||||||
this.started = true;
|
this.started = true;
|
||||||
this._setupPeerHandlers(openCallback);
|
this._setupPeerHandlers(openCallback);
|
||||||
|
@ -378,9 +353,6 @@ Network.prototype._sendToOne = function(copayerId, payload, sig, cb) {
|
||||||
if (dataConn) {
|
if (dataConn) {
|
||||||
dataConn.send(payload);
|
dataConn.send(payload);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
console.log('[WebRTC.js.255] WARN: NO CONNECTION TO:', peerId); //TODO
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (typeof cb === 'function') cb();
|
if (typeof cb === 'function') cb();
|
||||||
};
|
};
|
||||||
|
@ -417,7 +389,6 @@ Network.prototype.connectTo = function(copayerId) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var peerId = this.peerFromCopayer(copayerId);
|
var peerId = this.peerFromCopayer(copayerId);
|
||||||
console.log('### STARTING CONNECTION TO:\n\t'+ peerId+"\n\t"+ copayerId);
|
|
||||||
var dataConn = this.peer.connect(peerId, {
|
var dataConn = this.peer.connect(peerId, {
|
||||||
serialization: 'none',
|
serialization: 'none',
|
||||||
reliable: true,
|
reliable: true,
|
||||||
|
@ -426,9 +397,6 @@ Network.prototype.connectTo = function(copayerId) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Network.prototype.lockIncommingConnections = function(allowedCopayerIdsArray) {
|
Network.prototype.lockIncommingConnections = function(allowedCopayerIdsArray) {
|
||||||
if (!this.allowedCopayerIds)
|
|
||||||
console.log('[webrtc] #### LOCKING INCOMMING CONNECTIONS');
|
|
||||||
|
|
||||||
this.allowedCopayerIds={};
|
this.allowedCopayerIds={};
|
||||||
for(var i in allowedCopayerIdsArray) {
|
for(var i in allowedCopayerIdsArray) {
|
||||||
this.allowedCopayerIds[ allowedCopayerIdsArray[i] ] = true;
|
this.allowedCopayerIds[ allowedCopayerIdsArray[i] ] = true;
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var imports = require('soop').imports();
|
|
||||||
|
|
||||||
function Storage() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// get value by key
|
|
||||||
Storage.prototype.get = function(walletId,k) {
|
|
||||||
};
|
|
||||||
|
|
||||||
// set value for key
|
|
||||||
Storage.prototype.set = function(walletId, k, v) {
|
|
||||||
};
|
|
||||||
|
|
||||||
// remove value for key
|
|
||||||
Storage.prototype.remove = function(walletId, k) {
|
|
||||||
};
|
|
||||||
|
|
||||||
Storage.prototype.getWalletIds = function() {
|
|
||||||
};
|
|
||||||
|
|
||||||
// obj contains keys to be set
|
|
||||||
Storage.prototype.setFromObj = function(walletId, obj) {
|
|
||||||
};
|
|
||||||
|
|
||||||
Storage.prototype.setFromEncryptedObj = function(walletId, obj) {
|
|
||||||
};
|
|
||||||
|
|
||||||
// wallet export - hex of encrypted wallet object
|
|
||||||
Storage.prototype.getEncryptedObj = function(walletId) {
|
|
||||||
};
|
|
||||||
|
|
||||||
// remove all values
|
|
||||||
Storage.prototype.clearAll = function() {
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = require('soop')(Storage);
|
|
|
@ -1,7 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
var imports = require('soop').imports();
|
var imports = require('soop').imports();
|
||||||
var fs = imports.fs || require('fs');
|
var fs = imports.fs || require('fs');
|
||||||
var parent = imports.parent || require('./Base');
|
|
||||||
var CryptoJS = require('node-cryptojs-aes').CryptoJS;
|
var CryptoJS = require('node-cryptojs-aes').CryptoJS;
|
||||||
|
|
||||||
var passwords = [];
|
var passwords = [];
|
||||||
|
@ -12,7 +11,6 @@ function Storage(opts) {
|
||||||
this.data = {};
|
this.data = {};
|
||||||
passwords[0] = opts.password;
|
passwords[0] = opts.password;
|
||||||
}
|
}
|
||||||
Storage.parent = parent;
|
|
||||||
|
|
||||||
Storage.prototype._encrypt = function(string) {
|
Storage.prototype._encrypt = function(string) {
|
||||||
var encrypted = CryptoJS.AES.encrypt(string, passwords[0]);
|
var encrypted = CryptoJS.AES.encrypt(string, passwords[0]);
|
||||||
|
|
|
@ -41,7 +41,7 @@ Storage.prototype._decrypt = function(base64) {
|
||||||
if (decrypted)
|
if (decrypted)
|
||||||
decryptedStr = decrypted.toString(CryptoJS.enc.Utf8);
|
decryptedStr = decrypted.toString(CryptoJS.enc.Utf8);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error while decrypting ' + base64);
|
// Error while decrypting
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return decryptedStr;
|
return decryptedStr;
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var imports = require('soop').imports();
|
var imports = require('soop').imports();
|
||||||
var parent = imports.parent || require('./Base');
|
|
||||||
|
|
||||||
function Storage() {
|
function Storage() {
|
||||||
}
|
}
|
||||||
Storage.parent = parent;
|
|
||||||
|
|
||||||
Storage.prototype._read = function(k) {
|
Storage.prototype._read = function(k) {
|
||||||
var ret;
|
var ret;
|
||||||
|
|
|
@ -100,7 +100,6 @@ angular.module('copayApp.services')
|
||||||
};
|
};
|
||||||
|
|
||||||
root.updateBalance = function(cb) {
|
root.updateBalance = function(cb) {
|
||||||
console.log('Updating balance...');
|
|
||||||
var w = $rootScope.wallet;
|
var w = $rootScope.wallet;
|
||||||
|
|
||||||
$rootScope.balanceByAddr = {};
|
$rootScope.balanceByAddr = {};
|
||||||
|
@ -132,7 +131,6 @@ angular.module('copayApp.services')
|
||||||
if (!w) return;
|
if (!w) return;
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
|
||||||
console.log('## updating tx proposals', opts); //TODO
|
|
||||||
var myCopayerId = w.getMyCopayerId();
|
var myCopayerId = w.getMyCopayerId();
|
||||||
var pendingForUs = 0;
|
var pendingForUs = 0;
|
||||||
var inT = w.getTxProposals().sort(function(t1, t2) { return t1.createdTs < t2.createdTs });
|
var inT = w.getTxProposals().sort(function(t1, t2) { return t1.createdTs < t2.createdTs });
|
||||||
|
@ -150,7 +148,6 @@ angular.module('copayApp.services')
|
||||||
i.isPending=1;
|
i.isPending=1;
|
||||||
}
|
}
|
||||||
if (!opts.onlyPending || i.isPending) {
|
if (!opts.onlyPending || i.isPending) {
|
||||||
console.log('tx:',i); //TODO
|
|
||||||
var tx = i.builder.build();
|
var tx = i.builder.build();
|
||||||
var outs = [];
|
var outs = [];
|
||||||
tx.outs.forEach(function(o) {
|
tx.outs.forEach(function(o) {
|
||||||
|
@ -175,7 +172,6 @@ angular.module('copayApp.services')
|
||||||
$rootScope.txAlertCount = pendingForUs;
|
$rootScope.txAlertCount = pendingForUs;
|
||||||
}
|
}
|
||||||
$rootScope.pendingTxCount = pendingForUs;
|
$rootScope.pendingTxCount = pendingForUs;
|
||||||
console.log('## Done updating tx proposals'); //TODO
|
|
||||||
};
|
};
|
||||||
|
|
||||||
root.setSocketHandlers = function() {
|
root.setSocketHandlers = function() {
|
||||||
|
@ -191,12 +187,10 @@ angular.module('copayApp.services')
|
||||||
newAddrs.push(a);
|
newAddrs.push(a);
|
||||||
}
|
}
|
||||||
for (var i = 0; i < newAddrs.length; i++) {
|
for (var i = 0; i < newAddrs.length; i++) {
|
||||||
console.log('### SUBSCRIBE TO', newAddrs[i]);
|
|
||||||
Socket.emit('subscribe', newAddrs[i]);
|
Socket.emit('subscribe', newAddrs[i]);
|
||||||
}
|
}
|
||||||
newAddrs.forEach(function(addr) {
|
newAddrs.forEach(function(addr) {
|
||||||
Socket.on(addr, function(txid) {
|
Socket.on(addr, function(txid) {
|
||||||
console.log('Received!', txid);
|
|
||||||
$rootScope.receivedFund = [txid, addr];
|
$rootScope.receivedFund = [txid, addr];
|
||||||
root.updateBalance(function(){
|
root.updateBalance(function(){
|
||||||
$rootScope.$digest();
|
$rootScope.$digest();
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
angular.module('notifications', []).
|
angular.module('notifications', []).
|
||||||
factory('$notification', ['$timeout',function($timeout){
|
factory('$notification', ['$timeout',function($timeout){
|
||||||
|
|
||||||
// console.log('notification service online');
|
|
||||||
var notifications = JSON.parse(localStorage.getItem('$notifications')) || [],
|
var notifications = JSON.parse(localStorage.getItem('$notifications')) || [],
|
||||||
queue = [];
|
queue = [];
|
||||||
|
|
||||||
|
@ -76,7 +75,6 @@ angular.module('notifications', []).
|
||||||
|
|
||||||
requestHtml5ModePermissions: function(){
|
requestHtml5ModePermissions: function(){
|
||||||
if (window.webkitNotifications){
|
if (window.webkitNotifications){
|
||||||
console.log('notifications are available');
|
|
||||||
if (window.webkitNotifications.checkPermission() === 0) {
|
if (window.webkitNotifications.checkPermission() === 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +91,6 @@ angular.module('notifications', []).
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
console.log('notifications are not supported');
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -113,12 +110,10 @@ angular.module('notifications', []).
|
||||||
/* ============== NOTIFICATION METHODS ==============*/
|
/* ============== NOTIFICATION METHODS ==============*/
|
||||||
|
|
||||||
info: function(title, content, userData){
|
info: function(title, content, userData){
|
||||||
console.log(title, content);
|
|
||||||
return this.awesomeNotify('info','loop', title, content, userData);
|
return this.awesomeNotify('info','loop', title, content, userData);
|
||||||
},
|
},
|
||||||
|
|
||||||
funds: function(title, content, userData){
|
funds: function(title, content, userData){
|
||||||
console.log(title, content);
|
|
||||||
return this.awesomeNotify('funds','bitcoin', title, content, userData);
|
return this.awesomeNotify('funds','bitcoin', title, content, userData);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -168,9 +163,9 @@ angular.module('notifications', []).
|
||||||
|
|
||||||
if(settings.html5Mode){
|
if(settings.html5Mode){
|
||||||
html5Notify(image, title, content, function(){
|
html5Notify(image, title, content, function(){
|
||||||
console.log("inner on display function");
|
// inner on display function
|
||||||
}, function(){
|
}, function(){
|
||||||
console.log("inner on close function");
|
// inner on close function
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -190,11 +185,9 @@ angular.module('notifications', []).
|
||||||
|
|
||||||
save: function(){
|
save: function(){
|
||||||
// Save all the notifications into localStorage
|
// Save all the notifications into localStorage
|
||||||
// console.log(JSON);
|
|
||||||
if(settings.localStorage){
|
if(settings.localStorage){
|
||||||
localStorage.setItem('$notifications', JSON.stringify(notifications));
|
localStorage.setItem('$notifications', JSON.stringify(notifications));
|
||||||
}
|
}
|
||||||
// console.log(localStorage.getItem('$notifications'));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
restore: function(){
|
restore: function(){
|
||||||
|
@ -218,7 +211,6 @@ angular.module('notifications', []).
|
||||||
* Finally, the directive should have its own controller for
|
* Finally, the directive should have its own controller for
|
||||||
* handling all of the notifications from the notification service
|
* handling all of the notifications from the notification service
|
||||||
*/
|
*/
|
||||||
// console.log('this is a new directive');
|
|
||||||
var html =
|
var html =
|
||||||
'<div class="dr-notification-wrapper" ng-repeat="noti in queue">' +
|
'<div class="dr-notification-wrapper" ng-repeat="noti in queue">' +
|
||||||
'<div class="dr-notification-close-btn" ng-click="removeNotification(noti)">' +
|
'<div class="dr-notification-close-btn" ng-click="removeNotification(noti)">' +
|
||||||
|
|
|
@ -69,11 +69,9 @@ Video.prototype._addCall = function(mediaConnection, cb) {
|
||||||
});
|
});
|
||||||
|
|
||||||
mediaConnection.on('close', function() {
|
mediaConnection.on('close', function() {
|
||||||
console.log('Media connection closed with ' + peerID);
|
|
||||||
cb(true, peerID, null); // ask to stop video streaming in UI
|
cb(true, peerID, null); // ask to stop video streaming in UI
|
||||||
});
|
});
|
||||||
mediaConnection.on('error', function(e) {
|
mediaConnection.on('error', function(e) {
|
||||||
console.log('Media connection error with ' + peerID);
|
|
||||||
cb(e, peerID, null);
|
cb(e, peerID, null);
|
||||||
});
|
});
|
||||||
this.mediaConnections[peerID] = mediaConnection;
|
this.mediaConnections[peerID] = mediaConnection;
|
||||||
|
|
Loading…
Reference in New Issue